Skip to content

Commit c216249

Browse files
generatedunixname89002005287564meta-codesync[bot]
authored andcommitted
cinderx [B] [A] [A]
Reviewed By: jbower-fb Differential Revision: D86987304 fbshipit-source-id: a6a5911b7edf457df0d5d60ca04cbaebb1241124
1 parent 457d085 commit c216249

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

cinderx/PythonLib/cinderx/compiler/strict/common.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
Try,
2727
)
2828
from collections import deque
29+
from collections.abc import Callable, Mapping, MutableMapping
2930
from contextlib import nullcontext
3031
from dataclasses import dataclass
3132
from symtable import Class, SymbolTable
32-
from typing import Callable, Dict, final, Generic, Mapping, MutableMapping, TypeVar
33+
from typing import final, Generic, TypeVar
3334

3435
from .runtime import freeze_type, mutable
3536

@@ -65,7 +66,7 @@ def make_fixed_modules() -> Mapping[str, Mapping[str, object]]:
6566
TVar = TypeVar("TScope")
6667
TScopeData = TypeVar("TData", covariant=True)
6768

68-
SymbolMap = Dict[AST, SymbolTable]
69+
SymbolMap = dict[AST, SymbolTable]
6970

7071

7172
@dataclass
@@ -106,15 +107,15 @@ def __init__(self, symbols: SymbolTable) -> None:
106107
self.symbol_stack: deque[SymbolTable] = deque([symbols])
107108
children = self.symbol_stack.popleft().get_children()
108109
self.symbol_stack.extendleft(
109-
(x for x in reversed(children) if not is_annotation(x))
110+
x for x in reversed(children) if not is_annotation(x)
110111
)
111112
self.mapping: SymbolMap = {}
112113

113114
def _process_scope_node(self, node: AST) -> None:
114115
current_symbol = self.mapping[node] = self.symbol_stack.popleft()
115116
children = current_symbol.get_children()
116117
self.symbol_stack.extendleft(
117-
(x for x in reversed(children) if not is_annotation(x))
118+
x for x in reversed(children) if not is_annotation(x)
118119
)
119120

120121
def visit_ClassDef(self, node: ClassDef) -> None:

cinderx/PythonLib/cinderx/compiler/unparse.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import ast
55
import sys
66
import warnings
7-
from typing import Any, Callable, Dict, List, Optional, Type
7+
from collections.abc import Callable
8+
from typing import Optional
89

910

1011
PR_TUPLE = 0
@@ -277,7 +278,7 @@ def _format_set(node: ast.Set, level: int) -> str:
277278
return "{" + ", ".join(to_expr(elt, PR_TEST) for elt in node.elts) + "}"
278279

279280

280-
def _format_comprehensions(nodes: List[ast.comprehension]) -> str:
281+
def _format_comprehensions(nodes: list[ast.comprehension]) -> str:
281282
return "".join(_format_comprehension(n) for n in nodes)
282283

283284

@@ -304,7 +305,7 @@ def _format_gen_exp(node: ast.GeneratorExp, level: int) -> str:
304305
return "(" + to_expr(node.elt) + _format_comprehensions(node.generators) + ")"
305306

306307

307-
def format_fstring_elt(res: List[str], elt: ast.expr, is_format_spec: bool) -> None:
308+
def format_fstring_elt(res: list[str], elt: ast.expr, is_format_spec: bool) -> None:
308309
if isinstance(elt, ast.Constant):
309310
res.append(elt.value)
310311
elif isinstance(elt, ast.JoinedStr):

0 commit comments

Comments
 (0)