Parses the JSON object stored at GPJob.info and assigns its metadata to
        properties of this GPJob object.

        Primarily intended to be called from GPJob.get_info().
4009
def load_info(self):
        
        self.task_name = self.info['taskName']
        self.task_lsid = self.info['taskLsid']
        self.user_id = self.info['userId']
        self.job_number = int(self.info['jobId'])
        self.status = self.get_status_message()
        self.date_submitted = self.info['dateSubmitted']
        self.log_files = self.info['logFiles']
        self.output_files = self.info['outputFiles']
        self.num_output_files = self.info['numOutputFiles']

        # Create children, if relevant
        self.children = self.get_child_jobs()
790838
def get_job_info():
    

    jobid = get_job_id()

    if jobid == '':
        return None

    info = get_qstat_info('-ft {0}'.format(jobid), 'Job Id:')

    # Select the dict for this job (there should only be one entry in any case)
    info = info['Job Id: {}'.format(jobid)]

    # Add the jobid to the dict and then return
    info['Job_ID'] = jobid

    return info
1371891
def _construct_from_json(self, rec):
        

        self.delete()

        for required_key in ['dagobah_id', 'created_jobs']:
            setattr(self, required_key, rec[required_key])

        for job_json in rec.get('jobs', []):
            self._add_job_from_spec(job_json)

        self.commit(cascade=True)
736122
def _schema_from_json_file_object(self, file_obj):
        
        json_data = json.load(file_obj)
        return [SchemaField.from_api_repr(field) for field in json_data]
7414
def __json_date_parse(json_object):
        
        known_date_fields = ["created_at", "week", "day", "expires_at", "scheduled_at"]
        for k, v in json_object.items():
            if k in known_date_fields:
                if v != None:
                    try:
                        if isinstance(v, int):
                            json_object[k] = datetime.datetime.fromtimestamp(v, pytz.utc)
                        else:
                            json_object[k] = dateutil.parser.parse(v)
                    except:
                        raise MastodonAPIError('Encountered invalid date.')
        return json_object
218921
def json(self):
        
        return {
            "status": self.status,
            "criteria_name": self.criteria_name,
            "warnings": [w.json() for w in self.warnings],
            "settings": self.settings,
        }
496197
def _get_object_parser(self, json):
        
        typ = self.typ
        dtype = self.dtype
        kwargs = {
            "orient": self.orient, "dtype": self.dtype,
            "convert_axes": self.convert_axes,
            "convert_dates": self.convert_dates,
            "keep_default_dates": self.keep_default_dates, "numpy": self.numpy,
            "precise_float": self.precise_float, "date_unit": self.date_unit
        }
        obj = None
        if typ == 'frame':
            obj = FrameParser(json, **kwargs).parse()

        if typ == 'series' or obj is None:
            if not isinstance(dtype, bool):
                kwargs['dtype'] = dtype
            obj = SeriesParser(json, **kwargs).parse()

        return obj
975961
private void parsePointMetadata(JsonParser jp) throws IOException, SQLException {
        jp.nextToken(); // FIELD_NAME coordinates        
        String coordinatesField = jp.getText();
        if (coordinatesField.equalsIgnoreCase(GeoJsonField.COORDINATES)) {
            jp.nextToken(); // START_ARRAY [ to parse the coordinate
            parseCoordinateMetadata(jp);            
        } else {
            throw new SQLException("Malformed GeoJSON file. Expected 'coordinates', found '" + coordinatesField + "'");
        }
    }
17344
def _fromJSON(cls, jsonobject):
        
        newInstance = cls(jsonobject[0], jsonobject[1])
        attribDict = {}
        attribDict['dataProcessingRef'] = jsonobject[2]
        attribDict['precursor'] = jsonobject[3]
        attribDict['product'] = jsonobject[4]
        attribDict['params'] = [tuple(param) for param in jsonobject[5]]
        attribDict['attrib'] = jsonobject[6]
        attribDict['arrayInfo'] = dict()
        for arrayType, jsonEntry in viewitems(jsonobject[7]):
            arrayEntry = {'dataProcessingRef': jsonEntry['dataProcessingRef'],
                          'params': [tuple(_) for _ in jsonEntry['params']]
                          }
            attribDict['arrayInfo'][arrayType] = arrayEntry
        for key, value in viewitems(attribDict):
            setattr(newInstance, key, value)
        return newInstance
1244567
def _parse_json(self, json, exactly_one=True):
        ''''''
        features = json['features']
        if features == []:
            return None

        def parse_feature(feature):
            location = feature['place_name']
            place = feature['text']
            longitude = feature['geometry']['coordinates'][0]
            latitude = feature['geometry']['coordinates'][1]
            return Location(location, (latitude, longitude), place)
        if exactly_one:
            return parse_feature(features[0])
        else:
            return [parse_feature(feature) for feature in features]
862197
def _read_routine_metadata(self):
        
        metadata = {}
        if os.path.isfile(self._metadata_filename):
            with open(self._metadata_filename, 'r') as file:
                metadata = json.load(file)

        return metadata
959962
def _process_json(json_data):
    
    requests = []
    for item in json_data:
        degree = GradDegree()
        degree.degree_title = item["degreeTitle"]
        degree.exam_place = item["examPlace"]
        degree.exam_date = parse_datetime(item.get("examDate"))
        degree.req_type = item["requestType"]
        degree.major_full_name = item["majorFullName"]
        degree.submit_date = parse_datetime(item.get("requestSubmitDate"))
        degree.decision_date = parse_datetime(item.get('decisionDate'))
        degree.status = item["status"]
        degree.target_award_year = item["targetAwardYear"]
        if item.get("targetAwardQuarter")and\
           len(item.get("targetAwardQuarter")):
            degree.target_award_quarter = item["targetAwardQuarter"].lower()

        requests.append(degree)
    return requests
743720
def _fromJSON(cls, jsonobject):
        
        newInstance = cls(None, None)
        newInstance.__dict__.update(jsonobject)
        return newInstance
1353884
def json_data(self):
        """"""
        return {
            "type": self.type,
            "recruiter": self.recruiter_id,
            "assignment_id": self.assignment_id,
            "hit_id": self.hit_id,
            "mode": self.mode,
            "end_time": self.end_time,
            "base_pay": self.base_pay,
            "bonus": self.bonus,
            "status": self.status,
        }
1359303
def json(self):
        
        data = super(CalTRACKHourlyModel, self).json()
        data.update(
            {
                "occupancy_lookup": self.occupancy_lookup.to_json(orient="split"),
                "temperature_bins": self.temperature_bins.to_json(orient="split"),
            }
        )
        return data
675953
def _parse_properties(self):
        
        props_dict = self.data.get('properties', {})
        for prop_name in self.KNOWN_PROPERTIES:
            if prop_name in props_dict:
                setattr(self, prop_name, props_dict.get(prop_name))
            else:
                setattr(self, prop_name, None)
352009
def _populate(self, json):
        
        if not json:
            return

        # hide the raw JSON away in case someone needs it
        self._set('_raw_json', json)

        for key in json:
            if key in (k for k in type(self).properties.keys()
                    if not type(self).properties[k].identifier):
                if type(self).properties[key].relationship \
                    and not json[key] is None:
                    if isinstance(json[key], list):
                        objs = []
                        for d in json[key]:
                            if not 'id' in d:
                                continue
                            new_class = type(self).properties[key].relationship
                            obj = new_class.make_instance(d['id'],
                                    getattr(self,'_client'))
                            if obj:
                                obj._populate(d)
                            objs.append(obj)
                        self._set(key, objs)
                    else:
                        if isinstance(json[key], dict):
                            related_id = json[key]['id']
                        else:
                            related_id = json[key]
                        new_class = type(self).properties[key].relationship
                        obj = new_class.make_instance(related_id, getattr(self,'_client'))
                        if obj and isinstance(json[key], dict):
                            obj._populate(json[key])
                        self._set(key, obj)
                elif  type(self).properties[key].slug_relationship \
                        and not json[key] is None:
                    # create an object of the expected type with the given slug
                    self._set(key, type(self).properties[key].slug_relationship(self._client, json[key]))
                elif type(json[key]) is dict:
                    self._set(key, MappedObject(**json[key]))
                elif type(json[key]) is list:
                    # we're going to use MappedObject's behavior with lists to
                    # expand these, then grab the resulting value to set
                    mapping = MappedObject(_list=json[key])
                    self._set(key, mapping._list) # pylint: disable=no-member
                elif type(self).properties[key].is_datetime:
                    try:
                        t = time.strptime(json[key], DATE_FORMAT)
                        self._set(key, datetime.fromtimestamp(time.mktime(t)))
                    except:
                        #TODO - handle this better (or log it?)
                        self._set(key, json[key])
                else:
                    self._set(key, json[key])

        self._set('_populated', True)
        self._set('_last_updated', datetime.now())