Fix type annotation and PEP8

This commit is contained in:
allegroai 2020-10-11 11:16:19 +03:00
parent f65e64aebe
commit 0eb1bb4492
2 changed files with 7 additions and 7 deletions

View File

@ -362,7 +362,7 @@ class PipelineController(object):
return True return True
def _verify_node(self, node): def _verify_node(self, node):
# type: (Node) -> bool # type: (PipelineController.Node) -> bool
""" """
Raise ValueError on verification errors Raise ValueError on verification errors
@ -407,7 +407,7 @@ class PipelineController(object):
return not bool(set(self._nodes.keys()) - visited) return not bool(set(self._nodes.keys()) - visited)
def _launch_node(self, node): def _launch_node(self, node):
# type: (Node) -> () # type: (PipelineController.Node) -> ()
""" """
Launch a single node (create and enqueue a TrainsJob) Launch a single node (create and enqueue a TrainsJob)
@ -618,7 +618,7 @@ class PipelineController(object):
pass pass
def __verify_step_reference(self, node, step_ref_string): def __verify_step_reference(self, node, step_ref_string):
# type: (Node, str) -> bool # type: (PipelineController.Node, str) -> bool
""" """
Verify the step reference. For example "${step1.parameters.Args/param}" Verify the step reference. For example "${step1.parameters.Args/param}"
:param Node node: calling reference node (used for logging) :param Node node: calling reference node (used for logging)

View File

@ -1329,19 +1329,19 @@ class PatchKerasModelIO(object):
if 'tensorflow' in sys.modules and not PatchKerasModelIO.__patched_tensorflow: if 'tensorflow' in sys.modules and not PatchKerasModelIO.__patched_tensorflow:
try: try:
# hack: make sure tensorflow.__init__ is called # hack: make sure tensorflow.__init__ is called
import tensorflow # noqa: F401 import tensorflow # noqa: F401, F811
from tensorflow.python.keras.engine.network import Network from tensorflow.python.keras.engine.network import Network
except ImportError: except ImportError:
Network = None Network = None
try: try:
# hack: make sure tensorflow.__init__ is called # hack: make sure tensorflow.__init__ is called
import tensorflow # noqa: F401 import tensorflow # noqa: F401, F811
from tensorflow.python.keras.engine.functional import Functional from tensorflow.python.keras.engine.functional import Functional
except ImportError: except ImportError:
Functional = None Functional = None
try: try:
# hack: make sure tensorflow.__init__ is called # hack: make sure tensorflow.__init__ is called
import tensorflow # noqa: F811 import tensorflow # noqa: F401, F811
from tensorflow.python.keras.engine.sequential import Sequential from tensorflow.python.keras.engine.sequential import Sequential
except ImportError: except ImportError:
Sequential = None Sequential = None
@ -1357,7 +1357,7 @@ class PatchKerasModelIO(object):
Network if PatchKerasModelIO.__patched_keras[0] != Network else None, Network if PatchKerasModelIO.__patched_keras[0] != Network else None,
Sequential if PatchKerasModelIO.__patched_keras[1] != Sequential else None, Sequential if PatchKerasModelIO.__patched_keras[1] != Sequential else None,
keras_saving if PatchKerasModelIO.__patched_keras[2] != keras_saving else None, keras_saving if PatchKerasModelIO.__patched_keras[2] != keras_saving else None,
Functional if PatchKerasModelIO.__patched_keras[3] != Functional else None,] Functional if PatchKerasModelIO.__patched_keras[3] != Functional else None, ]
else: else:
PatchKerasModelIO.__patched_tensorflow = [Network, Sequential, keras_saving, Functional] PatchKerasModelIO.__patched_tensorflow = [Network, Sequential, keras_saving, Functional]
PatchKerasModelIO._patch_io_calls(*PatchKerasModelIO.__patched_tensorflow) PatchKerasModelIO._patch_io_calls(*PatchKerasModelIO.__patched_tensorflow)