Skip to content

Commit

Permalink
Fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Setsugennoao committed Oct 30, 2023
1 parent 05bcd73 commit 0b30462
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions stgpytools/types/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MissingTBase(Enum):

DataType = Union[str, bytes, bytearray, SupportsString]

FuncExceptT = str | Callable[..., Any] | tuple[Callable[..., Any] | str, str] # type: ignore
FuncExceptT = str | Callable[..., Any] | tuple[Callable[..., Any] | str, str]
"""
This type is used in specific functions that can throw an exception.
```
Expand All @@ -45,8 +45,6 @@ def some_func() -> None:
``ValueError: (some_func) Some error occurred!!``
"""

FuncExceptT = str | Callable[..., Any] | tuple[Callable[..., Any] | str, str] # type: ignore


StrArr = SingleOrArr[SupportsString]
StrArrOpt = SingleOrArrOpt[SupportsString]
Expand Down
6 changes: 3 additions & 3 deletions stgpytools/types/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,16 @@ def _wrapper(function: Callable[Concatenate[T0, P0], R0]) -> inject_self[T0, P0,
return _wrapper


class inject_self(Generic[T, P, R], inject_self_base[T, P, R]): # type: ignore
class inject_self(Generic[T, P, R], inject_self_base[T, P, R]):
"""Wrap a method so it always has a constructed ``self`` provided to it."""

class cached(Generic[T0, P0, R0], inject_self_base[T0, P0, R0]): # type: ignore
class cached(Generic[T0, P0, R0], inject_self_base[T0, P0, R0]):
"""
Wrap a method so it always has a constructed ``self`` provided to it.
Once ``self`` is constructed, it will be reused.
"""

class init_kwargs(Generic[T0, P0, R0], inject_self_base[T0, P0, R0]): # type: ignore
class init_kwargs(Generic[T0, P0, R0], inject_self_base[T0, P0, R0]):
"""
Wrap a method so it always has a constructed ``self`` provided to it.
When constructed, kwargs to the function will be passed to the constructor.
Expand Down

0 comments on commit 0b30462

Please sign in to comment.