Skip to content

Commit 745bd2f

Browse files
google-labs-jules[bot]bosd
authored andcommitted
Fix warnings in test session and prevent index error"
Fixes #585 index error list index out of range
1 parent 6b7b67d commit 745bd2f

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

camelot/parsers/hybrid.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Implementation of hybrid table parser."""
22

3-
import numpy as np
4-
53
from ..utils import bboxes_overlap
64
from ..utils import boundaries_to_split_lines
75
from .base import BaseParser
@@ -158,10 +156,10 @@ def _generate_table(self, table_idx, bbox, cols, rows, **kwargs):
158156
table = parser._generate_table(table_idx, bbox, cols, rows, **kwargs)
159157
# Because hybrid can inject extraneous splits from both lattice and
160158
# network, remove lines / cols that are completely empty.
161-
table.df = table.df.replace("", np.nan)
162-
table.df = table.df.dropna(axis=0, how="all")
163-
table.df = table.df.dropna(axis=1, how="all")
164-
table.df = table.df.replace(np.nan, "")
159+
# drop empty rows
160+
table.df = table.df.loc[~(table.df == "").all(axis=1)]
161+
# drop empty columns
162+
table.df = table.df.loc[:, ~(table.df == "").all(axis=0)]
165163
table.shape = table.df.shape
166164
return table
167165

noxfile.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,20 @@ def tests(session: Session) -> None:
190190
*plot_requires,
191191
)
192192
try:
193-
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
193+
session.run(
194+
"coverage",
195+
"run",
196+
"--parallel",
197+
"-m",
198+
"pytest",
199+
*session.posargs,
200+
env={
201+
"PYTHONWARNINGS": (
202+
"ignore:ARC4 has been moved to"
203+
" cryptography.hazmat.decrepit.ciphers.algorithms.ARC4"
204+
)
205+
},
206+
)
194207
finally:
195208
if session.interactive:
196209
session.notify("coverage", posargs=[])

0 commit comments

Comments
 (0)