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