Esempio n. 1
0
    def from_json_decoded(cls, obj):
        """Return an LFSBook object from a json-decoded object."""
        d = {}
        # We iterate on the members actually present, ignoring absent ones.
        for k, v in obj.items():
            d[k] = v

        # Properties with non-json-serializable values
        if 'snippets' in obj:
            d['snippets'] = [
                Snippet.from_json_decoded(x) for x in obj['snippets']
            ]

        return cls(**d)