Skip to content

STYLE: enable pylint warnings for cell-var-from-loop #49445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a9793f5
STYLE: Refactored one loop, suppressed three false positives.
Nov 1, 2022
eee0510
Merge branch 'pandas-dev:main' into cell_var_from_loop
roadswitcher Nov 1, 2022
724f3c7
Oooh, didn't think of that.
roadswitcher Nov 1, 2022
98b6991
I need to get better at spotting this stuff.
roadswitcher Nov 1, 2022
412391e
Merge branch 'main' into cell_var_from_loop
roadswitcher Nov 1, 2022
d4b22e5
Yeah, let's not suppress those after all.
roadswitcher Nov 1, 2022
eb3bdd6
Merge branch 'cell_var_from_loop' of github.com:roadswitcher/pandas i…
roadswitcher Nov 1, 2022
e672d53
Merge branch 'main' into cell_var_from_loop
roadswitcher Nov 1, 2022
08baba9
Merge branch 'main' into cell_var_from_loop
roadswitcher Nov 1, 2022
7572c87
Accidentally removed a newline.
roadswitcher Nov 1, 2022
4ec8eaa
Merge branch 'main' into cell_var_from_loop
roadswitcher Nov 1, 2022
eb74060
Merge branch 'main' into cell_var_from_loop
roadswitcher Nov 2, 2022
2a681f9
Helps to revert to correct version of file.
roadswitcher Nov 2, 2022
d4c8674
OK, backing slowly away from the git client now.
roadswitcher Nov 2, 2022
a1f410f
OK, backing slowly away from the git client now.
roadswitcher Nov 2, 2022
7f9de43
Resolve autotyper find
roadswitcher Nov 2, 2022
9b360fa
Added type hints per reviewer note.
roadswitcher Nov 2, 2022
e5b8d7a
Update pandas/core/strings/object_array.py
roadswitcher Nov 2, 2022
fa3c521
Update pandas/tests/io/parser/test_c_parser_only.py
roadswitcher Nov 2, 2022
f486673
Merge branch 'main' into cell_var_from_loop
roadswitcher Nov 2, 2022
564a4b2
Merge branch 'main' into cell_var_from_loop
roadswitcher Nov 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pandas/core/strings/object_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ def _str_get_dummies(self, sep: str = "|"):

for i, t in enumerate(tags2):
pat = sep + t + sep
# pylint: disable-next=cell-var-from-loop
dummies[:, i] = lib.map_infer(arr.to_numpy(), lambda x: pat in x)
return dummies, tags2

Expand Down
3 changes: 2 additions & 1 deletion pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -4124,7 +4124,7 @@ def process_filter(field, filt):
# the levels
if self.is_multi_index:
filt = filt.union(Index(self.levels))

# pylint: disable-next=cell-var-from-loop
takers = op(axis_values, filt)
return obj.loc(axis=axis_number)[takers]

Expand All @@ -4138,6 +4138,7 @@ def process_filter(field, filt):
# hack until we support reversed dim flags
if isinstance(obj, DataFrame):
axis_number = 1 - axis_number
# pylint: disable-next=cell-var-from-loop
takers = op(values, filt)
return obj.loc(axis=axis_number)[takers]

Expand Down
10 changes: 5 additions & 5 deletions pandas/tests/io/parser/test_c_parser_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ def test_precise_conversion(c_parser_only):
normal_errors = []
precise_errors = []

def error(val, actual_val):
return abs(Decimal(f"{val:.100}") - actual_val)

# test numbers between 1 and 2
for num in np.linspace(1.0, 2.0, num=500):
# 25 decimal digits of precision
Expand All @@ -192,11 +195,8 @@ def test_precise_conversion(c_parser_only):
)
actual_val = Decimal(text[2:])

def error(val):
return abs(Decimal(f"{val:.100}") - actual_val)

normal_errors.append(error(normal_val))
precise_errors.append(error(precise_val))
normal_errors.append(error(normal_val, actual_val))
precise_errors.append(error(precise_val, actual_val))

# round-trip should match float()
assert roundtrip_val == float(text[2:])
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ disable = [
"arguments-renamed",
"attribute-defined-outside-init",
"broad-except",
"cell-var-from-loop",
"comparison-with-callable",
"confusing-with-statement",
"dangerous-default-value",
Expand Down