Skip to content

Commit e01bc0f

Browse files
committed
Fix Ruff rules
1 parent e438a8b commit e01bc0f

File tree

4 files changed

+9
-52
lines changed

4 files changed

+9
-52
lines changed

tfx/orchestration/portable/base_executor_operator.py

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323
from google.protobuf import message
2424

25-
class ParentBaseExecutorOperator(abc.ABC):
25+
26+
class BaseExecutorOperator(abc.ABC):
2627
"""The base class of all executor operators."""
2728

2829
SUPPORTED_EXECUTOR_SPEC_TYPE = abc_utils.abstract_property()
@@ -83,28 +84,6 @@ def with_execution_watcher(
8384
self._execution_watcher_address = execution_watcher_address
8485
return self
8586

86-
@abc.abstractmethod
87-
def handle_stop(self) -> None:
87+
def handle_stop(self) -> None:# noqa: B027
8888
"""Executor Operator specific logic to clean up after it is stopped."""
89-
pass
90-
91-
class BaseExecutorOperator(ParentBaseExecutorOperator):
92-
"""The child class for all abstract methods."""
93-
94-
def run_executor(
95-
self,
96-
execution_info: data_types.ExecutionInfo,
97-
) -> Optional[execution_result_pb2.ExecutorOutput]:
98-
"""Invokes the executor with inputs provided by the Launcher.
99-
100-
Args:
101-
execution_info: A wrapper of the info needed by this execution.
102-
103-
Returns:
104-
The output from executor.
105-
"""
106-
pass
107-
108-
def handle_stop(self) -> None:
109-
"""Executor Operator specific logic to clean up after it is stopped."""
110-
pass
89+
pass

tfx/tools/cli/handler/dag_runner_patcher.py

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
"""Base class to patch DagRunner classes in TFX CLI."""
15-
15+
#ruff: noqa: B027
1616
import abc
1717
import contextlib
1818
import functools
@@ -24,7 +24,7 @@
2424
from tfx.proto.orchestration import pipeline_pb2
2525

2626

27-
class ParentDagRunnerPatcher(abc.ABC):
27+
class DagRunnerPatcher(abc.ABC):
2828
"""Abstract base class for Patchers for various "DagRunner"s.
2929
3030
These patcher classes "decorate" the `run` function of the DagRunners.
@@ -56,13 +56,11 @@ def __init__(self, call_real_run=True):
5656
self._run_called = False
5757
self._call_real_run = call_real_run
5858

59-
@abc.abstractmethod
6059
def _before_run(self, runner: tfx_runner.TfxRunner,
6160
pipeline: Union[pipeline_pb2.Pipeline, tfx_pipeline.Pipeline],
6261
context: MutableMapping[str, Any]) -> None:
6362
pass
6463

65-
@abc.abstractmethod
6664
def _after_run(self, runner: tfx_runner.TfxRunner,
6765
pipeline: Union[pipeline_pb2.Pipeline, tfx_pipeline.Pipeline],
6866
context: MutableMapping[str, Any]) -> None:
@@ -136,22 +134,4 @@ def wrapper(*args, **kwargs):
136134
self._after_run(runner, pipeline, self._context)
137135
return result
138136

139-
return wrapper
140-
141-
class DagRunnerPatcher(ParentDagRunnerPatcher):
142-
"""The child class for all abstract methods."""
143-
144-
def _before_run(self, runner: tfx_runner.TfxRunner,
145-
pipeline: Union[pipeline_pb2.Pipeline, tfx_pipeline.Pipeline],
146-
context: MutableMapping[str, Any]) -> None:
147-
pass
148-
149-
def _after_run(self, runner: tfx_runner.TfxRunner,
150-
pipeline: Union[pipeline_pb2.Pipeline, tfx_pipeline.Pipeline],
151-
context: MutableMapping[str, Any]) -> None:
152-
pass
153-
154-
def get_runner_class(
155-
self
156-
) -> Union[Type[tfx_runner.TfxRunner], Type[portable_tfx_runner.TfxRunner]]:
157-
raise NotImplementedError()
137+
return wrapper

tfx/types/system_artifacts.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from ml_metadata.metadata_store import mlmd_types
2222

2323

24-
class SystemArtifact(abc.ABC):
24+
class SystemArtifact(abc.ABC):# noqa: B024
2525
"""TFX system artifact base class.
2626
2727
A user may create a subclass of SystemArtifact and override the
@@ -30,7 +30,6 @@ class SystemArtifact(abc.ABC):
3030
The subclasses, e.g, Dataset, Model, Statistics, e.t.c, match the MLMD types
3131
from third_party/ml_metadata/metadata_store/mlmd_types.py.
3232
"""
33-
# noqa: B024
3433
# MLMD system base type enum. Override it when creating subclasses.
3534
MLMD_SYSTEM_BASE_TYPE = None
3635

tfx/types/system_executions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from ml_metadata.metadata_store import mlmd_types
2222

2323

24-
class SystemExecution(abc.ABC):
24+
class SystemExecution(abc.ABC):# noqa: B024
2525
"""TFX system execution base class.
2626
2727
A user may create a subclass of SystemExecution and override the
@@ -30,7 +30,6 @@ class SystemExecution(abc.ABC):
3030
The subclasses, e.g, Train, Transform, Process, e.t.c, match the MLMD types
3131
from third_party/ml_metadata/metadata_store/mlmd_types.py.
3232
"""
33-
# noqa: B024
3433
# MLMD system base type enum. Override it when creating subclasses.
3534
MLMD_SYSTEM_BASE_TYPE = None
3635

0 commit comments

Comments
 (0)