Skip to content

Commit

Permalink
Ignore mypy errors for click's shell_complete kwarg
Browse files Browse the repository at this point in the history
This is absent from click's type inline types somehow.
Refs pallets/click#2802
  • Loading branch information
craigds committed Nov 9, 2024
1 parent 22f7a0b commit c7f913e
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 19 deletions.
2 changes: 1 addition & 1 deletion kart/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def apply_patch(
"--ref",
default="HEAD",
help="Which ref to apply the patch onto.",
shell_complete=ref_completer,
shell_complete=ref_completer, # type: ignore[call-arg]
)
@click.option(
"--amend",
Expand Down
22 changes: 18 additions & 4 deletions kart/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@
multiple=True,
help="Request that a particular dataset *not* be checked out (one which is currently configured to be checked out)",
)
@click.argument("refish", default=None, required=False, shell_complete=ref_completer)
@click.argument(
"refish",
default=None,
required=False,
shell_complete=ref_completer, # type: ignore[call-arg]
)
def checkout(
ctx,
new_branch,
Expand Down Expand Up @@ -320,7 +325,12 @@ def git_refetch(repo, promisor_remote, spec):
help="If a local branch of given name doesn't exist, but a remote does, "
"this option guesses that the user wants to create a local to track the remote",
)
@click.argument("refish", default=None, required=False, shell_complete=ref_completer)
@click.argument(
"refish",
default=None,
required=False,
shell_complete=ref_completer, # type: ignore[call-arg]
)
def switch(ctx, create, force_create, discard_changes, do_guess, refish):
"""
Switch branches
Expand Down Expand Up @@ -475,7 +485,7 @@ def _is_in_branches(branch_name, branches):
"tag associated with it. "
),
default="HEAD",
shell_complete=ref_completer,
shell_complete=ref_completer, # type: ignore[call-arg]
)
@click.argument("filters", nargs=-1)
def restore(ctx, source, filters):
Expand Down Expand Up @@ -512,7 +522,11 @@ def restore(ctx, source, filters):
is_flag=True,
help="Discard local changes in working copy if necessary",
)
@click.argument("refish", default="HEAD", shell_complete=ref_completer)
@click.argument(
"refish",
default="HEAD",
shell_complete=ref_completer, # type: ignore[call-arg]
)
def reset(ctx, discard_changes, refish):
"""
Reset the branch head to point to a particular commit.
Expand Down
7 changes: 6 additions & 1 deletion kart/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ def data(ctx, **kwargs):
is_flag=True,
help="When set, outputs the dataset type and version. (This may become the default in a later version of Kart)",
)
@click.argument("refish", required=False, default="HEAD", shell_complete=ref_completer)
@click.argument(
"refish",
required=False,
default="HEAD",
shell_complete=ref_completer, # type: ignore[call-arg]
)
@click.pass_context
def data_ls(ctx, output_format, with_dataset_types, refish):
"""List all of the datasets in the Kart repository"""
Expand Down
2 changes: 1 addition & 1 deletion kart/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def feature_count_diff(
metavar="[REVISIONS] [--] [FILTERS]",
nargs=-1,
type=click.UNPROCESSED,
shell_complete=ref_or_repo_path_completer,
shell_complete=ref_or_repo_path_completer, # type: ignore[call-arg]
)
def diff(
ctx,
Expand Down
2 changes: 1 addition & 1 deletion kart/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"args",
nargs=-1,
metavar="DATASET [EXPORT_TYPE:]DESTINATION",
shell_complete=repo_path_completer,
shell_complete=repo_path_completer, # type: ignore[call-arg]
)
def export(ctx, args, **kwargs):
"""
Expand Down
2 changes: 1 addition & 1 deletion kart/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def list_import_formats(ctx):
"args",
nargs=-1,
metavar="SOURCE [[SOURCES...] or [DATASETS...]]",
shell_complete=file_path_completer,
shell_complete=file_path_completer, # type: ignore[call-arg]
)
def import_(ctx, args, **kwargs):
"""
Expand Down
2 changes: 1 addition & 1 deletion kart/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"--import",
"import_from",
help='Import a database (all tables): "FORMAT:PATH" eg. "GPKG:my.gpkg". Currently only tabular formats are supported.',
shell_complete=file_path_completer,
shell_complete=file_path_completer, # type: ignore[call-arg]
)
@click.option(
"--checkout/--no-checkout",
Expand Down
2 changes: 1 addition & 1 deletion kart/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def convert_user_patterns_to_raw_paths(paths, repo, commits):
"args",
metavar="[REVISIONS] [--] [FILTERS]",
nargs=-1,
shell_complete=ref_or_repo_path_completer,
shell_complete=ref_or_repo_path_completer, # type: ignore[call-arg]
)
def log(
ctx,
Expand Down
2 changes: 1 addition & 1 deletion kart/point_cloud/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"args",
nargs=-1,
metavar="SOURCE [SOURCES...]",
shell_complete=file_path_completer,
shell_complete=file_path_completer, # type: ignore[call-arg]
)
def point_cloud_import(
ctx,
Expand Down
6 changes: 5 additions & 1 deletion kart/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
)
@click.argument("repository", required=False, metavar="REMOTE")
@click.argument(
"refspecs", nargs=-1, required=False, metavar="REFISH", shell_complete=ref_completer
"refspecs",
nargs=-1,
required=False,
metavar="REFISH",
shell_complete=ref_completer, # type: ignore[call-arg]
)
@click.pass_context
def pull(ctx, ff, ff_only, launch_editor, do_progress, repository, refspecs):
Expand Down
2 changes: 1 addition & 1 deletion kart/raster/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"args",
nargs=-1,
metavar="SOURCE [SOURCES...]",
shell_complete=file_path_completer,
shell_complete=file_path_completer, # type: ignore[call-arg]
)
def raster_import(
ctx,
Expand Down
2 changes: 1 addition & 1 deletion kart/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def _fix_conflict_label(conflict_label):
"conflict_labels",
nargs=-1,
metavar="[CONFLICT_LABELS]",
shell_complete=conflict_completer,
shell_complete=conflict_completer, # type: ignore[call-arg]
)
def resolve(ctx, with_version, file_path, renumber, conflict_labels):
"""Resolve a merge conflict, using one of the conflicting versions, or with a user-supplied resolution."""
Expand Down
7 changes: 5 additions & 2 deletions kart/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
metavar="[REVISION] [--] [FILTERS]",
nargs=-1,
type=click.UNPROCESSED,
shell_complete=ref_or_repo_path_completer,
shell_complete=ref_or_repo_path_completer, # type: ignore[call-arg]
)
@click.option(
"--diff-format",
Expand Down Expand Up @@ -184,7 +184,10 @@ def show(
)
# NOTE: this is *required* for now.
# A future version might create patches from working-copy changes.
@click.argument("refish", shell_complete=ref_completer)
@click.argument(
"refish",
shell_complete=ref_completer, # type: ignore[call-arg]
)
def create_patch(
ctx,
*,
Expand Down
2 changes: 1 addition & 1 deletion kart/tabular/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def get_driver(destination_spec):
"args",
nargs=-1,
metavar="DATASET [EXPORT_TYPE:]DESTINATION",
shell_complete=repo_path_completer,
shell_complete=repo_path_completer, # type: ignore[call-arg]
)
def table_export(
ctx,
Expand Down
2 changes: 1 addition & 1 deletion kart/tabular/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def any_at_all(iterable):
"args",
nargs=-1,
metavar="SOURCE ([SOURCES...] or [TABLES...])",
shell_complete=file_path_completer,
shell_complete=file_path_completer, # type: ignore[call-arg]
)
def table_import(
ctx,
Expand Down

0 comments on commit c7f913e

Please sign in to comment.