Skip to content

Commit

Permalink
split model introspection into several files
Browse files Browse the repository at this point in the history
  • Loading branch information
zhPavel committed Dec 30, 2023
1 parent 9cb1f47 commit dccbfed
Show file tree
Hide file tree
Showing 18 changed files with 654 additions and 606 deletions.
2 changes: 1 addition & 1 deletion src/adaptix/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from adaptix._internal.definitions import DebugTrail

from ._internal.common import Dumper, Loader, TypeHint
from ._internal.model_tools.introspection import TypedDictAt38Warning
from ._internal.model_tools.introspection.typed_dict import TypedDictAt38Warning
from ._internal.morphing.facade.func import dump, load
from ._internal.morphing.facade.provider import (
as_is_dumper,
Expand Down
5 changes: 3 additions & 2 deletions src/adaptix/_internal/model_tools/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from enum import Enum
from keyword import iskeyword
from typing import Any, Callable, FrozenSet, Generic, Hashable, Mapping, Optional, TypeVar, Union

from ..common import Catchable, TypeHint, VarTuple
Expand Down Expand Up @@ -146,7 +147,7 @@ def create_key_accessor(key: Union[str, int], access_error: Optional[Catchable])


def is_valid_field_id(value: str) -> bool:
return value.isidentifier()
return value.isidentifier() or iskeyword(value)


@dataclass(frozen=True)
Expand Down Expand Up @@ -315,7 +316,7 @@ class OutputShape(BaseShape):
Out = TypeVar('Out', bound=Optional[OutputShape])


@dataclass
@dataclass(frozen=True)
class Shape(Generic[Inp, Out]):
input: Inp
output: Out
Expand Down
Loading

0 comments on commit dccbfed

Please sign in to comment.