diff --git a/tables.py b/tables.py index 7f041fb..1db1ea6 100644 --- a/tables.py +++ b/tables.py @@ -26,6 +26,9 @@ class Table(Iterable): Table([1, 2, 3], {}) # Table([1, 2, 3]) Table(1,2,3) == Table([1,2,3]) # True len(Table("a", "b", "c", four="d", five="e")) # 5 + Types: + KeyValue (str | int): Any key value, either a string or an int. A string is used for dictionary keys, + and an int is used for list indices. """ type KeyValue = str | int # typing @@ -60,7 +63,7 @@ def __setitem__(self, key: Iterable[KeyValue], value: Iterable[Any]): ... def find_keys(self, value: Any, /) -> KeyValue: ... @overload - def find_keys[default: Any]( + def find_keys[default]( self, value: Any, /, *, default: Any = None) -> list[KeyValue] | default: ... @overload diff --git a/tests/definitions.py b/tests/definitions.py index 530fd42..bf89650 100644 --- a/tests/definitions.py +++ b/tests/definitions.py @@ -1,4 +1,12 @@ -from ..tables import Table +"""Definitons for tests. +""" +try: + from ..tables import Table +except: + try: + from tables import Table + except: + from .tables import Table if __name__ == "__main__": # definitions print("Table definitions:") @@ -22,4 +30,4 @@ print(f"{Table(1,2,3).dict = }") # {} print(f"{Table(foo='bar', spam='eggs').list = }") # [] print(f"{Table(foo='bar', spam='eggs').dict = }") # {'foo': 'bar', 'spam': 'eggs'} - print(f"{Table(1,2,3, foo='bar', spam='eggs').foreach((lambda _, y: y ), True, False) = }") + #print(f"{Table(1,2,3, foo='bar', spam='eggs').foreach((lambda _, y: y ), True, False) = }")