tiled.adapters.mapping.MapAdapter
- class tiled.adapters.mapping.MapAdapter(mapping: Mapping[str, A], *, metadata: Mapping[str, str | int | float | Mapping[str, JSON_ITEM] | Sequence[JSON_ITEM] | None] | None = None, sorting: List[SortingItem] | None = None, specs: List[Spec] | None = None, entries_stale_after: timedelta | None = None, metadata_stale_after: timedelta | None = None, must_revalidate: bool = True)[source]
Adapt any mapping (dictionary-like object) to Tiled.
- __init__(mapping: Mapping[str, A], *, metadata: Mapping[str, str | int | float | Mapping[str, JSON_ITEM] | Sequence[JSON_ITEM] | None] | None = None, sorting: List[SortingItem] | None = None, specs: List[Spec] | None = None, entries_stale_after: timedelta | None = None, metadata_stale_after: timedelta | None = None, must_revalidate: bool = True) None[source]
Create a simple Adapter from any mapping (e.g. dict, OneShotCachedMap).
- Parameters:
- mappingdict-like
- metadatadict, optional
- specsList[str], optional
- sortingList[Tuple[str, int]], optional
- specsList[str], optional
- entries_stale_after: timedelta
This server uses this to communicate to the client how long it should rely on a local cache before checking back for changes.
- metadata_stale_after: timedelta
This server uses this to communicate to the client how long it should rely on a local cache before checking back for changes.
- must_revalidatebool
Whether the client should strictly refresh stale cache items.
Methods
__init__(mapping, *[, metadata, sorting, ...])Create a simple Adapter from any mapping (e.g. dict, OneShotCachedMap).
get(k[,d])get_distinct(metadata, structure_families, ...)items()keys()metadata()new_variation(*args[, mapping, metadata, ...])read([fields])register_query(class_, translator)register_query_lazy(toplevel, register)Register a registration function which will be called if the toplevel module (e.g. 'pandas') is ever loaded.
search(query)sort(sorting)structure()supported_storage()values()Attributes
entries_stale_atitems_indexerkeys_indexermetadata_stale_atmust_revalidatequery_registrysortingspecsstructure_familyvalues_indexerfn