Source code for passengersim.tracers.generic

from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    import pandas as pd

    from passengersim import Simulation


[docs] class GenericTracer(ABC): name: str = "generic_tracer"
[docs] @abstractmethod def reset(self) -> None: """Reset the internal counters on this tracer to a null state.""" raise NotImplementedError()
[docs] @abstractmethod def fresh(self) -> GenericTracer: """Return a fresh copy of this tracer, tracing the same targets but not sharing state.""" raise NotImplementedError()
[docs] @abstractmethod def attach(self, sim: Simulation) -> None: """Attach this tracer to a Simulation, which will be traced as it runs.""" raise NotImplementedError()
[docs] @abstractmethod def finalize(self) -> pd.DataFrame: """Convert the internal counters on this tracer to a dataframe.""" raise NotImplementedError()