Skip to content

Commit

Permalink
Merge pull request #170 from 0Hughman0/meta-typing-improve
Browse files Browse the repository at this point in the history
improved typing of meta wrapped classes
  • Loading branch information
0Hughman0 authored Aug 29, 2024
2 parents 7ae57a5 + 15d70eb commit cf01106
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cassini/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ def as_field(self) -> Tuple[str, Tuple[Type[JSONType], FieldInfo]]:
return self.name, (self.json_type, Field(default=self.default))


T = TypeVar("T")


class MetaManager:
"""
Class for the creation of meta objects.
Expand All @@ -250,7 +253,7 @@ def __init__(self) -> None:
self.cls: Union[Type, None] = None
self.meta_attrs: List[MetaAttr] = []

def connect_class(self, cls: Type) -> Type:
def connect_class(self, cls: Type[T]) -> Type[T]:
cls.__meta_manager__ = self # type: ignore[attr-defined]
self.cls = cls
return cls
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cassini"
version = "0.3.0a6"
version = "0.3.0a7"
description = "A tool to structure experimental work, data and analysis using Jupyter Lab."
authors = ["0Hughman0 <[email protected]>"]
license = "GPL-3.0-only"
Expand Down

0 comments on commit cf01106

Please sign in to comment.