Skip to content

Commit d129143

Browse files
committed
Linter fixes
1 parent 4ee7113 commit d129143

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

command_runner/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ def _get_error_output(output_stdout, output_stderr):
648648
if output_stderr:
649649
return output_stderr
650650
return None
651-
651+
652652
def _heartbeat_thread(
653653
process, # type: Union[subprocess.Popen[str], subprocess.Popen]
654654
heartbeat, # type: int
@@ -702,7 +702,10 @@ def __check_timeout(
702702
if heartbeat:
703703
heartbeat_thread = threading.Thread(
704704
target=_heartbeat_thread,
705-
args=(process, heartbeat,),
705+
args=(
706+
process,
707+
heartbeat,
708+
),
706709
)
707710
heartbeat_thread.daemon = True
708711
heartbeat_thread.start()
@@ -847,12 +850,14 @@ def _monitor_process(
847850
if heartbeat:
848851
heartbeat_thread = threading.Thread(
849852
target=_heartbeat_thread,
850-
args=(process, heartbeat,),
853+
args=(
854+
process,
855+
heartbeat,
856+
),
851857
)
852858
heartbeat_thread.daemon = True
853859
heartbeat_thread.start()
854860

855-
856861
if encoding is False:
857862
output_stdout = output_stderr = b""
858863
output_stdout_end = output_stderr_end = b""

command_runner/elevate.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ def main(argv):
3030
__author__ = "Orsiris de Jong"
3131
__copyright__ = "Copyright (C) 2017-2023 Orsiris de Jong"
3232
__licence__ = "BSD 3 Clause"
33-
__version__ = "0.3.2"
34-
__build__ = "2023122801"
33+
__version__ = "0.3.3"
34+
__build__ = "2024091501"
3535

3636
from logging import getLogger
3737
import os
3838
import sys
3939
from command_runner import command_runner
4040

41-
if os.name == "nt":
41+
OS_NAME = os.name
42+
if OS_NAME == "nt":
4243
try:
4344
import win32event # monitor process
4445
import win32process # monitor process
@@ -61,23 +62,22 @@ def is_admin():
6162
6263
:return: Boolean, True if admin privileges present
6364
"""
64-
current_os_name = os.name
6565

6666
# Works with XP SP2 +
67-
if current_os_name == "nt":
67+
if OS_NAME == "nt":
6868
try:
6969
return IsUserAnAdmin()
7070
except Exception:
7171
raise EnvironmentError("Cannot check admin privileges")
72-
elif current_os_name == "posix":
72+
elif OS_NAME == "posix":
7373
# Check for root on Posix
7474
# os.getuid only exists on postix OSes
7575
# pylint: disable=E1101 (no-member)
7676
return os.getuid() == 0
7777
else:
7878
raise EnvironmentError(
7979
"OS does not seem to be supported for admin check. OS: {}".format(
80-
current_os_name
80+
OS_NAME
8181
)
8282
)
8383

@@ -97,7 +97,7 @@ def get_absolute_path(executable):
9797
if os.path.isfile(output):
9898
return output
9999

100-
if os.name == "nt":
100+
if OS_NAME == "nt":
101101
split_char = ";"
102102
else:
103103
split_char = ":"
@@ -205,7 +205,7 @@ def elevate(callable_function, *args, **kwargs):
205205
else:
206206
runner, arguments = _check_environment()
207207
# Windows runner
208-
if os.name == "nt":
208+
if OS_NAME == "nt":
209209
# Re-run the script with admin rights
210210
# Join arguments and double quote each argument in order to prevent space separation
211211
arguments = " ".join('"' + arg + '"' for arg in arguments)

0 commit comments

Comments
 (0)