Update all the pre-commit hooks

This commit is contained in:
Andrew Godwin 2023-11-09 12:07:21 -07:00
parent e17f17385a
commit 6fdfdca442
66 changed files with 48 additions and 128 deletions

View file

@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
@ -15,21 +15,22 @@ repos:
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: "v3.3.0"
rev: "v3.15.0"
hooks:
- id: pyupgrade
args: [--py310-plus]
args: [--py311-plus]
- repo: https://github.com/adamchainz/django-upgrade
rev: "1.13.0"
rev: "1.15.0"
hooks:
- id: django-upgrade
args: [--target-version, "4.2"]
- repo: https://github.com/psf/black
rev: 22.10.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0
hooks:
- id: black
language_version: python3.11
- repo: https://github.com/pycqa/isort
rev: 5.12.0
@ -38,12 +39,12 @@ repos:
args: ["--profile=black"]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
rev: v1.6.1
hooks:
- id: mypy
exclude: "^tests/"
@ -51,8 +52,6 @@ repos:
[types-pyopenssl, types-mock, types-cachetools, types-python-dateutil]
- repo: https://github.com/rtts/djhtml
rev: v1.5.2
rev: 3.0.6
hooks:
- id: djhtml
- id: djcss
- id: djjs

View file

@ -8,7 +8,6 @@ import stator.models
class Migration(migrations.Migration):
dependencies = [
("activities", "0001_initial"),
]

View file

@ -10,7 +10,6 @@ import core.uploads
class Migration(migrations.Migration):
dependencies = [
("activities", "0002_hashtag"),
]

View file

@ -11,7 +11,6 @@ import stator.models
class Migration(migrations.Migration):
dependencies = [
("users", "0003_identity_followers_etc"),
("activities", "0003_postattachment_null_thumb"),

View file

@ -14,7 +14,6 @@ def timelineevent_populate_published(apps, schema_editor):
class Migration(migrations.Migration):
dependencies = [
("activities", "0004_emoji_post_emojis"),
]

View file

@ -5,7 +5,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0005_report"),
("activities", "0005_post_type_timeline_urls"),

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("activities", "0006_fanout_subject_identity_alter_fanout_type"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("activities", "0007_post_stats"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("users", "0011_announcement"),
("activities", "0008_state_and_post_indexes"),

View file

@ -4,7 +4,6 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("users", "0013_stator_indexes"),
("activities", "0009_alter_timelineevent_index_together"),

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("activities", "0010_stator_indexes"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("activities", "0011_postinteraction_value_alter_postinteraction_type"),
]

View file

@ -5,7 +5,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0015_bookmark"),
("activities", "0012_in_reply_to_index"),

View file

@ -6,7 +6,6 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("activities", "0013_postattachment_author"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("activities", "0014_post_content_vector_gin"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("activities", "0015_alter_postinteraction_type"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("activities", "0017_stator_next_change"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("activities", "0018_timelineevent_dismissed"),
]

View file

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [

View file

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0008_follow_boosts"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("api", "0002_remove_token_code_token_revoked_alter_token_token_and_more"),
]

View file

@ -10,7 +10,6 @@ import core.uploads
class Migration(migrations.Migration):
initial = True
dependencies = [

View file

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0016_hashtagfollow"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("stator", "0001_initial"),
]

View file

@ -16,7 +16,6 @@ import users.models.password_reset
class Migration(migrations.Migration):
initial = True
dependencies = []

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0001_initial"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0002_identity_discoverable"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0003_identity_followers_etc"),
]

View file

@ -9,7 +9,6 @@ import users.models.report
class Migration(migrations.Migration):
dependencies = [
("activities", "0004_emoji_post_emojis"),
("users", "0004_identity_admin_notes_identity_restriction_and_more"),

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0005_report"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0006_identity_actor_type"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0007_remove_invite_email_invite_expires_invite_uses"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0008_follow_boosts"),
]

View file

@ -8,7 +8,6 @@ import users.models.domain
class Migration(migrations.Migration):
dependencies = [
("users", "0009_state_and_post_indexes"),
]

View file

@ -5,7 +5,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0010_domain_state"),
]

View file

@ -8,7 +8,6 @@ import users.models.block
class Migration(migrations.Migration):
dependencies = [
("users", "0011_announcement"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("users", "0012_block_states"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0013_stator_indexes"),
]

View file

@ -5,7 +5,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("activities", "0012_in_reply_to_index"),
("users", "0014_domain_notes"),

View file

@ -5,7 +5,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("activities", "0012_in_reply_to_index"),
("users", "0015_bookmark"),

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0016_hashtagfollow"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0017_identity_featured_collection_uri"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0019_stator_next_change"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0020_alter_identity_local"),
]

View file

@ -4,7 +4,6 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("users", "0021_identity_aliases"),
]

View file

@ -19,7 +19,6 @@ class NodeInfoUsage(BaseModel):
class NodeInfo(BaseModel):
version: Literal["2.0"]
software: NodeInfoSoftware
protocols: list[str] | None

View file

@ -9,7 +9,6 @@ from users.views.admin.generic import HTMXActionView
@method_decorator(admin_required, name="dispatch")
class AnnouncementsRoot(ListView):
template_name = "admin/announcements.html"
paginate_by = 30
@ -26,7 +25,6 @@ class AnnouncementsRoot(ListView):
@method_decorator(admin_required, name="dispatch")
class AnnouncementCreate(CreateView):
model = Announcement
template_name = "admin/announcement_create.html"
extra_context = {"section": "announcements"}
@ -45,7 +43,6 @@ class AnnouncementCreate(CreateView):
@method_decorator(admin_required, name="dispatch")
class AnnouncementEdit(UpdateView):
model = Announcement
template_name = "admin/announcement_edit.html"
extra_context = {"section": "announcements"}
@ -61,7 +58,6 @@ class AnnouncementEdit(UpdateView):
@method_decorator(admin_required, name="dispatch")
class AnnouncementDelete(DeleteView):
model = Announcement
template_name = "admin/announcement_delete.html"
success_url = Announcement.urls.admin_root

View file

@ -35,7 +35,6 @@ class DomainValidator(RegexValidator):
@method_decorator(admin_required, name="dispatch")
class Domains(TemplateView):
template_name = "admin/domains.html"
def get_context_data(self):
@ -47,7 +46,6 @@ class Domains(TemplateView):
@method_decorator(admin_required, name="dispatch")
class DomainCreate(FormView):
template_name = "admin/domain_create.html"
extra_context = {"section": "domains"}
@ -156,7 +154,6 @@ class DomainCreate(FormView):
@method_decorator(admin_required, name="dispatch")
class DomainEdit(FormView):
template_name = "admin/domain_edit.html"
extra_context = {"section": "domains"}
@ -250,7 +247,6 @@ class DomainEdit(FormView):
@method_decorator(admin_required, name="dispatch")
class DomainDelete(TemplateView):
template_name = "admin/domain_delete.html"
def dispatch(self, request, domain):

View file

@ -13,7 +13,6 @@ from users.views.admin.generic import HTMXActionView
@method_decorator(moderator_required, name="dispatch")
class EmojiRoot(ListView):
template_name = "admin/emoji.html"
paginate_by = 50
@ -41,7 +40,6 @@ class EmojiRoot(ListView):
@method_decorator(moderator_required, name="dispatch")
class EmojiCreate(FormView):
template_name = "admin/emoji_create.html"
extra_context = {"section": "emoji"}

View file

@ -10,7 +10,6 @@ from users.decorators import moderator_required
@method_decorator(moderator_required, name="dispatch")
class Hashtags(ListView):
template_name = "admin/hashtags.html"
paginate_by = 30
@ -26,7 +25,6 @@ class Hashtags(ListView):
@method_decorator(moderator_required, name="dispatch")
class HashtagEdit(FormView):
template_name = "admin/hashtag_edit.html"
extra_context = {"section": "hashtags"}

View file

@ -10,7 +10,6 @@ from users.models import Identity, IdentityStates
@method_decorator(moderator_required, name="dispatch")
class IdentitiesRoot(ListView):
template_name = "admin/identities.html"
paginate_by = 30
@ -51,7 +50,6 @@ class IdentitiesRoot(ListView):
@method_decorator(moderator_required, name="dispatch")
class IdentityEdit(FormView):
template_name = "admin/identity_edit.html"
extra_context = {
"section": "identities",

View file

@ -13,7 +13,6 @@ from users.models import Invite
@method_decorator(moderator_required, name="dispatch")
class InvitesRoot(ListView):
template_name = "admin/invites.html"
paginate_by = 30
@ -29,7 +28,6 @@ class InvitesRoot(ListView):
@method_decorator(moderator_required, name="dispatch")
class InviteCreate(FormView):
template_name = "admin/invite_create.html"
extra_context = {
"section": "invites",
@ -65,7 +63,6 @@ class InviteCreate(FormView):
@method_decorator(moderator_required, name="dispatch")
class InviteView(FormView):
template_name = "admin/invite_view.html"
extra_context = {
"section": "invites",

View file

@ -10,7 +10,6 @@ from users.models import Identity, Report
@method_decorator(moderator_required, name="dispatch")
class ReportsRoot(ListView):
template_name = "admin/reports.html"
paginate_by = 30
@ -34,7 +33,6 @@ class ReportsRoot(ListView):
@method_decorator(moderator_required, name="dispatch")
class ReportView(FormView):
template_name = "admin/report_view.html"
extra_context = {
"section": "reports",

View file

@ -24,7 +24,6 @@ class AdminSettingsPage(SettingsPage):
class BasicSettings(AdminSettingsPage):
section = "basic"
options = {
@ -155,7 +154,6 @@ cache_field_defaults = {
class TuningSettings(AdminSettingsPage):
section = "tuning"
options = {
@ -196,7 +194,6 @@ class TuningSettings(AdminSettingsPage):
class PoliciesSettings(AdminSettingsPage):
section = "policies"
options = {

View file

@ -7,7 +7,6 @@ from users.decorators import admin_required
@method_decorator(admin_required, name="dispatch")
class Stator(TemplateView):
template_name = "admin/stator.html"
def get_context_data(self):

View file

@ -10,7 +10,6 @@ from users.models import User
@method_decorator(admin_required, name="dispatch")
class UsersRoot(ListView):
template_name = "admin/users.html"
paginate_by = 30
@ -33,7 +32,6 @@ class UsersRoot(ListView):
@method_decorator(admin_required, name="dispatch")
class UserEdit(FormView):
template_name = "admin/user_edit.html"
extra_context = {
"section": "users",

View file

@ -29,11 +29,9 @@ class Logout(LogoutView):
class Signup(FormView):
template_name = "auth/signup.html"
class form_class(forms.Form):
email = forms.EmailField(
help_text="We will send a link to this email to create your account.",
)
@ -126,11 +124,9 @@ class Signup(FormView):
class TriggerReset(FormView):
template_name = "auth/trigger_reset.html"
class form_class(forms.Form):
email = forms.EmailField(
help_text="We will send a reset link to this email",
)
@ -155,11 +151,9 @@ class TriggerReset(FormView):
class PerformReset(FormView):
template_name = "auth/perform_reset.html"
class form_class(forms.Form):
password = forms.CharField(
widget=forms.PasswordInput,
help_text="Must be at least 8 characters, and contain both letters and numbers.",

View file

@ -7,7 +7,6 @@ from users.views.base import IdentityViewMixin
class DeleteIdentity(IdentityViewMixin, FormView):
template_name = "settings/delete.html"
extra_context = {"section": "delete"}

View file

@ -103,9 +103,9 @@ class CsvView(IdentityViewMixin, View):
else:
raise ValueError(f"Cannot export attribute {attrname}")
# Make it into CSV format
if type(value) == bool:
if isinstance(value, bool):
value = "true" if value else "false"
elif type(value) == int:
elif isinstance(value, int):
value = str(value)
row.append(value)
writer.writerow(row)

View file

@ -61,7 +61,6 @@ class TokenCreate(IdentityViewMixin, FormView):
class TokenEdit(IdentityViewMixin, DetailView):
template_name = "settings/token_edit.html"
extra_context = {"section": "tokens"}