Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ repos:
rev: "1.29.1" # replace with latest tag on GitHub
hooks:
- id: django-upgrade
args: [--target-version, "5.1"] # Replace with Django version
args: [--target-version, "6.0"] # Replace with Django version
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.14.2
rev: v0.14.7
hooks:
# Run the linter.
- id: ruff-check
Expand All @@ -43,10 +43,3 @@ repos:
additional_dependencies:
- prettier@2.5.1
- "@prettier/plugin-xml@1.2.0"
- repo: https://github.com/facebook/pyrefly-pre-commit
rev: 0.0.1
hooks:
- id: pyrefly-typecheck-system
name: Pyrefly (type checking)
pass_filenames: false # Recomended to do full repo checks. However, you can change this to `true` to only check changed files
entry: uv run pyrefly check
3 changes: 0 additions & 3 deletions config/markdown_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ def __init__(self, *, escape: bool = False, **kwargs: dict) -> None:
if PYGMENTS_AVAILABLE:
# create a cache for lexers to improve performance
self._lexer_cache = {
# pyrefly: ignore [missing-attribute]
"example": lexers.TextLexer(),
}
self._formatter = html.HtmlFormatter()
# pyrefly: ignore [missing-attribute]
self._text_lexer = lexers.TextLexer()

self._escape = escape
Expand Down Expand Up @@ -71,7 +69,6 @@ def block_code(self, code: str, info=None) -> str: # noqa: ANN001
lexer = self._text_lexer

highlighted = highlight(code, lexer, self._formatter)
# pyrefly: ignore [bad-return, unsupported-operation, unsupported-operation]
return highlighted + "\n"

# Fallback to basic code block
Expand Down
3 changes: 0 additions & 3 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@
if "sqlite" in DB_ENGINE:
DATABASES["default"].update(SQLITE_OPTIONS)

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

AUTH_PASSWORD_VALIDATORS = [
{
Expand Down Expand Up @@ -256,12 +255,10 @@
},
}
if LOGFIRE_API_KEY:
# pyrefly: ignore # unsupported-operation
LOGGING["handlers"]["logfire"] = {
"level": "INFO",
"class": "logfire.LogfireLoggingHandler",
}
# pyrefly: ignore # index-error, missing-attribute
LOGGING["root"]["handlers"].append("logfire")


Expand Down
1 change: 0 additions & 1 deletion config/sitemaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class StaticSitemap(Sitemap):
"""Sitemap for stuartm.nz."""

changefreq = "monthly"
# pyrefly: ignore [bad-override]
protocol = "https"

def items(self) -> list:
Expand Down
2 changes: 0 additions & 2 deletions contact_form/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
class ContactFormConfig(AppConfig):
"""App configuration for the contact_form app."""

# pyrefly: ignore [bad-override]
default_auto_field = "django.db.models.BigAutoField"
name = "contact_form"
2 changes: 0 additions & 2 deletions debugging_app/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
class DebuggingAppConfig(AppConfig):
"""App configuration."""

# pyrefly: ignore [bad-override]
default_auto_field = "django.db.models.BigAutoField"
name = "debugging_app"
2 changes: 0 additions & 2 deletions healthcheck_app/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
class HealthcheckAppConfig(AppConfig):
"""App configuration for the healthcheck app."""

# pyrefly: ignore [bad-override]
default_auto_field = "django.db.models.BigAutoField"
name = "healthcheck_app"
2 changes: 0 additions & 2 deletions healthcheck_app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ def health_check(_: HttpRequest) -> JsonResponse:
status, error = check_function()

# Update the component's status in the health data
# pyrefly: ignore [unsupported-operation]
health_data["details"][check_name] = {"status": status}

# If there's an error, add it to the component's data
if error:
# pyrefly: ignore [bad-index]
health_data["details"][check_name]["error"] = error

# If any component is unhealthy, set overall status to 'unhealthy'
Expand Down
2 changes: 0 additions & 2 deletions home/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
class HomeConfig(AppConfig):
"""Home app configuration."""

# pyrefly: ignore [bad-override]
default_auto_field = "django.db.models.BigAutoField"
name = "home"
2 changes: 0 additions & 2 deletions markdown_editor/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
class MarkdownEditorConfig(AppConfig):
"""Configuration for the markdown_editor app."""

# pyrefly: ignore [bad-override]
default_auto_field = "django.db.models.BigAutoField"
name = "markdown_editor"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readme = "README.md"
requires-python = ">=3.14"
dependencies = [
"environs[django]>=14.3.0",
"django~=5.2.0",
"django~=6.0.0",
"djpress~=0.22",
"whitenoise>=6.7.0",
"gunicorn>=23.0.0",
Expand Down
2 changes: 0 additions & 2 deletions shell/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
class ShellConfig(AppConfig):
"""Configuration for the shell app."""

# pyrefly: ignore [bad-override]
default_auto_field = "django.db.models.BigAutoField"
name = "shell"
1 change: 0 additions & 1 deletion shell/management/commands/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
class Command(BaseShellCommand):
"""Custom shell command to support the pyrepl shell."""

# pyrefly: ignore [bad-override]
shells: ClassVar = ["ipython", "bpython", "pyrepl", "python"]

def pyrepl(self, _) -> None: # noqa: ANN001
Expand Down
6 changes: 0 additions & 6 deletions spf_generator/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
class EmailProviderAdmin(admin.ModelAdmin):
"""Admin interface configuration for EmailProvider model."""

# pyrefly: ignore [bad-override]
list_display: ClassVar = [
"name",
"category",
Expand All @@ -22,28 +21,24 @@ class EmailProviderAdmin(admin.ModelAdmin):
"active",
]

# pyrefly: ignore [bad-override]
list_filter: ClassVar = [
"category",
"active",
"mechanism_type",
]

# pyrefly: ignore [bad-override]
search_fields: ClassVar = [
"name",
"description",
"mechanism_value",
"notes",
]

# pyrefly: ignore [bad-override]
readonly_fields: ClassVar = [
"created_at",
"updated_at",
]

# pyrefly: ignore [bad-override]
fieldsets: ClassVar = [
(
None,
Expand Down Expand Up @@ -97,7 +92,6 @@ def mechanism_display(self, obj: EmailProvider) -> str:
Returns:
str: HTML-formatted SPF mechanism
"""
# pyrefly: ignore [bad-return]
return format_html(
"<code>{}</code>",
obj.get_mechanism(),
Expand Down
2 changes: 0 additions & 2 deletions spf_generator/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
class SpfGeneratorConfig(AppConfig):
"""App configuration for the SPF Generator app."""

# pyrefly: ignore [bad-override]
default_auto_field = "django.db.models.BigAutoField"
name = "spf_generator"
1 change: 0 additions & 1 deletion spf_generator/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # noqa: ANN401

# Group providers by category
for category in ProviderCategory.choices:
# pyrefly: ignore [missing-attribute]
providers = EmailProvider.objects.filter(
category=category[0],
active=True,
Expand Down
3 changes: 0 additions & 3 deletions spf_generator/management/commands/populate_spf_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Command(BaseCommand):

help = "Populates the database with common email provider SPF records"

# pyrefly: ignore [bad-override]
def handle(self, *args: Any, **options: Any) -> None: # noqa: ANN401, ARG002
"""Handle the command execution."""
# Email Hosting Providers
Expand Down Expand Up @@ -245,12 +244,10 @@ def handle(self, *args: Any, **options: Any) -> None: # noqa: ANN401, ARG002

# Create providers in database
for provider_data in all_providers:
# pyrefly: ignore [missing-attribute]
EmailProvider.objects.get_or_create(
name=provider_data["name"],
defaults=provider_data,
)
self.stdout.write(
# pyrefly: ignore [missing-attribute]
self.style.SUCCESS(f"Created provider: {provider_data['name']}"),
)
1 change: 0 additions & 1 deletion spf_generator/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):
# pyrefly: ignore [bad-override]
initial = True

dependencies = []
Expand Down
1 change: 0 additions & 1 deletion spf_generator/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ class Meta:

def __str__(self) -> str:
"""Returns the name of the provider when converted to a string."""
# pyrefly: ignore [bad-return]
return self.name

def get_mechanism(self) -> str:
Expand Down
4 changes: 0 additions & 4 deletions spf_generator/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def client():
def email_providers():
"""Create some test email providers."""
providers = [
# pyrefly: ignore [missing-attribute]
EmailProvider.objects.create(
name="Google Workspace",
category=ProviderCategory.EMAIL_HOSTING,
Expand All @@ -25,7 +24,6 @@ def email_providers():
lookup_count=2,
priority=10,
),
# pyrefly: ignore [missing-attribute]
EmailProvider.objects.create(
name="SendGrid",
category=ProviderCategory.TRANSACTIONAL,
Expand All @@ -34,7 +32,6 @@ def email_providers():
lookup_count=1,
priority=20,
),
# pyrefly: ignore [missing-attribute]
EmailProvider.objects.create(
name="Office 365",
category=ProviderCategory.EMAIL_HOSTING,
Expand Down Expand Up @@ -87,7 +84,6 @@ def test_post_with_multiple_providers(self, client, email_providers):
def test_lookup_count_limit(self, client, email_providers):
"""Test that the 10 lookup limit is enforced."""
# Create a provider with 9 lookups
# pyrefly: ignore [missing-attribute]
high_lookup_provider = EmailProvider.objects.create(
name="High Lookup Provider",
category=ProviderCategory.OTHER,
Expand Down
2 changes: 0 additions & 2 deletions spf_generator/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def generate_spf_record(request: HttpRequest) -> HttpResponse:
for field_name, value in form.cleaned_data.items():
if value and field_name.startswith("provider_"):
provider_id = int(field_name.split("_")[1])
# pyrefly: ignore [missing-attribute]
provider = EmailProvider.objects.get(id=provider_id)
selected_providers.append(provider)

Expand Down Expand Up @@ -101,7 +100,6 @@ def generate_spf_record(request: HttpRequest) -> HttpResponse:
)

# GET request - display form
# pyrefly: ignore [missing-attribute]
providers = {provider.pk: provider for provider in EmailProvider.objects.filter(active=True)}

context = {
Expand Down
2 changes: 0 additions & 2 deletions timezone_converter/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
class TimezoneConverterConfig(AppConfig):
"""Timezone converter app configuration."""

# pyrefly: ignore [bad-override]
default_auto_field = "django.db.models.BigAutoField"
name = "timezone_converter"
2 changes: 0 additions & 2 deletions timezone_converter/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ def converter(request: HttpRequest) -> HttpResponse:
def convert(request: HttpRequest) -> HttpResponse:
"""Convert a timestamp to a different timezone and display the result."""
# Get the timestamp and timezone from the POST request.
# pyrefly: ignore [bad-assignment]
timestamp: str | None = request.POST.get("timestamp")
# pyrefly: ignore [bad-assignment]
timezone: str | None = request.POST.get("timezone")

error_message: str = ""
Expand Down
Loading