Load the submission from a file-like object

        :param fileobj: File-like object
        :return: the loaded submission
346652
def load(fileobj):
        
        with gzip.GzipFile(fileobj=fileobj, mode='r') as z:
            submission = Submission(metadata=json.loads(z.readline()))

            for line in z:
                token_id, token = json.loads(line)
                submission['tokens'][token_id] = token

        return submission
126776
def load(self, fobj, index=None):
        
        if index is None:
            index = self._get_tab_index()
        page = self.pages[index]

        if fobj is None:
            return


        if not isinstance(fobj, tuple(page.clss_load)):
            raise RuntimeError('Object to load must be in {0!s} (not a {1!s})'.format(
             [x.__name__ for x in page.clss_load], fobj.__class__.__name__))

        page.editor.load(fobj)
        self._update_gui_text_tabs()
524022
def dump(self, fileobj):
        ''''''
        if self.file_format == 'csv':
            csv.writer(fileobj).writerows(self.raw_dict().items())
        elif self.file_format == 'json':
            json.dump(self.raw_dict(), fileobj, separators=(',', ':'))
        elif self.file_format == 'pickle':
            pickle.dump(dict(self.raw_dict()), fileobj, 2)
        else:
            raise NotImplementedError('Unknown format: ' +
                                      repr(self.file_format))
166042
def tell(self):
        
        if isinstance(self.fileobj, gzip2.GzipFile):
            return self.fileobj.fileobj.tell()
        else:
            return self.fileobj.tell()
106391
function loadFile(filepath, defaultObj) {
  defaultObj = defaultObj || {};

  if (!isFile(filepath)) { return defaultObj; }

  var extension = path.extname(filepath).replace(/^\./, '');
  var contents = supportedExtensions[extension](filepath);

  return assign({}, defaultObj, contents);
}
1087923
def create_from_file(cls, filename):
        """"""
        obj = cls()
        obj.object_file = filename
        obj.load()
        return obj
780361
def get_object_by_filename(self, request, filename):
        
        kw = dict()
        kw[self.file_field] = filename
        obj = self.get_queryset(request).filter(**kw).first()
        if not obj:
            raise Http404(_('File {} not found').format(filename))
        return self.get_object(request, obj.id)
67573
def submissionfile_post_save(sender, instance, signal, created, **kwargs):
    '''
        
    '''
    if created:
        logger.debug("Running post-processing for new submission file.")
        instance.md5 = instance.attachment_md5()
        instance.save()
1110011
def load(cls, filename, gzipped, byteorder='big'):
        
        open_file = gzip.open if gzipped else open
        with open_file(filename, 'rb') as buff:
            return cls.from_buffer(buff, byteorder)
386739
def load(source, **kwargs) -> JsonObj:
    
    if isinstance(source, str):
        if '://' in source:
            req = Request(source)
            req.add_header("Accept", "application/json, text/json;q=0.9")
            with urlopen(req) as response:
                jsons = response.read()
        else:
            with open(source) as f:
                jsons = f.read()
    elif hasattr(source, "read"):
        jsons = source.read()
    else:
        raise TypeError("Unexpected type {} for source {}".format(type(source), source))

    return loads(jsons, **kwargs)
1240859
public static File toFile(Object obj) throws PageException {
	if (obj instanceof File) return (File) obj;
	return FileUtil.toFile(Caster.toString(obj));
    }
574968
def __getFileObj(self, f):
        """"""
        if not f:
            raise ShapefileException("Shapefile Reader requires a shapefile or file-like object.")
        if self.shp and self.shpLength is None:
            self.load()
        if self.dbf and len(self.fields) == 0:
            self.load()
        return f
600675
def from_data(cls, data):
        
        obj = cls()
        with contextlib.closing(BytesIO(data)) as file_handle:
            obj.load_file(file_handle)
        return obj
1267564
def upload_from_fileobject(f, profile=None, label=None):
    
    if profile is None:
        profile = 'default'
    conf = get_profile_configs(profile)
    f.seek(0)
    if not is_image(f, types=conf['TYPES']):
        msg = (('Format of uploaded file is not allowed. '
                'Allowed formats is: %(formats)s.') %
               {'formats': ', '.join(map(lambda t: t.upper(), conf['TYPES']))})
        raise RuntimeError(msg)
    return _custom_upload(f, profile, label, conf)
925174
function(fileObj) {
  return new Promise(function (resolve, reject) {
    window.requestFileSystem(window.TEMPORARY, 4*1024*1024*1024,
        function({root}){
          resolve({root:root, fileObj: fileObj})
        },
        function(err) {
          reject(err)
        }
    );
  });
}
1220719
def fileobj_name(fileobj):
    

    value = getattr(fileobj, "name", u"")
    if not isinstance(value, (text_type, bytes)):
        value = text_type(value)
    return value
760886
def __get_file(self, file):
        
        file_object = None
        if file['name'] in request.files:
            file_object = request.files[file['name']]
            clean_filename = secure_filename(file_object.filename)
            if clean_filename == '':
                return file_object
            if file_object and self.__allowed_extension(
                    clean_filename, file['extensions']):
                return file_object
        elif file['name'] not in request.files and file['required']:
            return file_object
        return file_object