Skip to content

Commit 39cf9bf

Browse files
committed
Adjust positional only arguments for new mypy
1 parent 2e5b308 commit 39cf9bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+143
-101
lines changed

pulp_cli/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ def config() -> None:
218218
@click.pass_context
219219
def create(
220220
ctx: click.Context,
221+
/,
221222
interactive: bool,
222223
editor: bool,
223224
overwrite: bool,

pulpcore/cli/ansible/content.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
href_option,
1818
list_command,
1919
parse_size_callback,
20-
pass_entity_context,
20+
pass_content_context,
2121
pass_pulp_context,
2222
pulp_group,
2323
pulp_option,
@@ -68,7 +68,7 @@ def _content_callback(ctx: click.Context, param: click.Parameter, value: t.Any)
6868
)
6969
@pass_pulp_context
7070
@click.pass_context
71-
def content(ctx: click.Context, pulp_ctx: PulpCLIContext, content_type: str) -> None:
71+
def content(ctx: click.Context, pulp_ctx: PulpCLIContext, /, content_type: str) -> None:
7272
if content_type == "collection-version":
7373
ctx.obj = PulpAnsibleCollectionVersionContext(pulp_ctx)
7474
elif content_type == "role":
@@ -200,11 +200,12 @@ def content(ctx: click.Context, pulp_ctx: PulpCLIContext, content_type: str) ->
200200
allowed_with_contexts=signature_context,
201201
required=True,
202202
)
203-
@pass_entity_context
203+
@pass_content_context
204204
@pass_pulp_context
205205
def upload(
206206
pulp_ctx: PulpCLIContext,
207207
content_ctx: PulpContentContext,
208+
/,
208209
file: t.IO[bytes],
209210
**kwargs: t.Any,
210211
) -> None:

pulpcore/cli/ansible/distribution.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
)
5353
@pass_pulp_context
5454
@click.pass_context
55-
def distribution(ctx: click.Context, pulp_ctx: PulpContext, distribution_type: str) -> None:
55+
def distribution(ctx: click.Context, pulp_ctx: PulpContext, /, distribution_type: str) -> None:
5656
if distribution_type == "ansible":
5757
ctx.obj = PulpAnsibleDistributionContext(pulp_ctx)
5858
else:
@@ -106,6 +106,7 @@ def distribution(ctx: click.Context, pulp_ctx: PulpContext, distribution_type: s
106106
@pass_entity_context
107107
def update(
108108
distribution_ctx: PulpEntityContext,
109+
/,
109110
base_path: t.Optional[str],
110111
repository: EntityFieldDefinition,
111112
content_guard: EntityFieldDefinition,

pulpcore/cli/ansible/remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def yaml_callback(
5454
)
5555
@pass_pulp_context
5656
@click.pass_context
57-
def remote(ctx: click.Context, pulp_ctx: PulpCLIContext, remote_type: str) -> None:
57+
def remote(ctx: click.Context, pulp_ctx: PulpCLIContext, /, remote_type: str) -> None:
5858
if remote_type == "role":
5959
ctx.obj = PulpAnsibleRoleRemoteContext(pulp_ctx)
6060
elif remote_type == "collection":

pulpcore/cli/ansible/repository.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def _signing_service_callback(ctx: click.Context, param: click.Parameter, value:
9595
)
9696
@pass_pulp_context
9797
@click.pass_context
98-
def repository(ctx: click.Context, pulp_ctx: PulpCLIContext, repo_type: str) -> None:
98+
def repository(ctx: click.Context, pulp_ctx: PulpCLIContext, /, repo_type: str) -> None:
9999
if repo_type == "ansible":
100100
ctx.obj = PulpAnsibleRepositoryContext(pulp_ctx)
101101
else:
@@ -197,6 +197,7 @@ def repository(ctx: click.Context, pulp_ctx: PulpCLIContext, repo_type: str) ->
197197
@pass_repository_context
198198
def sync(
199199
repository_ctx: PulpRepositoryContext,
200+
/,
200201
remote: EntityFieldDefinition,
201202
) -> None:
202203
"""
@@ -230,6 +231,7 @@ def sync(
230231
@pass_repository_context
231232
def sign(
232233
repository_ctx: PulpRepositoryContext,
234+
/,
233235
signing_service: PulpSigningServiceContext,
234236
content_units: t.Optional[t.List[str]],
235237
) -> None:

pulpcore/cli/common/acs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def path() -> None:
5353
@acs_lookup_option
5454
@path_option
5555
@pass_acs_context
56-
def add(acs_ctx: PulpACSContext, paths: t.Iterable[str]) -> None:
56+
def add(acs_ctx: PulpACSContext, /, paths: t.Iterable[str]) -> None:
5757
"""Add path(s) to an existing ACS."""
5858
paths = set(paths)
5959
existing_paths = set(acs_ctx.entity["paths"])
@@ -72,7 +72,7 @@ def add(acs_ctx: PulpACSContext, paths: t.Iterable[str]) -> None:
7272
@acs_lookup_option
7373
@path_option
7474
@pass_acs_context
75-
def remove(acs_ctx: PulpACSContext, paths: t.Iterable[str]) -> None:
75+
def remove(acs_ctx: PulpACSContext, /, paths: t.Iterable[str]) -> None:
7676
"""Remove path(s) from an existing ACS."""
7777
paths = set(paths)
7878
existing_paths = set(acs_ctx.entity["paths"])
@@ -111,7 +111,7 @@ def remove(acs_ctx: PulpACSContext, paths: t.Iterable[str]) -> None:
111111
@name_option
112112
@pass_acs_context
113113
@pass_pulp_context
114-
def refresh(pulp_ctx: PulpCLIContext, acs_ctx: PulpACSContext) -> None:
114+
def refresh(pulp_ctx: PulpCLIContext, acs_ctx: PulpACSContext, /) -> None:
115115
acs_ctx.refresh()
116116

117117
return acs

pulpcore/cli/common/debug.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ def debug() -> None:
3636
@debug.command()
3737
@pass_pulp_context
3838
@click.pass_context
39-
def ipython(
40-
ctx: click.Context,
41-
pulp_ctx: PulpCLIContext,
42-
) -> None:
39+
def ipython(ctx: click.Context, pulp_ctx: PulpCLIContext, /) -> None:
4340
"""
4441
Drop into an interactive python shell.
4542
Prepopulated symbols:
@@ -68,6 +65,7 @@ def ipython(
6865
def has_cli_plugin(
6966
ctx: click.Context,
7067
pulp_ctx: PulpCLIContext,
68+
/,
7169
name: str,
7270
specifier: t.Optional[str],
7371
) -> None:
@@ -99,6 +97,7 @@ def has_cli_plugin(
9997
def has_plugin(
10098
ctx: click.Context,
10199
pulp_ctx: PulpCLIContext,
100+
/,
102101
name: str,
103102
specifier: t.Optional[str],
104103
) -> None:
@@ -117,7 +116,7 @@ def openapi_group() -> None:
117116

118117
@openapi_group.command()
119118
@pass_pulp_context
120-
def spec(pulp_ctx: PulpCLIContext) -> None:
119+
def spec(pulp_ctx: PulpCLIContext, /) -> None:
121120
"""
122121
Print the openapi schema of the server.
123122
"""
@@ -126,7 +125,7 @@ def spec(pulp_ctx: PulpCLIContext) -> None:
126125

127126
@openapi_group.command()
128127
@pass_pulp_context
129-
def info(pulp_ctx: PulpCLIContext) -> None:
128+
def info(pulp_ctx: PulpCLIContext, /) -> None:
130129
"""
131130
Print info block.
132131
"""
@@ -135,7 +134,7 @@ def info(pulp_ctx: PulpCLIContext) -> None:
135134

136135
@openapi_group.command()
137136
@pass_pulp_context
138-
def security_schemes(pulp_ctx: PulpCLIContext) -> None:
137+
def security_schemes(pulp_ctx: PulpCLIContext, /) -> None:
139138
"""
140139
Print info block.
141140
"""
@@ -145,7 +144,7 @@ def security_schemes(pulp_ctx: PulpCLIContext) -> None:
145144
@openapi_group.command()
146145
@click.option("--id", "operation_id", required=True, help=_("Operation ID in openapi schema"))
147146
@pass_pulp_context
148-
def operation(pulp_ctx: PulpCLIContext, operation_id: str) -> None:
147+
def operation(pulp_ctx: PulpCLIContext, /, operation_id: str) -> None:
149148
"""
150149
Print the spec of the operation.
151150
"""
@@ -167,7 +166,7 @@ def operation(pulp_ctx: PulpCLIContext, operation_id: str) -> None:
167166

168167
@openapi_group.command()
169168
@pass_pulp_context
170-
def operation_ids(pulp_ctx: PulpCLIContext) -> None:
169+
def operation_ids(pulp_ctx: PulpCLIContext, /) -> None:
171170
"""
172171
Print a list of available operation-ids.
173172
"""
@@ -182,6 +181,7 @@ def operation_ids(pulp_ctx: PulpCLIContext) -> None:
182181
@pass_pulp_context
183182
def call(
184183
pulp_ctx: PulpCLIContext,
184+
/,
185185
operation_id: str,
186186
parameters: t.Iterable[str],
187187
body: t.Any,
@@ -208,7 +208,7 @@ def call(
208208
"--name", "schema_name", required=True, help=_("Component schema name in openapi schema")
209209
)
210210
@pass_pulp_context
211-
def schema(pulp_ctx: PulpCLIContext, schema_name: str) -> None:
211+
def schema(pulp_ctx: PulpCLIContext, /, schema_name: str) -> None:
212212
"""
213213
Print the spec of the schema component.
214214
"""
@@ -223,7 +223,7 @@ def schema(pulp_ctx: PulpCLIContext, schema_name: str) -> None:
223223

224224
@openapi_group.command()
225225
@pass_pulp_context
226-
def schema_names(pulp_ctx: PulpCLIContext) -> None:
226+
def schema_names(pulp_ctx: PulpCLIContext, /) -> None:
227227
"""
228228
Print a list of available schema component names.
229229
"""

pulpcore/cli/common/generic.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,7 @@ def list_command(**kwargs: t.Any) -> click.Command:
13101310
def callback(
13111311
pulp_ctx: PulpCLIContext,
13121312
entity_ctx: PulpEntityContext,
1313+
/,
13131314
limit: int,
13141315
offset: int,
13151316
**kwargs: t.Any,
@@ -1342,7 +1343,7 @@ def show_command(**kwargs: t.Any) -> click.Command:
13421343
@pulp_command(**kwargs)
13431344
@pass_entity_context
13441345
@pass_pulp_context
1345-
def callback(pulp_ctx: PulpCLIContext, entity_ctx: PulpEntityContext) -> None:
1346+
def callback(pulp_ctx: PulpCLIContext, entity_ctx: PulpEntityContext, /) -> None:
13461347
"""
13471348
Show details of a {entity}.
13481349
"""
@@ -1368,7 +1369,9 @@ def create_command(**kwargs: t.Any) -> click.Command:
13681369
@pulp_command(**kwargs) # type: ignore [arg-type]
13691370
@pass_entity_context
13701371
@pass_pulp_context
1371-
def callback(pulp_ctx: PulpCLIContext, entity_ctx: PulpEntityContext, **kwargs: t.Any) -> None:
1372+
def callback(
1373+
pulp_ctx: PulpCLIContext, entity_ctx: PulpEntityContext, /, **kwargs: t.Any
1374+
) -> None:
13721375
"""
13731376
Create a {entity}.
13741377
"""
@@ -1398,7 +1401,9 @@ def update_command(**kwargs: t.Any) -> click.Command:
13981401
@pulp_command(**kwargs) # type: ignore [arg-type]
13991402
@pass_entity_context
14001403
@pass_pulp_context
1401-
def callback(pulp_ctx: PulpCLIContext, entity_ctx: PulpEntityContext, **kwargs: t.Any) -> None:
1404+
def callback(
1405+
pulp_ctx: PulpCLIContext, entity_ctx: PulpEntityContext, /, **kwargs: t.Any
1406+
) -> None:
14021407
"""
14031408
Update a {entity}.
14041409
"""
@@ -1419,7 +1424,7 @@ def destroy_command(**kwargs: t.Any) -> click.Command:
14191424

14201425
@pulp_command(**kwargs)
14211426
@pass_entity_context
1422-
def callback(entity_ctx: PulpEntityContext) -> None:
1427+
def callback(entity_ctx: PulpEntityContext, /) -> None:
14231428
"""
14241429
Destroy a {entity}.
14251430
"""
@@ -1447,10 +1452,7 @@ def version_command(**kwargs: t.Any) -> click.Command:
14471452
@pulp_group(**kwargs)
14481453
@pass_repository_context
14491454
@click.pass_context
1450-
def callback(
1451-
ctx: click.Context,
1452-
repository_ctx: PulpRepositoryContext,
1453-
) -> None:
1455+
def callback(ctx: click.Context, repository_ctx: PulpRepositoryContext, /) -> None:
14541456
ctx.obj = repository_ctx.get_version_context()
14551457

14561458
callback.add_command(list_command(decorators=decorators + [content_in_option]))
@@ -1467,6 +1469,7 @@ def callback(
14671469
def repair(
14681470
pulp_ctx: PulpCLIContext,
14691471
repository_version_ctx: PulpRepositoryVersionContext,
1472+
/,
14701473
) -> None:
14711474
result = repository_version_ctx.repair()
14721475
pulp_ctx.output_result(result)
@@ -1488,29 +1491,29 @@ def label_command(**kwargs: t.Any) -> click.Command:
14881491

14891492
@pulp_group(**kwargs)
14901493
@pass_pulp_context
1491-
def label_group(pulp_ctx: PulpCLIContext) -> None:
1494+
def label_group(pulp_ctx: PulpCLIContext, /) -> None:
14921495
for item in need_plugins:
14931496
pulp_ctx.needs_plugin(item)
14941497

14951498
@pulp_command(name="set", help=_("Add or update a label"))
14961499
@click.option("--key", required=True, help=_("Key of the label"))
14971500
@click.option("--value", required=True, help=_("Value of the label"))
14981501
@pass_entity_context
1499-
def label_set(entity_ctx: PulpEntityContext, key: str, value: str) -> None:
1502+
def label_set(entity_ctx: PulpEntityContext, /, key: str, value: str) -> None:
15001503
"""Add or update a label"""
15011504
entity_ctx.set_label(key, value)
15021505

15031506
@pulp_command(name="unset", help=_("Remove a label with a given key"))
15041507
@click.option("--key", required=True, help=_("Key of the label"))
15051508
@pass_entity_context
1506-
def label_unset(entity_ctx: PulpEntityContext, key: str) -> None:
1509+
def label_unset(entity_ctx: PulpEntityContext, /, key: str) -> None:
15071510
"""Remove a label with a given key"""
15081511
entity_ctx.unset_label(key)
15091512

15101513
@pulp_command(name="show", help=_("Show the value for a particular label key"))
15111514
@click.option("--key", required=True, help=_("Key of the label"))
15121515
@pass_entity_context
1513-
def label_show(entity_ctx: PulpEntityContext, key: str) -> None:
1516+
def label_show(entity_ctx: PulpEntityContext, /, key: str) -> None:
15141517
"""Show the value for a particular label key"""
15151518
click.echo(entity_ctx.show_label(key))
15161519

@@ -1541,14 +1544,14 @@ def role_group() -> None:
15411544
@pulp_command(help=_("List my permissions on this object."))
15421545
@pass_entity_context
15431546
@pass_pulp_context
1544-
def my_permissions(pulp_ctx: PulpCLIContext, entity_ctx: PulpEntityContext) -> None:
1547+
def my_permissions(pulp_ctx: PulpCLIContext, entity_ctx: PulpEntityContext, /) -> None:
15451548
result = entity_ctx.my_permissions()
15461549
pulp_ctx.output_result(result)
15471550

15481551
@pulp_command(name="list", help=_("List assigned object roles."))
15491552
@pass_entity_context
15501553
@pass_pulp_context
1551-
def role_list(pulp_ctx: PulpCLIContext, entity_ctx: PulpEntityContext) -> None:
1554+
def role_list(pulp_ctx: PulpCLIContext, entity_ctx: PulpEntityContext, /) -> None:
15521555
result = entity_ctx.list_roles()
15531556
pulp_ctx.output_result(result)
15541557

@@ -1561,6 +1564,7 @@ def role_list(pulp_ctx: PulpCLIContext, entity_ctx: PulpEntityContext) -> None:
15611564
def role_add(
15621565
pulp_ctx: PulpCLIContext,
15631566
entity_ctx: PulpEntityContext,
1567+
/,
15641568
role: str,
15651569
users: t.List[str],
15661570
groups: t.List[str],
@@ -1577,6 +1581,7 @@ def role_add(
15771581
def role_remove(
15781582
pulp_ctx: PulpCLIContext,
15791583
entity_ctx: PulpEntityContext,
1584+
/,
15801585
role: str,
15811586
users: t.List[str],
15821587
groups: t.List[str],
@@ -1617,6 +1622,7 @@ def version_callback(
16171622
def content_list(
16181623
content_ctx: PulpContentContext,
16191624
pulp_ctx: PulpCLIContext,
1625+
/,
16201626
version: PulpRepositoryVersionContext,
16211627
offset: int,
16221628
limit: int,
@@ -1635,6 +1641,7 @@ def content_list(
16351641
@pass_content_context
16361642
def content_add(
16371643
content_ctx: PulpContentContext,
1644+
/,
16381645
base_version: PulpRepositoryVersionContext,
16391646
) -> None:
16401647
repo_ctx = base_version.repository_ctx
@@ -1647,6 +1654,7 @@ def content_add(
16471654
@pass_content_context
16481655
def content_remove(
16491656
content_ctx: PulpContentContext,
1657+
/,
16501658
base_version: PulpRepositoryVersionContext,
16511659
all: bool,
16521660
) -> None:

pulpcore/cli/container/content.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _content_callback(ctx: click.Context, param: click.Parameter, value: t.Any)
4343
)
4444
@pass_pulp_context
4545
@click.pass_context
46-
def content(ctx: click.Context, pulp_ctx: PulpCLIContext, content_type: str) -> None:
46+
def content(ctx: click.Context, pulp_ctx: PulpCLIContext, /, content_type: str) -> None:
4747
if content_type == "manifest":
4848
ctx.obj = PulpContainerManifestContext(pulp_ctx)
4949
elif content_type == "tag":

0 commit comments

Comments
 (0)