Return normalized user data as a dictionary.

        empty: an empty dictionary
        userdata: data in the form of Userdata, dict or None
192028
def normalize(cls, empty, userdata):
        
        if isinstance(userdata, Userdata):
            return userdata.to_dict()
        if isinstance(userdata, dict):
            return cls._dict_to_dict(empty, userdata)
        if isinstance(userdata, (bytes, bytearray)):
            return cls._bytes_to_dict(empty, userdata)
        if userdata is None:
            return empty
        raise ValueError
644885
def _ParseChatData(self, data):
    
    data_store = {}

    if 'body' in data:
      body = data.get('body', '').replace('\n', ' ')
      if body.startswith('//') and '{' in body:
        body_dict = self._ExtractJQuery(body)
        title, _, _ = body.partition('{')
        body = '{0:s} <{1!s}>'.format(
            title[2:], self._DictToListOfStrings(body_dict))
    else:
      body = 'No text.'

    data_store['text'] = body

    room = data.get('rooms', None)
    if not room:
      room = data.get('room', None)
    if room:
      data_store['room'] = room

    data_store['id'] = data.get('id', None)
    user = data.get('user', None)
    if user:
      try:
        user_sid = int(user)
        data_store['sid'] = user_sid
      except (ValueError, TypeError):
        data_store['user'] = user

    return data_store
1268592
def _get_data_from_empty_list(source, fields='*', first_row=0, count=-1, schema=None):
  
  fields = get_field_list(fields, schema)
  return {'cols': _get_cols(fields, schema), 'rows': []}, 0
114307
def get_users(self, capacity=None):
        # type: (Optional[str]) -> List[User]
        
        users = list()
        usersdicts = self.data.get('users')
        if usersdicts is not None:
            for userdata in usersdicts:
                if capacity is not None and userdata['capacity'] != capacity:
                    continue
                id = userdata.get('id')
                if id is None:
                    id = userdata['name']
                user = hdx.data.user.User.read_from_hdx(id, configuration=self.configuration)
                user['capacity'] = userdata['capacity']
                users.append(user)
        return users
941089
def _user_raw_from_login_content(login_content):
    """"""
    matching_keys = [
        'displayName',
        'lastLogin',
        'active',
        'name',
        'isMe',
        'lastPasswordChangedDate',
        'passwordResetRequired',
        'groups',
        'roles',
        'email',
        'isAdmin',
        'createdDate',
        'modifiedDate',
        'createdByUser',
        'modifiedByUser',
        'userName',
        'id',
        'disabled'
    ]

    raw_data = {
        '$type': User._type,
    }

    for key in matching_keys:
        if key in login_content:
            raw_data[key] = login_content[key]

    return raw_data
1183029
def get_data(self):
        
        return {key: "".join(chr(byte) for byte in data)
                for key, data in six.iteritems(self.data)}
183557
def to_dict(self, remove_nones=False):
        

        if remove_nones:
            return super().to_dict(remove_nones=True)

        return {
            'id': self.id,
            'name': self.name,
            'type': self.type
        }
705505
def get_user(self, id, **data):
        
        
        return self.get("/users/{0}/".format(id), data=data)
26781
def to_dict(self):
        ''''''
        d = {'name': self.name}
        if self.data:
            d['data'] = self.data
        return d
1166685
async def _get_user_id(self, user, *, asdict=False):
        
        uid = self.config.user_id()
        if isinstance(user, dict):
            user_id = user.get(uid)
        elif hasattr(user, "to_dict"):
            _to_dict = await utils.call(user.to_dict)
            user_id = _to_dict.get(uid)
        else:
            raise exceptions.InvalidRetrieveUserObject()

        if asdict:
            return {uid: user_id}

        return user_id
567208
def data(self):
        
        d = {}
        for name in self.key_names:
            d[name] = self.__dict__.get(name, None)
        return d
825523
def data(self):
        '''
        '''
        d = {}
        for val, key in self._fields.items():
            val = getattr(self, val)
            if val is not None:
                d[key] = val
        return d
993357
def fetch_post_data(self):
        '''
        
        '''
        post_data = {}
        ext_dic = {}
        for key in self.request.arguments:
            if key.startswith('def_'):
                ext_dic[key] = self.get_argument(key)
            else:
                post_data[key] = self.get_arguments(key)[0]

        post_data['user_name'] = self.userinfo.user_name

        ext_dic = dict(ext_dic, **self.ext_post_data(postdata=post_data))

        return (post_data, ext_dic)
529834
def data(self):
        
        data = {}
        data["favorite"] = self.favorite if self.favorite else ""
        data["trashed"] = self.trashed if self.trashed else ""
        data["read"] = self.read if self.read else ""
        data["tags"] = self.tags if self.tags else ""
        data["folder"] = self.folder if self.folder else ""
        data["tone"] = self.tone if self.tone else ""

        # Deletes parameter if it does not have a value
        for key, value in list(data.items()):
            if value == '':
                del data[key]

        data = json.dumps(data)
        return data
552052
def template(cls, userdata):
        """"""
        ud = Userdata(cls.normalize(cls.create_empty(None), userdata))
        return ud
162858
def getData(datadictionary_id)
      # /DataDictionaries/{ID}|{Name}/data
      parameter = { basic_auth: @auth }

      response = self.class.get("/datadictionaries/#{datadictionary_id}/data", parameter)
      if response.success?
        response['Data']
      else
        raise response.response
      end
    end
989931
def json_data(self, name, default=None):
        
        value = self.get(name)
        if value is Missing.Value:
            return default
        return value