Skip to content

Commit e45aedb

Browse files
committed
lint: fix pylint suggestions
C0114: Missing module docstring (missing-module-docstring) fixed by adding the docstring C0116: Missing function or method docstring fixed by adding the docstring to main() W1514: Using open without explicitly specifying an encoding fixed by specifying the manpage encoding as UTF-8 W1510: Using subprocess.run without explicitly set `check` fixed by adding check=True argument R1722: Consider using sys.exit() fixed by separating print from exit, and using sys.exit(1)
1 parent 7a24a2d commit e45aedb

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

1.14.5/bullseye/entrypoint.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env python3
2-
2+
"""
3+
Docker entrypoint for Dogecoin Core
4+
"""
35
import argparse
46
import os
57
import pwd
@@ -23,7 +25,8 @@ def execute(executable, args):
2325
executable_path = shutil.which(executable)
2426

2527
if executable_path is None:
26-
exit(f"{sys.argv[0]}: {executable} not found.")
28+
print(f"{sys.argv[0]}: {executable} not found.")
29+
sys.exit(1)
2730

2831
#Prepare execve args & launch container command
2932
execve_args = [executable_path] + args
@@ -47,7 +50,7 @@ def executable_options(executable):
4750
man_folder = "/usr/share/man/man1"
4851
man_file = os.path.join(man_folder, f"{executable}.1")
4952

50-
with open(man_file, "r") as man_filestream:
53+
with open(man_file, "r", encoding="utf-8") as man_filestream:
5154
man_content = man_filestream.read()
5255

5356
# Regex to match single option entry in man(1) page
@@ -77,7 +80,7 @@ def create_datadir():
7780
os.makedirs(datadir, exist_ok=True)
7881

7982
user = os.environ["USER"]
80-
subprocess.run(["chown", "-R", f"{user}:{user}", datadir])
83+
subprocess.run(["chown", "-R", f"{user}:{user}", datadir], check=True)
8184

8285
def convert_env(executable):
8386
"""
@@ -131,6 +134,9 @@ def run_executable(executable, executable_args):
131134
execute(executable, executable_args)
132135

133136
def main():
137+
"""
138+
Main routine
139+
"""
134140
if sys.argv[1].startswith("-"):
135141
executable = "dogecoind"
136142
else:

0 commit comments

Comments
 (0)