diff --git a/sdk/python/kfp/cli/__main__.py b/sdk/python/kfp/cli/__main__.py index 633f363eb50..83ed0882a73 100644 --- a/sdk/python/kfp/cli/__main__.py +++ b/sdk/python/kfp/cli/__main__.py @@ -25,4 +25,4 @@ def main(): cli.cli(obj={}, auto_envvar_prefix='KFP') except Exception as e: click.echo(str(e), err=True) - sys.exit(1) \ No newline at end of file + sys.exit(1) diff --git a/sdk/python/kfp/cli/cli_test.py b/sdk/python/kfp/cli/cli_test.py index 5eb0b91ffcc..aefd1d162b7 100644 --- a/sdk/python/kfp/cli/cli_test.py +++ b/sdk/python/kfp/cli/cli_test.py @@ -19,8 +19,8 @@ from click import testing -# Docker is an optional install, but we need the import to succeed for tests. -# So we patch it before importing kfp.cli.components. +# Docker is an optional install, but we need the import to succeed for tests, +# so we patch it before importing from kfp.cli try: import docker except ImportError: diff --git a/sdk/python/kfp/cli/component.py b/sdk/python/kfp/cli/component.py index 8eca50b1be1..7fb8774d8c2 100644 --- a/sdk/python/kfp/cli/component.py +++ b/sdk/python/kfp/cli/component.py @@ -330,38 +330,38 @@ def component(): @component.command() @click.argument( - "components_directory", + 'components_directory', type=pathlib.Path, ) @click.option( - "--component-filepattern", + '--component-filepattern', type=str, default='**/*.py', - help="Filepattern to use when searching for KFP components. The" - " default searches all Python files in the specified directory.") + help='Filepattern to use when searching for KFP components. The' + ' default searches all Python files in the specified directory.') @click.option( - "--engine", + '--engine', type=str, - default="docker", + default='docker', help="Engine to use to build the component's container.") @click.option( - "--kfp-package-path", + '--kfp-package-path', type=pathlib.Path, default=None, - help="A pip-installable path to the KFP package.") + help='A pip-installable path to the KFP package.') @click.option( - "--overwrite-dockerfile", + '--overwrite-dockerfile', type=bool, is_flag=True, default=False, - help="Set this to true to always generate a Dockerfile" - " as part of the build process") + help='Set this to true to always generate a Dockerfile' + ' as part of the build process') @click.option( - "--push-image/--no-push-image", + '--push-image/--no-push-image', type=bool, is_flag=True, default=True, - help="Push the built image to its remote repository.") + help='Push the built image to its remote repository.') def build(components_directory: pathlib.Path, component_filepattern: str, engine: str, kfp_package_path: Optional[pathlib.Path], overwrite_dockerfile: bool, push_image: bool): diff --git a/sdk/python/kfp/cli/components_test.py b/sdk/python/kfp/cli/component_test.py similarity index 98% rename from sdk/python/kfp/cli/components_test.py rename to sdk/python/kfp/cli/component_test.py index d596d5f3bee..54f89afe722 100644 --- a/sdk/python/kfp/cli/components_test.py +++ b/sdk/python/kfp/cli/component_test.py @@ -247,8 +247,8 @@ def testComponentFilepatternCanBeUsedToRestrictDiscovery(self): str(self._working_dir), '--component-filepattern=train/*' ], ) - print("OUTPUT", result.output) - print("DONE") + print('OUTPUT', result.output) + print('DONE') print(result.exc_info) import traceback traceback.print_tb(result.exc_info[2]) @@ -329,7 +329,7 @@ def testKanikoEngineIsNotSupported(self): func_name='train', target_image='custom-image') _write_components('components.py', component) with self.assertWarnsRegex(DeprecationWarning, - r"The --engine option is deprecated"): + r'The --engine option is deprecated'): result = self.runner.invoke( self.cli, ['build', str(self._working_dir), '--engine=kaniko'], @@ -344,7 +344,7 @@ def testCloudBuildEngineIsNotSupported(self): _write_components('components.py', component) with self.assertWarnsRegex(DeprecationWarning, - r"The --engine option is deprecated"): + r'The --engine option is deprecated'): result = self.runner.invoke( self.cli, ['build', diff --git a/sdk/python/kfp/cli/utils/__init__.py b/sdk/python/kfp/cli/utils/__init__.py index 45da0a9502d..94eae6abc61 100644 --- a/sdk/python/kfp/cli/utils/__init__.py +++ b/sdk/python/kfp/cli/utils/__init__.py @@ -10,4 +10,4 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. \ No newline at end of file +# limitations under the License. diff --git a/sdk/python/kfp/cli/utils/aliased_plurals_group.py b/sdk/python/kfp/cli/utils/aliased_plurals_group.py index d905bc23ed4..79631827de7 100644 --- a/sdk/python/kfp/cli/utils/aliased_plurals_group.py +++ b/sdk/python/kfp/cli/utils/aliased_plurals_group.py @@ -23,7 +23,7 @@ def get_command(self, ctx: click.Context, cmd_name: str) -> click.Command: regular = click.Group.get_command(self, ctx, cmd_name) if regular is not None: return regular - elif cmd_name.endswith("s"): + elif cmd_name.endswith('s'): singular = click.Group.get_command(self, ctx, cmd_name[:-1]) if singular is not None: return singular diff --git a/sdk/python/kfp/cli/utils/aliased_plurals_group_test.py b/sdk/python/kfp/cli/utils/aliased_plurals_group_test.py index d50aa93c96e..45cc054580a 100644 --- a/sdk/python/kfp/cli/utils/aliased_plurals_group_test.py +++ b/sdk/python/kfp/cli/utils/aliased_plurals_group_test.py @@ -37,12 +37,12 @@ def setUp(self): def test_aliases_default_success(self): result = self.runner.invoke(cli, ['command']) self.assertEqual(result.exit_code, 0) - self.assertEqual(result.output, "Called command.\n") + self.assertEqual(result.output, 'Called command.\n') def test_aliases_plural_success(self): result = self.runner.invoke(cli, ['commands']) self.assertEqual(result.exit_code, 0) - self.assertEqual(result.output, "Called command.\n") + self.assertEqual(result.output, 'Called command.\n') def test_aliases_failure(self): result = self.runner.invoke(cli, ['commandss']) @@ -51,5 +51,5 @@ def test_aliases_failure(self): result.output) -if __name__ == "__main__": - unittest.main() \ No newline at end of file +if __name__ == '__main__': + unittest.main()