Skip to content

Commit

Permalink
update dependencies (#766)
Browse files Browse the repository at this point in the history
* update dependencies

* fix lint

* sync migration

---------

Co-authored-by: mein Name <ich@example.com>
  • Loading branch information
alphatownsman and mein Name authored Oct 28, 2024
1 parent 7293e6c commit 4c5c970
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 337 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ __pycache__/
# VS Code configuration files
.vscode/

# Zed settings
.zed

# flake8
tox.ini

Expand Down
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
13 changes: 0 additions & 13 deletions boofilsic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@
IGDB_API_CLIENT_SECRET=(str, ""),
# Discord webhooks
DISCORD_WEBHOOKS=(dict, {"user-report": None}),
# Slack API token, for sending exceptions to Slack, may deprecate in future
SLACK_API_TOKEN=(str, ""),
THREADS_APP_ID=(str, ""),
THREADS_APP_SECRET=(str, ""),
NEODB_ENABLE_LOGIN_BLUESKY=(bool, False),
Expand Down Expand Up @@ -276,8 +274,6 @@
DISCOGS_API_KEY = env("DISCOGS_API_KEY")
IGDB_CLIENT_ID = env("IGDB_API_CLIENT_ID")
IGDB_CLIENT_SECRET = env("IGDB_API_CLIENT_SECRET")
SLACK_TOKEN = env("SLACK_API_TOKEN")
SLACK_CHANNEL = "alert"

DOWNLOADER_PROXY_LIST = env("NEODB_DOWNLOADER_PROXY_LIST")
DOWNLOADER_BACKUP_PROXY = env("NEODB_DOWNLOADER_BACKUP_PROXY", default="") # type: ignore
Expand Down Expand Up @@ -412,15 +408,6 @@
logging.getLogger("httpx").setLevel(logging.WARNING)
logging.getLogger("httpcore").setLevel(logging.WARNING)

if SLACK_TOKEN:
INSTALLED_APPS += [
"django_slack",
]
LOGGING["handlers"]["slack"] = {
"level": "ERROR",
"class": "django_slack.log.SlackExceptionHandler",
}
LOGGING["loggers"]["django"] = {"handlers": ["slack"], "level": "ERROR"}

MARKDOWNX_MARKDOWNIFY_FUNCTION = "journal.models.render_md"

Expand Down
71 changes: 0 additions & 71 deletions catalog/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import uuid

import django.db.models.deletion
import simple_history.models
from django.db import migrations, models

import catalog.common.utils
Expand Down Expand Up @@ -101,76 +100,6 @@ class Migration(migrations.Migration):
("edited_time", models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name="HistoricalItem",
fields=[
(
"id",
models.BigIntegerField(
auto_created=True, blank=True, db_index=True, verbose_name="ID"
),
),
(
"uid",
models.UUIDField(db_index=True, default=uuid.uuid4, editable=False),
),
(
"title",
models.CharField(default="", max_length=1000, verbose_name="标题"),
),
(
"brief",
models.TextField(blank=True, default="", verbose_name="简介"),
),
(
"primary_lookup_id_type",
models.CharField(
max_length=50, null=True, verbose_name="主要标识类型"
),
),
(
"primary_lookup_id_value",
models.CharField(
max_length=1000, null=True, verbose_name="主要标识数值"
),
),
(
"metadata",
models.JSONField(
blank=True, default=dict, null=True, verbose_name="其它信息"
),
),
(
"cover",
models.TextField(
blank=True,
default="item/default.svg",
max_length=100,
verbose_name="封面",
),
),
("created_time", models.DateTimeField(blank=True, editable=False)),
("edited_time", models.DateTimeField(blank=True, editable=False)),
("is_deleted", models.BooleanField(db_index=True, default=False)),
("history_id", models.AutoField(primary_key=True, serialize=False)),
("history_date", models.DateTimeField(db_index=True)),
("history_change_reason", models.CharField(max_length=100, null=True)),
(
"history_type",
models.CharField(
choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
max_length=1,
),
),
],
options={
"verbose_name": "historical item",
"verbose_name_plural": "historical items",
"ordering": ("-history_date", "-history_id"),
"get_latest_by": ("history_date", "history_id"),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
migrations.CreateModel(
name="Item",
fields=[
Expand Down
48 changes: 0 additions & 48 deletions catalog/migrations/0002_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,54 +47,6 @@ class Migration(migrations.Migration):
to="contenttypes.contenttype",
),
),
migrations.AddField(
model_name="historicalitem",
name="history_user",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="historicalitem",
name="last_editor",
field=models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="historicalitem",
name="merged_to_item",
field=models.ForeignKey(
blank=True,
db_constraint=False,
default=None,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="catalog.item",
),
),
migrations.AddField(
model_name="historicalitem",
name="polymorphic_ctype",
field=models.ForeignKey(
blank=True,
db_constraint=False,
editable=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="contenttypes.contenttype",
),
),
migrations.AddField(
model_name="externalresource",
name="item",
Expand Down
92 changes: 48 additions & 44 deletions catalog/migrations/0012_alter_model_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,55 +55,13 @@ class Migration(migrations.Migration):
("apple_podcast", "Apple Podcast"),
("apple_music", "Apple Music"),
("fedi", "Fediverse"),
("qidian", "Qidian"),
("ypshuo", "Ypshuo"),
],
max_length=50,
verbose_name="IdType of the source site",
),
),
migrations.AlterField(
model_name="item",
name="brief",
field=models.TextField(blank=True, default="", verbose_name="description"),
),
migrations.AlterField(
model_name="item",
name="cover",
field=models.ImageField(
blank=True,
default="item/default.svg",
upload_to=catalog.common.utils.item_cover_path,
verbose_name="cover",
),
),
migrations.AlterField(
model_name="item",
name="metadata",
field=models.JSONField(
blank=True, default=dict, null=True, verbose_name="metadata"
),
),
migrations.AlterField(
model_name="item",
name="primary_lookup_id_type",
field=models.CharField(
max_length=50, null=True, verbose_name="Primary ID Type"
),
),
migrations.AlterField(
model_name="item",
name="primary_lookup_id_value",
field=models.CharField(
help_text="automatically detected, usually no change necessary, left empty if unsure",
max_length=1000,
null=True,
verbose_name="Primary ID Value",
),
),
migrations.AlterField(
model_name="item",
name="title",
field=models.CharField(default="", max_length=1000, verbose_name="title"),
),
migrations.AlterField(
model_name="itemlookupid",
name="id_type",
Expand Down Expand Up @@ -148,11 +106,57 @@ class Migration(migrations.Migration):
("apple_podcast", "Apple Podcast"),
("apple_music", "Apple Music"),
("fedi", "Fediverse"),
("qidian", "Qidian"),
("ypshuo", "Ypshuo"),
],
max_length=50,
verbose_name="source site",
),
),
migrations.AlterField(
model_name="item",
name="brief",
field=models.TextField(blank=True, default="", verbose_name="description"),
),
migrations.AlterField(
model_name="item",
name="cover",
field=models.ImageField(
blank=True,
default="item/default.svg",
upload_to=catalog.common.utils.item_cover_path,
verbose_name="cover",
),
),
migrations.AlterField(
model_name="item",
name="metadata",
field=models.JSONField(
blank=True, default=dict, null=True, verbose_name="metadata"
),
),
migrations.AlterField(
model_name="item",
name="primary_lookup_id_type",
field=models.CharField(
max_length=50, null=True, verbose_name="Primary ID Type"
),
),
migrations.AlterField(
model_name="item",
name="primary_lookup_id_value",
field=models.CharField(
help_text="automatically detected, usually no change necessary, left empty if unsure",
max_length=1000,
null=True,
verbose_name="Primary ID Value",
),
),
migrations.AlterField(
model_name="item",
name="title",
field=models.CharField(default="", max_length=1000, verbose_name="title"),
),
migrations.AlterField(
model_name="itemlookupid",
name="id_value",
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
Loading

0 comments on commit 4c5c970

Please sign in to comment.