Skip to content
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

DEPR: enforce a bunch #49552

Merged
merged 6 commits into from
Nov 7, 2022
Merged

DEPR: enforce a bunch #49552

merged 6 commits into from
Nov 7, 2022

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@jbrockmendel
Copy link
Member Author

@MarcoGorelli pls advise on the pylint failures, not clear if they are actionable

@MarcoGorelli
Copy link
Member

probably not, do you want to add c-extension-no-member to

pandas/pyproject.toml

Lines 60 to 78 in 1d8922e

disable = [
"abstract-class-instantiated",
"import-error",
"invalid-repr-returned",
"invalid-unary-operand-type",
"no-member",
"no-name-in-module",
"no-value-for-parameter",
"not-an-iterable",
"not-callable",
"redundant-keyword-arg",
"too-many-function-args",
"undefined-variable",
"unexpected-keyword-arg",
"unpacking-non-sequence",
"unsubscriptable-object",
"unsupported-assignment-operation",
"unsupported-membership-test",
"used-before-assignment",

alongside this PR?

@jbrockmendel
Copy link
Member Author

pandas/core/frame.py:688:12: R1720: Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it (no-else-raise)

Will this check start showing up in the pre-commit soon? Otherwise let's get rid of it. (and even if yes, im not a fan)

@MarcoGorelli
Copy link
Member

MarcoGorelli commented Nov 7, 2022

yeah happy to get rid of it if you like - I'm glad that some of these pylint checks are helping find issue (like #49382 (review)), but others no-else-raise does seem nitpicky

EDIT: will review the rest of the PR this afternoon

@@ -315,6 +317,7 @@ Removal of prior version deprecations/changes
- Removed argument ``line_terminator`` from :meth:`DataFrame.to_csv` and :meth:`Series.to_csv`, use ``lineterminator`` instead (:issue:`45302`)
- Removed argument ``inplace`` from :meth:`DataFrame.set_axis` and :meth:`Series.set_axis`, use ``obj = obj.set_axis(..., copy=False)`` instead (:issue:`48130`)
- Disallow passing positional arguments to :meth:`MultiIndex.set_levels` and :meth:`MultiIndex.set_codes` (:issue:`41485`)
- Disallow parsing to Timedelta strings with components with units "Y", "y", or "m", as these do not represent unambiguous durations (:issue:`47268`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issue number doesn't explain the context particularly well to users, is there a better reference? maybe #36838

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, here you have 'm' whereas in the warning message there's 'M'

Comment on lines -262 to +260
compare(
ts_utc,
datetime.utcfromtimestamp(current_time),
)

ts_utc = Timestamp.utcfromtimestamp(current_time)
assert ts_utc.timestamp() == current_time
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for my understanding, why did

        compare(
            ts_utc,
            datetime.utcfromtimestamp(current_time),
        )

have to change into

        assert ts_utc.timestamp() == current_time

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because datetime.utcfromtimestamp(current_time) behaves differently from pd.Timestamp.utcfromtimestamp(current_time), so using compare to check they match would be wrong.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I follow, sorry, how would it be wrong?

the rest looks fine anyway, I've removed the 'requested changes', but I'll leave this change to someone else to approve

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, the assertion would still hold. Either way is fine.

Copy link
Member

@mroeschke mroeschke Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO I am fine with not using compare here (especially with #49076 possibly changing .value)

@mroeschke mroeschke added Code Style Code style, linting, code_checks Deprecate Functionality to remove in pandas and removed Code Style Code style, linting, code_checks labels Nov 7, 2022
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving so as to remove my "requested changes", but I don't follow the change in #49552 (comment) so it'd be good if someone else could have a look at that

The rest looks good

@mroeschke mroeschke added this to the 2.0 milestone Nov 7, 2022
@mroeschke mroeschke merged commit 7bffe51 into pandas-dev:main Nov 7, 2022
@mroeschke
Copy link
Member

Thanks @jbrockmendel

phofl pushed a commit to phofl/pandas that referenced this pull request Nov 9, 2022
* DEPR: enforce a bunch

* docstring fixup

* disable pylint check

* pylint fixup

* Fix gh ref in whatsnew
noatamir pushed a commit to noatamir/pandas that referenced this pull request Nov 9, 2022
* DEPR: enforce a bunch

* docstring fixup

* disable pylint check

* pylint fixup

* Fix gh ref in whatsnew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants