Load item details fom JSON file into memory
179371
def load_items():
    

    filename = os.path.join(os.path.dirname(__file__), "data", "items.json")

    with open(filename) as f:
        items = json.loads(f.read())["result"]["items"]
        for item in items:
            ITEMS_CACHE[item["id"]] = item
217303
def _read_info(info_path):
  """"""
  if not tf.io.gfile.exists(info_path):
    return None
  with tf.io.gfile.GFile(info_path) as info_f:
    return json.load(info_f)
1339072
function loadJSON (file, callback) {
  loadText(file, function (err, data) {
    if (err) {
      callback(err, null)
    } else {
      var json = null
      try {
        json = JSON.parse(data)
      } catch (e) {
        return callback(e, null)
      }
      callback(null, json)
    }
  })
}
918641
def _read_jsonl(filepath, kwargs):
    """"""
    with open(filepath) as data_file:
        data = [json.loads(line, **kwargs)
                for line in data_file
                if len(line) > 0]
    return data
1179903
def load_metadata(fileobj):
        
        with gzip.GzipFile(fileobj=fileobj, mode='r') as z:
            return json.loads(z.readline())
213217
def load(fp, encoding=None, cls=JSONTreeDecoder, object_hook=None,
         parse_float=None, parse_int=None, parse_constant=None,
         object_pairs_hook=None, **kargs):
    
    return json.load(fp, encoding, cls, object_hook,
         parse_float, parse_int, parse_constant,
         object_pairs_hook, **kargs)
1311759
def load(cls, fname, args):
    

    if args.type == JSON:
        if fname.endswith('.bz2'):
            open_ = bz2.open
        else:
            open_ = open

        if args.progress:
            print('Loading JSON data...')

        with open_(fname, 'rt') as fp:
            storage = JsonStorage.load(fp)
    else:
        storage = SqliteStorage.load(fname)

    if args.settings is not None:
        extend(storage.settings, args.settings)

    return cls.from_storage(storage)
1066211
def load_many(self, fobjs=None):
        """"""
        if fobjs is not None:
            # tolerance
            if not hasattr(fobjs, "__iter__"):
                fobjs = [fobjs]

            for index, (fobj, page) in enumerate(zip(fobjs, self.pages)):
                if fobj is None:
                    continue
                elif isinstance(fobj, ft.DataFile):
                    self.load(fobj, index)
                elif isinstance(fobj, str):
                    self.load_filename(fobj, index)
                else:
                    raise TypeError("Invalid object of class '{}'".format(fobj.__class__.__name__))
729741
def load_json_from_file(file_path):
    """"""
    try:
        with open(file_path) as f:
            json_data = json.load(f)
    except ValueError as e:
        raise ValueError('Given file {} is not a valid JSON file: {}'.format(file_path, e))
    else:
        return json_data
1294835
def loads(cls, json_data):
        """"""
        try:
            return cls(**cls.MARSHMALLOW_SCHEMA.loads(json_data))
        except marshmallow.exceptions.ValidationError as exc:
            raise ValidationError("Failed to load message", extra=exc.args[0])
375278
function getItem(itemName) {
  if (data[itemName]) {
    return data[itemName];
  } else if (localExists()) {
    var itemStr = window.sessionStorage.getItem(itemName);
    // Check that str is not null before parsing
    if (itemStr) {
      var isObj = false;
      var itemObj = null;
      // Try parsing to object
      try {
        itemObj = JSON.parse(itemStr);
        isObj = true;
      } catch (err) {
        // Parsing failed, this must just be a string
        // logger.log({message: 'String could not be parsed.', error: err, func: 'getItem', obj: 'storage'})
        isObj = false;
      }
      if (isObj) {
        return itemObj;
      }
    }
    return itemStr;
  } else {
    return null;
  }
}
277000
def read_json(file_or_path):
    """"""
    try:
        with (open(file_or_path, 'r') if isinstance(file_or_path, (str, bytes)) else file_or_path) as f:
            obj = json.load(f)
    except IOError:
        obj = json.loads(file_or_path)
    return obj
1030184
def load_from_file(cls, file_path):
        """"""
        data = None
        if os.path.exists(file_path):
            metadata_file = open(file_path)
            data = json.loads(metadata_file.read())
        return cls(initial=data)
85665
def _load_file(self):
        

        if not os.path.exists(self.file):
            return {}

        with open(self.file, "r") as infile:
            data = json.load(infile)

        return data
988600
def loadJson(self, data):
        """"""
        if not isinstance(data, dict):
            data = json.loads(data)
        self.__dict__.update(data)
        self.inflate() # restore objects from str values
        #if self.ports:  self._gotPorts = True
        return self
301912
def json_numpy_loader():
    """"""
    data = request.get_json()
    logger.debug('Received JSON data of length {:,}'.format(len(data)))
    return data
518968
def _loadfilepath(self, filepath, **kwargs):
        
        with open(filepath, "r") as f:
            data = json.load(f, **kwargs)
        return data