Skip to content

Commit

Permalink
Merge pull request #975 from planetlabs/click-typing-update
Browse files Browse the repository at this point in the history
Ignore type errors involving click decorators
  • Loading branch information
sgillies authored Jul 7, 2023
2 parents a3b27c1 + a623948 commit 4ad5a45
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 42 deletions.
8 changes: 4 additions & 4 deletions planet/cli/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
LOGGER = logging.getLogger(__name__)


@click.group()
@click.group() # type: ignore
@click.pass_context
@click.option('-u',
'--base-url',
Expand All @@ -35,7 +35,7 @@ def auth(ctx, base_url):
ctx.obj['BASE_URL'] = base_url


@auth.command()
@auth.command() # type: ignore
@click.pass_context
@translate_exceptions
@click.option(
Expand All @@ -58,14 +58,14 @@ def init(ctx, email, password):
click.echo(f'export {ENV_API_KEY}=$(planet auth value)')


@auth.command()
@auth.command() # type: ignore
@translate_exceptions
def value():
"""Print the stored authentication information"""
click.echo(planet.Auth.from_file().value)


@auth.command()
@auth.command() # type: ignore
@translate_exceptions
@click.argument('key')
def store(key):
Expand Down
12 changes: 6 additions & 6 deletions planet/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
LOGGER = logging.getLogger(__name__)


@click.group()
@click.group() # type: ignore
@click.pass_context
@click.option('--quiet',
is_flag=True,
Expand Down Expand Up @@ -73,8 +73,8 @@ def _configure_logging(verbosity):
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')


main.add_command(auth.auth)
main.add_command(data.data)
main.add_command(orders.orders)
main.add_command(subscriptions.subscriptions)
main.add_command(collect.collect)
main.add_command(auth.auth) # type: ignore
main.add_command(data.data) # type: ignore
main.add_command(orders.orders) # type: ignore
main.add_command(subscriptions.subscriptions) # type: ignore
main.add_command(collect.collect) # type: ignore
26 changes: 13 additions & 13 deletions planet/cli/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async def data_client(ctx):
yield cl


@click.group()
@click.group() # type: ignore
@click.pass_context
@click.option('-u',
'--base-url',
Expand Down Expand Up @@ -149,7 +149,7 @@ def _func(obj):
return [_func(v) for v in values] if values else None


@data.command()
@data.command() # type: ignore
@click.pass_context
@translate_exceptions
@click.option('--asset',
Expand Down Expand Up @@ -274,7 +274,7 @@ def filter(ctx,
echo_json(filt, pretty)


@data.command(epilog=valid_item_string)
@data.command(epilog=valid_item_string) # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand Down Expand Up @@ -318,7 +318,7 @@ async def search(ctx, item_types, filter, limit, name, sort, pretty):
echo_json(item, pretty)


@data.command(epilog=valid_item_string)
@data.command(epilog=valid_item_string) # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand Down Expand Up @@ -355,7 +355,7 @@ async def search_create(ctx, item_types, filter, name, daily_email, pretty):
echo_json(items, pretty)


@data.command()
@data.command() # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand Down Expand Up @@ -384,7 +384,7 @@ async def search_list(ctx, sort, search_type, limit, pretty):
echo_json(item, pretty)


@data.command()
@data.command() # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand All @@ -407,7 +407,7 @@ async def search_run(ctx, search_id, sort, limit, pretty):
echo_json(item, pretty)


@data.command(epilog=valid_item_string)
@data.command(epilog=valid_item_string) # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand Down Expand Up @@ -438,7 +438,7 @@ async def stats(ctx, item_types, filter, interval):
echo_json(items)


@data.command()
@data.command() # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand All @@ -455,7 +455,7 @@ async def search_get(ctx, search_id, pretty):
echo_json(items, pretty)


@data.command()
@data.command() # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand All @@ -467,7 +467,7 @@ async def search_delete(ctx, search_id):
await cl.delete_search(search_id)


@data.command(epilog=valid_item_string)
@data.command(epilog=valid_item_string) # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand Down Expand Up @@ -510,7 +510,7 @@ async def search_update(ctx,
echo_json(items, pretty)


@data.command(epilog=valid_item_string)
@data.command(epilog=valid_item_string) # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand Down Expand Up @@ -572,7 +572,7 @@ async def asset_download(ctx,
cl.validate_checksum(asset, path)


@data.command(epilog=valid_item_string)
@data.command(epilog=valid_item_string) # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand All @@ -586,7 +586,7 @@ async def asset_activate(ctx, item_type, item_id, asset_type):
await cl.activate_asset(asset)


@data.command(epilog=valid_item_string)
@data.command(epilog=valid_item_string) # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand Down
5 changes: 3 additions & 2 deletions planet/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
default=100,
show_default=True,
help="""Maximum number of results to return. When set to 0, no maximum is
applied.""")
applied.""") # type: ignore

pretty = click.option('--pretty', is_flag=True, help='Format JSON output.')
pretty = click.option('--pretty', is_flag=True,
help='Format JSON output.') # type: ignore
16 changes: 8 additions & 8 deletions planet/cli/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def orders_client(ctx):
yield cl


@click.group()
@click.group() # type: ignore
@click.pass_context
@click.option('-u',
'--base-url',
Expand All @@ -48,7 +48,7 @@ def orders(ctx, base_url):
ctx.obj['BASE_URL'] = base_url


@orders.command()
@orders.command() # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand All @@ -72,7 +72,7 @@ async def list(ctx, state, limit, pretty):
echo_json(o, pretty)


@orders.command()
@orders.command() # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand All @@ -89,7 +89,7 @@ async def get(ctx, order_id, pretty):
echo_json(order, pretty)


@orders.command()
@orders.command() # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand All @@ -106,7 +106,7 @@ async def cancel(ctx, order_id):
click.echo(json_resp)


@orders.command()
@orders.command() # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand Down Expand Up @@ -158,7 +158,7 @@ async def wait(ctx, order_id, delay, max_attempts, state):
click.echo(state)


@orders.command()
@orders.command() # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand Down Expand Up @@ -200,7 +200,7 @@ async def download(ctx, order_id, overwrite, directory, checksum):
cl.validate_checksum(Path(directory, str(order_id)), checksum)


@orders.command()
@orders.command() # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand All @@ -221,7 +221,7 @@ async def create(ctx, request: str, pretty):
echo_json(order, pretty)


@orders.command()
@orders.command() # type: ignore
@click.pass_context
@translate_exceptions
@coro
Expand Down
18 changes: 9 additions & 9 deletions planet/cli/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def subscriptions_client(ctx):
yield cl


@click.group()
@click.group() # type: ignore
@click.pass_context
@click.option('-u',
'--base-url',
Expand All @@ -60,7 +60,7 @@ def subscriptions(ctx, base_url):
# We want our command to be known as "list" on the command line but
# don't want to clobber Python's built-in "list". We'll define the
# command function as "list_subscriptions".
@subscriptions.command(name="list")
@subscriptions.command(name="list") # type: ignore
@pretty
@click.option(
'--status',
Expand All @@ -87,7 +87,7 @@ async def list_subscriptions_cmd(ctx, status, limit, pretty):
echo_json(sub, pretty)


@subscriptions.command(name='create')
@subscriptions.command(name='create') # type: ignore
@click.argument('request', type=types.JSON())
@pretty
@click.pass_context
Expand All @@ -107,7 +107,7 @@ async def create_subscription_cmd(ctx, request, pretty):
echo_json(sub, pretty)


@subscriptions.command(name='cancel')
@subscriptions.command(name='cancel') # type: ignore
@click.argument('subscription_id')
@pretty
@click.pass_context
Expand All @@ -119,7 +119,7 @@ async def cancel_subscription_cmd(ctx, subscription_id, pretty):
_ = await client.cancel_subscription(subscription_id)


@subscriptions.command(name='update')
@subscriptions.command(name='update') # type: ignore
@click.argument('subscription_id')
@click.argument('request', type=types.JSON())
@pretty
Expand All @@ -140,7 +140,7 @@ async def update_subscription_cmd(ctx, subscription_id, request, pretty):
echo_json(sub, pretty)


@subscriptions.command(name='get')
@subscriptions.command(name='get') # type: ignore
@click.argument('subscription_id')
@pretty
@click.pass_context
Expand All @@ -153,7 +153,7 @@ async def get_subscription_cmd(ctx, subscription_id, pretty):
echo_json(sub, pretty)


@subscriptions.command(name='results')
@subscriptions.command(name='results') # type: ignore
@click.argument('subscription_id')
@pretty
@click.option(
Expand Down Expand Up @@ -187,7 +187,7 @@ async def list_subscription_results_cmd(ctx,
echo_json(result, pretty)


@subscriptions.command()
@subscriptions.command() # type: ignore
@translate_exceptions
@click.option('--name',
required=True,
Expand Down Expand Up @@ -220,7 +220,7 @@ def request(name, source, delivery, notifications, tools, pretty):
echo_json(res, pretty)


@subscriptions.command(epilog=valid_item_string)
@subscriptions.command(epilog=valid_item_string) # type: ignore
@translate_exceptions
@click.option('--item-types',
required=True,
Expand Down

0 comments on commit 4ad5a45

Please sign in to comment.