From 67329e6622c38b5932d3e84542c620da16a21073 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Fri, 15 Dec 2023 17:40:57 +0100 Subject: Prevent loading related object when updating tags We can simply save by the ID here, we do not need any other data from the related object. --- pydis_site/apps/content/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pydis_site/apps/content/utils.py') diff --git a/pydis_site/apps/content/utils.py b/pydis_site/apps/content/utils.py index cfd73d67..9c949a93 100644 --- a/pydis_site/apps/content/utils.py +++ b/pydis_site/apps/content/utils.py @@ -206,9 +206,9 @@ def record_tags(tags: list[Tag]) -> None: # pretend it's previous state is the current state old_tag = new_tag - if old_tag.sha == new_tag.sha and old_tag.last_commit is not None: + if old_tag.sha == new_tag.sha and old_tag.last_commit_id is not None: # We still have an up-to-date commit entry - new_tag.last_commit = old_tag.last_commit + new_tag.last_commit_id = old_tag.last_commit_id new_tag.save() -- cgit v1.2.3 From 5cd802be1da397c448898c6aab1c3bebc2e417e3 Mon Sep 17 00:00:00 2001 From: Xithrius Date: Thu, 1 Feb 2024 23:09:49 -0800 Subject: Appeased the linter --- pydis_site/apps/content/utils.py | 2 +- pyproject.toml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'pydis_site/apps/content/utils.py') diff --git a/pydis_site/apps/content/utils.py b/pydis_site/apps/content/utils.py index 9c949a93..5a146e10 100644 --- a/pydis_site/apps/content/utils.py +++ b/pydis_site/apps/content/utils.py @@ -107,7 +107,7 @@ def fetch_tags() -> list[Tag]: for file in repo.getmembers(): if "/bot/resources/tags" in file.path: included.append(file) - repo.extractall(folder, included) + repo.extractall(folder, included) # noqa: S202 for tag_file in Path(folder).rglob("*.md"): name = tag_file.name diff --git a/pyproject.toml b/pyproject.toml index 334ad4e4..32acf064 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,9 @@ build-backend = "poetry.core.masonry.api" [tool.ruff] target-version = "py311" extend-exclude = [".cache"] +line-length = 120 + +[tool.ruff.lint] ignore = [ "ANN002", "ANN003", "ANN101", "ANN102", "ANN204", "ANN206", "ANN401", "B904", @@ -57,10 +60,9 @@ ignore = [ "S311", "SIM102", "SIM108", ] -line-length = 120 select = ["ANN", "B", "C4", "D", "DJ", "DTZ", "E", "F", "ISC", "INT", "N", "PGH", "PIE", "RET", "RSE", "RUF", "S", "SIM", "T20", "TID", "UP", "W"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "pydis_site/apps/**/migrations/*.py" = ["ALL"] "manage.py" = ["T201"] "pydis_site/apps/api/tests/base.py" = ["S106"] -- cgit v1.2.3