Refactor name of group parser method

This commit is contained in:
Christian Wolf 2023-11-20 11:53:58 +01:00
parent 7382df03a8
commit b4ec4f896c
5 changed files with 14 additions and 14 deletions

View File

@ -71,7 +71,7 @@ class GroupParser:
"Masters V": self.MAS5,
}
def parseClass(self, cls: str) -> Group_t:
def parseGroup(self, cls: str) -> Group_t:
match = re.compile("^(\\w+\\.?)/(\\w+\\.?)$").match(cls)
if match is not None:
grpA = self.mapNames[match.group(1)]
@ -80,9 +80,9 @@ class GroupParser:
else:
return self.mapNames[cls]
def isPureClass(self, cls: str) -> bool:
parsedClass = self.parseClass(cls)
return isinstance(parsedClass, Group)
def isPureGroup(self, cls: str) -> bool:
parsedGroup = self.parseGroup(cls)
return isinstance(parsedGroup, Group)
def getGroups(self) -> list[Group]:
return [

View File

@ -46,7 +46,7 @@ class HtmlParser:
return {
"dance": dance.strip(),
"class_": str(self.classParser.parseClass(rawClass, True)),
"group": str(self.groupParser.parseClass(rawGroup)),
"group": str(self.groupParser.parseGroup(rawGroup)),
}
def parseResult(self):

View File

@ -37,7 +37,7 @@ class CSVResultReader:
def __processRow(row):
result = ResultRow(
competitionGroup=groupParser.parseClass(row[2]),
competitionGroup=groupParser.parseGroup(row[2]),
competitionClass=classParser.parseClass(row[3]),
dance=row[4],
id=row[5],
@ -46,7 +46,7 @@ class CSVResultReader:
club=row[10],
place=row[12],
placeTo=row[13],
group=groupParser.parseClass(row[15]),
group=groupParser.parseGroup(row[15]),
class_=classParser.parseClass(row[16]),
)
self.l.log(5, "Found row in CSV: %s", result)

View File

@ -39,7 +39,7 @@ class HtmlPreviewParticipant:
self.name = name
self.id = id
groupParser = group.GroupParser()
self.group = groupParser.parseClass(group_)
self.group = groupParser.parseGroup(group_)
self.finalist = None
def __eq__(self, o):

View File

@ -85,7 +85,7 @@ class Worker:
# for participant in participants:
# groupSet.add(participant.group)
for tup in data.htmlResults.results.keys():
gr = self._groupParser.parseClass(tup[0])
gr = self._groupParser.parseGroup(tup[0])
# groupSet.add(gr)
groupSet.update(gr.getContainedGroups())
# self.l.log(5, 'Group type %s', type(gr))
@ -137,11 +137,11 @@ class Worker:
groupsPerId = {}
for tup in importedData.htmlResults.results:
competitionGroup = self._groupParser.parseClass(tup[0])
competitionGroup = self._groupParser.parseGroup(tup[0])
fixture = importedData.htmlResults.tabges.get(tup, (None, None, None))
id = int(tup[3])
if fixture[2] is not None:
group = self._groupParser.parseClass(fixture[2])
group = self._groupParser.parseGroup(fixture[2])
else:
containedGroups = competitionGroup.getContainedGroups()
if len(containedGroups) > 1:
@ -202,7 +202,7 @@ class Worker:
additionalDances = set()
foundDances = set()
for tup in data.htmlResults.results.keys():
currentGroup = self._groupParser.parseClass(tup[0])
currentGroup = self._groupParser.parseGroup(tup[0])
if group not in currentGroup.getContainedGroups():
continue
foundDances.add(tup[2])
@ -233,7 +233,7 @@ class Worker:
# self.l.log(5, 'Results %s', pformat(importedData.htmlResults.results))
for tup in importedData.htmlResults.results.keys():
currentGroup = self._groupParser.parseClass(tup[0])
currentGroup = self._groupParser.parseGroup(tup[0])
activeGroups = currentGroup.getContainedGroups()
if group not in activeGroups:
continue
@ -244,7 +244,7 @@ class Worker:
else:
if (
fixture[2] is not None
and self._groupParser.parseClass(fixture[2]) != group
and self._groupParser.parseGroup(fixture[2]) != group
):
self.l.log(
5,