geestac.custom_types#
Custom types.
Attributes#
Classes#
A Namespace to store objects with a unique attribute (key). |
Module Contents#
- class geestac.custom_types.ListNamespace(*args, key)[source]#
Bases:
Generic[T]A Namespace to store objects with a unique attribute (key).
If the value of the key is not suitable for an attribute, it’ll be converted with format_attribute function. The values of the keys must be unique, else the first occurrence will be kept.
- Parameters:
args (T) – a list of objects.
key (str) – the attribute of the object to get the key from.
- __getitem__(index)[source]#
Get item from ListNamepace.
- Parameters:
index (int | str) – index of the element in the ListNamespace.
- as_dict(value=None)[source]#
ListNamespace as a dict.
- Parameters:
value (str | None) – attribute of the object to use as value.
- Return type:
dict