infobip/infobip-api-python-client · http.py
python logo
def deserialize(self, s, cls):
        vals = json.JSONDecoder().decode(s)
        return self.deserialize_map(vals, cls)
Similar code snippets
1.
p1c2u/openapi-core · models.py
Match rating: 66.67% · See similar code snippets
python logo
def deserialize(self, value):
        if not self.aslist or self.explode:
            return value

        deserializer = self.get_dererializer()
        return deserializer(value)
2.
ecordell/pymacaroons · json_serializer.py
Match rating: 65.3% · See similar code snippets
python logo
def deserialize(self, serialized):
        '''Deserialize a JSON macaroon depending on the format.

        @param serialized the macaroon in JSON format.
        @return the macaroon object.
        '''
        deserialized = json.loads(serialized)
        if deserialized.get('identifier') is None:
            return self._deserialize_v2(deserialized)
        else:
            return self._deserialize_v1(deserialized)
3.
wtsi-hgi/python-hgijson · _serialization.py
Match rating: 63.83% · See similar code snippets
python logo
def decode_parsed(self, parsed_json: PrimitiveJsonType) -> SerializableType:
        deserializer = self._create_deserializer()
        return deserializer.deserialize(parsed_json)
4.
aws/aws-dynamodb-encryption-python · transform.py
Match rating: 63.7% · See similar code snippets
python logo
def ddb_to_dict(item):
    # type: (Dict[str, Any]) -> Dict[str, Any]
    # TODO: narrow these types down
    """Converts a raw DynamoDB item to a native Python dictionary.

    :param dict item: DynamoDB item
    :returns: Native item
    :rtype: dict
    """
    deserializer = TypeDeserializer()
    return {key: deserializer.deserialize(value) for key, value in item.items()}
5.
wtsi-hgi/python-hgijson · serialization.py
Match rating: 63.06% · See similar code snippets
python logo
def deserialize(self, to_deserialize: PrimitiveJsonType) \
            -> Optional[Union[SerializableType, List[SerializableType]]]:
        """
        Deserializes the given representation of the serialized object.
        :param to_deserialize: the serialized object as a dictionary
        :return: the deserialized object or collection of deserialized objects
        """
        if to_deserialize is None:
            # Implements #17
            return None
        elif isinstance(to_deserialize, List):
            deserialized = []
            for item in to_deserialize:
                item_deserialized = self.deserialize(item)
                deserialized.append(item_deserialized)
            return deserialized
        else:
            mappings_not_set_in_constructor = []    # type: List[PropertyMapping]

            init_kwargs = dict()    # type: Dict[str, Any]
            for mapping in self._property_mappings:
                if mapping.object_constructor_parameter_name is not None:
                    value = mapping.serialized_property_getter(to_deserialize)
                    if not (mapping.optional and value is None):
                        decoded_value = self._deserialize_property_value(value, mapping.deserializer_cls)
                        if isinstance(decoded_value, list):
                            collection = mapping.collection_factory(decoded_value)
                            decoded_value = collection

                        argument = mapping.object_constructor_argument_modifier(decoded_value)
                        init_kwargs[mapping.object_constructor_parameter_name] = argument
                else:
                    mappings_not_set_in_constructor.append(mapping)

            decoded = self._deserializable_cls(**init_kwargs)
            assert type(decoded) == self._deserializable_cls

            for mapping in mappings_not_set_in_constructor:
                assert mapping.object_constructor_parameter_name is None
                if mapping.serialized_property_getter is not None and mapping.object_property_setter is not None:
                    value = mapping.serialized_property_getter(to_deserialize)
                    if not (mapping.optional and value is None):
                        decoded_value = self._deserialize_property_value(value, mapping.deserializer_cls)
                        if isinstance(decoded_value, list):
                            collection = mapping.collection_factory(decoded_value)
                            decoded_value = collection

                        mapping.object_property_setter(decoded, decoded_value)

            return decoded
6.
scrapinghub/kafka-scanner · msg_processor_handlers.py
Match rating: 62.8% · See similar code snippets
python logo
def deserialize_json(self, msg):
        return json.loads(msg.decode(encoding=self.__encoding))
7.
coleifer/flask-peewee · rest.py
Match rating: 61.94% · See similar code snippets
python logo
def deserialize_object(self, data, instance):
        d = self.get_deserializer()
        return d.deserialize_object(instance, data)
8.
turicas/rows · fields.py
Match rating: 61.86% · See similar code snippets
python logo
def deserialize(cls, value, *args, **kwargs):
        value = super(JSONField, cls).deserialize(value)
        if value is None or isinstance(value, cls.TYPE):
            return value
        else:
            return json.loads(value)
9.
anti1869/sunhead · json.py
Match rating: 61.44% · See similar code snippets
python logo
def deserialize(self, msg: Serialized) -> Transferrable:
        body_txt = msg.decode("utf-8") if hasattr(msg, "decode") else msg
        try:
            deserialized = json.loads(body_txt)
        except json.JSONDecodeError:
            logger.error("Error deserializing message body", exc_info=True)
            if not self.graceful:
                raise SerializationError

            deserialized = self._deserialized_default

        return deserialized
10.
teddychoi/BynamoDB · model.py
Match rating: 61.1% · See similar code snippets
python logo
def from_raw_data(cls, item_raw):
        """Translate the raw item data from the DynamoDBConnection
        to the item object.

        """
        deserialized = {}
        for name, value in item_raw.items():
            attr = getattr(cls, name, None)
            if attr is None:
                continue
            deserialized[name] = attr.decode(value)
        return cls(**deserialized)