Skip to content
Snippets Groups Projects
DataHandler.py 1.44 KiB
Newer Older
  • Learn to ignore specific revisions
  • from abc import ABC
    
    Lennard Geese's avatar
    T
    Lennard Geese committed
    
    class DataHandler(ABC):
    
    Lennard Geese's avatar
    Lennard Geese committed
        '''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.'''
    
    Lennard Geese's avatar
    T
    Lennard Geese committed
    
        def __init__(self):
            self.numberOfDrivers = 20
            self.invalidDriverId = "NO_DRIVER"
            self.activateDebugOvertakeAnalysis = False
    
    Lennard Geese's avatar
    Lennard Geese committed
            self.slickCompounds = ("SOFT", "MEDIUM", "HARD")
    
    Lennard Geese's avatar
    Lennard Geese committed
            self.validSessionTypes = ("Practice", "Qualifying", "Race")
    
            self.countOutPitstops = True
    
    
    class SessionIdentifier:
    
    Lennard Geese's avatar
    Lennard Geese committed
        '''Uniquely identifies a single session without having to load or create the Session object'''
    
    
        year: int
        event: int | str
        sessionType: str
    
        def __init__(self, year: int, event: int | str, sessionType: str = "R"):
            self.year = year
            self.event = event
    
            self.sessionType = sessionType
    
    
    class WeatherChangeWindow:
    
    Lennard Geese's avatar
    Lennard Geese committed
        '''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.'''
    
    
        firstLap: int
        lastLap: int
    
        def __init__(self, firstTireChange: int, lastTireChange: int):
            self.firstLap = firstTireChange - 1
            self.lastLap = lastTireChange + 1