From 3d1997b4dae0bcf5c18ed43dc10eb6e673c77224 Mon Sep 17 00:00:00 2001 From: Lennard Geese <lennard.geese@sva.de> Date: Fri, 11 Apr 2025 16:11:06 +0200 Subject: [PATCH] Fix typos --- DataAnalyser.py | 24 ++++++++++++------------ DataHandler.py | 14 +++++++------- DataImporter.py | 8 ++++---- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/DataAnalyser.py b/DataAnalyser.py index a7c6100..1e5ba4b 100644 --- a/DataAnalyser.py +++ b/DataAnalyser.py @@ -5,12 +5,12 @@ from DataHandler import DataHandler, SessionIdentifier class DataAnalyser(DataHandler): - ''' + """ Analyses sessions by extrapolating existing or new data from them. Any method of this class must be given a Session object or a list thereof. If the method does not require such an object, it should not be part of this class. - ''' + """ # ===== Overtakes ===== @@ -57,15 +57,15 @@ class DataAnalyser(DataHandler): return overtakes def prepareWeightedOrderFromLap(self, lapNumber: int, race: Session): - '''Prepare a list from specific lap & race, that can be sorted via bubble sort to determine the number of - overtakes that occured in that lap. + """Prepare a list from specific lap & race, that can be sorted via bubble sort to determine the number of + overtakes that occurred in that lap. :param lapNumber: Which lap to prepare from the given race. Note that value of 1 will return a list ordered by starting grid, as there is no previous lap. :param race: Race from which to pull the given lap from. :return: list[(Lap, int)]: A list with pairs of every driver's lap and their position at the end of the lap. Entries are sorted by the driver's positions at the start of the lap. If an invalid lap number (below 1 or above the number of laps the race had), all laps in the list will be either None objects or empty Panda Dataframes. - ''' + """ previousLaps: Laps = race.laps.pick_laps(lapNumber - 1) currentLaps: Laps = race.laps.pick_laps(lapNumber) @@ -117,15 +117,15 @@ class DataAnalyser(DataHandler): # ===== Weather ===== def filterForRainSessions(self, sessions: list[Session]): - ''' + """ Filter out & return only those sessions from input list that had rain falling at any point during the session. Note: The sessions returned are not necessarily sessions that had wet conditions for any meaningful amount of time. Also, sessions that had wet conditions only from leftover rainwater on track are not included in the - returned sessions, as no rain occured during the session. This is due to technical limitations. + returned sessions, as no rain occurred during the session. This is due to technical limitations. :param sessions: List of sessions from which to pick out sessions with rain. :return: List of sessions which had rain falling during the session for any amount of time. - ''' + """ rainSessions: list[Session] = [] for session in sessions: @@ -153,11 +153,11 @@ class DataAnalyser(DataHandler): earliestTireChanges.append(earliestTireChange) return earliestTireChanges - # Returns -1 if no tire change occured + # Returns -1 if no tire change occurred def getEarliestTireChange(self, race: Session): earliestTireChangeLap: int = -1 compoundsPerLap: list[list[str]] = self.getCompoundsForRace(race) - compoundsPerLap[0] = compoundsPerLap[1] # presume grid tires same as 1st lap; races are only picked if weather change after first 10 laps anyways, so its ok + compoundsPerLap[0] = compoundsPerLap[1] # presume grid tires same as 1st lap; races are only picked if weather change after first 10 laps anyway, so it's ok startingCompound: str = self.getPredominantCompound(compoundsPerLap[0]) earliestTireChangeLap = self.getFirstLapWithOppositeCompound(compoundsPerLap, startingCompound) @@ -170,11 +170,11 @@ class DataAnalyser(DataHandler): latestTireChanges.append(latestTireChange) return latestTireChanges - # Returns -1 if no tire change occured + # Returns -1 if no tire change occurred def getLatestTireChange(self, race: Session): latestTireChangeLap: int = -1 compoundsPerLap: list[list[str]] = self.getCompoundsForRace(race) - compoundsPerLap[0] = compoundsPerLap[1] # presume grid tires same as 1st lap; races are only picked if weather change after first 10 laps anyways, so its ok + compoundsPerLap[0] = compoundsPerLap[1] # presume grid tires same as 1st lap; races are only picked if weather change after first 10 laps anyway, so it's ok startingCompound: str = self.getPredominantCompound(compoundsPerLap[0]) latestTireChangeLap = self.getFirstLapWithoutCompound(compoundsPerLap, startingCompound) diff --git a/DataHandler.py b/DataHandler.py index e4f3e4f..1599efd 100644 --- a/DataHandler.py +++ b/DataHandler.py @@ -1,8 +1,8 @@ from abc import ABC class DataHandler(ABC): - '''Defines variables that are needed for any type of interaction with FastF1's data. Any class utilizing FastF1 - data in any way should be a subclass of the DataHandler class to inherit these variables.''' + """Defines variables that are needed for any type of interaction with FastF1's data. Any class utilizing FastF1 + data in any way should be a subclass of the DataHandler class to inherit these variables.""" def __init__(self): self.numberOfDrivers = 20 @@ -14,10 +14,10 @@ class DataHandler(ABC): self.firstFastF1Year: int = 2018 class SessionIdentifier: - '''Uniquely identifies a single session without having to load or create the Session object''' + """Uniquely identifies a single Formula 1 session without having to load or create a Session object""" year: int - event: int | str + event: int | str # Either the event name or the round number of the event during that year/season sessionType: str def __init__(self, year: int, event: int | str, sessionType: str = "R"): @@ -27,9 +27,9 @@ class SessionIdentifier: class WeatherChangeWindow: - '''Identifies a window of laps, during which a weather change took place. A WeatherChangeWindow is itself not - associated with a SessionObject or a SessionIdentifier. This association must be made and maintained by whatever - object or function is using an object of this class.''' + """Identifies a window of laps during which a weather change took place. A WeatherChangeWindow is not + associated with a SessionObject or a SessionIdentifier by itself. This association must be made and maintained by whatever + object or function is using an object of this class.""" firstLap: int lastLap: int diff --git a/DataImporter.py b/DataImporter.py index 6ec928b..877e9ea 100644 --- a/DataImporter.py +++ b/DataImporter.py @@ -9,12 +9,12 @@ from DataHandler import DataHandler, SessionIdentifier class DataImporter(DataHandler, ABC): - ''' + """ Imports/loads sessions as specified by SessionIdentifiers and/or certain criteria such as rain. Any method of this class must be given a SessionIdentifier, a time or a time period by which to select sessions. If the method does not require one of these, it should not be part of this class. - ''' + """ def importAllEventsFromYear(self, year: int): @@ -25,12 +25,12 @@ class DataImporter(DataHandler, ABC): return races def importSessionWeather(self, sessionIdentifier: SessionIdentifier): - ''' + """ Import a session containing only weather data. :param sessionIdentifier: Session to import. Note that only races after 2017 can import weather, as session data before 2018 is provided by the Ergast/Jolpica API, which does not contain weather data. :return: Session object containing only weather data and basic session information. - ''' + """ return self.importSession(sessionIdentifier, laps = False, telemetry = False, weather = True, messages = False) def importSessions(self, sessionIdentifiers: list[SessionIdentifier], laps = True, telemetry = False, weather = False, messages = False): -- GitLab