Skip to content

Commit

Permalink
pyright 1.1.326 compatibility.
Browse files Browse the repository at this point in the history
This commit improves compatibility with the most recent stable release
of `pyright` (i.e., `pyright 1.1.326`). Assuming continuous integration
(CI) now passes, this constitutes the last commit of @beartype's 0.16.0
cycle. Let's go, bois! (*Incantation's cant of a significant signifier!*)
  • Loading branch information
leycec committed Sep 12, 2023
1 parent 77db610 commit fe0cda8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 5 additions & 7 deletions beartype/_check/forward/_fwdref.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ class _BeartypeForwardRefMeta(type):

# ....................{ DUNDERS }....................
def __getattr__( # type: ignore[misc]
cls: Type['_BeartypeForwardRefABC'], # pyright: ignore[reportGeneralTypeIssues]
hint_name: str,
) -> Type['_BeartypeForwardRefIndexableABC']:
cls, hint_name: str) -> Type['_BeartypeForwardRefIndexableABC']:
'''
**Fully-qualified forward reference subclass** (i.e.,
:class:`._BeartypeForwardRefABC` subclass whose metaclass is this
Expand Down Expand Up @@ -115,7 +113,9 @@ def __getattr__( # type: ignore[misc]
# Return a new fully-qualified forward reference subclass concatenated
# as described above.
return make_forwardref_indexable_subtype(
cls.__beartype_scope_name__, f'{cls.__beartype_name__}.{hint_name}')
cls.__beartype_scope_name__, # type: ignore[arg-type]
f'{cls.__beartype_name__}.{hint_name}',
)


def __instancecheck__( # type: ignore[misc]
Expand Down Expand Up @@ -394,9 +394,7 @@ def __class_getitem__(cls, *args, **kwargs) -> (
# ....................{ FACTORIES }....................
#FIXME: Unit test us up, please.
def make_forwardref_indexable_subtype(
scope_name: str,
hint_name: str,
) -> Type[_BeartypeForwardRefIndexableABC]:
scope_name: str, hint_name: str) -> Type[_BeartypeForwardRefIndexableABC]:
'''
Create and return a new **subscriptable forward reference subclass** (i.e.,
concrete subclass of the :class:`._BeartypeForwardRefIndexableABC`
Expand Down
2 changes: 2 additions & 0 deletions beartype_test/a00_unit/a40_api/door/_doorfixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ class MuhGenericTwoIntInt(MuhGenericTwo[int, int]):
(MuhNutherThing, MuhThingP, False),
(MuhThingP, MuhThing, False),

# ..................{ PEP 586 }..................
# PEP 586-compliant type hints.
(Literal[7], int, True),
(Literal["a"], str, True),
Expand All @@ -455,6 +456,7 @@ class MuhGenericTwoIntInt(MuhGenericTwo[int, int]):
(int, Literal[7], False),
(Literal[7, 8], Literal[7, 8, 9], True),

# ..................{ PEP 589 }..................
# PEP 589-compliant type hints.
(MuhDict, dict, True),
]
Expand Down

0 comments on commit fe0cda8

Please sign in to comment.