Datatypes¶
Module containing internal classes used for storing internal data
Exposed classes offer a bit of introspection that can be useful
-
class
pheres._datatypes.
JsonAttr
(module: ModuleType, cls_name: str, name: str, py_name: str, type: TypeHint, default: Any = MISSING, is_json_only: Union[_MISSING, bool] = MISSING, *, cls: type = None)¶ Bases:
object
Stores information for a json attribute
- Variables
-
property
is_required
¶ Returns True if this attribute is mandatory in JSON
-
get_default
()¶ Returns the default value of this attribute
The returned value is a copy and is safe to use and modify
-
class
pheres._datatypes.
ValueData
(type: TypeHint)¶ Bases:
object
Opaque type storing pheres data for jsonable values
Exposed for used with
issubclass
-
class
pheres._datatypes.
ArrayData
(types: tuple)¶ Bases:
object
Opaque type storing pheres data for jsonable arrays
Exposed for used with
issubclass
-
class
pheres._datatypes.
DictData
(type: TypeHint)¶ Bases:
object
Opaque type storing pheres data for jsonable dicts
Exposed for used with
issubclass
-
class
pheres._datatypes.
ObjectData
(attrs: dict[str, JsonAttr])¶ Bases:
object
Opaque type storing pheres data for jsonable objects
Exposed for used with
issubclass
-
class
pheres._datatypes.
DelayedData
(func: Callable[[type], type], kind: JsonableEnum)¶ Bases:
object
Opaque type storing pheres data for jsonable that have been delayed
Exposed for used with
issubclass
- Variables
kind (pheres._datatypes.JsonableEnum) – What type of jsonable the class will be once decorated (This has not happened yet !)
-
class
pheres._datatypes.
UsableDecoder
(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None)¶ Bases:
json.decoder.JSONDecoder
json.JSONDecoder
subclass with wrapper methodsload()
andloads()
using itself for the decoder class-
classmethod
load
(*args, **kwargs)¶ Thin wrapper around
json.load
that use this class as the defaultcls
argument
-
classmethod
loads
(*args, **kwargs)¶ Thin wrapper around
json.loads
that use this class as the defaultcls
argument
-
classmethod