pg.typing.StrKey¶
Accessible via pg.typing.StrKey.
- class StrKey(regex=None)[source]¶
Bases:
pg.typing.NonConstKeyClass that represents a variable string key.
Example:
# Create a key spec that specifies all string keys started with 'foo'. key = pg.typing.StrKey('foo.*') assert key.match('foo') assert key.match('foo1') assert not key.match('bar')
Methods:
format(**kwargs)Format this object.
match(key)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 regular expression of this key spec.
- 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.