Deserializes the script database from JSON.
779865
def _load_db():
    """"""
    from os import path
    from pyci.utility import get_json
    global datapath, db
    datapath = path.abspath(path.expanduser(settings.datafile))
    vms("Deserializing DB from {}".format(datapath))
    db = get_json(datapath, {"installed": [], "enabled": True, "cron": False})
852376
@SuppressWarnings("UnusedDeclaration")
  public static Bindings fromJson( String json )
  {
    try
    {
      return PARSER.get().parseJson( json );
    }
    catch( ScriptException e )
    {
      throw new RuntimeException( e );
    }
  }
821564
def from_json(self, fname):
        '''
            
        '''
        with open(fname, 'rt') as fp:
            for row in json.load(fp):
                nn = ServerInfo.from_dict(row)
                self[str(nn)] = nn
1065604
def load(json_src, save=False):
    """"""
    if isinstance(json_src, six.string_types):
        json_src = json_lib.loads(json_src)

    if isinstance(json_src, list):
        return [getattr(objects, obj['class']).load(obj, save)
                for obj in json_src]

    return getattr(objects, json_src['class']).load(json_src, save)
216609
def loads(cls, s, **kwargs):
    """"""
    json_obj = json.loads(s, **kwargs)
    return parse(cls, json_obj)
607526
def read_from_json(json_filename):
  """"""
  with tf.io.gfile.GFile(json_filename) as f:
    dataset_info_json_str = f.read()
  # Parse it back into a proto.
  parsed_proto = json_format.Parse(dataset_info_json_str,
                                   dataset_info_pb2.DatasetInfo())
  return parsed_proto
957491
def from_db_value(self, value, expression, connection, context):
        
        if value is None:
            return value
        return json_decode(value)
111021
public static SchemaBuilder fromJson(String json) {
        try {
            return JsonSerializer.fromString(json, SchemaBuilder.class);
        } catch (IOException e) {
            throw new IndexException(e, "Unparseable JSON schema: {}: {}", e.getMessage(), json);
        }
    }
1369023
def btc_witness_script_deserialize(_script):
    

    script = None
    if isinstance(_script, str) and re.match('^[0-9a-fA-F]*$', _script):
        # convert from hex to bin, safely
        script = binascii.unhexlify(_script)
    else:
        script = _script[:]

    # pointer to byte offset in _script (as an array due to Python scoping rules)
    ptr = [0]

    witness_stack_len = read_var_int(ptr, script)
    witness_stack = []

    for _ in xrange(0, witness_stack_len):

        stack_item = read_var_string(ptr, script)
        witness_stack.append(stack_item)

    return witness_stack
496077
public void fromJson(JSONObject json) {
        super.fromJson(json);
        if (json.containsKey(CHANGE)) {
            change = new Change(json.getJSONObject(CHANGE));
        }
        if (json.containsKey(PATCH_SET)) {
            patchSet = new PatchSet(json.getJSONObject(PATCH_SET));
        } else if (json.containsKey(PATCHSET)) {
            patchSet = new PatchSet(json.getJSONObject(PATCHSET));
        }
    }
659279
def from_json(cls, data, json_schema_class=None):
        
        schema = cls.json_schema if json_schema_class is None else json_schema_class()
        return schema.load(data)
924189
def toJson(self, data=None, pretty=False):
        """"""
        if data==None: data = self.attrs
        data = self.flatten(data) # don't send objects as str in json
        #if pretty:
        ret = json.dumps(data, indent=4, sort_keys=True)
        #self.inflate() # restore objects from json str data
        return ret
138155
def deserialize(self, text, method='json', encoding='utf8', raise_exception=False):
        """"""

        return self.helper.string.serialization.deserialize(
            text, method=method, encoding=encoding, raise_exception=raise_exception)
867970
def from_json(cls, json):
        """"""
        obj = cls(name=json['name'],
                  code=json['code'],
                  numeric_code=json['numeric_code'],
                  symbol=json['symbol'],
                  exponent=json['exponent'],
                  entities=json['entities'],
                  withdrawal_date=json['withdrawal_date'],
                  subunits=json['subunits'])
        return obj
1286741
private String convertToJson(Map<String, ?> map) throws MovieDbException {
        try {
            return MAPPER.writeValueAsString(map);
        } catch (JsonProcessingException ex) {
            throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "JSON conversion failed", "", ex);
        }
    }
626209
public RecordedQuery fromJSON(String json) {
		RecordedQuery ret = new RecordedQuery(false);
		StringReader sr = new StringReader(json);
		JsonReader reader = Json.createReader(sr);
		JsonObject jsonResult = reader.readObject();
		
		ret.setGeneric(jsonResult.getBoolean(GENERIC));
		JsonArray augmentations = jsonResult.getJsonArray(AUGMENTATIONS);
		if (augmentations != null) {
			Map<String, String> augs = new HashMap<String, String>();
			Iterator<JsonValue> ait = augmentations.iterator();
			while(ait.hasNext()) {
				JsonObject a = (JsonObject) ait.next();
				augs.put(a.getString(KEY), a.getString(VALUE));
			}
			ret.setAugmentations(augs);
		}
		
		JsonArray statements = jsonResult.getJsonArray(STATEMENTS);
		Iterator<JsonValue> it = statements.iterator();
		while(it.hasNext()) {
			JsonValue s = it.next();
			readStatement(s, ret.getStatements(), ret);
		}
		return ret;
	}
658418
def from_file(cls, db_file=ALL_SETS_PATH):
        
        if callable(getattr(db_file, 'read', None)):
            return cls(json.load(db_file))

        with io.open(db_file, encoding='utf8') as inp:
            return cls(json.load(inp))