Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-mccarthy committed Apr 21, 2022
1 parent 0e1abcf commit 231294c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion sdk/python/kfp/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
sys.exit(1)
4 changes: 2 additions & 2 deletions sdk/python/kfp/cli/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
26 changes: 13 additions & 13 deletions sdk/python/kfp/cli/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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'],
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/kfp/cli/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
# limitations under the License.
2 changes: 1 addition & 1 deletion sdk/python/kfp/cli/utils/aliased_plurals_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions sdk/python/kfp/cli/utils/aliased_plurals_group_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand All @@ -51,5 +51,5 @@ def test_aliases_failure(self):
result.output)


if __name__ == "__main__":
unittest.main()
if __name__ == '__main__':
unittest.main()

0 comments on commit 231294c

Please sign in to comment.