8000 formatting · python/cpython@28be691 · GitHub
[go: up one dir, main page]

Skip to content

Commit 28be691

Browse files
committed
formatting
1 parent bf260fb commit 28be691

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

Lib/annotationlib.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,15 @@ def __init__(
9090
def __init_subclass__(cls, /, *args, **kwds):
9191
raise TypeError("Cannot subclass ForwardRef")
9292

93-
def evaluate(self, *, globals=None, locals=None, type_params=None, owner=None,
94-
format=Format.VALUE):
93+
def evaluate(
94+
self,
95+
*,
96+
globals=None,
97+
locals=None,
98+
type_params=None,
99+
owner=None,
100+
format=Format.VALUE,
101+
):
95102
"""Evaluate the forward reference and return the value.
96103
97104
If the forward reference cannot be evaluated, raise an exception.
@@ -182,8 +189,10 @@ def evaluate(self, *, globals=None, locals=None, type_params=None, owner=None,
182189
if not is_forwardref_format:
183190
raise
184191
new_locals = _StringifierDict(
185-
{**builtins.__dict__, **locals}, globals=globals, owner=owner,
186-
is_class=self.__forward_is_class__
192+
{**builtins.__dict__, **locals},
193+
globals=globals,
194+
owner=owner,
195+
is_class=self.__forward_is_class__,
187196
)
188197
try:
189198
result = eval(code, globals=globals, locals=new_locals)
@@ -650,8 +659,7 @@ def call_annotate_function(annotate, format, *, owner=None, _is_evaluate=False):
650659
raise ValueError(f"Invalid format: {format!r}")
651660

652661

653-
def _build_closure(annotate, owner, is_class, stringifier_dict, *,
654-
allow_evaluation):
662+
def _build_closure(annotate, owner, is_class, stringifier_dict, *, allow_evaluation):
655663
if not annotate.__closure__:
656664
return None
657665
freevars = annotate.__code__.co_freevars
@@ -789,7 +797,7 @@ def get_annotations(
789797
# But if we didn't get it, we use __annotations__ instead.
790798
ann = _get_dunder_annotations(obj)
791799
if ann is not None:
792-
return annotations_to_string(ann)
800+
return annotations_to_string(ann)
793801
case Format.VALUE_WITH_FAKE_GLOBALS:
794802
raise ValueError("The VALUE_WITH_FAKE_GLOBALS format is for internal use only")
795803
case _:

Lib/test/test_annotationlib.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,8 +1086,6 @@ def test_pep_695_generics_with_future_annotations_nested_in_function(self):
10861086
set(results.generic_func.__type_params__),
10871087
)
10881088

1089-
maxDiff = None
1090-
10911089
def test_partial_evaluation(self):
10921090
def f(
10931091
x: builtins.undef,

0 commit comments

Comments
 (0)
0