F483/apigen · apigen.py
python logo
def _deserialize(kwargs):
    def deserialize(item):
        if isinstance(item[1], str):
            try:
                data = json.loads(item[1])  # load as json
            except:
                data = item[1].decode('utf-8')  # must be a string
        else:
            data = item[1]  # already deserialized (method default value)
        return (item[0], data)
    return dict(map(deserialize, kwargs.items()))
Similar code snippets
1.
aiogram/aiogram · fields.py
Match rating: 64.55% · See similar code snippets
python logo
def deserialize(self, value, parent=None):
        result = []
        deserialize = super(ListField, self).deserialize
        for item in value:
            result.append(deserialize(item, parent=parent))
        return result
2.
adewes/blitzdb · serializers.py
Match rating: 62.84% · See similar code snippets
python logo
def deserialize(cls, data):
        if six.PY3:
            return json.loads(data.decode('utf-8'))
        else:
            return json.loads(data.decode('utf-8'))
3.
AirtestProject/Poco · controller.py
Match rating: 61.8% · See similar code snippets
python logo
def deserialize(self, data):
        if six.PY3 and not isinstance(data, six.text_type):
            data = data.decode('utf-8')
        return json.loads(data)
4.
infobip/infobip-api-python-client · http.py
Match rating: 60.69% · See similar code snippets
python logo
def deserialize(self, s, cls):
        vals = json.JSONDecoder().decode(s)
        return self.deserialize_map(vals, cls)
5.
elastic/elasticsearch-dsl-py · field.py
Match rating: 60.67% · See similar code snippets
python logo
def deserialize(self, data):
        if isinstance(data, (list, AttrList, tuple)):
            data = [
                None if d is None else self._deserialize(d)
                for d in data
            ]
            return data
        if data is None:
            return None
        return self._deserialize(data)
6.
gmr/tinman · serializers.py
Match rating: 60.22% · See similar code snippets
python logo
def deserialize(self, data):
        """Return the deserialized data.

        :param str data: The data to deserialize
        :rtype: dict

        """
        if not data:
            return dict()
        return self._deserialize_datetime(pickle.loads(data))
7.
podhmo/swagger-marshmallow-codegen · fields.py
Match rating: 60.15% · See similar code snippets
python logo
def _deserialize(self, value):
        return {self.key_field.deserialize(k): self.nested_field.deserialize(v) for k, v in value.items()}
8.
mbodenhamer/syn · sequence.py
Match rating: 59.3% · See similar code snippets
python logo
def deserialize(cls, seq, **kwargs):
        if not isinstance(seq, collections.Sequence):
            return super(Sequence, cls).deserialize(seq, **kwargs)

        ret = [deserialize(item, **kwargs) for item in seq]
        return cls.type(ret)
9.
elastic/elasticsearch-dsl-py · field.py
Match rating: 58.48% · See similar code snippets
python logo
def _deserialize(self, data):
        if isinstance(data, Range):
            return data
        data = dict((k, self._core_field.deserialize(v)) for k, v in iteritems(data))
        return Range(data)
10.
Josef-Friedrich/phrydy · mediafile.py
Match rating: 56.94% · See similar code snippets
python logo
def deserialize(self, data):
        if isinstance(data, mutagen.asf.ASFBaseAttribute):
            data = data.value
        return data