Skip to content

Commit c0c6d98

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 62f7724 commit c0c6d98

File tree

6 files changed

+28
-30
lines changed

6 files changed

+28
-30
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ This repository contains the `ansible.scm` Ansible Collection that allows you to
55
<!--start requires_ansible-->
66
## Ansible version compatibility
77

8-
This collection has been tested against following Ansible versions: **>=2.15.0**.
8+
This collection has been tested against the following Ansible versions: **>=2.15.0**.
99

10-
For collections that support Ansible 2.9, please ensure you update your `network_os` to use the
11-
fully qualified collection name (for example, `cisco.ios.ios`).
1210
Plugins and modules within a collection may be tested with only specific Ansible versions.
1311
A collection may contain metadata that identifies these versions.
1412
PEP440 is the schema used to describe the versions of Ansible.

plugins/action/git_publish.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class ActionModule(GitBase):
5757

5858
# pylint: disable=too-many-arguments
5959
def __init__( # noqa: PLR0913
60-
self: T,
60+
self,
6161
connection: Connection,
6262
loader: DataLoader,
6363
play_context: PlayContext,
@@ -91,7 +91,7 @@ def __init__( # noqa: PLR0913
9191
self._supports_async = True
9292
self._result: Result = Result()
9393

94-
def _check_argspec(self: T) -> None:
94+
def _check_argspec(self) -> None:
9595
"""Check the argspec for the action plugin.
9696
9797
:raises AnsibleActionFail: If the argspec is invalid
@@ -108,7 +108,7 @@ def _check_argspec(self: T) -> None:
108108
err = "Token can not be an empty string"
109109
raise AnsibleActionFail(err)
110110

111-
def _configure_git_user_name(self: T) -> None:
111+
def _configure_git_user_name(self) -> None:
112112
"""Configure the git user name."""
113113
command_parts = list(self._base_command)
114114
command_parts.extend(["config", "--get", "user.name"])
@@ -131,7 +131,7 @@ def _configure_git_user_name(self: T) -> None:
131131
self._run_command(command=command)
132132
self._result.user_name = name
133133

134-
def _configure_git_user_email(self: T) -> None:
134+
def _configure_git_user_email(self) -> None:
135135
"""Configure the git user email."""
136136
command_parts = list(self._base_command)
137137
command_parts.extend(["config", "--get", "user.email"])
@@ -154,7 +154,7 @@ def _configure_git_user_email(self: T) -> None:
154154
self._run_command(command=command)
155155
self._result.user_email = email
156156

157-
def _add(self: T) -> None:
157+
def _add(self) -> None:
158158
"""Add files for the pending commit."""
159159
command_parts = list(self._base_command)
160160
files = " ".join(self._task.args["include"])
@@ -165,7 +165,7 @@ def _add(self: T) -> None:
165165
)
166166
self._run_command(command=command)
167167

168-
def _commit(self: T) -> None:
168+
def _commit(self) -> None:
169169
"""Perform a commit for the pending push."""
170170
command_parts = list(self._base_command)
171171
message = self._task.args["commit"]["message"].format(play_name=self._play_name)
@@ -177,7 +177,7 @@ def _commit(self: T) -> None:
177177
)
178178
self._run_command(command=command)
179179

180-
def _tag(self: T) -> None:
180+
def _tag(self) -> None:
181181
"""Create a tag object."""
182182
command_parts = list(self._base_command)
183183
message = self._task.args["tag"].get("message")
@@ -192,7 +192,7 @@ def _tag(self: T) -> None:
192192
)
193193
self._run_command(command=command)
194194

195-
def _push(self: T) -> None:
195+
def _push(self) -> None:
196196
"""Push the commit to the origin."""
197197
command_parts = list(self._base_command)
198198
command_parts.extend(["remote", "-v"])
@@ -235,7 +235,7 @@ def _push(self: T) -> None:
235235
line for line in command.stderr.split("remote:") if "https" in line
236236
).strip()
237237

238-
def _remove_repo(self: T) -> None:
238+
def _remove_repo(self) -> None:
239239
"""Remove the temporary directory."""
240240
if not self._task.args["remove"]:
241241
return
@@ -247,7 +247,7 @@ def _remove_repo(self: T) -> None:
247247
self._result.msg = "Failed to remove repository"
248248

249249
def run(
250-
self: T,
250+
self,
251251
tmp: None = None,
252252
task_vars: Optional[Dict[str, JSONTypes]] = None,
253253
) -> Dict[str, JSONTypes]:

plugins/action/git_retrieve.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ActionModule(GitBase):
6161
_requires_connection = False
6262

6363
def __init__( # noqa: PLR0913
64-
self: T,
64+
self,
6565
connection: Connection,
6666
loader: DataLoader,
6767
play_context: PlayContext,
@@ -98,7 +98,7 @@ def __init__( # noqa: PLR0913
9898
self._supports_async = True
9999
self._result: Result = Result()
100100

101-
def _check_argspec(self: T) -> None:
101+
def _check_argspec(self) -> None:
102102
"""Check the argspec for the action plugin.
103103
104104
:raises AnsibleActionFail: If the argspec is invalid
@@ -120,14 +120,14 @@ def _check_argspec(self: T) -> None:
120120
raise AnsibleActionFail(err)
121121

122122
@property
123-
def _branch_exists(self: T) -> bool:
123+
def _branch_exists(self) -> bool:
124124
"""Return True if the branch exists.
125125
126126
:returns: True if the branch exists
127127
"""
128128
return self._branch_name in self._branches
129129

130-
def _host_key_checking(self: T) -> None:
130+
def _host_key_checking(self) -> None:
131131
"""Configure host key checking."""
132132
origin = self._task.args["origin"]["url"]
133133
upstream = self._task.args["upstream"].get("url") or ""
@@ -151,7 +151,7 @@ def _host_key_checking(self: T) -> None:
151151
)
152152
self._run_command(command=command)
153153

154-
def _clone(self: T) -> None:
154+
def _clone(self) -> None:
155155
"""Clone the repository.
156156
157157
Additionally set the base command to the repository path.
@@ -209,7 +209,7 @@ def _clone(self: T) -> None:
209209
self._base_command = ("git", "-C", self._repo_path)
210210
return
211211

212-
def _get_branches(self: T) -> None:
212+
def _get_branches(self) -> None:
213213
"""Get the branches."""
214214
command_parts = list(self._base_command)
215215
command_parts.extend(["branch", "-a"])
@@ -256,14 +256,14 @@ def _get_branches(self: T) -> None:
256256
self._result.branch_name = self._branch_name
257257
return
258258

259-
def _detect_duplicate_branch(self: T) -> None:
259+
def _detect_duplicate_branch(self) -> None:
260260
"""Detect duplicate branch."""
261261
duplicate_detection = self._task.args["branch"]["duplicate_detection"]
262262
if duplicate_detection and self._branch_exists:
263263
self._result.failed = True
264264
self._result.msg = f"Branch '{self._branch_name}' already exists"
265265

266-
def _switch_checkout(self: T) -> None:
266+
def _switch_checkout(self) -> None:
267267
"""Switch to or checkout the branch."""
268268
command_parts = list(self._base_command)
269269
branch = self._branch_name
@@ -283,7 +283,7 @@ def _switch_checkout(self: T) -> None:
283283
)
284284
self._run_command(command=command)
285285

286-
def _add_upstream_remote(self: T) -> None:
286+
def _add_upstream_remote(self) -> None:
287287
"""Add the upstream remote."""
288288
if not self._task.args["upstream"].get("url"):
289289
return
@@ -298,7 +298,7 @@ def _add_upstream_remote(self: T) -> None:
298298
self._run_command(command=command)
299299
return
300300

301-
def _pull_upstream(self: T) -> None:
301+
def _pull_upstream(self) -> None:
302302
"""Pull from upstream."""
303303
if not self._task.args["upstream"].get("url"):
304304
return
@@ -325,7 +325,7 @@ def _pull_upstream(self: T) -> None:
325325
return
326326

327327
def run(
328-
self: T,
328+
self,
329329
tmp: None = None,
330330
task_vars: Optional[Dict[str, JSONTypes]] = None,
331331
) -> Dict[str, JSONTypes]:

plugins/plugin_utils/command.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ class Command:
3939
stderr_lines: List[str] = field(default_factory=list)
4040

4141
@property
42-
def command(self: T) -> str:
42+
def command(self) -> str:
4343
"""Return the command as a string.
4444
4545
:return: The command as a string.
4646
"""
4747
return shlex.join(self.command_parts)
4848

4949
@property
50-
def cleaned(self: T) -> Dict[str, Union[int, Dict[str, str], List[str], str]]:
50+
def cleaned(self) -> Dict[str, Union[int, Dict[str, str], List[str], str]]:
5151
"""Return the sanitized details of the command for the log.
5252
5353
:return: The sanitized details of the command for the log.

plugins/plugin_utils/git_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ActionInit:
4444

4545
@property
4646
def asdict(
47-
self: T,
47+
self,
4848
) -> Dict[str, Union[Connection, DataLoader, PlayContext, ModuleType, Task, Templar]]:
4949
"""Create a dictionary, avoiding the deepcopy with dataclass.asdict.
5050
@@ -71,7 +71,7 @@ class ResultBase: # pylint: disable=too-many-instance-attributes
7171
class GitBase(ActionBase): # type: ignore[misc] # parent has type Any
7272
"""Base class for the git paction plugins."""
7373

74-
def __init__(self: U, action_init: ActionInit) -> None:
74+
def __init__(self, action_init: ActionInit) -> None:
7575
"""Initialize the action plugin.
7676
7777
:param action_init: The keyword arguments for action base
@@ -97,7 +97,7 @@ def _git_auth_header(token: str) -> Tuple[str, List[str]]:
9797
]
9898
return basic_encoded, cli_parameters
9999

100-
def _run_command(self: U, command: Command, ignore_errors: bool = False) -> None:
100+
def _run_command(self, command: Command, ignore_errors: bool = False) -> None:
101101
"""Run a command and append the command result to the results.
102102
103103
:param command: The command to run

tests/unit/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .definitions import ActionModuleInit
2121

2222

23-
@pytest.fixture()
23+
@pytest.fixture
2424
def action_init() -> ActionModuleInit:
2525
"""Provide a fixture for action initialization.
2626

0 commit comments

Comments
 (0)