-
Notifications
You must be signed in to change notification settings - Fork 15
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
Migrate to ruff #215
Migrate to ruff #215
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #215 +/- ##
=======================================
Coverage 98.65% 98.65%
=======================================
Files 32 32
Lines 1486 1487 +1
=======================================
+ Hits 1466 1467 +1
Misses 20 20
|
@@ -137,7 +139,7 @@ def __call__(cls, *args, **kwargs): | |||
# deprecated class is in jinja2 template). __module__ attribute is not | |||
# important enough to raise an exception as users may be unable | |||
# to fix inspect.stack() errors. | |||
warn(f"Error detecting parent module: {e!r}") | |||
warn(f"Error detecting parent module: {e!r}", stacklevel=1) |
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.
Not sure what's the good level here, so I kept the implicit one.
@@ -7,7 +7,7 @@ | |||
from .url import ResponseUrl | |||
|
|||
|
|||
class BrowserHtml(SelectableMixin, str): | |||
class BrowserHtml(SelectableMixin, str): # noqa: SLOT000 |
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.
Not 100% sure how it works, but it looks like even if __slots__
is defined here, it has no effect (I assume because the other base class doesn't have it).
|
||
setup( | ||
name="web-poet", | ||
version="0.18.0", | ||
description="Zyte's Page Object pattern for web scraping", | ||
long_description=long_description, | ||
long_description=Path("README.rst").read_text(), |
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.
Not an issue specific to these changes, but this may be a good opportunity to specify the encoding, for cross-platform support (not sure when that would become an issue, but it has hit us in the past precisely in setup.py).
Enabling postponed annotations in tests/test_serialization.py breaks two tests because
get_type_hints()
probably doesn't resolve locally defined classes correctly in this case. In one test it's called fromsingledispatch()
, and it seems to be a known incompatibility before Python 3.14. In another test it's called from andi, and it may suggest that andi doesn't support some user code that uses postponed annotations in the plan callables (andi has some tests for them, but maybe they don't test everything).Edit: enabling postponed annotations in files that define attr-classes also leads to similar breakages. It could be possible to fix somewhere, though the actual crash is inside
typing.get_type_hints()
, but needs to be done separately and won't help older versions.