Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2025 poetry lock #1244

Merged
merged 3 commits into from
Jan 11, 2025
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
36 changes: 20 additions & 16 deletions .ci/run-safety.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,23 @@
# 67599: pip issue, utter nonsense
# 70612: Jinja2 SSTI, as of https://github.com/inducer/relate/pull/1053
# there is no longer a direct Jinja dependency, and no known path to SSTI.
safety check \
-i 38678 \
-i 39253 \
-i 39535 \
-i 40291 \
-i 44715 \
-i 44716 \
-i 44717 \
-i 51159 \
-i 51549 \
-i 51499 \
-i 51457 \
-i 65213 \
-i 67599 \
-i 70612 \
--full-report
if test "$SAFETY_API_KEY" != ""; then
safety --stage cicd --key "$SAFETY_API_KEY" scan \
-i 38678 \
-i 39253 \
-i 39535 \
-i 40291 \
-i 44715 \
-i 44716 \
-i 44717 \
-i 51159 \
-i 51549 \
-i 51499 \
-i 51457 \
-i 65213 \
-i 67599 \
-i 70612 \
--full-report
else
echo ":warning::Skipped running safety, no API key."
fi
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
run: poetry run ./.ci/run-mypy.sh
- name: "Safety"
run: poetry run ./.ci/run-safety.sh
env:
SAFETY_API_KEY: ${{ secrets.SAFETY_API_KEY }}
- name: "Sphinx"
run: |
(cd doc; poetry run make html SPHINXOPTS="-W --keep-going -n")
Expand Down
5 changes: 3 additions & 2 deletions course/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import os
import re
import sys
from dataclasses import dataclass
from typing import cast
from xml.etree.ElementTree import Element, tostring

Expand Down Expand Up @@ -1195,9 +1196,9 @@ def unknown_decl(self, data):
self.out_file.write(f"<![{data}]>")


@dataclass
class PreserveFragment:
def __init__(self, s: str) -> None:
self.s = s
s: str


class LinkFixerTreeprocessor(Treeprocessor):
Expand Down
8 changes: 4 additions & 4 deletions course/grades.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"""

import re
from dataclasses import dataclass
from decimal import Decimal
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -210,11 +211,10 @@ def view_grading_opportunity_list(pctx):

# {{{ teacher grade book

@dataclass
class GradeInfo:
def __init__(self, opportunity: GradingOpportunity,
grade_state_machine: GradeStateMachine) -> None:
self.opportunity = opportunity
self.grade_state_machine = grade_state_machine
opportunity: GradingOpportunity
grade_state_machine: GradeStateMachine


def get_grade_table(course: Course) -> tuple[
Expand Down
33 changes: 12 additions & 21 deletions course/page/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

from abc import ABC, abstractmethod
from collections.abc import Callable, Sequence
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any

import django.forms as forms
Expand Down Expand Up @@ -97,6 +98,7 @@
"""


@dataclass
class PageContext:
"""
.. attribute:: course
Expand All @@ -113,24 +115,13 @@ class PageContext:
which is used internally by the flow views.
"""

def __init__(
self,
course: Course,
repo: Repo_ish,
commit_sha: bytes,
flow_session: FlowSession,
in_sandbox: bool = False,
page_uri: str | None = None,
request: django.http.HttpRequest | None = None,
) -> None:

self.course = course
self.repo = repo
self.commit_sha = commit_sha
self.flow_session = flow_session
self.in_sandbox = in_sandbox
self.page_uri = page_uri
self.request = request
course: Course
repo: Repo_ish
commit_sha: bytes
flow_session: FlowSession
in_sandbox: bool = False
page_uri: str | None = None
request: django.http.HttpRequest | None = None


class PageBehavior:
Expand Down Expand Up @@ -194,11 +185,11 @@ def round_point_count_to_quarters(
return int(value)

import math
_atol = atol * 4
actual_atol = atol * 4
v = value * 4
if abs(v - math.floor(v)) < _atol:
if abs(v - math.floor(v)) < actual_atol:
v = math.floor(v)
elif abs(v - math.ceil(v)) < _atol:
elif abs(v - math.ceil(v)) < actual_atol:
v = math.ceil(v)
else:
return value
Expand Down
13 changes: 7 additions & 6 deletions course/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import re
import sys
from collections.abc import Sequence
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Literal, TypeAlias

import dulwich.objects
Expand Down Expand Up @@ -226,10 +227,10 @@ def validate_struct(
# }}}


@dataclass
class ValidationWarning:
def __init__(self, location: str | None, text: str) -> None:
self.location = location
self.text = text
location: str | None
text: str


class ValidationContext:
Expand Down Expand Up @@ -1588,10 +1589,10 @@ def tree(self):
return FileSystemFakeRepoTree(self.root)


@dataclass
class FileSystemFakeRepoTreeEntry: # pragma: no cover
def __init__(self, path: bytes, mode: int) -> None:
self.path = path
self.mode = mode
path: bytes
mode: int


class FileSystemFakeRepoTree: # pragma: no cover
Expand Down
Loading
Loading