data = [{'id', 'tid', 'annotation_tid', 'value', 'comment', 'upvote', 'downvote',
        'curator_status', 'withdrawn', 'term_version', 'annotation_term_version', 'orig_uid',
        'orig_time'}]
326780
def updateAnnotations(self,
                          data,
                          LIMIT=25,
                          _print=True,
                          crawl=False,):
        
        url_base = self.base_url + \
            '/api/1/term/edit-annotation/{id}'  # id of annotation not term id
        annotations = self.getAnnotations_via_id([d['id'] for d in data],
                                                 LIMIT=LIMIT,
                                                 _print=_print,
                                                 crawl=crawl)

        annotations_to_update = []
        for d in data:
            annotation = annotations[int(d['id'])]
            annotation.update({**d})
            url = url_base.format(id=annotation['id'])
            annotations_to_update.append((url, annotation))
        self.post(annotations_to_update,
                  LIMIT=LIMIT,
                  action='Updating Annotations',
                  _print=_print,
                  crawl=crawl)
170903
def getanymentions(idf, anidfobject):
    """"""
    name = anidfobject.obj[1]
    foundobjs = []
    keys = idfobjectkeys(idf)
    idfkeyobjects = [idf.idfobjects[key.upper()] for key in keys]
    for idfobjects in idfkeyobjects:
        for idfobject in idfobjects:
            if name.upper() in [item.upper() 
                                    for item in idfobject.obj 
                                        if isinstance(item, basestring)]:
                foundobjs.append(idfobject)
    return foundobjs
282430
def _Pairs(data):
    """"""
    keys = sorted(data)
    return [{'@key': k, '@value': data[k]} for k in keys]
539341
def _data():
    
    global _DATA
    if _DATA is None:
        _DATA = {}
        with open(resource_filename(__name__, 'data.json'), 'r', encoding='utf-8') as f:
            _DATA['alpha3'] = {k: Currency(**v) for k, v in json.load(f).items()}

        _DATA['code_num'] = {d.code_num: d for d in _DATA['alpha3'].values() if d.code_num is not None}
        _DATA['symbol'] = defaultdict(list)
        for d in _DATA['alpha3'].values():
            for s in d.symbols:
                _DATA['symbol'][s] += [d]

        for s, d in _DATA['symbol'].items():
            _DATA['symbol'][s] = sorted(d, key=lambda d: 10000 if d.code_num is None else d.code_num)

        _DATA['name'] = {}
        for d in _DATA['alpha3'].values():
            if d.name in _DATA['name']:
                assert 'Duplicate name "{}"!'.format(d.name)
            _DATA['name'][d.name] = d

        _DATA['country'] = defaultdict(list)
        for d in _DATA['alpha3'].values():
            for cc in d.countries:
                _DATA['country'][cc] += [d]

        for s, d in _DATA['country'].items():
            _DATA['country'][s] = sorted(d, key=lambda d: (
                int(d.symbols == []),  # at least one symbol
                10000 if d.code_num is None else d.code_num,  # official first
                len(d.countries),  # the fewer countries the more specific
            ))

    return _DATA
750233
def to_dict(self):
        
        data = {}

        # mandatory characteristics
        data["name"] = self.name
        data["description"] = self.description if self.description and len(self.description) else None
        data["type"] = self.type if self.type and len(self.type) else None
        data["allowed_chars"] = self.allowed_chars if self.allowed_chars and len(self.allowed_chars) else None
        data["allowed_choices"] = self.allowed_choices
        data["autogenerated"] = self.autogenerated
        data["channel"] = self.channel if self.channel and len(self.channel) else None
        data["creation_only"] = self.creation_only
        data["default_order"] = self.default_order
        data["default_value"] = self.default_value if self.default_value and len(self.default_value) else None
        data["deprecated"] = self.deprecated
        data["exposed"] = self.exposed
        data["filterable"] = self.filterable
        data["format"] = self.format if self.format and len(self.format) else None
        data["max_length"] = int(self.max_length) if self.max_length is not None else None
        data["max_value"] = int(self.max_value) if self.max_value is not None else None
        data["min_length"] = int(self.min_length) if self.min_length is not None else None
        data["min_value"] = int(self.min_value) if self.min_value is not None else None
        data["orderable"] = self.orderable
        data["read_only"] = self.read_only
        data["required"] = self.required
        data["transient"] = self.transient
        data["unique"] = self.unique
        data["uniqueScope"] = self.unique_scope if self.unique_scope and len(self.unique_scope) else None
        data["subtype"] = self.subtype if self.subtype and len(self.subtype) else None
        data["userlabel"] = self.userlabel if self.userlabel and len(self.userlabel) else None

        return data
1028264
def to_dict(self):
        """"""
        data = model_to_dict(self, exclude=['id'])
        data['title'] = unicode(self)
        data['slug'] = self.slug
        data['release_date'] = self.release_date.date().isoformat()
        data['created'] = self.created.isoformat()
        data['modified'] = self.modified.isoformat()
        new_features, known_issues = self.notes(public_only=False)
        for note in known_issues:
            note.tag = 'Known'
        data['notes'] = [n.to_dict(self) for n in chain(new_features, known_issues)]
        return data
390598
def item_id(response):
    
    dict_keys = ['item_0', 'item_1', 'item_2',
                 'item_3', 'item_4', 'item_5']
    new_keys = ['item_0_name', 'item_1_name', 'item_2_name',
                'item_3_name', 'item_4_name', 'item_5_name']

    for player in response['players']:
        for key, new_key in zip(dict_keys, new_keys):
            for item in items['items']:
                if item['id'] == player[key]:
                    player[new_key] = item['localized_name']

    return response
1366053
function(callback) {
        dataIndex = {};

        var pos = 0;

        enamdictData.split("\n").forEach(function(line) {
            var parts = line.split("|");
            var cleanName = parts[0];
            var romaji = parts[1];

            if (!(cleanName in dataIndex)) {
                dataIndex[cleanName] = pos;
            }

            if (!(romaji in dataIndex)) {
                dataIndex[romaji] = pos;
            }

            // +1 for the \n
            pos += line.length + 1;
        });

        callback(null, this);
    }
581367
def data_nodes(self):
        

        return {k: v for k, v in self.nodes.items() if v['type'] == 'data'}
1230539
def as_dict(self):
        ''''''
        pk = self.pk
        id_type = 3
        if pk.type == 'auto':
            id_type = 1
        return {'id_name': pk.name,
                'id_type': id_type,
                'sorted': bool(self.ordering),
                'autoincr': self.ordering and self.ordering.auto,
                'multi_fields': [field.name for field in self.multifields],
                'indices': dict(((idx.attname, idx.unique)
                                 for idx in self.indices))}
368843
def data(self):
        
        d = {}
        for key in self._data:
            if key == "plugins":
                d[key] = self.plugins.data()
            else:
                try:
                    d[key] = getattr(self, key)
                except AttributeError:
                    pass  # unknown key, just leave it unchanged
        return d
1007384
def from_json(cls, data):
        
        optional_keys = ('city', 'state', 'country', 'latitude', 'longitude',
                         'time_zone', 'elevation', 'station_id', 'source')
        for key in optional_keys:
            if key not in data:
                data[key] = None

        return cls(data['city'], data['state'], data['country'], data['latitude'],
                   data['longitude'], data['time_zone'], data['elevation'],
                   data['station_id'], data['source'])
84517
def info(self):
        
        unique_indexes = set(self._uniqueIndexes)
        return {
            'len': len(self),
            'name': self.table_name,
            'fields': list(_object_attrnames(self[0])) if self else [],
            'indexes': [(iname, self._indexes[iname] in unique_indexes) for iname in self._indexes],
        }
1016166
def extract_annotation(data):
    
    xlabel = None
    xvalues = None
    ylabel = None
    yvalues = None
    if hasattr(data, 'minor_axis'):
        xvalues = data.minor_axis
        if hasattr(data.minor_axis, 'name'):
            xlabel = data.minor_axis.name
    if hasattr(data, 'columns'):
        xvalues = data.columns
        if hasattr(data.columns, 'name'):
            xlabel = data.columns.name
    if hasattr(data, 'major_axis'):
        yvalues = data.major_axis
        if hasattr(data.major_axis, 'name'):
            ylabel = data.major_axis.name
    if hasattr(data, 'index'):
        yvalues = data.index
        if hasattr(data.index, 'name'):
            ylabel = data.index.name
    return xlabel, xvalues, ylabel, yvalues
342144
def data(self, *args):
        ''''''
        data = self._data
        if not args:
            return data or {}
        result, adding = self._attrdata('data', *args)
        if adding:
            if data is None:
                self._extra['data'] = {}
            add = self._visitor.add_data
            for key, value in result.items():
                add(self, key, value)
            return self
        else:
            return result
902965
def _get_data_from_list_of_dicts(source, fields='*', first_row=0, count=-1, schema=None):
  
  if schema is None:
    schema = google.datalab.bigquery.Schema.from_data(source)
  fields = get_field_list(fields, schema)
  gen = source[first_row:first_row + count] if count >= 0 else source
  rows = [{'c': [{'v': row[c]} if c in row else {} for c in fields]} for row in gen]
  return {'cols': _get_cols(fields, schema), 'rows': rows}, len(source)
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