mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-09-06 17:57:58 +00:00
ruff: enable B (flake8-bugbear)
Fixes 71 violations across production and test code: - B904 (~50): raise-from in except blocks; from None at API/view boundaries, from exc where the cause is the direct origin - B017 (9): pytest.raises(Exception) → specific type or match= arg - B007 (5): unused loop vars renamed to _ - B027 (1): missing @abstractmethod on DateParserPluginBase.__exit__ - B028 (3): warnings.warn without stacklevel=2 in test utils - B011 (1): assert False → raise AssertionError() - B905 (3): zip() without strict=False - B009 (3): getattr with constant string (auto-fixed) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
6f1673e0ae
commit
976eb3beaa
@@ -334,7 +334,7 @@ def parse_dateparser_languages(languages: str | None) -> list[str]:
|
||||
language_list = languages.split("+") if languages else []
|
||||
# There is an unfixed issue in zh-Hant and zh-Hans locales in the dateparser lib.
|
||||
# See: https://github.com/scrapinghub/dateparser/issues/875
|
||||
for index, language in enumerate(language_list):
|
||||
for _, language in enumerate(language_list):
|
||||
if language.startswith("zh-") and "zh" not in language_list:
|
||||
logger.warning(
|
||||
f"Chinese locale detected: {language}. dateparser might fail to parse"
|
||||
|
||||
Reference in New Issue
Block a user