Module Contents


TypeLookup(__dict: Optional[Mapping[ValidTypes, ValidTypes]] = None, **kwargs: Hashable)

Dict-like Mapping object that creates keys from values and values from keys.

exception great_expectations.experimental.datasources.type_lookup.TypeLookupError

Bases: ValueError

Inappropriate argument value (of correct type).

great_expectations.experimental.datasources.type_lookup.ValidTypes :TypeAlias
class great_expectations.experimental.datasources.type_lookup.TypeLookup(__dict: Optional[Mapping[ValidTypes, ValidTypes]] = None, **kwargs: Hashable)

Bases: collections.UserDict, Mapping[ValidTypes, ValidTypes]

Dict-like Mapping object that creates keys from values and values from keys. Because of this, all values must be Hashable. NoneType / None is not allowed.

If a Mapping-like object is passed as the first parameter, its key/values will be unpacked (and combined with kwargs) into the new TypeDict object.

Once set, values/keys cannot be overwritten.

__getitem__(self, key: str)
__delitem__(self, key: ValidTypes)
__setitem__(self, key: ValidTypes, value: ValidTypes)

Return repr(self).


Return str(self).

intersection(self, collection_: Iterable[ValidTypes])

Returns the intersection of a list (or other iterable) and the keys/values of the TypeLookup instance.

raise_if_contains(self, collection_: Iterable[ValidTypes])

Raise a TypeLookup error if the passed iterable contains any overlapping items.


Clear all data. Deletes all keys and values.


Context manager that waits until end of transaction to commit changes. Any exceptions that happen within the context will prevent any of the changes from being committed.

Any exceptions encountered will be re-raised on exit.


>>> t = TypeLookup()
>>> with t.transaction():
...     t["my_type"] = tuple
...     assert tuple in t, "Should not fail"
...     assert True is False, "Should fail"
Traceback (most recent call last):
AssertionError: Should fail
>>> print(tuple in t)