Skip to content

Commit aa2cedb

Browse files
committed
some edits
1 parent 7c2c6dc commit aa2cedb

File tree

7 files changed

+13
-28
lines changed

7 files changed

+13
-28
lines changed

src/gt4py/cartesian/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
stencil_object,
3030
type_hints,
3131
)
32+
from .stencil_object import StencilObject
3233

3334

3435
__all__ = [
@@ -44,5 +45,5 @@
4445
"stencil_builder",
4546
"stencil_object",
4647
"type_hints",
48+
"StencilObject",
4749
]
48-
from .stencil_object import StencilObject

src/gt4py/cartesian/backend/pyext_builder.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def build_pybind_ext(
195195
libraries: Optional[List[str]] = None,
196196
extra_compile_args: Optional[Union[List[str], Dict[str, List[str]]]] = None,
197197
extra_link_args: Optional[List[str]] = None,
198-
build_ext_class: Type = None,
198+
build_ext_class: Optional[Type] = None,
199199
verbose: bool = False,
200200
clean: bool = False,
201201
) -> Tuple[str, str]:
@@ -213,7 +213,7 @@ def build_pybind_ext(
213213
libraries: Optional[List[str]] = None,
214214
extra_compile_args: Optional[Union[List[str], Dict[str, List[str]]]] = None,
215215
extra_link_args: Optional[List[str]] = None,
216-
build_ext_class: Type = None,
216+
build_ext_class: Optional[Type] = None,
217217
verbose: bool = False,
218218
clean: bool = False,
219219
) -> Tuple[str, str]:

src/gt4py/cartesian/frontend/nodes.py

-18
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,6 @@ class ScalarLiteral(Literal):
322322
loc = attribute(of=Location, optional=True)
323323

324324

325-
# @attribclass
326-
# class TupleLiteral(Node):
327-
# items = attribute(of=TupleOf[Expr])
328-
#
329-
# @property
330-
# def length(self):
331-
# return len(self.items)
332-
333-
334325
@attribclass
335326
class BuiltinLiteral(Literal):
336327
value = attribute(of=Builtin)
@@ -593,12 +584,6 @@ class Statement(Node):
593584
pass
594585

595586

596-
# @attribclass
597-
# class ExprStmt(Statement):
598-
# expr = attribute(of=Expr)
599-
# loc = attribute(of=Location, optional=True)
600-
601-
602587
class Decl(Statement):
603588
pass
604589

@@ -722,9 +707,6 @@ def is_single_index(self) -> bool:
722707
return self.start.level == self.end.level and self.start.offset == self.end.offset - 1
723708

724709
def disjoint_from(self, other: "AxisInterval") -> bool:
725-
# This made-up constant must be larger than any LevelMarker.offset used
726-
DOMAIN_SIZE: int = 1000
727-
728710
def get_offset(bound: AxisBound) -> int:
729711
return (
730712
0 + bound.offset if bound.level == LevelMarker.START else sys.maxsize + bound.offset

src/gt4py/cartesian/gtscript.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -674,14 +674,14 @@ def __getitem__(self, field_spec):
674674
data_dims = ()
675675

676676
if isinstance(field_spec, str) or not isinstance(field_spec, collections.abc.Collection):
677-
# Field[dtype]
677+
# Field[dtype] # noqa: ERA001 # commented-out code
678678
dtype = field_spec
679679
elif _FieldDescriptorMaker._is_axes_spec(field_spec[0]):
680-
# Field[axes, dtype]
680+
# Field[axes, dtype] # noqa: ERA001 # commented-out code
681681
assert len(field_spec) == 2
682682
axes, dtype = field_spec
683683
elif len(field_spec) == 2 and not _FieldDescriptorMaker._is_axes_spec(field_spec[1]):
684-
# Field[high_dimensional_dtype]
684+
# Field[high_dimensional_dtype] # noqa: ERA001 # commented-out code
685685
dtype = field_spec
686686
else:
687687
raise ValueError("Invalid field type descriptor")

src/gt4py/cartesian/utils/attrib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def attribute(of, optional=False, **kwargs):
223223
attr_type_hint = of.type_hint
224224

225225
elif isinstance(of, type):
226-
# assert of in (bool, float, str, int, enum.Enum)
226+
# assert of in (bool, float, str, int, enum.Enum) # noqa: ERA001 # commented-out code
227227
attr_validator = attr.validators.instance_of(of)
228228
attr_type_hint = of
229229

src/gt4py/next/embedded/operators.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ class ScanOperator(EmbeddedOperator[_R, _P]):
4242
init: core_defs.Scalar | tuple[core_defs.Scalar | tuple, ...]
4343
axis: common.Dimension
4444

45-
def __call__(
46-
self, *args: common.Field | core_defs.Scalar, **kwargs: common.Field | core_defs.Scalar
45+
def __call__( # type: ignore[override]
46+
self,
47+
*args: common.Field | core_defs.Scalar,
48+
**kwargs: common.Field | core_defs.Scalar, # type: ignore[override]
4749
) -> common.Field: # we cannot properly type annotate relative to self.fun
4850
scan_range = embedded_context.closure_column_range.get()
4951
assert self.axis == scan_range[0]

src/gt4py/next/iterator/transforms/inline_lambdas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def inline_lambda( # noqa: C901 # see todo above
8080
expr = node.fun.expr
8181
if clashes:
8282
# TODO(tehrengruber): find a better way of generating new symbols in `name_map` that don't collide with each other. E.g. this must still work:
83-
# (lambda arg, arg_: (lambda arg_: ...)(arg))(a, b) # noqa: E800
83+
# (lambda arg, arg_: (lambda arg_: ...)(arg))(a, b) # noqa: ERA001
8484
name_map: dict[ir.SymRef, str] = {}
8585

8686
def new_name(name):

0 commit comments

Comments
 (0)