@@ -19,7 +19,7 @@ def url_for_field(field, value):
19
19
20
20
21
21
def jsonprint (value ):
22
- return json .dumps (value , indent = 2 , separators = (',' , ': ' ))
22
+ return json .dumps (value , indent = 2 , separators = ("," , ": " ))
23
23
24
24
25
25
def check_db_version (puppetdb ):
@@ -30,8 +30,8 @@ def check_db_version(puppetdb):
30
30
current_version = puppetdb .current_version ()
31
31
log .info (f"PuppetDB version: { current_version } " )
32
32
33
- current_semver = current_version .split ('-' )[0 ]
34
- minimum_semver = ' 5.2.0'
33
+ current_semver = current_version .split ("-" )[0 ]
34
+ minimum_semver = " 5.2.0"
35
35
36
36
if parse (current_semver ) < parse (minimum_semver ):
37
37
log .error (f"The minimum supported version of PuppetDB is { minimum_semver } " )
@@ -54,12 +54,7 @@ def check_secret_key(secret_key_value):
54
54
being accepted in v5.x of the app.
55
55
"""
56
56
57
- # Flask's SECRET_KEY can be bytes or string, but for the check below
58
- # we need it to be a string
59
- if type (secret_key_value ) is bytes :
60
- secret_key_value = secret_key_value .decode ("utf-8" )
61
-
62
- if secret_key_value .startswith ("default-" ):
57
+ if type (secret_key_value ) is str and secret_key_value .startswith ("default-" ):
63
58
log .warning (
64
59
"Leaving SECRET_KEY set to a default value WILL cause issues"
65
60
" when the app is restarted or has more than 1 replica"
@@ -72,7 +67,7 @@ def check_secret_key(secret_key_value):
72
67
"Please see"
73
68
" https://github.com/voxpupuli/puppetboard/issues/721"
74
69
" for more info."
75
- )
70
+ )
76
71
77
72
78
73
def parse_python (value : str ):
@@ -104,8 +99,7 @@ def formatvalue(value):
104
99
105
100
106
101
def get_or_abort (func , * args , ** kwargs ):
107
- """Perform a backend request and handle all the errors,
108
- """
102
+ """Perform a backend request and handle all the errors,"""
109
103
return _do_get_or_abort (False , func , * args , ** kwargs )
110
104
111
105
@@ -166,19 +160,17 @@ def quote_columns_data(data: str) -> str:
166
160
interpret the dot a way to get into a nested results object.
167
161
168
162
See https://datatables.net/reference/option/columns.data#Types."""
169
- return data .replace ('.' , ' \\ .' )
163
+ return data .replace ("." , " \\ ." )
170
164
171
165
172
166
def check_env (env : str , envs : dict ):
173
- if env != '*' and env not in envs :
167
+ if env != "*" and env not in envs :
174
168
abort (404 )
175
169
176
170
177
171
def is_a_test ():
178
172
running_in_shell = any (
179
- pytest_binary in sys .argv [0 ] for pytest_binary in ['pytest' , 'py.test' ]
180
- )
181
- running_in_intellij = any (
182
- '_jb_pytest_runner.py' in arg for arg in sys .argv
173
+ pytest_binary in sys .argv [0 ] for pytest_binary in ["pytest" , "py.test" ]
183
174
)
175
+ running_in_intellij = any ("_jb_pytest_runner.py" in arg for arg in sys .argv )
184
176
return running_in_shell or running_in_intellij
0 commit comments