diff --git a/caimira/profiler.py b/caimira/profiler.py index a5f67576..6c39212e 100644 --- a/caimira/profiler.py +++ b/caimira/profiler.py @@ -9,7 +9,7 @@ from datetime import datetime from enum import Enum from functools import wraps -from pstats import f8, func_std_string +from pstats import f8, func_std_string # type: ignore from pyinstrument import Profiler as PyInstrumentProfiler @@ -134,12 +134,12 @@ def is_running(self): class CaimiraProfiler: + _cache_dirpath: str + _cache_filepath: str CACHE_DIR: str = os.environ.get("CAIMIRA_PROFILER_CACHE_DIR", "/tmp") ROOT_URL: str = "/profiler" - _cache_dirpath: str = None - _cache_filepath: str = None - def __init__(self, cache_dir: typing.Optional[str] = None): + def __init__(self): _cache_dir = os.path.join(self.CACHE_DIR, "caimira-profiler") self._cache_dirpath = _cache_dir self._cache_filepath = os.path.join(_cache_dir, "active") @@ -209,7 +209,7 @@ def is_active(self): def start_session( self, name: typing.Optional[str] = None, - profiler_type: typing.Optional[Profilers] = Profilers.PYINSTRUMENT, + profiler_type: Profilers = Profilers.PYINSTRUMENT, ): """Start a new session, assigning the given name.""" now = datetime.utcnow().isoformat()