Skip to content

Commit b9fa3a9

Browse files
committed
typing: add a bunch of -> None for obvious cases
1 parent 2d3bb1e commit b9fa3a9

File tree

17 files changed

+20
-20
lines changed

17 files changed

+20
-20
lines changed

pyinfra/api/command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def execute(self, state: "State", host: "Host", connector_arguments: ConnectorAr
236236
if "state" in argspec.args and "host" in argspec.args:
237237
return self.function(state, host, *self.args, **self.kwargs)
238238

239-
def execute_function():
239+
def execute_function() -> None:
240240
with ctx_config.use(state.config.copy()):
241241
with ctx_host.use(host):
242242
self.function(*self.args, **self.kwargs)

pyinfra/api/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ def set_current_state(self, config_state):
224224
for key, value in config_state:
225225
setattr(self, key, value)
226226

227-
def lock_current_state(self):
227+
def lock_current_state(self) -> None:
228228
self._locked_config = self.get_current_state()
229229

230-
def reset_locked_state(self):
230+
def reset_locked_state(self) -> None:
231231
self.set_current_state(self._locked_config)
232232

233233
def copy(self) -> "Config":

pyinfra/api/host.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def get_fact(self, name_or_cls, *args, **kwargs):
361361
# Connector proxy
362362
#
363363

364-
def _check_state(self):
364+
def _check_state(self) -> None:
365365
if not self.state:
366366
raise TypeError("Cannot call this function with no state!")
367367

@@ -403,7 +403,7 @@ def connect(self, reason=None, show_errors: bool = True, raise_exceptions: bool
403403
self.state.trigger_callbacks("host_connect", self)
404404
self.connected = True
405405

406-
def disconnect(self):
406+
def disconnect(self) -> None:
407407
"""
408408
Disconnect from the host using it's configured connector.
409409
"""

pyinfra/api/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class StateHostMeta:
122122
ops_no_change = 0
123123
op_hashes: set[str]
124124

125-
def __init__(self):
125+
def __init__(self) -> None:
126126
self.op_hashes = set()
127127

128128

pyinfra/connectors/chroot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
@memoize
25-
def show_warning():
25+
def show_warning() -> None:
2626
logger.warning("The @chroot connector is in beta!")
2727

2828

pyinfra/connectors/docker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def connect(self) -> None:
129129
self.container_id = _start_docker_image(docker_identifier)
130130

131131
@override
132-
def disconnect(self):
132+
def disconnect(self) -> None:
133133
container_id = self.container_id
134134

135135
if self.no_stop:

pyinfra/connectors/dockerssh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
@memoize
25-
def show_warning():
25+
def show_warning() -> None:
2626
logger.warning("The @dockerssh connector is in beta!")
2727

2828

pyinfra/connectors/local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def get_file(
210210
return True
211211

212212
@override
213-
def check_can_rsync(self):
213+
def check_can_rsync(self) -> None:
214214
if not which("rsync"):
215215
raise NotImplementedError("The `rsync` binary is not available on this system.")
216216

pyinfra/connectors/ssh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def put_file(
543543
return True
544544

545545
@override
546-
def check_can_rsync(self):
546+
def check_can_rsync(self) -> None:
547547
if self.data["ssh_key_password"]:
548548
raise NotImplementedError(
549549
"Rsync does not currently work with SSH keys needing passwords."

pyinfra/connectors/terraform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
@memoize
12-
def show_warning():
12+
def show_warning() -> None:
1313
logger.warning("The @terraform connector is in beta!")
1414

1515

0 commit comments

Comments
 (0)