Return (images, sounds)
347917
def get_media(self, v14_scriptable):
        """"""
        images = []
        sounds = []
        for media in v14_scriptable.media:
            if media.class_name == 'SoundMedia':
                sounds.append(media)
            elif media.class_name == 'ImageMedia':
                images.append(media)
        return (images, sounds)
248204
function(mute) {
			if (!Crafty.support.audio)
				return;
			var s;
			for (var i in this.sounds) {
				s = this.sounds[i];
				s.obj.volume = mute ? 0 : s.volume;
			}
			this.muted = mute;
		}
607948
def returned(self):
        """"""
        if self._returned is None:
            node = _parse_text(self.extracted)
            self._returned = usefunction._returns_last(node)
        return self._returned
848076
async function getTextFromFiles(index, inputFiles) {
  // Read all of the given files and provide request objects that will be
  // passed to the Cloud Vision API in a batch request.
  const requests = await Promise.all(
    inputFiles.map(async filename => {
      const content = await readFile(filename);
      console.log(` 👉 ${filename}`);
      return {
        image: {
          content: content.toString('base64'),
        },
        features: [{type: 'TEXT_DETECTION'}],
      };
    })
  );

  // Make a call to the Vision API to detect text
  const results = await client.batchAnnotateImages({requests});
  const detections = results[0].responses;
  await Promise.all(
    inputFiles.map(async (filename, i) => {
      const response = detections[i];
      if (response.error) {
        console.info(`API Error for ${filename}`, response.error);
        return;
      }
      await extractDescriptions(filename, index, response);
    })
  );
}
81160
def validate_sound(sound,
                   token):
    '''
    
    '''
    ret = {
            'message': 'Sound is invalid',
            'res': False
           }
    parameters = dict()
    parameters['token'] = token

    response = query(function='validate_sound',
                     method='GET',
                     query_params=parameters)

    if response['res']:
        if 'message' in response:
            _message = response.get('message', '')
            if 'status' in _message:
                if _message.get('dict', {}).get('status', '') == 1:
                    sounds = _message.get('dict', {}).get('sounds', '')
                    if sound in sounds:
                        ret['message'] = 'Valid sound {0}.'.format(sound)
                        ret['res'] = True
                    else:
                        ret['message'] = 'Warning: {0} not a valid sound.'.format(sound)
                        ret['res'] = False
                else:
                    ret['message'] = ''.join(_message.get('dict', {}).get('errors'))
    return ret
1152004
def get_image_files(c:PathOrStr, check_ext:bool=True, recurse=False)->FilePathList:
    ""
    return get_files(c, extensions=(image_extensions if check_ext else None), recurse=recurse)
126585
def main(input_file, output, format):
    """"""

    try:
        process_image(input_file, subfolder=output, ext=format)
    except Exception as e:
        sys.exit(e)
1147018
def returns(self) -> T.Optional[DocstringReturns]:
        """"""
        try:
            return next(
                DocstringReturns.from_meta(meta)
                for meta in self.meta
                if meta.args[0] in {"return", "returns", "yield", "yields"}
            )
        except StopIteration:
            return None
998195
function (data, options) {
                if (options.disabled) {
                    return data;
                }
                var file = data.files[data.index],
                    url,
                    audio;
                if (this._audioElement.canPlayType &&
                        this._audioElement.canPlayType(file.type) &&
                        ($.type(options.maxFileSize) !== 'number' ||
                            file.size <= options.maxFileSize) &&
                        (!options.fileTypes ||
                            options.fileTypes.test(file.type))) {
                    url = loadImage.createObjectURL(file);
                    if (url) {
                        audio = this._audioElement.cloneNode(false);
                        audio.src = url;
                        audio.controls = true;
                        data.audio = audio;
                        return data;
                    }
                }
                return data;
            }
23269
function(sounds) {
          //console.log("SOUNDS", typeof sounds, sounds )
          sounds = JSON.parse( sounds )
          filename = sounds.results[0].name
          var id = sounds.results[0].id

          if (typeof Freesound.loaded[filename] === 'undefined') {

            freesound.getSound( id, function( val ){ 
              var request = new XMLHttpRequest(),
                  dict    = JSON.parse( val ),
                  path    = dict.previews['preview-hq-mp3']

              //Gibber.log("now downloading " + filename + ", " + sounds.sounds[0].duration + " seconds in length")
              request.open('GET', path, true) //"?&api_key=" + freesound.apiKey, true);
              request.responseType = 'arraybuffer';
              //request.withCredentials = true;
              request.onload = function( v ) {
                onload(request)
              };
              request.send();

              console.log( 'freesound path:', path, request )
            }, null )
          } else {
            sampler.buffer = Freesound.loaded[filename];
            sampler.filename = filename;
            sampler.bufferLength = sampler.buffer.length;
            sampler.isLoaded = true;
            sampler.end = sampler.bufferLength;
            sampler.setBuffer(sampler.buffer);
            sampler.setPhase(sampler.bufferLength);

            sampler.send(Master, 1)
            if (callback) {
              callback()
            }
          }
        }
1023964
def media(self):
        
        return self.widget.media + self.checkbox.media + Media(self.Media)
1078354
def guess_media_type(filepath):
    """"""
    o = subprocess.check_output(['file', '--mime-type', '-Lb', filepath])
    o = o.strip()
    return o
998112
def _return_samples(return_type, samples):
    
    if return_type.lower() == "dataframe":
        if HAS_PANDAS:
            return pandas.DataFrame.from_records(samples)
        else:
            warn("Pandas installation not found. Returning numpy.recarray object")
            return samples
    else:
        return samples
881141
function (data, options) {
                if (data.audio && !options.disabled) {
                    data.files[data.index][options.name || 'preview'] = data.audio;
                }
                return data;
            }
428478
function audioExt (name) {
  var ext = path.extname(name)
  return ['.wav', '.ogg', '.mp3'].indexOf(ext) > -1 ? ext : null
}
321805
function restoreImage (image) {
  if (image.restore && (typeof image.restore === 'function')) {
    image.restore();

    return true;
  }

  return false;
}
786526
def returner(ret):
    '''
    
    '''
    opts = _get_options(ret)
    try:
        with salt.utils.files.flopen(opts['filename'], 'a') as logfile:
            salt.utils.json.dump(ret, logfile)
            logfile.write(str('\n'))  # future lint: disable=blacklisted-function
    except Exception:
        log.error('Could not write to rawdata_json file %s', opts['filename'])
        raise