Repository navigation
Conversation
Medno
commented
Jun 27, 2026
Comment on lines
+12
to
-18
| import urllib.parse | ||
|
|
||
| from ago import human | ||
| import boto3 | ||
| import botocore | ||
| from dateutil import parser | ||
| from hurry.filesize import size | ||
| from scrapy.utils.log import configure_logging | ||
| from six.moves import urllib |
Contributor
Author
There was a problem hiding this comment.
Here is an example of six package replacement by urllib.parse
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The package currently lacks consistency due to a heterogeneous coding style.
Several tools are available to improve code consistency and readability, including linters and formatters. Among them, ruff has recently gained significant popularity thanks to its speed and broad feature set. It is a compelling alternative to black, while also providing linting and formatting capabilities.
Running the linter also highlighted several compatibility layers intended to support both Python 2 and Python 3. Since Python 2 is no longer supported by the project, this PR removes these legacy compatibility patterns.
Proposed changes
Added a pre-commit configuration
ruff checkandruff formathooks.pre-committoextras_requireinsetup.py.Applied
ruffto the codebaseThe largest part of the diff is the formatting-only commit: 922c1e8. This commit does not introduce any functional changes.
.git-blame-ignore-revsfile so thatgit blamecan ignore this formatting commit and keep the history easier to navigate.Applied several PEP 8 recommendations:
except:statements with explicitexcept Exception:.!= Nonewithis not None.Removed legacy Python 2 compatibility
try ... except ImportErrorpatterns used to support both Python 2 and Python 3 imports (e.g.urllib.parse).sixdependency and replaced its usage with native Python 3 features.How to test
Run the configured pre-commit hooks:
source .venv/bin/activate pre-commit run --all-files