Skip to content

Commit

Permalink
Fix compatibility with Python < 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
liskin committed Nov 21, 2023
1 parent fc36381 commit 75bb15c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/strava_gear/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
'--show-vert/--hide-vert', default=False, show_default=True,
help="Show vertical (elevation gain)")
@click.option(
'--units', type=click.Choice(list(Units)), default=Units.METRIC, show_default=True,
'--units', type=click.Choice([u.name.lower() for u in Units]), default=Units.METRIC.name.lower(), show_default=True,
callback=lambda _ctx, _param, v: Units[v.upper()], # TODO: drop when Python 3.11 is the oldest supported
help="Show data in metric or imperial")
def main(
rules_input: TextIO,
Expand Down
4 changes: 2 additions & 2 deletions src/strava_gear/report.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections import defaultdict
import csv
from enum import StrEnum
from enum import Enum
from enum import auto
from functools import partial
from typing import Dict
Expand All @@ -18,7 +18,7 @@
FOOT_IN_METERS: Final[float] = 0.3048


class Units(StrEnum):
class Units(Enum):
METRIC = auto()
IMPERIAL = auto()

Expand Down

0 comments on commit 75bb15c

Please sign in to comment.