Skip to content

Commit

Permalink
Upgrade to latest ruff
Browse files Browse the repository at this point in the history
A few errors need fixing after upgrading, and one file is reformatted.
  • Loading branch information
DavidCain committed Jan 28, 2024
1 parent 5a70940 commit 5e2301b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 23 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.

9 changes: 9 additions & 0 deletions ws/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,12 @@ class WinterSchoolSettings(SingletonModel):
default=True, verbose_name="Accept new Winter School leader applications"
)

def __str__(self):
return (
f"Applications: {'on' if self.accepting_applications else 'off'}, "
f"Lecture attendance: {'on' if self.allow_setting_attendance else 'off'}"
)


class MentorActivity(models.Model):
"""An activity which can be mentored.
Expand Down Expand Up @@ -1750,6 +1756,9 @@ class Meta:
abstract = True # See model_from_activity for more
ordering = ["time_created"]

def __str__(self) -> str:
return f"Application by {self.participant} to be leader in {self.year}"

@property
def rating_given(self):
"""Return any activity rating created after this application."""
Expand Down
2 changes: 1 addition & 1 deletion ws/utils/geardb.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Rental(NamedTuple):
"""

email: str
id: str # Example, 'BK-19-04' # noqa: A003
id: str # Example, 'BK-19-04'
name: str
cost: float # How much the daily cost for the item is
checkedout: date
Expand Down
2 changes: 1 addition & 1 deletion ws/views/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def get_stats(trips: GroupedTrips) -> list[str]:
return []

def count(
key: Literal["on_trip", "creator", "leader", "wimp", "waitlisted"]
key: Literal["on_trip", "creator", "leader", "wimp", "waitlisted"],
) -> str:
matching_trips = trips["past"][key]
assert matching_trips is not None # waitlisted can be omitted
Expand Down
6 changes: 3 additions & 3 deletions ws/views/trips.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TripView(DetailView):
context_object_name = "trip"
template_name = "trips/view.html"

object: models.Trip # noqa: A003
object: models.Trip

def get_queryset(self):
trips = super().get_queryset().select_related("info")
Expand Down Expand Up @@ -147,7 +147,7 @@ class ReviewTripView(DetailView):
template_name = "trips/review.html"
success_msg = "Thanks for your feedback!"

object: models.Trip # noqa: A003
object: models.Trip
request: "RequestWithParticipant"

@property
Expand Down Expand Up @@ -346,7 +346,7 @@ class EditTripView(UpdateView, TripLeadersOnlyView):
form_class = forms.TripForm
template_name = "trips/edit.html"

object: models.Trip # noqa: A003
object: models.Trip

def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
Expand Down

0 comments on commit 5e2301b

Please sign in to comment.