Skip to content

Black #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 14, 2022
Merged

Black #145

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/autotests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ env:
TEST_API_USERNAME2: test_plugin2
TEST_API_PASSWORD2: ${{ secrets.MERGINTEST_API_PASSWORD2 }}

concurrency:
group: ci-${{github.ref}}-autotests
cancel-in-progress: true

jobs:
tests:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code_style.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Code Style

on: [push, pull_request]
on: [push]

jobs:
code_style_python:
Expand Down
49 changes: 25 additions & 24 deletions mergin/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@
download_project_finalize,
download_project_is_running,
)
from mergin.client_pull import pull_project_async, pull_project_is_running, pull_project_finalize, \
pull_project_cancel
from mergin.client_push import push_project_async, push_project_is_running, push_project_finalize, \
push_project_cancel
from mergin.client_pull import pull_project_async, pull_project_is_running, pull_project_finalize, pull_project_cancel
from mergin.client_push import push_project_async, push_project_is_running, push_project_finalize, push_project_cancel


from pygeodiff import GeoDiff
Expand Down Expand Up @@ -143,7 +141,9 @@ def _print_unhandled_exception():
click.echo(line)


@click.group(epilog=f"Copyright (C) 2019-2021 Lutra Consulting\n\n(mergin-py-client v{__version__} / pygeodiff v{GeoDiff().version()})")
@click.group(
epilog=f"Copyright (C) 2019-2021 Lutra Consulting\n\n(mergin-py-client v{__version__} / pygeodiff v{GeoDiff().version()})"
)
@click.option(
"--url",
envvar="MERGIN_URL",
Expand Down Expand Up @@ -183,9 +183,12 @@ def login(ctx):
@cli.command()
@click.argument("project")
@click.option("--public", is_flag=True, default=False, help="Public project, visible to everyone")
@click.option("--from-dir", default=None,
help="Content of the directory will be uploaded to the newly created project. "
"The directory will get assigned to the project.")
@click.option(
"--from-dir",
default=None,
help="Content of the directory will be uploaded to the newly created project. "
"The directory will get assigned to the project.",
)
@click.pass_context
def create(ctx, project, public, from_dir):
"""Create a new project on Mergin Maps server. `project` needs to be a combination of namespace/project."""
Expand Down Expand Up @@ -234,29 +237,24 @@ def create(ctx, project, public, from_dir):
@click.option(
"--order_params",
help="optional attributes for sorting the list. "
"It should be a comma separated attribute names "
"with _asc or _desc appended for sorting direction. "
"For example: \"namespace_asc,disk_usage_desc\". "
"Available attrs: namespace, name, created, updated, disk_usage, creator",
"It should be a comma separated attribute names "
"with _asc or _desc appended for sorting direction. "
'For example: "namespace_asc,disk_usage_desc". '
"Available attrs: namespace, name, created, updated, disk_usage, creator",
)
@click.pass_context
def list_projects(ctx, flag, name, namespace, order_params):
"""List projects on the server."""
filter_str = "(filter flag={})".format(flag) if flag is not None else "(all public)"

click.echo("List of projects {}:".format(filter_str))

mc = ctx.obj["client"]
if mc is None:
return

projects_list = mc.projects_list(
flag=flag,
name=name,
namespace=namespace,
order_params=order_params
)

projects_list = mc.projects_list(flag=flag, name=name, namespace=namespace, order_params=order_params)

click.echo("Fetched {} projects .".format(len(projects_list)))
for project in projects_list:
full_name = "{} / {}".format(project["namespace"], project["name"])
Expand Down Expand Up @@ -401,9 +399,12 @@ def status(ctx):
return

if mc.has_unfinished_pull(os.getcwd()):
click.secho("The previous pull has not finished completely: status "
"of some files may be reported incorrectly. Use "
"resolve_unfinished_pull command to try to fix that.", fg="yellow")
click.secho(
"The previous pull has not finished completely: status "
"of some files may be reported incorrectly. Use "
"resolve_unfinished_pull command to try to fix that.",
fg="yellow",
)

click.secho("### Server changes:", fg="magenta")
pretty_diff(pull_changes)
Expand Down Expand Up @@ -526,7 +527,7 @@ def show_file_history(ctx, path):
@click.argument("version")
@click.pass_context
def show_file_changeset(ctx, path, version):
""" Displays information about project changes."""
"""Displays information about project changes."""
mc = ctx.obj["client"]
if mc is None:
return
Expand Down
Loading