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

Pylint fixes for .pyi files #265

Merged
merged 3 commits into from
Apr 2, 2024
Merged

Pylint fixes for .pyi files #265

merged 3 commits into from
Apr 2, 2024

Conversation

avylove
Copy link
Collaborator

@avylove avylove commented Mar 6, 2024

Pylint recently started checking .pyi files but there are some messages that either don't make sense (ex: unused argument) or aren't strictly necessary in a type hints file (ex: no function docstring).

There is some discussion in pylint-dev/pylint#9096 of quieting these, but rather than wait, I figured we can fix the ones that made sense to fix and disable the others.

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.42%. Comparing base (c28b53f) to head (8c36af6).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #265   +/-   ##
=======================================
  Coverage   95.42%   95.42%           
=======================================
  Files           9        9           
  Lines        1027     1027           
  Branches      216      216           
=======================================
  Hits          980      980           
  Misses         43       43           
  Partials        4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@avylove
Copy link
Collaborator Author

avylove commented Mar 6, 2024

Might have to look at this a little more. Getting this (Although only in the pull_request test run not the push test run. The references are wrong, but still points to something.

blessed/colorspace.py:1: [R0401(cyclic-import), ] Cyclic import (blessed.sequences -> blessed.terminal)

@jquast
Copy link
Owner

jquast commented Mar 6, 2024

looks like it comes from the blessed/sequences.pyi file, importing blessed/terminal.py to use the Terminal type

from .terminal import Terminal

I'm not sure what could be done, except to move all of sequences.* into terminal.* so that they are in the same file

@jquast
Copy link
Owner

jquast commented Mar 6, 2024

I am ok with moving all of sequences into terminal, so long as there is some alias that allows from blessed.sequences import .. statements to continue to work, there are several test cases covering this already.

@avylove
Copy link
Collaborator Author

avylove commented Apr 1, 2024

@jquast, sorry for the delay. I went the route of using a guard if TYPE_CHECKING: in the .pyi files and quoting Terminal in the type annotations. This seems to make Pylint happy without breaking anything else.

We could use from __future__ import annotations to avoid using quotes, but this only works in 3.7+ so could cause issues with someone using 3.5 or 3.6 with typing.

Copy link
Owner

@jquast jquast left a comment

Choose a reason for hiding this comment

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

Thanks for finding a less radical fix :) no need to apologize, looks great, hope you are well!

@avylove avylove merged commit e904de3 into master Apr 2, 2024
25 checks passed
@avylove avylove deleted the pylint_pyi branch April 2, 2024 03:18
@avylove
Copy link
Collaborator Author

avylove commented Apr 2, 2024

Looks like there are some errors due to missing type annotations for the ESC_DELAY changes. Not sure why that should matter, but looks like it does. I'll do a PR for that soon. Of course it doesn't fail locally, so not sure what's different in CI or why it didn't fail when this PR ran it's tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants