Skip to content

Commit

Permalink
Upgrade to newest ruff
Browse files Browse the repository at this point in the history
Ruff version 0.2 has a number of bugfixes & optimizations, but also
changes the structure of pyproject.toml -- we can upgrade straight to
0.3.5.
  • Loading branch information
DavidCain committed Apr 6, 2024
1 parent 10e39a7 commit 11158d7
Show file tree
Hide file tree
Showing 23 changed files with 48 additions and 27 deletions.
36 changes: 18 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.ruff]
select = [
lint.select = [
"A", # flake8-builtins
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
Expand Down Expand Up @@ -65,7 +65,7 @@ select = [
# "NPY", # NumPy-specific rules -- I don't use numpy
]

ignore = [
lint.ignore = [
# Specific rules ignored from checkers I otherwise view as valuable:
"ANN001", # Type annotations are knowingly incomplete.
"ANN002", # Type annotations are knowingly incomplete.
Expand Down Expand Up @@ -113,10 +113,10 @@ exclude = [
"static/",
]

fixable = ["ALL"]
unfixable = []
lint.fixable = ["ALL"]
lint.unfixable = []

[tool.ruff.flake8-self]
[tool.ruff.lint.flake8-self]
ignore-names = [
"_asdict",
"_replace",
Expand Down
1 change: 1 addition & 0 deletions ws/car_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
We used to rely on `localflavor` for this, but given that plates are
the *only* use for this enum, it's easy/simple to just enumerate.
"""

from typing import Final

US_STATES: Final[tuple[tuple[str, str], ...]] = (
Expand Down
9 changes: 5 additions & 4 deletions ws/conf/local_settings.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Local settings, intended for use on a local computer for basic feature testing.
- Exposed secret key
- DEBUG enabled
- Project root is just '/'
- Send emails to console
- Exposed secret key
- DEBUG enabled
- Project root is just '/'
- Send emails to console
"""

from typing import Any

DEBUG = True
Expand Down
1 change: 1 addition & 0 deletions ws/conf/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Intended to mirror production as much as is possible.
"""

from typing import Any

DEBUG = False
Expand Down
1 change: 1 addition & 0 deletions ws/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
account where they can log in with either email address, and get access to a
complete history.
"""

from collections.abc import Iterable
from typing import cast

Expand Down
1 change: 1 addition & 0 deletions ws/messages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Some messages may be called on *every* request, others as needed.
"""

from django.contrib import messages
from django.contrib.messages.storage.base import Message
from django.http import HttpRequest
Expand Down
1 change: 1 addition & 0 deletions ws/messages/leader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Messages for leaders!"""

from datetime import timedelta

from django.contrib import messages
Expand Down
1 change: 1 addition & 0 deletions ws/mixins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mixins used across multiple views."""

from datetime import timedelta

from django.contrib.auth.decorators import login_required
Expand Down
1 change: 1 addition & 0 deletions ws/signals/signup_signals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Handle aspects of trip creation/modification when receiving signup changes."""

# Signals are a terrible pattern that I aim to replace eventually.
# Ruff will complain about the large number of arguments. We can ignore for now.
# ruff: noqa: PLR0913
Expand Down
1 change: 1 addition & 0 deletions ws/unsubscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Ideally, participants just control their email preferences directly.
However, we provide this method for single-click unsubscribe links.
"""

import enum
from datetime import timedelta
from typing import NamedTuple, TypedDict
Expand Down
1 change: 1 addition & 0 deletions ws/utils/dates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Some shortcuts to retrieve meaningful dates."""

from datetime import date, datetime, time, timedelta

from django.utils import timezone
Expand Down
1 change: 1 addition & 0 deletions ws/utils/geardb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The gear database is itself a Django application, which we interface with
via machine-to-machine API endpoints.
"""

import logging
from collections.abc import Iterable, Iterator
from datetime import date, datetime, timedelta
Expand Down
1 change: 1 addition & 0 deletions ws/utils/member_sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
spreadsheets. Each spreadsheet will be shared with the company offering the
discount, so that they can verify membership status.
"""

import bisect
import logging
import random
Expand Down
1 change: 1 addition & 0 deletions ws/utils/membership_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'status': 'Missing',
}
"""

from datetime import date
from typing import Any, Literal, TypedDict

Expand Down
1 change: 1 addition & 0 deletions ws/views/account.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Views relating to account management."""

import logging
from urllib.parse import urlencode

Expand Down
1 change: 1 addition & 0 deletions ws/views/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
and activity chairs can respond to those applications with recommendations
and/or ratings.
"""

from collections import defaultdict
from collections.abc import Iterator, Mapping

Expand Down
1 change: 1 addition & 0 deletions ws/views/itinerary.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
That itinerary specifies who (if anybody) will be driving for the trip,
what the intended route will be, when to worry, and more.
"""

from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.db.models import Q
Expand Down
1 change: 1 addition & 0 deletions ws/views/leaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
For views relating to the leader application process, see ws.views.applications
"""

from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.db.models import Max
Expand Down
1 change: 1 addition & 0 deletions ws/views/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
user who has completed the mandatory signup information is given a Participant
object that's linked to their user account.
"""

import logging
from typing import Any, Literal, TypedDict, cast

Expand Down
1 change: 1 addition & 0 deletions ws/views/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
paired with another participant. All of these options are deemed "preferences"
of the participant.
"""

import contextlib
import json
from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions ws/views/trips.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
A "trip" is any official trip registered in the system - created by leaders, to be
attended by any interested participants.
"""

from collections import defaultdict
from datetime import date, timedelta
from typing import TYPE_CHECKING, Any, cast
Expand Down
1 change: 1 addition & 0 deletions ws/views/winter_school.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Winter School. This module contains those views. The majority of the system
works the same during Winter School as it does during the rest of the year.
"""

from django.contrib import messages
from django.shortcuts import redirect
from django.urls import reverse
Expand Down

0 comments on commit 11158d7

Please sign in to comment.