Skip to content

Commit

Permalink
Trimmed version
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinugu committed Sep 12, 2024
1 parent 01995a8 commit 65b5b93
Show file tree
Hide file tree
Showing 25 changed files with 1,427 additions and 1,051 deletions.
606 changes: 309 additions & 297 deletions src/omnipy/__init__.py

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions src/omnipy/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,13 @@ def _get_data_field(cls) -> ModelField:
return cast(ModelField, cls.__fields__.get(DATA_KEY))

@classmethod
def get_model_class(cls) -> Type[Model]:
def get_model_class(cls) -> type[Model] | None:
"""
Returns the concrete Model class used for all data files in the dataset, e.g.:
`Model[list[int]]`
:return: The concrete Model class used for all data files in the dataset
"""
model_type = cls._get_data_field().type_
return model_type
return cls._get_data_field().type_

@staticmethod
def _raise_no_model_exception() -> None:
Expand Down Expand Up @@ -618,9 +617,9 @@ def _to_data_if_model(data_obj: Any):
return data_obj


_KwargValT = TypeVar('_KwargValT', bound=object)
_ParamModelT = TypeVar('_ParamModelT', bound=ParamModel)
_ListOfParamModelT = TypeVar('_ListOfParamModelT', bound=ListOfParamModel)
_KwargValT = TypeVar('_KwargValT', bound=object, default=object)
_ParamModelT = TypeVar('_ParamModelT', bound=ParamModel, default=ParamModel)
_ListOfParamModelT = TypeVar('_ListOfParamModelT', bound=ListOfParamModel, default=ListOfParamModel)

ParamModelSuperKwargsType: TypeAlias = \
dict[str, dict[str, _ParamModelT | DataWithParams[_ParamModelT, _KwargValT]]]
Expand Down
6 changes: 6 additions & 0 deletions src/omnipy/data/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
from typing_extensions import TypeVar

T = TypeVar('T')
U = TypeVar('U')


class TypeVarStore(Generic[T]):
def __init__(self, t: T) -> None:
raise ValueError()


class DoubleTypeVarStore(Generic[T, U]):
def __init__(self, t: T | U) -> None:
raise ValueError()


class TypeVarStore1(TypeVarStore[T], Generic[T]):
...

Expand Down
Loading

0 comments on commit 65b5b93

Please sign in to comment.