Skip to content

Commit 7687bbe

Browse files
committed
Whole bunch of pylint/flake8 fixes due to updated pylint
Signed-off-by: Dinesh Dutt <[email protected]>
1 parent 4738004 commit 7687bbe

File tree

9 files changed

+17
-15
lines changed

9 files changed

+17
-15
lines changed

suzieq/engines/pandas/engineobj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ def _post_summarize(self, check_empty_col: str = 'deviceCnt') -> None:
587587
if self.ns[ns][check_empty_col] == 0:
588588
delete_keys.append(ns)
589589
for ns in delete_keys:
590-
del(self.ns[ns])
590+
del (self.ns[ns])
591591

592592
ns_df = pd.DataFrame(self.ns)
593593
if len(self.summary_row_order) > 0:

suzieq/engines/rest/engineobj.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ def _get_response(self, verb: str, **kwargs) -> pd.DataFrame:
104104
f'{verb}?'
105105
f'{query_params}')
106106

107-
response = requests.get(url, verify=False, )
107+
# pylint: disable=missing-timeout
108+
response = requests.get(url, verify=None)
108109
if response.status_code != 200:
109110
if response.text:
110111
msg = response.json().get("detail", str(response.status_code))

suzieq/gui/stlit/guiutils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def get_session_id():
128128
'''Return Streamlit's session ID'''
129129
ctx = get_script_run_ctx()
130130
if ctx is None:
131-
raise Exception("Failed to get the thread context")
131+
raise AttributeError("Failed to get the thread context")
132132
return ctx.session_id
133133

134134

@@ -166,8 +166,8 @@ def set_def_aggrid_options(grid_options: dict):
166166

167167
def get_image_dir():
168168
'''Get directory where images are stored'''
169-
return(os.path.dirname(find_spec('suzieq.gui')
170-
.loader.path) + '/images')
169+
return (os.path.dirname(find_spec('suzieq.gui')
170+
.loader.path) + '/images')
171171

172172

173173
def color_row(row, **kwargs):

suzieq/gui/stlit/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def _get_node_tooltip_color(self, hostname: str) -> str:
452452
color = 'red'
453453
else:
454454
color = 'black'
455-
return('\n'.join(tdf.T.to_string().split('\n')[1:]), color)
455+
return ('\n'.join(tdf.T.to_string().split('\n')[1:]), color)
456456

457457
def _aggrid_style(self):
458458
'''Style the cells based on value'''

suzieq/poller/worker/services/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def merge_results(self, result_list, _):
519519

520520
final_res = list(int_res.values())
521521

522-
return(final_res)
522+
return (final_res)
523523

524524
def _get_devtype_from_input(self, input_data):
525525
if isinstance(input_data, list):

suzieq/poller/worker/services/svcparser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ def cons_recs_from_json_template(tmplt_str, in_data):
196196
# Some outputs contain just the main key with a null
197197
# body such as ospfNbr from EOS: {'vrfs': {}}.
198198
logging.info(
199-
f"Unnatural return from svcparser. xstr is {xstr}. \
200-
Result is {result}")
199+
f"Unnatural return from svcparser. xstr is {xstr}.\
200+
Result is {result}")
201201
return cleanup_and_return(result)
202202
result = [{"rest": data[xstr]}]
203203
else:

suzieq/restServer/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class TruthasStrings(str, Enum):
284284

285285
@app.get("/api/v1/{rest_of_path:path}", deprecated=True)
286286
def deprecated_function(request: Request, rest_of_path: str):
287-
return([{'error': 'v1 is deprecated, use API version v2'}])
287+
return ([{'error': 'v1 is deprecated, use API version v2'}])
288288

289289

290290
@app.get("/api/v2/address/{verb}")

suzieq/shared/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _init_schemas(self, schema_dir: str):
2929
if not (schema_dir and os.path.exists(schema_dir)):
3030
logger.error(
3131
"Schema directory %s does not exist", schema_dir)
32-
raise Exception(f"Schema directory {schema_dir} does not exist")
32+
raise ValueError(f"Schema directory {schema_dir} does not exist")
3333

3434
for root, _, files in os.walk(schema_dir):
3535
for topic in files:

suzieq/shared/utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -879,9 +879,9 @@ def init_logger(logname: str,
879879

880880
def known_devtypes() -> list:
881881
"""Returns the list of known dev types"""
882-
return(['cumulus', 'eos', 'iosxe', 'iosxr', 'ios', 'junos-mx', 'junos-qfx',
883-
'junos-qfx10k', 'junos-ex', 'junos-es', 'junos-evo', 'linux',
884-
'nxos', 'sonic', 'panos'])
882+
return (['cumulus', 'eos', 'iosxe', 'iosxr', 'ios', 'junos-mx',
883+
'junos-qfx', 'junos-qfx10k', 'junos-ex', 'junos-es', 'junos-evo',
884+
'linux', 'nxos', 'sonic', 'panos'])
885885

886886

887887
def humanize_timestamp(field: pd.Series, tz=None) -> pd.Series:
@@ -1108,6 +1108,7 @@ def deprecated_command_warning(dep_command: str, dep_sub_command: str,
11081108
sub_command (str, optional): subcommand to use instead.
11091109
Defaults to None.
11101110
1111+
11111112
Returns:
11121113
str: deprecated command warning message
11131114
"""
@@ -1122,7 +1123,7 @@ def get_default_per_vals() -> Dict:
11221123
Returns:
11231124
Dict: mapping between type and default value
11241125
"""
1125-
return({
1126+
return ({
11261127
pa.string(): "",
11271128
pa.int32(): 0,
11281129
pa.int64(): 0,

0 commit comments

Comments
 (0)