Skip to content

Commit

Permalink
Refactor methods
Browse files Browse the repository at this point in the history
  • Loading branch information
v.filatov committed Jan 23, 2025
1 parent 4c3cc6a commit 178e97f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions sportorg/libs/sfr/sfrximporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
ResultManual,
ResultStatus,
Split,
SystemType,
SystemType, Person,
)
from sportorg.utils.time import hhmmss_to_time


def import_sfrx(source):
def import_sfrx(source: str):
sfr_csv = sfrxparser.parse(source)
obj = memory.race()

Expand Down Expand Up @@ -176,7 +176,7 @@ def import_sfrx(source):
)


def convert_bib(bib) -> int:
def convert_bib(bib: str) -> int:
if not bib.isdigit():
return 0

Expand All @@ -186,7 +186,7 @@ def convert_bib(bib) -> int:
return int(bib[0] + str(int(bib[1:])))


def sfr_qual_to_sportorg(value) -> int:
def sfr_qual_to_sportorg(value: str) -> int:
return {
"": 0,
"0": 0,
Expand All @@ -203,7 +203,7 @@ def sfr_qual_to_sportorg(value) -> int:
}[value]


def set_property(person, key, value) -> None:
def set_property(person: Person, key: str, value: str) -> None:
if value == "":
return

Expand Down
4 changes: 2 additions & 2 deletions sportorg/libs/sfr/sfrxparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, data=None):
self._data = [] if data is None else data
self._splits = []

def parse(self, source):
def parse(self, source: str):
f = codecs.open(source, "r", "UTF-8")

for row in f:
Expand Down Expand Up @@ -111,6 +111,6 @@ def settings(self):
return self._settings


def parse(source) -> SFRXParser:
def parse(source: str) -> SFRXParser:
parser = SFRXParser()
return parser.parse(source)

0 comments on commit 178e97f

Please sign in to comment.