Skip to content

Commit

Permalink
🐛 Fix typing for ozi.spec.base.Default.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjdbcm committed Jun 9, 2024
1 parent fdccaae commit 43f840f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ozi/spec/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
from typing import Iterator
from typing import Protocol
from typing import TypeAlias
from typing import TypeVar

if TYPE_CHECKING:
import sys
from collections.abc import Callable
from collections.abc import Mapping

_Val: TypeAlias = list['_Key'] | Mapping[str, '_Key']
_Key: TypeAlias = str | int | float | None | _Val
VT = TypeVar('VT', str, int, float, None)
_Val: TypeAlias = list['_Key'] | Mapping['_Key', VT] | VT
_Key: TypeAlias = VT | _Val
_Lambda: TypeAlias = Callable[[], '_FactoryMethod']
_FactoryMethod: TypeAlias = Callable[[], _Lambda] | Field

Expand Down Expand Up @@ -71,7 +73,7 @@ def __iter__(self: Self) -> Iterator[tuple[str, _Val]]:
),
)

def asdict(self: Self) -> dict[str, _Val | str]:
def asdict(self: Self) -> dict[str, _Val]:
"""Return a dictionary of all fields where repr=True.
Hide a variable from the dict by setting repr to False and using
a Default subclass as the default_factory.
Expand Down

0 comments on commit 43f840f

Please sign in to comment.