Skip to content

STYLE remove --keep-runtime-typing from pyupgrade #40759

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

Closed
MarcoGorelli opened this issue Apr 2, 2021 · 4 comments · Fixed by #40802 or #40805
Closed

STYLE remove --keep-runtime-typing from pyupgrade #40759

MarcoGorelli opened this issue Apr 2, 2021 · 4 comments · Fixed by #40802 or #40805
Labels
Code Style Code style, linting, code_checks good first issue

Comments

@MarcoGorelli
Copy link
Member

MarcoGorelli commented Apr 2, 2021

xref @simonjayhawkins 's comment: #40545 (comment)

Task is:

  • remove keep-runtime-typing from:

args: [--py37-plus, --keep-runtime-typing]

  • run pre-commit run pyupgrade --all-files
  • run pre-commit run flake8 --all-files, fixup any errors (probably some about extra imports)

Finally, run pre-commit run --all-files (this may take a few minutes), fixup any hooks which don't pass, and when everything passes, open a pull request 🚀

@MarcoGorelli MarcoGorelli added good first issue Code Style Code style, linting, code_checks labels Apr 2, 2021
@fathomer
Copy link
Contributor

fathomer commented Apr 3, 2021

Hi
I was working on this issue, fixed all the import errors from flake8, but there are some(19) "F821 undefined name" errors thrown by flake8 which seem to be some sort of false-positives. Is it ok to suppress them ?

As an example, for the file pandas/core/dtypes/generic.py ->
pandas/core/dtypes/generic.py:37:5: F821 undefined name 'Int64Index'

But I don't see anything which suggests there is anything wrong with line 37 :
ABCInt64Index = cast( "Type[Int64Index]", create_pandas_abc_type("ABCInt64Index", "_typ", ("int64index",)), )

There are multiple such instances in the same file.
Is it ok to suppress or them or is there any way to fix ?

@MarcoGorelli
Copy link
Member Author

Hi @fathomer ,

pandas/core/dtypes/generic.py wouldn't get rewritten by pyupgrade, so I don't see why anything else would have to change there, but if you open a pull request I can take a look

@fathomer
Copy link
Contributor

fathomer commented Apr 3, 2021

@MarcoGorelli raised the pull request, but there are some errors now in mypy type validations due to the changes by pyupgrade.
Any ideas on how to proceed on this?

@MarcoGorelli
Copy link
Member Author

I've left a comment on the PR (#40773 (comment)), let's continue the conversation there

fathomer added a commit to fathomer/pandas that referenced this issue Apr 4, 2021
fathomer added a commit to fathomer/pandas that referenced this issue Apr 4, 2021
fathomer added a commit to fathomer/pandas that referenced this issue Apr 4, 2021
fathomer added a commit to fathomer/pandas that referenced this issue Apr 5, 2021
fathomer added a commit to fathomer/pandas that referenced this issue Apr 5, 2021
fathomer added a commit to fathomer/pandas that referenced this issue Apr 6, 2021
@MarcoGorelli MarcoGorelli reopened this Apr 6, 2021
MarcoGorelli added a commit that referenced this issue Apr 6, 2021
* STY: remove --keep-runtime-typing from pyupgrade #40759 Final_Part-5

* fixup pyupgrade

* fixup

* fixup

* noop

Co-authored-by: Marco Gorelli <[email protected]>
JulianWgs pushed a commit to JulianWgs/pandas that referenced this issue Jul 3, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this issue Jul 3, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this issue Jul 3, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this issue Jul 3, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this issue Jul 3, 2021
…-dev#40805)

* STY: remove --keep-runtime-typing from pyupgrade pandas-dev#40759 Final_Part-5

* fixup pyupgrade

* fixup

* fixup

* noop

Co-authored-by: Marco Gorelli <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks good first issue
Projects
None yet
2 participants