Skip to content

Commit da93abd

Browse files
committed
More changes
1 parent a5d34e4 commit da93abd

File tree

5 files changed

+7
-15
lines changed

5 files changed

+7
-15
lines changed

src/basilisp/lang/compiler/generator.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
ast_AsyncFunctionDef,
104104
ast_ClassDef,
105105
ast_FunctionDef,
106-
ast_index,
107106
)
108107
from basilisp.lang.interfaces import IMeta, IRecord, ISeq, ISeqable, IType
109108
from basilisp.lang.runtime import CORE_NS
@@ -1985,7 +1984,7 @@ def fn(*args):
19851984
ret_ann_ast = (
19861985
ast.Subscript(
19871986
value=ast.Name(id=_UNION_ALIAS, ctx=ast.Load()),
1988-
slice=ast_index(ast.Tuple(elts=ret_ann_asts, ctx=ast.Load())),
1987+
slice=ast.Tuple(elts=ret_ann_asts, ctx=ast.Load()),
19891988
ctx=ast.Load(),
19901989
)
19911990
if ret_ann_asts

src/basilisp/lang/compiler/optimizer.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import Deque, Optional
77

88
from basilisp.lang.compiler.constants import OPERATOR_ALIAS
9-
from basilisp.lang.compiler.utils import ast_FunctionDef, ast_index
9+
from basilisp.lang.compiler.utils import ast_FunctionDef
1010

1111

1212
def _filter_dead_code(nodes: Iterable[ast.stmt]) -> list[ast.stmt]:
@@ -109,15 +109,13 @@ def _optimize_operator_call_attr( # pylint: disable=too-many-return-statements
109109
target, index = node.args
110110
assert len(node.args) == 2
111111
return ast.Delete(
112-
targets=[
113-
ast.Subscript(value=target, slice=ast_index(index), ctx=ast.Del())
114-
]
112+
targets=[ast.Subscript(value=target, slice=index, ctx=ast.Del())]
115113
)
116114

117115
if fn.attr == "getitem":
118116
target, index = node.args
119117
assert len(node.args) == 2
120-
return ast.Subscript(value=target, slice=ast_index(index), ctx=ast.Load())
118+
return ast.Subscript(value=target, slice=index, ctx=ast.Load())
121119

122120
return node
123121

src/basilisp/lang/compiler/utils.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
import sys
33
from functools import partial
44

5-
6-
def ast_index(v: ast.expr) -> ast.expr:
7-
return v
8-
9-
105
if sys.version_info >= (3, 12):
116
ast_AsyncFunctionDef = partial(ast.AsyncFunctionDef, type_params=[])
127
ast_ClassDef = partial(ast.ClassDef, type_params=[])
@@ -17,4 +12,4 @@ def ast_index(v: ast.expr) -> ast.expr:
1712
ast_FunctionDef = ast.FunctionDef
1813

1914

20-
__all__ = ("ast_ClassDef", "ast_FunctionDef", "ast_index")
15+
__all__ = ("ast_ClassDef", "ast_FunctionDef")

src/basilisp/lang/runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,7 @@ def wrap_class(cls: type):
21082108
continue
21092109

21102110
if is_abstract(interface):
2111-
interface_names: frozenset[str] = interface.__abstractmethods__
2111+
interface_names: frozenset[str] = interface.__abstractmethods__ # type: ignore[attr-definedm]
21122112
interface_property_names: frozenset[str] = frozenset(
21132113
method
21142114
for method in interface_names

src/basilisp/lang/vector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def cons_transient(self, *elems: T) -> "TransientVector[T]": # type: ignore[ove
5757
return self
5858

5959
def assoc_transient(self, *kvs: T) -> "TransientVector[T]":
60-
for i, v in cast("Sequence[Tuple[int, T]]", partition(kvs, 2)):
60+
for i, v in cast("Sequence[tuple[int, T]]", partition(kvs, 2)):
6161
self._inner.set(i, v)
6262
return self
6363

0 commit comments

Comments
 (0)