Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mein Name committed Oct 28, 2024
1 parent b7e7510 commit e83f094
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 35 deletions.
49 changes: 27 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
exclude: ^test_data/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: check-xml
- id: check-toml
- id: check-ast
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-symlinks
- id: check-added-large-files
- id: check-json
- id: check-xml
- id: check-toml
- id: check-ast
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-symlinks
- id: check-added-large-files
args: [--maxkb=1024]
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: debug-statements
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- id: requirements-txt-fixer
- id: mixed-line-ending
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: debug-statements
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- id: requirements-txt-fixer
- id: mixed-line-ending

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.7
rev: v0.7.1
hooks:
- id: ruff
# - id: ruff-format
Expand All @@ -39,14 +39,19 @@ repos:
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
- id: black

- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.34.1
rev: v1.35.2
hooks:
- id: djlint-reformat-django
- id: djlint-django

# - repo: https://github.com/RobertCraigie/pyright-python
# rev: v1.1.386
# hooks:
# - id: pyright

- repo: local
hooks:
- id: pyright
Expand Down
8 changes: 4 additions & 4 deletions catalog/sites/bandcamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ def validate_url_fallback(cls, url):
hostname = parsed_url.netloc
try:
answers = dns.resolver.query(hostname, "CNAME")
for rdata in answers: # type:ignore
if str(rdata.target) == "dom.bandcamp.com.":
for rdata in answers:
if str(rdata.target) == "dom.bandcamp.com.": # type:ignore
return True
except Exception:
pass
try:
answers = dns.resolver.query(hostname, "A")
for rdata in answers: # type:ignore
if str(rdata.address) == "35.241.62.186":
for rdata in answers:
if str(rdata.address) == "35.241.62.186": # type:ignore
return True
except Exception:
pass
Expand Down
8 changes: 4 additions & 4 deletions catalog/sites/bangumi.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def scrape(self):
case "别名":
other_title = (
[d["v"] for d in v]
if type(v) == list
if isinstance(v, list)
else ([v] if isinstance(v, str) else [])
)
case "imdb_id":
Expand All @@ -93,13 +93,13 @@ def scrape(self):
case "作者":
authors = (
[d["v"] for d in v]
if type(v) == list
if isinstance(v, list)
else ([v] if isinstance(v, str) else [])
)
case "平台":
platform = (
[d["v"] for d in v]
if type(v) == list
if isinstance(v, list)
else ([v] if isinstance(v, str) else [])
)
case "游戏类型":
Expand All @@ -109,7 +109,7 @@ def scrape(self):
else ([v] if isinstance(v, str) else [])
)
case "官方网站" | "website":
site = v[0] if type(v) == list else v
site = v[0] if isinstance(v, list) else v

img_url = o["images"].get("large") or o["images"].get("common")
raw_img = None
Expand Down
6 changes: 3 additions & 3 deletions catalog/sites/steam.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

def _get_preferred_languages():
langs = {}
for l in PREFERRED_LANGUAGES:
if l == "zh":
for la in PREFERRED_LANGUAGES:
if la == "zh":
langs.update({"zh-cn": "zh-CN", "zh-tw": "zh-TW"})
# zh-HK data is not good
else:
langs[l] = l
langs[la] = la
return langs


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dev-dependencies = [
"djlint>=1.35.2",
"isort~=5.13.2",
"lxml-stubs>=0.5.1",
"pyright>=1.1.384",
"pyright>=1.1.386",
"ruff>=0.7.1",
"mkdocs-material>=9.5.42",
]
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ pygments==2.18.0
# via mkdocs-material
pymdown-extensions==10.8.1
# via mkdocs-material
pyright==1.1.384
pyright==1.1.386
python-dateutil==2.9.0.post0
# via dateparser
# via django-auditlog
Expand Down

0 comments on commit e83f094

Please sign in to comment.