Show More
@@ -1362,9 +1362,9 def match_dict_keys( | |||
|
1362 | 1362 | # All checks passed! |
|
1363 | 1363 | return True |
|
1364 | 1364 | |
|
1365 | filtered_key_is_final: Dict[Union[str, bytes, int, float], _DictKeyState] = ( | |
|
1366 | defaultdict(lambda: _DictKeyState.BASELINE) | |
|
1367 | ) | |
|
1365 | filtered_key_is_final: Dict[ | |
|
1366 | Union[str, bytes, int, float], _DictKeyState | |
|
1367 | ] = defaultdict(lambda: _DictKeyState.BASELINE) | |
|
1368 | 1368 | |
|
1369 | 1369 | for k in keys: |
|
1370 | 1370 | # If at least one of the matches is not final, mark as undetermined. |
@@ -44,17 +44,20 else: | |||
|
44 | 44 | |
|
45 | 45 | @undoc |
|
46 | 46 | class HasGetItem(Protocol): |
|
47 |
def __getitem__(self, key) -> None: |
|
|
47 | def __getitem__(self, key) -> None: | |
|
48 | ... | |
|
48 | 49 | |
|
49 | 50 | |
|
50 | 51 | @undoc |
|
51 | 52 | class InstancesHaveGetItem(Protocol): |
|
52 |
def __call__(self, *args, **kwargs) -> HasGetItem: |
|
|
53 | def __call__(self, *args, **kwargs) -> HasGetItem: | |
|
54 | ... | |
|
53 | 55 | |
|
54 | 56 | |
|
55 | 57 | @undoc |
|
56 | 58 | class HasGetAttr(Protocol): |
|
57 |
def __getattr__(self, key) -> None: |
|
|
59 | def __getattr__(self, key) -> None: | |
|
60 | ... | |
|
58 | 61 | |
|
59 | 62 | |
|
60 | 63 | @undoc |
@@ -326,9 +329,9 class EvaluationContext(NamedTuple): | |||
|
326 | 329 | #: Global namespace |
|
327 | 330 | globals: dict |
|
328 | 331 | #: Evaluation policy identifier |
|
329 | evaluation: Literal["forbidden", "minimal", "limited", "unsafe", "dangerous"] = ( | |
|
330 | "forbidden" | |
|
331 | ) | |
|
332 | evaluation: Literal[ | |
|
333 | "forbidden", "minimal", "limited", "unsafe", "dangerous" | |
|
334 | ] = "forbidden" | |
|
332 | 335 | #: Whether the evaluation of code takes place inside of a subscript. |
|
333 | 336 | #: Useful for evaluating ``:-1, 'col'`` in ``df[:-1, 'col']``. |
|
334 | 337 | in_subscript: bool = False |
@@ -535,7 +535,8 def test_custom_repr_namedtuple_partialmethod(): | |||
|
535 | 535 | from functools import partialmethod |
|
536 | 536 | from typing import NamedTuple |
|
537 | 537 | |
|
538 |
class Foo(NamedTuple): |
|
|
538 | class Foo(NamedTuple): | |
|
539 | ... | |
|
539 | 540 | |
|
540 | 541 | Foo.__repr__ = partialmethod(lambda obj: "Hello World") |
|
541 | 542 | foo = Foo() |
General Comments 0
You need to be logged in to leave comments.
Login now