Skip to content

Commit f3b2e04

Browse files
committed
fix: pylint and format
1 parent 7c73a47 commit f3b2e04

File tree

9 files changed

+23
-22
lines changed

9 files changed

+23
-22
lines changed

.pylintrc

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[MASTER]
22
ignore = ,input
33
persistent = yes
4-
load-plugins = pylint_quotes
54

65
[MESSAGES CONTROL]
76
disable =
@@ -10,7 +9,6 @@ disable =
109
duplicate-code,
1110
no-member,
1211
parse-error,
13-
bad-continuation,
1412
too-few-public-methods,
1513
global-statement,
1614
cyclic-import,
@@ -28,23 +26,20 @@ disable =
2826
consider-iterating-dictionary,
2927
inconsistent-return-statements,
3028
consider-using-dict-items,
31-
modified-iterating-dict
29+
modified-iterating-dict,
30+
too-many-arguments,
31+
broad-exception-caught,
32+
R0917
3233

3334
[REPORTS]
3435
output-format = text
35-
files-output = no
3636
reports = no
3737

3838
[FORMAT]
3939
max-line-length = 120
40-
max-statement-lines = 75
4140
single-line-if-stmt = no
42-
no-space-check = trailing-comma,dict-separator
4341
max-module-lines = 1000
4442
indent-string = ' '
45-
string-quote=single-avoid-escape
46-
triple-quote=single
47-
docstring-quote=double
4843

4944
[MISCELLANEOUS]
5045
notes = FIXME,XXX,TODO
@@ -91,7 +86,6 @@ good-names=logger,id,ID
9186
bad-names=foo,bar,baz,toto,tutu,tata
9287

9388
# List of builtins function names that should not be used, separated by a comma
94-
bad-functions=apply,input
9589

9690
[DESIGN]
9791
max-args = 10
@@ -106,4 +100,4 @@ min-public-methods = 2
106100
max-public-methods = 20
107101

108102
[EXCEPTIONS]
109-
overgeneral-exceptions = Exception
103+
overgeneral-exceptions = builtins.Exception

config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@
5050

5151
# REDIS
5252
REDIS_HOST = environ.get('PROXSTAR_REDIS_HOST', 'localhost')
53-
RQ_DASHBOARD_REDIS_URL = "redis://" + environ.get('PROXSTAR_REDIS_HOST', 'localhost') + ":" + environ.get('PROXSTAR_REDIS_PORT', '6379') + "/0"
53+
RQ_DASHBOARD_REDIS_URL = (
54+
"redis://" + environ.get('PROXSTAR_REDIS_HOST', 'localhost') + ":" +
55+
environ.get('PROXSTAR_REDIS_PORT', '6379') + "/0"
56+
)
5457
REDIS_PORT = int(environ.get('PROXSTAR_REDIS_PORT', '6379'))
5558

5659
# VNC

gunicorn.conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
def start_websockify(websockify_path, target_file):
17-
result = subprocess.run(['pgrep', 'websockify'], stdout=subprocess.PIPE)
17+
result = subprocess.run(['pgrep', 'websockify'], stdout=subprocess.PIPE, check=False)
1818
if not result.stdout:
1919
print("Websockify is stopped. Starting websockify.")
2020
proxstar_port = app.config.get('WEBSOCKIFY_PORT')
@@ -34,6 +34,6 @@ def start_websockify(websockify_path, target_file):
3434
print("Websockify started.")
3535

3636

37-
def on_starting(server):
37+
def on_starting(server): # pylint: disable=unused-argument
3838
print("Booting Websockify server in daemon mode...")
3939
start_websockify(app.config['WEBSOCKIFY_PATH'], app.config['WEBSOCKIFY_TARGET_FILE'])

proxstar/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@
102102
app.config['STARRS_DB_PASS'],
103103
)
104104
)
105+
else:
106+
starrs = None
105107

106108
from proxstar.vm import VM
107109
from proxstar.user import User

proxstar/starrs.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import psycopg2
2-
3-
41
def get_next_ip(starrs, range_name):
52
c = starrs.cursor()
63
try:

proxstar/tasks.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def set_job_status(job, status):
6060
job.save_meta()
6161

6262

63-
def create_vm_task(user, name, cores, memory, disk, iso):
63+
def create_vm_task(user, name, cores, memory, disk, iso): # pylint: disable=too-many-arguments
6464
with app.app_context():
6565
job = get_current_job()
6666
proxmox = connect_proxmox()
@@ -177,7 +177,9 @@ def generate_pool_cache_task():
177177
store_pool_cache(db, pools)
178178

179179

180-
def setup_template_task(template_id, name, user, ssh_key, cores, memory):
180+
def setup_template_task(
181+
template_id, name, user, ssh_key, cores, memory
182+
): # pylint: disable=too-many-arguments
181183
with app.app_context():
182184
job = get_current_job()
183185
proxmox = connect_proxmox()
@@ -249,6 +251,7 @@ def cleanup_vnc_task():
249251
'https://{}/console/cleanup'.format(app.config['SERVER_NAME']),
250252
data={'token': app.config['VNC_CLEANUP_TOKEN']},
251253
verify=False,
254+
timeout=30,
252255
)
253256
except Exception as e: # pylint: disable=W0703
254257
print(e)

proxstar/vm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def set_ci_network(self):
372372

373373
# Will create a new VM with the given parameters, does not guarantee
374374
# the VM is done provisioning when returning
375-
def create_vm(proxmox, user, name, cores, memory, disk, iso):
375+
def create_vm(proxmox, user, name, cores, memory, disk, iso): # pylint: disable=too-many-arguments
376376
node = proxmox.nodes(get_node_least_mem(proxmox))
377377
vmid = get_free_vmid(proxmox)
378378
# Make sure lingering expirations are deleted

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ sqlalchemy==2.0.43
1919
tenacity==9.1.2
2020
websockify==0.13.0
2121
pylint==3.3.8
22-
pylint-quotes==0.2.3
2322
sentry-sdk[rq]
2423
sentry-sdk[flask]
2524
sentry-sdk~=2.38.0

rqsettings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
from sentry_sdk.integrations.redis import RedisIntegration
66

77
if os.path.exists('config_local.py'):
8-
import config_local as config
8+
try:
9+
import config_local as config # pylint: disable=import-error
10+
except ImportError:
11+
import config
912
else:
1013
import config
1114

0 commit comments

Comments
 (0)