Skip to content

Commit 5b781e3

Browse files
authored
Merge pull request #869 from netenglabs/update-pandas
Update pandas
2 parents b5180ba + 14d3c48 commit 5b781e3

File tree

17 files changed

+1922
-1648
lines changed

17 files changed

+1922
-1648
lines changed

.pylintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,5 +763,5 @@ min-public-methods=2
763763

764764
# Exceptions that will emit a warning when being caught. Defaults to
765765
# "BaseException, Exception".
766-
overgeneral-exceptions=BaseException,
767-
Exception
766+
overgeneral-exceptions=builtins.BaseException,
767+
builtins.Exception

build/requirements.txt

Lines changed: 85 additions & 84 deletions
Large diffs are not rendered by default.

poetry.lock

Lines changed: 1799 additions & 1508 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ textfsm = "*"
2323
async-timeout = "<4.0"
2424
aiofiles = "*"
2525
prompt-toolkit = ">2"
26-
pyarrow = "10.0.1"
27-
pandas = "1.3.4"
26+
pyarrow = "~11.0"
27+
pandas = "~1.5"
2828
PyYAML = "*"
2929
python-nubia = "0.2b5"
3030
uvloop = "*"
@@ -50,6 +50,7 @@ notebook = "6.4.12"
5050
urllib3 = "^1.26.12"
5151
packaging = "^21.3"
5252
psutil = "^5.9.4"
53+
jellyfish = "~0.10"
5354

5455
[tool.poetry.dev-dependencies]
5556
pylint = "*"
@@ -59,15 +60,15 @@ jedi = "~0.17.2"
5960
flake8 = "*"
6061
ipdb = "*"
6162
pycscope = "*"
62-
pytest = "*"
63+
pytest = "~7.2"
6364
pytest-cov = "*"
6465
pytest-xdist = "*"
6566
pytest-asyncio = "*"
6667
pytest-mock = "*"
6768
mock = "*"
6869
pytest-depends = "^1.0.1"
6970
bandit = "^1.6.2"
70-
pytest-icdiff = "^0.5"
71+
pytest-icdiff = "~0.6"
7172
ipython = "~=7.16.3"
7273
requests = "^2.24.0"
7374
sphinx-autodoc-typehints = "^1.11.1"

suzieq/cli/sqcmds/command.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,15 @@ def _gen_output(self, df: pd.DataFrame, json_orient: str = "records",
325325
or 'timestamp' in self.columns)):
326326
if 'timestamp' in cols:
327327
cols.remove('timestamp')
328+
328329
with pd.option_context(
329-
'precision', 3,
330+
'format.precision', 3,
331+
'display.width', None,
332+
'display.max_columns', None,
330333
'display.max_colwidth', max_colwidth,
331-
'display.max_rows', max_rows,
332-
'display.expand_frame_repr', not all_columns):
334+
'display.expand_frame_repr', not all_columns,
335+
'display.max_rows', max_rows):
336+
333337
df = self.sqobj.humanize_fields(df)
334338
if df.empty:
335339
print(df[cols])
@@ -382,7 +386,7 @@ def _invoke_sqobj(self, fn, **kwargs) -> pd.DataFrame:
382386
df = pd.DataFrame({'error': [f'ERROR: UserQueryError: {ex}']})
383387
else:
384388
if self.ctxt.debug:
385-
raise Exception from ex
389+
raise ex
386390
df = pd.DataFrame({'error': [f'ERROR: {ex}']})
387391

388392
return df

suzieq/db/parquet/migratedb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
from typing import Callable, Union
33
import pandas as pd
4-
from pandas.core.computation.ops import UndefinedVariableError
4+
from pandas.errors import UndefinedVariableError
55
from suzieq.shared.exceptions import SqVersConversionError
66
from suzieq.shared.schema import Schema
77

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/pandas/path.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,13 @@ def _find_fhr_df(self, device: str, ip: str) -> pd.DataFrame:
291291
# is obtained from the MAC because of trunk ports.
292292
if idf.empty:
293293
continue
294-
idf.at[idf.index, 'vlan'] = mac_entry.vlan.iloc[0]
294+
idfidx = idf.index.values[0]
295+
idf.at[idfidx, 'vlan'] = mac_entry.vlan.iloc[0]
296+
295297
if (idf.master == 'bridge').all():
296-
idf.at[idf.index, 'ipAddressList'] = f'{ip}/32'
298+
idf.at[idfidx, 'ipAddressList'] = f'{ip}/32'
297299
# Assuming the VRF is identical across multiple entries
298-
idf.at[idf.index, 'master'] = rslt_df.iloc[0].vrf
300+
idf.at[idfidx, 'master'] = rslt_df.iloc[0].vrf
299301
else:
300302
idf = self._if_df.query(f'hostname=="{row.hostname}" and '
301303
f'ifname=="{row.oif}" and '

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):

0 commit comments

Comments
 (0)