-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
STYLE ruff: enable PIE #51434
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
STYLE ruff: enable PIE #51434
Changes from 2 commits
6d05c42
7bb6483
e24c898
73b3951
0970ed5
b4de25d
0bf01bb
6942810
416f49f
f58be1c
da52ef7
2d3ffb9
2cdc091
6cd00ab
df2d3fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -836,8 +836,6 @@ def view(self, dtype: Dtype | None = None) -> Series: | |
|
||
# ---------------------------------------------------------------------- | ||
# NDArray Compat | ||
_HANDLED_TYPES = (Index, ExtensionArray, np.ndarray) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why remove this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error was PIE794. The fix that was suggested was removing one of the instances. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah you're right, it is indeed duplicated. thanks! |
||
|
||
def __array__(self, dtype: npt.DTypeLike | None = None) -> np.ndarray: | ||
""" | ||
Return the values as a NumPy array. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,15 +200,15 @@ class CSSResolver: | |
SIDES = ("top", "right", "bottom", "left") | ||
|
||
CSS_EXPANSIONS = { | ||
**{ | ||
{ | ||
(f"border-{prop}" if prop else "border"): _border_expander(prop) | ||
for prop in ["", "top", "right", "bottom", "left"] | ||
}, | ||
**{ | ||
{ | ||
f"border-{prop}": _side_expander(f"border-{{:s}}-{prop}") | ||
for prop in ["color", "style", "width"] | ||
}, | ||
**{ | ||
{ | ||
"margin": _side_expander("margin-{:s}"), | ||
"padding": _side_expander("padding-{:s}"), | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like this one is causing some test failures There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You probably want CSS_EXPANSIONS = {
**{
(f"border-{prop}" if prop else "border"): _border_expander(prop)
for prop in ["", "top", "right", "bottom", "left"]
},
**{
f"border-{prop}": _side_expander(f"border-{{:s}}-{prop}")
for prop in ["color", "style", "width"]
},
"margin": _side_expander("margin-{:s}"),
"padding": _side_expander("padding-{:s}"),
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the PIE error that was generated. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -875,7 +875,6 @@ class StataMissingValue: | |
float32_base = struct.pack("<i", int_value) | ||
|
||
float64_base: bytes = b"\x00\x00\x00\x00\x00\x00\xe0\x7f" | ||
increment = struct.unpack("q", b"\x00\x00\x00\x00\x00\x01\x00\x00")[0] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why remove this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error was PIE794. The fix that was suggested was removing one of the instances. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks - I don't think we can remove it though can you rename the first one to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have corrected this. |
||
for i in range(27): | ||
key = struct.unpack("<d", float64_base)[0] | ||
MISSING_VALUES[key] = "." | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -489,7 +489,7 @@ def keys(self): | |
df = DataFrame({"A": [1, 2], "B": [0.2, 1.5], "C": ["a", "bc"]}) | ||
|
||
dtype_mappings = { | ||
"column_dtypes": DictLike(**{"A": np.int8, "B": np.float32}), | ||
"column_dtypes": DictLike({"A": np.int8, "B": np.float32}), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this isn't right, you want
you can run this test with
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running pytest command is giving:
I have checked the module that was said to be missing and it exists. I searched and found this. I have made the required change and will be pushing it to remote. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you need to follow the instructions here to run tests https://pandas.pydata.org/docs/dev/development/contributing_environment.html |
||
"index_dtypes": f"{tm.ENDIAN}U2", | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -212,6 +212,8 @@ select = [ | |
"Q", | ||
# pylint | ||
"PLE", "PLR", "PLW", | ||
# misc lints | ||
"PIE", | ||
] | ||
|
||
ignore = [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we not add this please? there's a few false positives which risk confusing contributors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Would remove it.