Skip to content

Commit 41f1b12

Browse files
authored
Remove self type (#474)
1 parent 7f98ffa commit 41f1b12

File tree

6 files changed

+23
-24
lines changed

6 files changed

+23
-24
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ repos:
6868
- id: tox-ini-fmt
6969

7070
- repo: https://github.com/astral-sh/ruff-pre-commit
71-
rev: v0.7.2
71+
rev: v0.7.3
7272
hooks:
7373
- id: ruff
7474
args:
@@ -84,7 +84,7 @@ repos:
8484
- id: black
8585

8686
- repo: https://github.com/streetsidesoftware/cspell-cli
87-
rev: v8.15.2
87+
rev: v8.16.0
8888
hooks:
8989
- id: cspell
9090
name: Spell check with cspell

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,8 @@ external = [
347347
"DOC" # pydoclint
348348
]
349349
ignore = [
350-
# incompatible with ruff formatter
351-
"COM812", # missing-space-after-comma
352-
"ISC001" # implicit-str-concat
350+
"COM812", # conflicts with ISC001 on format
351+
"ISC001" # conflicts with COM812 on format
353352
]
354353
select = ["ALL"]
355354

src/ansible_dev_tools/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
class Cli:
1919
"""The Cli class."""
2020

21-
def __init__(self: Cli) -> None:
21+
def __init__(self) -> None:
2222
"""Initialize the CLI and parse CLI args."""
2323
self.args: dict[str, Any]
2424

25-
def parse_args(self: Cli) -> None:
25+
def parse_args(self) -> None:
2626
"""Parse the command line arguments."""
2727
self.args = vars(parse())
2828

29-
def _run_subcommand(self: Cli, subcommand: str) -> None:
29+
def _run_subcommand(self, subcommand: str) -> None:
3030
"""Run the subcommand.
3131
3232
Args:
@@ -37,7 +37,7 @@ def _run_subcommand(self: Cli, subcommand: str) -> None:
3737
subcommand_cls = getattr(import_module(subcommand_module), subcommand_cls_name)
3838
subcommand_cls(**self.args).run()
3939

40-
def run(self: Cli) -> None:
40+
def run(self) -> None:
4141
"""Dispatch work to correct subcommand class."""
4242
subcommand = self.args.pop("subcommand")
4343
if subcommand == "server":

src/ansible_dev_tools/resources/server/creator_v1.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def create_tar_file(init_path: Path, tar_file: Path) -> None:
3232
class CreatorFrontendV1:
3333
"""The creator frontend, handles requests from users."""
3434

35-
def _response_from_tar(self: CreatorFrontendV1, tar_file: Path) -> FileResponse:
35+
def _response_from_tar(self, tar_file: Path) -> FileResponse:
3636
"""Create a FileResponse from a tar file.
3737
3838
Args:
@@ -51,7 +51,7 @@ def _response_from_tar(self: CreatorFrontendV1, tar_file: Path) -> FileResponse:
5151
return response
5252

5353
def playbook(
54-
self: CreatorFrontendV1,
54+
self,
5555
request: HttpRequest,
5656
) -> FileResponse | HttpResponse:
5757
"""Create a new playbook project.
@@ -78,7 +78,7 @@ def playbook(
7878
)
7979

8080
def collection(
81-
self: CreatorFrontendV1,
81+
self,
8282
request: HttpRequest,
8383
) -> FileResponse | HttpResponse:
8484
"""Create a new collection project.
@@ -108,7 +108,7 @@ def collection(
108108
class CreatorOutput(Output):
109109
"""The creator output."""
110110

111-
def __init__(self: CreatorOutput, log_file: str) -> None:
111+
def __init__(self, log_file: str) -> None:
112112
"""Initialize the creator output.
113113
114114
Convenience class to consistently define output with a changing temporary directory.
@@ -128,15 +128,15 @@ def __init__(self: CreatorOutput, log_file: str) -> None:
128128
class CreatorBackend:
129129
"""The creator wrapper, handles interaction with the python creator project."""
130130

131-
def __init__(self: CreatorBackend, tmp_dir: Path) -> None:
131+
def __init__(self, tmp_dir: Path) -> None:
132132
"""Initialize the creator.
133133
134134
Args:
135135
tmp_dir: The temporary directory.
136136
"""
137137
self.tmp_dir = tmp_dir
138138

139-
def collection(self: CreatorBackend, collection: str, project: str) -> Path:
139+
def collection(self, collection: str, project: str) -> Path:
140140
"""Scaffold a collection.
141141
142142
Args:

src/ansible_dev_tools/resources/server/creator_v2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def create_tar_file(init_path: Path, tar_file: Path) -> None:
3232
class CreatorFrontendV2:
3333
"""The creator frontend, handles requests from users."""
3434

35-
def _response_from_tar(self: CreatorFrontendV2, tar_file: Path) -> FileResponse:
35+
def _response_from_tar(self, tar_file: Path) -> FileResponse:
3636
"""Create a FileResponse from a tar file.
3737
3838
Args:
@@ -108,7 +108,7 @@ def collection(
108108
class CreatorOutput(Output):
109109
"""The creator output."""
110110

111-
def __init__(self: CreatorOutput, log_file: str) -> None:
111+
def __init__(self, log_file: str) -> None:
112112
"""Initialize the creator output.
113113
114114
Convenience class to consistently define output with a changing temporary directory.
@@ -128,15 +128,15 @@ def __init__(self: CreatorOutput, log_file: str) -> None:
128128
class CreatorBackend:
129129
"""The creator wrapper, handles interaction with the python creator project."""
130130

131-
def __init__(self: CreatorBackend, tmp_dir: Path) -> None:
131+
def __init__(self, tmp_dir: Path) -> None:
132132
"""Initialize the creator.
133133
134134
Args:
135135
tmp_dir: The temporary directory.
136136
"""
137137
self.tmp_dir = tmp_dir
138138

139-
def collection(self: CreatorBackend, collection: str, project: str) -> Path:
139+
def collection(self, collection: str, project: str) -> Path:
140140
"""Scaffold a collection.
141141
142142
Args:

src/ansible_dev_tools/subcommands/server.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class AdtServerApp(BaseApplication): # type: ignore[misc]
3232
"""Custom application to integrate Gunicorn with the django WSGI app."""
3333

3434
# pylint: disable=abstract-method
35-
def __init__(self: AdtServerApp, app: WSGIHandler, options: dict[str, str]) -> None:
35+
def __init__(self, app: WSGIHandler, options: dict[str, str]) -> None:
3636
"""Initialize the application.
3737
3838
Args:
@@ -43,7 +43,7 @@ def __init__(self: AdtServerApp, app: WSGIHandler, options: dict[str, str]) -> N
4343
self.application = app
4444
super().__init__()
4545

46-
def load_config(self: AdtServerApp) -> None:
46+
def load_config(self) -> None:
4747
"""Load configuration for gunicorn."""
4848
config = {
4949
key: value
@@ -53,7 +53,7 @@ def load_config(self: AdtServerApp) -> None:
5353
for key, value in config.items():
5454
self.cfg.set(key.lower(), value)
5555

56-
def load(self: AdtServerApp) -> WSGIHandler:
56+
def load(self) -> WSGIHandler:
5757
"""Load application.
5858
5959
Returns:
@@ -65,7 +65,7 @@ def load(self: AdtServerApp) -> WSGIHandler:
6565
class Server:
6666
"""Ansible Devtools server implementation."""
6767

68-
def __init__(self: Server, port: str, debug: bool) -> None: # noqa: FBT001
68+
def __init__(self, port: str, debug: bool) -> None: # noqa: FBT001
6969
"""Initialize an AdtServer object.
7070
7171
Args:
@@ -90,7 +90,7 @@ def __init__(self: Server, port: str, debug: bool) -> None: # noqa: FBT001
9090
setup()
9191
self.application = get_wsgi_application()
9292

93-
def run(self: Server) -> None:
93+
def run(self) -> None:
9494
"""Start the server."""
9595
options = {"bind": f"0.0.0.0:{self.port}"}
9696
if self.debug:

0 commit comments

Comments
 (0)