Skip to content

Commit

Permalink
Update backend dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
treiher committed Apr 13, 2024
1 parent e139800 commit 06c5357
Show file tree
Hide file tree
Showing 12 changed files with 499 additions and 472 deletions.
872 changes: 439 additions & 433 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ exclude = '''

[tool.ruff]
target-version = "py39"
line-length = 100

[tool.ruff.lint]
select = [
"F", # pyflakes
"E", # pycodestyle
Expand Down Expand Up @@ -176,12 +179,11 @@ ignore = [
"PLC1901", # compare-to-empty-string
"PLR2004", # magic-value-comparison
]
line-length = 100

[tool.ruff.isort]
[tool.ruff.lint.isort]
combine-as-imports = true

[tool.ruff.pylint]
[tool.ruff.lint.pylint]
max-args = 6
max-branches = 12
max-returns = 10
Expand Down
46 changes: 25 additions & 21 deletions valens/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ def model_to_dict(

def to_routine_parts(json: list[dict[str, Any]]) -> list[RoutinePart]: # type: ignore[misc]
return [
to_routine_section(part, position)
if "rounds" in part
else to_routine_activity(part, position)
(
to_routine_section(part, position)
if "rounds" in part
else to_routine_activity(part, position)
)
for position, part in enumerate(json, start=1)
]

Expand Down Expand Up @@ -133,24 +135,26 @@ def to_routine_activity( # type: ignore[misc]

def to_workout_elements(json: list[dict[str, Any]]) -> list[WorkoutElement]: # type: ignore[misc]
return [
WorkoutSet(
position=position,
exercise_id=element["exercise_id"],
reps=element["reps"],
time=element["time"],
weight=element["weight"],
rpe=element["rpe"],
target_reps=element["target_reps"],
target_time=element["target_time"],
target_weight=element["target_weight"],
target_rpe=element["target_rpe"],
automatic=element["automatic"],
)
if "exercise_id" in element
else WorkoutRest(
position=position,
target_time=element["target_time"],
automatic=element["automatic"],
(
WorkoutSet(
position=position,
exercise_id=element["exercise_id"],
reps=element["reps"],
time=element["time"],
weight=element["weight"],
rpe=element["rpe"],
target_reps=element["target_reps"],
target_time=element["target_time"],
target_weight=element["target_weight"],
target_rpe=element["target_rpe"],
automatic=element["automatic"],
)
if "exercise_id" in element
else WorkoutRest(
position=position,
target_time=element["target_time"],
automatic=element["automatic"],
)
)
for position, element in enumerate(json, start=1)
]
Expand Down
2 changes: 1 addition & 1 deletion valens/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def public_url() -> str:
return current_app.config["PUBLIC_URL"] if "PUBLIC_URL" in current_app.config else ""
return current_app.config.get("PUBLIC_URL", "")


@bp.route("/")
Expand Down
36 changes: 22 additions & 14 deletions valens/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,22 +208,30 @@ def _workouts(user_id: int = 1) -> tuple[list[Exercise], list[Routine], list[Wor
for reps, time, weight, rpe in (
[
(
5 + week + random.randint(0, 1)
if exercise_names[routine_activity.exercise.name].reps
else None,
(
random.randint(3, 4)
5 + week + random.randint(0, 1)
if exercise_names[routine_activity.exercise.name].reps
else 10 + 5 * week + 5 * random.randint(0, 2)
)
if exercise_names[routine_activity.exercise.name].time
else None,
5 + (week + random.randint(0, 1)) * 0.5
if exercise_names[routine_activity.exercise.name].weight
else None,
min(7 + (week % 4) + (random.randint(0, 1) * 0.5), 10)
if exercise_names[routine_activity.exercise.name].rpe
else None,
else None
),
(
(
random.randint(3, 4)
if exercise_names[routine_activity.exercise.name].reps
else 10 + 5 * week + 5 * random.randint(0, 2)
)
if exercise_names[routine_activity.exercise.name].time
else None
),
(
5 + (week + random.randint(0, 1)) * 0.5
if exercise_names[routine_activity.exercise.name].weight
else None
),
(
min(7 + (week % 4) + (random.randint(0, 1) * 0.5), 10)
if exercise_names[routine_activity.exercise.name].rpe
else None
),
)
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Create Date: 2023-04-02
"""

import sqlalchemy as sa
from alembic import op

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Create Date: 2023-04-01
"""

from typing import Union

import sqlalchemy as sa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Create Date: 2021-07-18
"""

from typing import Any

from alembic import op
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Create Date: 2022-01-22
"""

from alembic import op

revision = "4b6051594962"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Create Date: 2021-07-03 21:19:40.634728
"""

import sqlalchemy as sa
from alembic import op

Expand Down
1 change: 1 addition & 0 deletions valens/migrations/versions/8a0dc258bf2a_extend_workouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Create Date: 2023-02-16
"""

from typing import Union

import sqlalchemy as sa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Create Date: 2022-11-13
"""

import sqlalchemy as sa
from alembic import op
from sqlalchemy import Boolean, Integer, String
Expand Down

0 comments on commit 06c5357

Please sign in to comment.