pg.typing.Bool¶
Accessible via pg.typing.Bool
.
- class Bool(default=MISSING_VALUE, is_noneable=False, frozen=False)[source]¶
Bases:
pg.typing.PrimitiveType
Value spec for boolean type.
Examples:
# A required bool value. pg.typing.Bool() # A bool value with the default value set to True. pg.typing.Bool(default=True) # An optional bool value with default value set to None. pg.typing.Bool().noneable() # An optional bool value with default value set to True. pg.typing.Bool(default=True).noneable() # A frozen bool with value set to True that is not modifiable by subclasses. pg.typing.Bool().freeze(True)
Methods:
to_json
(**kwargs)Returns a plain Python value as a representation for this object.
- 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
,tuple
where the container types should have plain Python values as their values.