Deal with different named data returned from the server
331316
def read(self, entity=None, attrs=None, ignore=None, params=None):
        
        if attrs is None:
            attrs = self.read_json()
        attrs['override'] = attrs.pop('override?')
        attrs['unlimited'] = attrs.pop('unlimited?')
        return super(Filter, self).read(entity, attrs, ignore, params)
1224068
function(serverData) {
      // Copy server data
      var tempServerData = {};
      Parse._objectEach(serverData, function(value, key) {
        tempServerData[key] = Parse._decode(key, value);
      });
      this._serverData = tempServerData;

      // Refresh the attributes.
      this._rebuildAllEstimatedData();

      
      // Clear out any changes the user might have made previously.
      this._refreshCache();
      this._opSetQueue = [{}];

      // Refresh the attributes again.
      this._rebuildAllEstimatedData();       
    }
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
1008365
def return_data(self, data, format=None):
        
        if format is None:
            format = self.format
        if format == "json":
            formatted_data = json.loads(data)
        else:
            formatted_data = data
        return formatted_data
11447
def reverse_name_server(self, query, limit=None, **kwargs):
        """"""
        return self._results('reverse-name-server', '/v1/{0}/name-server-domains'.format(query),
                            items_path=('primary_domains', ), limit=limit, **kwargs)
817945
def _handle_api_result(result: Optional[Dict[str, Any]]) -> Any:
    
    if isinstance(result, dict):
        if result.get('status') == 'failed':
            raise ActionFailed(retcode=result.get('retcode'))
        return result.get('data')
1228541
def StripTypeInfo(rendered_data):
  """"""

  if isinstance(rendered_data, (list, tuple)):
    return [StripTypeInfo(d) for d in rendered_data]
  elif isinstance(rendered_data, dict):
    if "value" in rendered_data and "type" in rendered_data:
      return StripTypeInfo(rendered_data["value"])
    else:
      result = {}
      for k, v in iteritems(rendered_data):
        result[k] = StripTypeInfo(v)
      return result
  else:
    return rendered_data
1362666
def handle_data(self, data):
        """"""
        if not self.silent:
            if self.url:
                if self.url == data:
                    data = ''
                else:
                    data = '(' + data + ')'
            self.url = ''
            self.result += cgi.escape(data, True)
        lines = data.splitlines()
        if len(lines) > 1:
            match_obj = RE_HTML_FIRST_NON_QUOTATION_CHAR_ON_LINE.search(
                lines[-1])
            if match_obj:
                self.line_quotation = '&gt;' * match_obj.start()
            else:
                self.line_quotation = ''
16988
def extract_value(self, data):
        
        if self.name not in data and not self.allow_missing:
            raise exceptions.FieldNotFound('Field {} is missing from request'.format(self.name))
        
        if self.multiple_inputs:
            self.value = []
            for value in data.getlist(self.name):
                if self.strip_value:
                    value = value.strip()
                if value == '' and self.convert_empty_to_none:
                    value = None

                self.value.append(value)
        else:
            self.value = data.get(self.name)
            if self.value is not None:
                if self.strip_value:
                    self.value = self.value.strip()
                if self.value == '' and self.convert_empty_to_none:
                    self.value = None

        # Convert the value to the correct data type
        self.convert_value()
1202179
def resolve_name(name):
    """"""
    logger.debug("resolve_name: %s", name)
    with Database("feeds") as feeds, Database("aliases") as aliases:
        if name in aliases.keys():
            return feeds[aliases[name]]
        elif name in feeds.keys():
            return feeds[name]
        else:
            print("Cannot find feed named: %s" % name)
            return
392692
function cleanData(originalData) {
            return originalData.reduce((acc, d) => {
                d.name = String(d[nameKey]);
                d.x = d[xKey];
                d.y = d[yKey];

                return [...acc, d];
            }, []);
        }
183797
def _parse_connection_name(self, name):
        
        if name is None:
            name = self.get_default_connection()

        if name.endswith(('::read', '::write')):
            return name.split('::', 1)

        return name, None
839509
function cleanUpData(data) {
  if (!(data instanceof Tag$1) && !(data && isFunction(data.trigger)))
    { return data }

  var o = {};
  for (var key in data) {
    if (!RE_RESERVED_NAMES.test(key)) { o[key] = data[key]; }
  }
  return o
}
539094
def namedb_get_names_with_value_hash( cur, value_hash, block_number ):
    

    unexpired_query, unexpired_args = namedb_select_where_unexpired_names( block_number )
    select_query = "SELECT name FROM name_records JOIN namespaces ON name_records.namespace_id = namespaces.namespace_id " + \
                   "WHERE value_hash = ? AND revoked = 0 AND " + unexpired_query + ";"

    args = (value_hash,) + unexpired_args
    name_rows = namedb_query_execute( cur, select_query, args )
    names = []

    for name_row in name_rows:
        names.append( name_row['name'] )

    if len(names) == 0:
        return None
    else:
        return names
1261422
function handleUniqueResult(results) {
      var res = [], flag = {};
      for (var i = 0; i<results.length; i++) {
        if (flag[results[i][self.displayProperty1]]) continue;
        flag[results[i][self.displayProperty1]] = true;
        res.push(results[i]);
      }
      return res;
    }
238357
def _extract_return(self, data):
        '''
        
        '''
        if isinstance(data, dict):
            data = data.get('return', data)

        return data
24288
def _handle_get(self, request):
        # type: (Get) -> CallbackResponses
        """"""
        data = self._block

        for i, endpoint in enumerate(request.path[1:]):
            try:
                data = data[endpoint]
            except KeyError:
                if hasattr(data, "typeid"):
                    typ = data.typeid
                else:
                    typ = type(data)
                raise UnexpectedError(
                    "Object %s of type %r has no attribute %r" % (
                        request.path[:i+1], typ, endpoint))
        # Important to serialize now with the lock so we get a consistent set
        serialized = serialize_object(data)
        ret = [request.return_response(serialized)]
        return ret