-
-
Notifications
You must be signed in to change notification settings - Fork 7
refactor: select all lint rules #35
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
base: main
Are you sure you want to change the base?
Conversation
Reviewer's GuideThis PR refactors the Ruff lint config to use a catch-all rule, modernizes type hints to PEP 585 generics, cleans up test parameterization and benchmarks for consistency, switches to named boolean flags in parse_url_encoded_dict calls, and trims redundant badges in the README. Class diagram for updated type hints in benchmarks.pyclassDiagram
class parse_url_encoded_form_data {
+parse_url_encoded_form_data(encoded_data: bytes) dict[str, Any]
}
class bench_qsl {
+bench_qsl(runner: pyperf.Runner) None
}
class bench_qs {
+bench_qs(runner: pyperf.Runner) None
}
parse_url_encoded_form_data --> "defaultdict[str, list[Any]]" DefaultDict
parse_url_encoded_form_data --> "loads" JSONDecode
bench_qsl --> "pyperf.Runner" Runner
bench_qs --> "pyperf.Runner" Runner
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey there - I've reviewed your changes - here's some feedback:
- The new PEP585-style generics (e.g. list[tuple[str, str]]) aren’t supported on Python 3.8 as declared in your config—either revert to typing.List/Tuple or bump the minimum Python version.
- In the README code snippet you imported
listfrom typing, which is invalid—switch that import toList(or remove it and use the built-in list) to avoid errors.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new PEP585-style generics (e.g. list[tuple[str, str]]) aren’t supported on Python 3.8 as declared in your config—either revert to typing.List/Tuple or bump the minimum Python version.
- In the README code snippet you imported `list` from typing, which is invalid—switch that import to `List` (or remove it and use the built-in list) to avoid errors.
## Individual Comments
### Comment 1
<location> `benchmarks.py:38-40` </location>
<code_context>
def parse_url_encoded_form_data(encoded_data: bytes) -> Dict[str, Any]:
"""Parse an url encoded form data into dict of parsed values"""
- decoded_dict: DefaultDict[str, List[Any]] = defaultdict(list)
+ decoded_dict: DefaultDict[str, list[Any]] = defaultdict(list)
for k, v in parse_qsl(encoded_data.decode(), keep_blank_values=True):
</code_context>
<issue_to_address>
**issue:** Using built-in generic types for defaultdict may impact compatibility with older Python versions.
This type annotation is only supported in Python 3.9 and above; consider using the older syntax if you need compatibility with earlier versions.
</issue_to_address>
### Comment 2
<location> `README.md:130` </location>
<code_context>
def parse_url_encoded_form_data(encoded_data: bytes) -> Dict[str, Any]:
"""Parse an url encoded form data into dict of parsed values"""
- decoded_dict: DefaultDict[str, List[Any]] = defaultdict(list)
+ decoded_dict: DefaultDict[str, list[Any]] = defaultdict(list)
</code_context>
<issue_to_address>
**issue (typo):** Change 'an url' to 'a url' in the docstring for correct grammar.
Replace 'an' with 'a' before 'url' in the docstring for grammatical accuracy.
```suggestion
"""Parse a url encoded form data into dict of parsed values"""
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: Winston H. <56998716+winstxnhdw@users.noreply.github.com>
As mentioned here, we default to selecting all lint rules.
Summary by Sourcery
Modernize project configuration and code style by defaulting to all Ruff lint rules, adopting PEP 585 generics throughout, cleaning up test parametrization, and synchronizing documentation with these changes.
Enhancements:
Documentation: