Free voice
            Returns the js menu compatible voice dict if the user
            can see it, None otherwise
960455
def get_free_voice(self, item):
        
        view = True
        if item.get('perms', None):
            view = self.check_user_permission(item.get('perms', []))
        elif item.get('apps', None):
            view = self.check_apps_permission(item.get('apps', []))

        if view:
            return {
                'type': 'free',
                'label': item.get('label', ''),
                'icon': item.get('icon', None),
                'url': item.get('url', None)
            }
        return None
1084578
def getVoicemailStats(self):
        
        if not self.hasVoicemail():
            return None
        if self.checkVersion('1.4'):
            cmd = "voicemail show users"
        else:
            cmd = "show voicemail users"
        cmdresp = self.executeCommand(cmd)

        info_dict = dict(accounts = 0, avg_messages = 0, max_messages = 0, 
                         total_messages = 0)
        for line in cmdresp.splitlines():
            mobj = re.match('\w+\s+\w+\s+.*\s+(\d+)\s*$', line)
            if mobj:
                msgs = int(mobj.group(1))
                info_dict['accounts'] += 1
                info_dict['total_messages'] += msgs
                if msgs > info_dict['max_messages']:
                    info_dict['max_messages'] = msgs
        if info_dict['accounts'] > 0:
            info_dict['avg_messages'] = (float(info_dict['total_messages']) 
                                         / info_dict['accounts'])
            
        return info_dict
43852
def get(self):
        
        click_tracking = {}
        if self.enable is not None:
            click_tracking["enable"] = self.enable

        if self.enable_text is not None:
            click_tracking["enable_text"] = self.enable_text
        return click_tracking
453867
function getCredentials(gruntOptions) {
    if (gruntOptions.authKey && grunt.file.exists('.ftpauth')) {
      return JSON.parse(grunt.file.read('.ftpauth'))[gruntOptions.authKey];
    } else if (gruntOptions.username && gruntOptions.password) {
      return { username: gruntOptions.username, password: gruntOptions.password };
    } else {
      // Warn the user we are attempting an anonymous login
      grunt.log.warn(messages.anonymousLogin);
      return { username: null, password: null };
    }
  }
860565
function() {
    _detectSandbox();
    return {
      browser: _extend(_pick(_navigator, [ "userAgent", "platform", "appName", "appVersion" ]), {
        isSupported: _isBrowserSupported()
      }),
      flash: _omit(_flashState, [ "bridge" ]),
      zeroclipboard: {
        version: ZeroClipboard.version,
        config: ZeroClipboard.config()
      }
    };
  }
1171859
function() {
      var self = this || Howler;

      // Create a global ID counter.
      self._counter = 1000;

      // Pool of unlocked HTML5 Audio objects.
      self._html5AudioPool = [];
      self.html5PoolSize = 10;

      // Internal properties.
      self._codecs = {};
      self._howls = [];
      self._muted = false;
      self._volume = 1;
      self._canPlayEvent = 'canplaythrough';
      self._navigator = (typeof window !== 'undefined' && window.navigator) ? window.navigator : null;

      // Public properties.
      self.masterGain = null;
      self.noAudio = false;
      self.usingWebAudio = true;
      self.autoSuspend = true;
      self.ctx = null;

      // Set to false to disable the auto audio unlocker.
      self.autoUnlock = true;

      // Setup the various state values for global tracking.
      self._setup();

      return self;
    }
657393
function (done, options) {
      var audioOptions = options.audio
      if (audioOptions.excludeIOS11 && navigator.userAgent.match(/OS 11.+Version\/11.+Safari/)) {
          // See comment for excludeUserAgent and https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088
        return done(options.EXCLUDED)
      }
  
      var AudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContext
  
      if (AudioContext == null) {
        return done(options.NOT_AVAILABLE)
      }
  
      var context = new AudioContext(1, 44100, 44100)
  
      var oscillator = context.createOscillator()
      oscillator.type = 'triangle'
      oscillator.frequency.setValueAtTime(10000, context.currentTime)
  
      var compressor = context.createDynamicsCompressor()
      each([
          ['threshold', -50],
          ['knee', 40],
          ['ratio', 12],
          ['reduction', -20],
          ['attack', 0],
          ['release', 0.25]
      ], function (item) {
        if (compressor[item[0]] !== undefined && typeof compressor[item[0]].setValueAtTime === 'function') {
          compressor[item[0]].setValueAtTime(item[1], context.currentTime)
        }
      })
  
      oscillator.connect(compressor)
      compressor.connect(context.destination)
      oscillator.start(0)
      context.startRendering()
  
      var audioTimeoutId = setTimeout(function () {
        console.warn('Audio fingerprint timed out. Please report bug at https://github.com/Valve/fingerprintjs2 with your user agent: "' + navigator.userAgent + '".')
        context.oncomplete = function () {}
        context = null
        return done('audioTimeout')
      }, audioOptions.timeout)
  
      context.oncomplete = function (event) {
        var fingerprint
        try {
          clearTimeout(audioTimeoutId)
          fingerprint = event.renderedBuffer.getChannelData(0)
              .slice(4500, 5000)
              .reduce(function (acc, val) { return acc + Math.abs(val) }, 0)
              .toString()
          oscillator.disconnect()
          compressor.disconnect()
        } catch (error) {
          done(error)
          return
        }
        done(fingerprint)
      }
    }
171635
async def jsk_vc_resume(self, ctx: commands.Context):
        

        voice = ctx.guild.voice_client

        if not voice.is_paused():
            return await ctx.send("Audio is not paused.")

        voice.resume()
        await ctx.send(f"Resumed audio in {voice.channel.name}.")
803873
function() {
      var UA = navigator.userAgent
      var browser
      var version
      var verOffset
      var nameOffset

      if ((verOffset = UA.indexOf('Opera')) > -1) {
        browser = 'Opera'
        version = UA.substring(verOffset + 6)
        if ((verOffset = UA.indexOf('Version')) > -1) {
          version = UA.substring(verOffset + 8)
        }
      } else if ((verOffset = UA.indexOf('MSIE')) > -1) {
        browser = 'Internet Explorer'
        version = UA.substring(verOffset + 5)
      } else if ((verOffset = UA.indexOf('Chrome')) > -1) {
        browser = 'Chrome'
        version = UA.substring(verOffset + 7)
      } else if ((verOffset = UA.indexOf('Safari')) > -1) {
        browser = 'Safari'
        version = UA.substring(verOffset + 7)
        if ((verOffset = UA.indexOf('Version')) > -1) {
          version = UA.substring(verOffset + 8)
        }
      } else if ((verOffset = UA.indexOf('Firefox')) > -1) {
        browser = 'Firefox'
        version = UA.substring(verOffset + 8)
      } else if (UA.indexOf('Trident/') > -1) {
        browser = 'Internet Explorer'
        version = UA.substring(UA.indexOf('rv:') + 3)
      } else if ((nameOffset = UA.lastIndexOf(' ') + 1) < (verOffset = UA.lastIndexOf('/'))) {
        browser = UA.substring(nameOffset, verOffset)
        version = UA.substring(verOffset + 1)
        if (browser.toLowerCase() == browser.toUpperCase()) {
          browser = navigator.appName
        }
      }

      return {
        browser: browser,
        version: version,
      }
    }
40331
function isOptOut() {
  // Check cookie first
  let optOutState = getCookie();

  // No cookie info, check localStorage
  if (optOutState === null) {
    optOutState = getLocalStorage();
  }

  // No localStorage, we get default value
  if (optOutState === null || typeof optOutState === 'undefined') {
    optOutState = false;
  }

  // Set global for the environment
  window[disableStr] = optOutState;

  return optOutState;
}
162043
function getUserDictionary(){
    
    const userDict = {};

    if (!userId){

        userDict['userId'] = deviceData.getDeviceId();

    } else {

        userDict['userId'] = userId;

    }

    for (let key in extraInfo){
        
        userDict[key] = extraInfo[key];
    
    }

    return userDict;

}
231920
def get_default_voices(self):
        
        voices = []
        for app in self.app_list:
            children = []
            for model in app.get('models', []):
                child = {
                    'type': 'model',
                    'label': model.get('name', ''),
                    'url': model.get('admin_url', '')
                }
                children.append(child)
            voice = {
                'type': 'app',
                'label': app.get('name', ''),
                'url': app.get('app_url', ''),
                'children': children
            }
            voices.append(voice)

        return voices
637205
function() {
      var self = this || Howler;
      var audioTest = null;

      // Must wrap in a try/catch because IE11 in server mode throws an error.
      try {
        audioTest = (typeof Audio !== 'undefined') ? new Audio() : null;
      } catch (err) {
        return self;
      }

      if (!audioTest || typeof audioTest.canPlayType !== 'function') {
        return self;
      }

      var mpegTest = audioTest.canPlayType('audio/mpeg;').replace(/^no$/, '');

      // Opera version <33 has mixed MP3 support, so we need to check for and block it.
      var checkOpera = self._navigator && self._navigator.userAgent.match(/OPR\/([0-6].)/g);
      var isOldOpera = (checkOpera && parseInt(checkOpera[0].split('/')[1], 10) < 33);

      self._codecs = {
        mp3: !!(!isOldOpera && (mpegTest || audioTest.canPlayType('audio/mp3;').replace(/^no$/, ''))),
        mpeg: !!mpegTest,
        opus: !!audioTest.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ''),
        ogg: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''),
        oga: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''),
        wav: !!audioTest.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ''),
        aac: !!audioTest.canPlayType('audio/aac;').replace(/^no$/, ''),
        caf: !!audioTest.canPlayType('audio/x-caf;').replace(/^no$/, ''),
        m4a: !!(audioTest.canPlayType('audio/x-m4a;') || audioTest.canPlayType('audio/m4a;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
        mp4: !!(audioTest.canPlayType('audio/x-mp4;') || audioTest.canPlayType('audio/mp4;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
        weba: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''),
        webm: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''),
        dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ''),
        flac: !!(audioTest.canPlayType('audio/x-flac;') || audioTest.canPlayType('audio/flac;')).replace(/^no$/, '')
      };

      return self;
    }
1007597
async function speechTreeApi(server, options, next) {
  if (!options.speechClassifier) {
    return next(TypeError('speech classifier must be specified'));
  }

  if (typeof options.speechClassifier != 'function') {
    return next(TypeError('speech classifier must be a function'));
  }

  const apiUrl = '/' + settings.apiUrl.split('/').pop();

  server.route({
    method: ['GET'],
    path: `${apiUrl}/label`,
    async handler(request, reply) {
      const sentence = request.query.sentence;

      if (!sentence) {
        const error = boom.badRequest('sentence must be provided');
        return reply(error);
      }

      let label = options.speechClassifier(sentence);

      if (!label) {
        const error = boom.notFound('label not found');
        return reply(error);
      }

      if (typeof label.then == 'function' &&
          typeof label.catch == 'function') {
        label = await label;
      }

      if (typeof label != 'string') {
        throw TypeError('label must be a string');
      }

      reply({ label });
    }
  });

  next();
}
1106687
def get_comment_mdata():
    """"""
    return {
        'text': {
            'element_label': {
                'text': 'text',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'enter no more than 256 characters.',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_string_values': [{
                'text': '',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            }],
            'syntax': 'STRING',
            'minimum_string_length': 0,
            'maximum_string_length': 256,
            'string_set': [],
        },
        'reference': {
            'element_label': {
                'text': 'reference',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': [],
        },
        'rating': {
            'element_label': {
                'text': 'rating',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': [],
        },
    }
1249443
function prompt(menu){
    return new Promise(function(resolve, reject){

        // user confirmation required!
        _prompt.start();
        _prompt.message = '';
        _prompt.delimiter = '';
        _prompt.colors = false;

        _prompt.get(menu, function (err, result){
            if (err){
                reject(err);
            }else{
                resolve(result);
            }
        });

    });
}
45399
def get_app_model_voice(self, app_model_item):
        
        if app_model_item.get('name', None) is None:
            raise ImproperlyConfigured('Model menu voices must have a name key') # noqa

        if app_model_item.get('app', None) is None:
            raise ImproperlyConfigured('Model menu voices must have an app key') # noqa

        return self.get_model_voice(app_model_item.get('app'), app_model_item)