Skip to content

Commit 534dce8

Browse files
Fix Ruff rule A002
1 parent ecf3409 commit 534dce8

File tree

14 files changed

+23
-23
lines changed

14 files changed

+23
-23
lines changed

Diff for: tfx/dsl/compiler/node_inputs_compiler_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class DummyArtifact(types.Artifact):
4747

4848
class DummyNode(base_node.BaseNode):
4949

50-
def __init__(self, id: str, inputs=None, exec_properties=None): # pylint: disable=redefined-builtin
50+
def __init__(self, id: str, inputs=None, exec_properties=None): # noqa: A002
5151
super().__init__()
5252
self.with_id(id)
5353
self._inputs = inputs or {}

Diff for: tfx/dsl/components/base/base_component_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class _BasicComponent(base_component.BaseComponent):
6161
def __init__(self,
6262
spec: types.ComponentSpec = None,
6363
folds: int = None,
64-
input: types.Channel = None): # pylint: disable=redefined-builtin
64+
input: types.Channel = None): # noqa: A002
6565
if not spec:
6666
output = types.Channel(type=_OutputArtifact)
6767
spec = _BasicComponentSpec(folds=folds, input=input, output=output)

Diff for: tfx/dsl/components/base/base_node.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ def component_id(self) -> str:
126126

127127
@id.setter
128128
@doc_controls.do_not_doc_in_subclasses
129-
def id(self, id: str) -> None: # pylint: disable=redefined-builtin
129+
def id(self, id: str) -> None: # noqa: A002
130130
self._id = id
131131

132132
# TODO(kmonte): Update this to Self once we're on 3.11 everywhere
133133
@doc_controls.do_not_doc_in_subclasses
134-
def with_id(self, id: str) -> typing_extensions.Self: # pylint: disable=redefined-builtin
134+
def with_id(self, id: str) -> typing_extensions.Self: # noqa: A002
135135
self._id = id
136136
return self
137137

Diff for: tfx/dsl/input_resolution/canned_resolver_functions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ def pick(channel: channel_types.BaseChannel, i: int, /):
744744
return _slice(channel, start=i, stop=(i + 1) or None, min_count=1)
745745

746746

747-
def slice( # pylint: disable=redefined-builtin
747+
def slice( # noqa: A002
748748
channel: channel_types.BaseChannel,
749749
/,
750750
start: Optional[int] = None,

Diff for: tfx/dsl/input_resolution/ops/test_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class DummyArtifact(types.Artifact):
5151
'version': tfx_artifact.Property(type=tfx_artifact.PropertyType.INT),
5252
}
5353

54-
# pylint: disable=redefined-builtin
54+
# noqa: A002
5555
def __init__(
5656
self,
5757
id: Optional[str] = None,
@@ -149,7 +149,7 @@ class FakeComponent(base_component.BaseComponent):
149149

150150
DRIVER_CLASS = base_driver.BaseDriver
151151

152-
def __init__(self, id: str, inputs=None, exec_properties=None): # pylint: disable=redefined-builtin
152+
def __init__(self, id: str, inputs=None, exec_properties=None): # noqa: A002
153153
super().__init__(spec=FakeSpec())
154154
self.with_id(id)
155155

Diff for: tfx/dsl/input_resolution/resolver_op.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def my_resolver_stem(input_dict):
228228

229229
def __init__(
230230
self, *,
231-
type: Type[_T], # pylint: disable=redefined-builtin
231+
type: Type[_T], # noqa: A002
232232
default: Union[_T, _Empty] = _EMPTY):
233233
self._type = type
234234
self._required = default is _EMPTY

Diff for: tfx/dsl/io/fileio.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
from tfx.dsl.io.filesystem import PathType
2121

2222
# Import modules that may provide filesystem plugins.
23-
import tfx.dsl.io.plugins.tensorflow_gfile # pylint: disable=unused-import, g-import-not-at-top
24-
import tfx.dsl.io.plugins.local # pylint: disable=unused-import, g-import-not-at-top
23+
import tfx.dsl.io.plugins.tensorflow_gfile # noqa: F401, E402
24+
import tfx.dsl.io.plugins.local # noqa: F401, E402
2525

2626

2727
# Expose `NotFoundError` as `fileio.NotFoundError`.
@@ -33,7 +33,7 @@ def _get_filesystem(path) -> Type[filesystem.Filesystem]:
3333
.get_filesystem_for_path(path))
3434

3535

36-
def open(path: PathType, mode: str = 'r'): # pylint: disable=redefined-builtin
36+
def open(path: PathType, mode: str = 'r'): # noqa: A002
3737
"""Open a file at the given path."""
3838
return _get_filesystem(path).open(path, mode=mode)
3939

Diff for: tfx/dsl/placeholder/artifact_placeholder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
_types = placeholder_base.types
2424

2525

26-
def input(key: str) -> ArtifactPlaceholder: # pylint: disable=redefined-builtin
26+
def input(key: str) -> ArtifactPlaceholder: # noqa: A002
2727
"""Returns a Placeholder that represents an input artifact.
2828
2929
Args:

Diff for: tfx/orchestration/pipeline_test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class _FakeComponent(base_component.BaseComponent):
8585

8686
def __init__(
8787
self,
88-
type: Type[types.Artifact], # pylint: disable=redefined-builtin
88+
type: Type[types.Artifact], # noqa: A002
8989
spec_kwargs: Dict[str, Any]):
9090
spec = _FakeComponentSpec(output=types.Channel(type=type), **spec_kwargs)
9191
super().__init__(spec=spec)
@@ -98,7 +98,7 @@ class _FakeBeamComponent(base_beam_component.BaseBeamComponent):
9898

9999
def __init__(
100100
self,
101-
type: Type[types.Artifact], # pylint: disable=redefined-builtin
101+
type: Type[types.Artifact], # noqa: A002
102102
spec_kwargs: Dict[str, Any]):
103103
spec = _FakeComponentSpec(output=types.Channel(type=type), **spec_kwargs)
104104
super().__init__(spec=spec)

Diff for: tfx/types/artifact_property.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Property:
4949
PropertyType.BOOLEAN: metadata_store_pb2.BOOLEAN,
5050
}
5151

52-
def __init__(self, type): # pylint: disable=redefined-builtin
52+
def __init__(self, type): # noqa: A002
5353
if type not in Property._ALLOWED_MLMD_TYPES:
5454
raise ValueError('Property type must be one of %s.' %
5555
list(Property._ALLOWED_MLMD_TYPES.keys()))

Diff for: tfx/types/channel.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class BaseChannel(abc.ABC, Generic[_AT]):
123123
set.
124124
"""
125125

126-
def __init__(self, type: Type[_AT], is_optional: Optional[bool] = None): # pylint: disable=redefined-builtin
126+
def __init__(self, type: Type[_AT], is_optional: Optional[bool] = None): # noqa: A002
127127
if not _is_artifact_type(type):
128128
raise ValueError(
129129
'Argument "type" of BaseChannel constructor must be a subclass of '
@@ -155,11 +155,11 @@ def as_optional(self) -> typing_extensions.Self:
155155
return new_channel
156156

157157
@property
158-
def type(self) -> Type[_AT]: # pylint: disable=redefined-builtin
158+
def type(self) -> Type[_AT]: # noqa: A002
159159
return self._artifact_type
160160

161161
@type.setter
162-
def type(self, value: Type[_AT]): # pylint: disable=redefined-builtin
162+
def type(self, value: Type[_AT]): # noqa: A002
163163
self._set_type(value)
164164

165165
@doc_controls.do_not_generate_docs
@@ -235,7 +235,7 @@ class won't be removed in TFX 1.x due to backward compatibility guarantee
235235
# TODO(b/125348988): Add support for real Channel in addition to static ones.
236236
def __init__(
237237
self,
238-
type: Type[Artifact], # pylint: disable=redefined-builtin
238+
type: Type[Artifact], # noqa: A002
239239
additional_properties: Optional[Dict[str, Property]] = None,
240240
additional_custom_properties: Optional[Dict[str, Property]] = None,
241241
# TODO(b/161490287): deprecate static artifact.

Diff for: tfx/types/component_spec.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ class MyCustomComponentSpec(ComponentSpec):
340340
non-primitive types like lists) should be stored in its original form.
341341
"""
342342

343-
def __init__(self, type=None, optional=False, use_proto=False): # pylint: disable=redefined-builtin
343+
def __init__(self, type=None, optional=False, use_proto=False): # noqa: A002
344344
self.type = type
345345
self.optional = optional
346346
self.use_proto = use_proto
@@ -419,7 +419,7 @@ class MyCustomComponentSpec(ComponentSpec):
419419

420420
def __init__(
421421
self,
422-
type: Optional[Type[artifact.Artifact]] = None, # pylint: disable=redefined-builtin
422+
type: Optional[Type[artifact.Artifact]] = None, # noqa: A002
423423
optional: bool = False,
424424
allow_empty: Optional[bool] = None,
425425
is_async: bool = False,

Diff for: tfx/v1/dsl/io/fileio.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from tfx.dsl.io.fileio import makedirs
2323
from tfx.dsl.io.fileio import mkdir
2424
from tfx.dsl.io.fileio import NotFoundError
25-
from tfx.dsl.io.fileio import open # pylint: disable=redefined-builtin
25+
from tfx.dsl.io.fileio import open # noqa: A002
2626
from tfx.dsl.io.fileio import PathType
2727
from tfx.dsl.io.fileio import remove
2828
from tfx.dsl.io.fileio import rename

Diff for: tfx/v1/dsl/placeholders/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from tfx.dsl.placeholder.placeholder import exec_property
1818
from tfx.dsl.placeholder.placeholder import execution_invocation
19-
from tfx.dsl.placeholder.placeholder import input # pylint: disable=redefined-builtin
19+
from tfx.dsl.placeholder.placeholder import input # noqa: A002
2020
from tfx.dsl.placeholder.placeholder import output
2121

2222
__all__ = [

0 commit comments

Comments
 (0)