pg.typing.Any¶
Accessible via pg.typing.Any.
- class Any(default=MISSING_VALUE, annotation=MISSING_VALUE, transform=None, frozen=False)[source]¶
Bases:
ValueSpecBaseValue spec for any type.
Examples:
# A required value of any type. pg.typing.Any() # An optional value of any type, with None as its default value. pg.typing.Any().noneable() # A required value of any type, with 1 as its default value. pg.typing.Any(default=1)
Note
While Any type is very flexible and useful to pass though data between components, we should minimize its usage since minimal validation is performed on this type.
Methods:
annotate(annotation)Set external type annotation.
format([compact, verbose, root_indent])Format this object.
is_compatible(other)Any is compatible with any ValueSpec.
to_json(**kwargs)Returns a plain Python value as a representation for this object.
Attributes:
Returns type annotation.
- format(compact=False, verbose=True, root_indent=0, **kwargs)[source]¶
Format this object.
- Return type:
- to_json(**kwargs)[source]¶
Returns a plain Python value as a representation for this object.
A plain Python value are basic python types that can be serialized into JSON, e.g:
bool,int,float,str,dict(with string keys),list,tuplewhere the container types should have plain Python values as their values.