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
3.3.0 breaks pylint #102
Comments
This is a pylint bug, not ours 👍 Please open an issue there. |
It may be that pylint is not perfect in this regard, I just think that fixing this in this package is much more straightforward and quicker than trying to get pylint to cater to this corner case. Two ways I see: |
Note the import in the root package are not guarded by the if branch, so they're always executed, therefore you cannot raise the error without moving the import. |
You'll need to do some mangling with the type checker too, but if you put in a PR to change it and passes the CI I'll review it. |
This is sort of unfortunate approach I'd say. I am not going to debate whether this is pylint problem or not. What will likely happen is that those who run pylint on the code using filelock will likely stick to 3.2.0. |
|
Is there a bug report open now in pylint? I just got hit by this in automated test suite, which didn't have locked version. Just waiting over a weekend now to decide if locking to older version or not. |
Seems this cannot be done because unsettles the type checker.
If I remove the ABC then the static checkers complain that class does not implement all abstract methods from the base. If someone comes up with a solution that pleases both the static checker + type checker + documentation generation I'm still happy to review. In the meantime I'll close it as a pylint bug. |
@Zahlii Did you report this in the pylint repository? Could we add a link here? |
Given that this issue can be "fixed" by disabling the inspection per statement I haven't bothered opening it, especially since I am not entirely sure this indeed is a pylint bug. # pylint: disable=abstract-class-instantiated
with filelock.FileLock(lockfile):
pass |
Instead of leaving abstract methods without definition when running on the other platform (Unix vs Windows), define them and raise a PlatformMismatchError if called on the wrong platform. This fixes pylint warnings such as Abstract class 'WindowsFileLock' with abstract methods instantiated Abstract class 'UnixFileLock' with abstract methods instantiated Fixes tox-dev#102
Would it work to have the methods raise e.g. a PlatformMismatchError if they run on the wrong platform? (See suggestion in pull request.) |
Since the last update, I am getting the following warnings. I suspect this has to do with the fact that pylint cannot deduce that the correct instance will not be superclassed by ABC (if-else definition of classes).
The text was updated successfully, but these errors were encountered: