fields
Special field types for type-annotating class variables in a JsonObject.
- class CustomField(arg)[source]
Bases:
ABCAbstract base class for defining custom field types in a JsonObject.
- abstract property as_dtype
How should instances appear in cells of a pandas Series?
- abstract property as_json
How should instances be represented in a JSON-serializable dict?
- class FlexiDate(date)[source]
Bases:
objectFlexible wrapper around python’s own
datetime.dateobject.- Parameters:
date – Can be an ISO string of a date or datetime, a
datetime.dateor adatetime.datetimeobject, or apandas.Timestamp.
- property as_datetime
Date as a datetime object.
- property as_dtype
Representation in a pandas DataFrame.
- property as_json
Representation to appear in a JSON.
- class FlexiTime(time)[source]
Bases:
objectFlexible wrapper around python’s own
datetime.datetimeobject.- Parameters:
time – Can be an ISO string of a date or datetime, a
datetime.dateor adatetime.datetimeobject, or apandas.Timestamp.
- property as_dtype
Representation in a pandas DataFrame.
- property as_json
Representation to appear in a JSON.
- class Lower(lstrip=None, rstrip=None)[source]
Bases:
ArgReprLowercase strings, optionally stripping characters left and/or right.
- Parameters:
lstrip (str, optional) – Characters to strip from the left of a string. Defaults to
None, resulting in only whitespaces to be stripped.rstrip (str, optional) – Characters to strip from the right of a string. Defaults to
None, resulting in only whitespaces to be stripped.
- class Maybe(cast)[source]
Bases:
GenericType annotation to allow for
Nonevalues.Initialize this class with a built-in type, class, or other callable that will cast a given value to the desired type if it is not
None. Then calling the callable instance on that value will return the desired type if the value is notNoneandNoneif it is.- Parameters:
cast (callable) – Casts value to desired type if value is not
None.
Note
Upon instantiation, the generic class can be type-annotated with the return type of cast.