pg.typing.ListKey¶
Accessible via pg.typing.ListKey.
- class ListKey(min_value=0, max_value=None)[source]¶
Bases:
pg.typing.NonConstKeyClass that represents key specification for a list.
Example:
# Create a key spec that specifies list items from 1 to 5 (zero-based). key = pg.typing.ListKey(min_value=1, max_value=5) assert key.match(1) assert key.match(5) assert not key.match(0)
Methods:
extend(base)Extend current key spec on top of base spec.
format(**kwargs)Format this object.
match(key)Returns whether this key spec can match against input key.
to_json(**kwargs)Returns a plain Python value as a representation for this object.
Attributes:
Returns max value of acceptable list index value.
Returns min value of acceptable list index value.
- 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.