Skip to content

Commit 939e227

Browse files
build(pylint): format codebase
1 parent 3c1d55b commit 939e227

14 files changed

+3240
-2859
lines changed

command_line.py

+529-499
Large diffs are not rendered by default.

config.py

+49-43
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
## CWD Computation --------------------------------------
3030

31-
inside_packed_exe = getattr(sys, 'frozen', '')
31+
inside_packed_exe = getattr(sys, "frozen", "")
3232

3333
if inside_packed_exe:
3434
# we are running in a |PyInstaller| bundle
@@ -39,85 +39,89 @@
3939

4040
## CMD Utility functions --------------------------------
4141

42+
4243
def get_file(path):
43-
parts = path.split('/')
44+
parts = path.split("/")
4445
independent_path = utils.path_join(CWD, *parts)
4546
return independent_path
4647

48+
4749
def is_installed():
48-
uninst = get_file('uninst.exe')
50+
uninst = get_file("uninst.exe")
4951
return utils.is_windows() and os.path.exists(uninst)
5052

53+
5154
## Version Setting ----------------------------------------
5255

5356
__version__ = "v0.0.0"
5457

55-
with open(get_file('files/version.txt')) as f:
58+
with open(get_file("files/version.txt")) as f:
5659
__version__ = f.read().strip()
5760

58-
ICON_PATH = 'files/images/icon.png'
59-
WARNING_ICON = 'files/images/warning.png'
60-
APP_SETTINGS_ICON = 'files/images/app_settings.png'
61-
WINDOW_SETTINGS_ICON = 'files/images/window_settings.png'
62-
EXPORT_SETTINGS_ICON = 'files/images/export_settings.png'
63-
COMPRESS_SETTINGS_ICON = 'files/images/compress_settings.png'
64-
DOWNLOAD_SETTINGS_ICON = 'files/images/download_settings.png'
65-
FOLDER_OPEN_ICON = 'files/images/folder_open.png'
61+
ICON_PATH = "files/images/icon.png"
62+
WARNING_ICON = "files/images/warning.png"
63+
APP_SETTINGS_ICON = "files/images/app_settings.png"
64+
WINDOW_SETTINGS_ICON = "files/images/window_settings.png"
65+
EXPORT_SETTINGS_ICON = "files/images/export_settings.png"
66+
COMPRESS_SETTINGS_ICON = "files/images/compress_settings.png"
67+
DOWNLOAD_SETTINGS_ICON = "files/images/download_settings.png"
68+
FOLDER_OPEN_ICON = "files/images/folder_open.png"
6669

67-
W2E_VER_FILE = 'files/version.txt'
70+
W2E_VER_FILE = "files/version.txt"
6871

6972
TEMP_DIR = utils.get_temp_dir()
7073

71-
ERROR_LOG_FILE = 'files/error.log'
72-
VER_FILE = 'files/nw-versions.txt'
73-
SETTINGS_FILE = 'files/settings.cfg'
74-
GLOBAL_JSON_FILE = 'files/global.json'
75-
WEB2EXE_JSON_FILE = 'web2exe.json'
74+
ERROR_LOG_FILE = "files/error.log"
75+
VER_FILE = "files/nw-versions.txt"
76+
SETTINGS_FILE = "files/settings.cfg"
77+
GLOBAL_JSON_FILE = "files/global.json"
78+
WEB2EXE_JSON_FILE = "web2exe.json"
7679

77-
LAST_PROJECT_FILE = 'files/last_project_path.txt'
78-
RECENT_FILES_FILE = 'files/recent_files.txt'
80+
LAST_PROJECT_FILE = "files/last_project_path.txt"
81+
RECENT_FILES_FILE = "files/recent_files.txt"
7982

80-
NW_BRANCH_FILE = 'files/nw-branch.txt'
83+
NW_BRANCH_FILE = "files/nw-branch.txt"
8184

82-
UPX_WIN_PATH = 'files/compressors/upx-win.exe'
83-
UPX_MAC_PATH = 'files/compressors/upx-mac'
84-
UPX_LIN32_PATH = 'files/compressors/upx-linux-x32'
85-
UPX_LIN64_PATH = 'files/compressors/upx-linux-x64'
85+
UPX_WIN_PATH = "files/compressors/upx-win.exe"
86+
UPX_MAC_PATH = "files/compressors/upx-mac"
87+
UPX_LIN32_PATH = "files/compressors/upx-linux-x32"
88+
UPX_LIN64_PATH = "files/compressors/upx-linux-x64"
8689

87-
ENV_VARS_PY_PATH = 'files/env_vars.py'
88-
ENV_VARS_BAT_PATH = 'files/env_vars.bat'
89-
ENV_VARS_BASH_PATH = 'files/env_vars.bash'
90+
ENV_VARS_PY_PATH = "files/env_vars.py"
91+
ENV_VARS_BAT_PATH = "files/env_vars.bat"
92+
ENV_VARS_BASH_PATH = "files/env_vars.bash"
9093

9194
## Logger setup ----------------------------------------------
9295

9396
LOG_FILENAME = utils.get_data_file_path(ERROR_LOG_FILE)
9497

98+
9599
def getLogHandler():
96100
return lh.RotatingFileHandler(
97-
LOG_FILENAME,
98-
maxBytes=100000,
99-
backupCount=2,
100-
encoding='utf-8'
101+
LOG_FILENAME, maxBytes=100000, backupCount=2, encoding="utf-8"
101102
)
102103

103104

104105
if DEBUG:
105106
logging.basicConfig(
106-
format=("%(levelname) -10s %(asctime)s %(module)s.py: "
107-
"%(lineno)s %(funcName)s - %(message)s"),
107+
format=(
108+
"%(levelname) -10s %(asctime)s %(module)s.py: "
109+
"%(lineno)s %(funcName)s - %(message)s"
110+
),
108111
level=logging.DEBUG,
109-
handlers=[getLogHandler()]
112+
handlers=[getLogHandler()],
110113
)
111114
else:
112115
logging.basicConfig(
113-
format=("%(levelname) -10s %(asctime)s %(module)s.py: "
114-
"%(lineno)s %(funcName)s - %(message)s"),
116+
format=(
117+
"%(levelname) -10s %(asctime)s %(module)s.py: "
118+
"%(lineno)s %(funcName)s - %(message)s"
119+
),
115120
level=logging.INFO,
116-
handlers=[getLogHandler()]
121+
handlers=[getLogHandler()],
117122
)
118123

119124

120-
121125
def getLogger(name):
122126
logger = logging.getLogger(name)
123127
logger.addHandler(getLogHandler())
@@ -129,17 +133,19 @@ def getLogger(name):
129133

130134
## Custom except hook to log all errors ----------------------
131135

136+
132137
def my_excepthook(type_, value, tback):
133-
output_err = ''.join([x for x in traceback.format_exception(type_, value,
134-
tback)])
135-
logger.error('{}'.format(output_err))
138+
output_err = "".join([x for x in traceback.format_exception(type_, value, tback)])
139+
logger.error("{}".format(output_err))
136140
sys.__excepthook__(type_, value, tback)
137141

142+
138143
sys.excepthook = my_excepthook
139144

145+
140146
def download_path(path=None):
141147
# Ensure that the default download path exists
142-
path = path or utils.get_data_path('files/downloads')
148+
path = path or utils.get_data_path("files/downloads")
143149
try:
144150
os.makedirs(path)
145151
except:

files/env_vars.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
PROJECT_DIR='{proj_dir}'
2-
PROJECT_NAME='{proj_name}'
3-
EXPORT_DIR='{export_dir}'
4-
EXPORT_DIRS={export_dirs}
5-
MAC64_EXPORT_DIR='{mac-x64_dir}'
6-
MAC32_EXPORT_DIR='{mac-x32_dir}'
7-
WIN64_EXPORT_DIR='{windows-x64_dir}'
8-
WIN32_EXPORT_DIR='{windows-x32_dir}'
9-
LINUX64_EXPORT_DIR='{linux-x64_dir}'
10-
LINUX32_EXPORT_DIR='{linux-x32_dir}'
11-
NUM_DIRS={num_dirs}
1+
PROJECT_DIR = "{proj_dir}"
2+
PROJECT_NAME = "{proj_name}"
3+
EXPORT_DIR = "{export_dir}"
4+
EXPORT_DIRS = {export_dirs}
5+
MAC64_EXPORT_DIR = "{mac-x64_dir}"
6+
MAC32_EXPORT_DIR = "{mac-x32_dir}"
7+
WIN64_EXPORT_DIR = "{windows-x64_dir}"
8+
WIN32_EXPORT_DIR = "{windows-x32_dir}"
9+
LINUX64_EXPORT_DIR = "{linux-x64_dir}"
10+
LINUX32_EXPORT_DIR = "{linux-x32_dir}"
11+
NUM_DIRS = {num_dirs}

0 commit comments

Comments
 (0)