From 451e171ad9bef27d87f4124dbf032881d3ccc485 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 7 Jun 2024 21:24:32 -0700 Subject: [PATCH] remove old cache wrapper (#32653) * remove wrapper that is functools.cache * format --- common/git.py | 2 +- common/utils.py | 12 ------------ system/version.py | 3 +-- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/common/git.py b/common/git.py index bfb18ce25d..4406bf96b1 100644 --- a/common/git.py +++ b/common/git.py @@ -1,5 +1,5 @@ +from functools import cache import subprocess -from openpilot.common.utils import cache from openpilot.common.run import run_cmd, run_cmd_default diff --git a/common/utils.py b/common/utils.py index e37f2448c5..b9de020ee6 100644 --- a/common/utils.py +++ b/common/utils.py @@ -1,11 +1,3 @@ -from collections.abc import Callable -from functools import lru_cache -from typing import TypeVar - - -_RT = TypeVar("_RT") - - class Freezable: _frozen: bool = False @@ -17,7 +9,3 @@ class Freezable: if self._frozen: raise Exception("cannot modify frozen object") super().__setattr__(*args, **kwargs) - - -def cache(user_function: Callable[..., _RT], /) -> Callable[..., _RT]: - return lru_cache(maxsize=None)(user_function) diff --git a/system/version.py b/system/version.py index d258fe0492..94964526b3 100755 --- a/system/version.py +++ b/system/version.py @@ -1,14 +1,13 @@ #!/usr/bin/env python3 from dataclasses import dataclass +from functools import cache import json import os import pathlib import subprocess - from openpilot.common.basedir import BASEDIR from openpilot.common.swaglog import cloudlog -from openpilot.common.utils import cache from openpilot.common.git import get_commit, get_origin, get_branch, get_short_branch, get_commit_date RELEASE_BRANCHES = ['release3-staging', 'release3', 'nightly']