tiled.queries.KeyLike#

class tiled.queries.KeyLike(key: str, before: bool = True, after: bool = True)[source]#

Match entries whose key contains, starts with, or ends with some text.

The match is case-sensitive. The text is matched literally: characters such as %, _, and * have no special meaning.

At least one of before or after must be True. For an exact match, use an exact-key query (KeyLookup or KeysFilter).

Parameters:
keystr

Text to look for in the entries’ keys. Must not be empty.

beforebool, optional

Allow other characters before the text. Default True.

afterbool, optional

Allow other characters after the text. Default True.

Examples

Search for keys that contain “scan”

>>> c.search(KeyLike("scan"))

Search for keys that start with “scan”

>>> c.search(KeyLike("scan", before=False))

Search for keys that end with “scan”

>>> c.search(KeyLike("scan", after=False))
__init__(key: str, before: bool = True, after: bool = True) → None#

Methods

__bool__()

__delattr__(name, /)

Implement delattr(self, name).

__dir__(/)

Default dir() implementation.

__eq__(other)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__getstate__(/)

Helper for pickle.

__gt__(value, /)

Return self>value.

__init__(key[, before, after])

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(*args, **kwargs)

__post_init__()

__reduce__(/)

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__(/)

Size of object in memory, in bytes.

__str__(/)

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

decode(*, key[, before, after])

encode()

Attributes

__annotations__

__dataclass_fields__

__dataclass_params__

__dict__

__doc__

__hash__

__match_args__

__module__

__weakref__

list of weak references to the object

after

before

key