Skip to content

Commit

Permalink
future annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Aug 29, 2023
1 parent 006556c commit c6ac66d
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 2 deletions.
4 changes: 3 additions & 1 deletion admin_scripts/calculate_winners.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
Edit the values of the constants at the top of this file for your purposes, e.g.
START_TIME, TEAM_NAMES, etc.
"""
from __future__ import annotations

import csv
from collections import defaultdict
from datetime import datetime, timezone
Expand All @@ -23,7 +25,7 @@
# "Final" level, the advance to which encodes that the team finished
FINAL_LEVEL = "51"
# List of team names as strings
TEAM_NAMES: list["TeamName"] = []
TEAM_NAMES: list[TeamName] = []
# Path to hunt event csv taken from the website
CSV_FILE_PATH = r"C:\Users\username\Downloads\hunt.huntevent.csv"

Expand Down
1 change: 1 addition & 0 deletions admin_scripts/download.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
from __future__ import annotations

import argparse
import asyncio
Expand Down
2 changes: 2 additions & 0 deletions admin_scripts/level_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
level setter has not come up with their own novel image-naming scheme that wouldn't
work once the server considers the images alphabetically.
"""
from __future__ import annotations

import argparse
import json
import os
Expand Down
1 change: 1 addition & 0 deletions admin_scripts/upload.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
from __future__ import annotations

import json
from pathlib import Path
Expand Down
2 changes: 2 additions & 0 deletions hunt/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.contrib import admin

from hunt.models import AppSetting, ChatMessage, Hint, HuntEvent, HuntInfo, Level
Expand Down
2 changes: 2 additions & 0 deletions hunt/apps.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.apps import AppConfig


Expand Down
7 changes: 6 additions & 1 deletion hunt/chat/consumers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
from __future__ import annotations

import json
from typing import TYPE_CHECKING

from asgiref.sync import sync_to_async
from channels.generic.websocket import AsyncWebsocketConsumer
from django.contrib.auth.models import User

from hunt.models import ChatMessage, Level

if TYPE_CHECKING:
from django.contrib.auth.models import User


class ChatConsumer(AsyncWebsocketConsumer): # type: ignore[misc]
def __init__(self) -> None:
Expand Down
2 changes: 2 additions & 0 deletions hunt/chat/routing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from django.urls import path

from hunt.chat import consumers
Expand Down
2 changes: 2 additions & 0 deletions hunt/constants.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from __future__ import annotations

HINTS_PER_LEVEL = 5
2 changes: 2 additions & 0 deletions hunt/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from __future__ import annotations

from django.conf import settings
from django.conf.urls.static import static
from django.urls import include, path
Expand Down
2 changes: 2 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
"""Django's command-line utility for administrative tasks."""
from __future__ import annotations

import os
import sys

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,6 @@ unfixable = [

[tool.ruff.flake8-type-checking]
strict = true

[tool.ruff.isort]
required-imports = ["from __future__ import annotations"]
1 change: 1 addition & 0 deletions treasure/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
from __future__ import annotations

import os

Expand Down
2 changes: 2 additions & 0 deletions treasure/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from __future__ import annotations

from django.contrib import admin
from django.urls import include, path

Expand Down
1 change: 1 addition & 0 deletions treasure/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
from __future__ import annotations

import os

Expand Down

0 comments on commit c6ac66d

Please sign in to comment.