Skip to content

Commit

Permalink
Revert "Replace usage of functools.cached_property with DIY class for…
Browse files Browse the repository at this point in the history
… backwar… (#613)"

This reverts commit 82f9bb9.
  • Loading branch information
teocns committed Dec 30, 2024
1 parent f8893a1 commit 371c086
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 87 deletions.
2 changes: 1 addition & 1 deletion agentops/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import threading
import traceback
from decimal import Decimal
from functools import cached_property
from typing import List, Optional, Tuple, Union
from uuid import UUID, uuid4

Expand All @@ -27,7 +28,6 @@
from .meta_client import MetaClient
from .session import Session, active_sessions
from .singleton import conditional_singleton
from .helpers import cached_property


@conditional_singleton
Expand Down
19 changes: 0 additions & 19 deletions agentops/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,3 @@ def wrapper(self, *args, **kwargs):
return func(self, *args, **kwargs)

return wrapper


class cached_property:
"""
Decorator that converts a method with a single self argument into a
property cached on the instance.
See: https://github.com/AgentOps-AI/agentops/issues/612
"""

def __init__(self, func):
self.func = func
self.__doc__ = func.__doc__

def __get__(self, instance, cls=None):
if instance is None:
return self
value = self.func(instance)
setattr(instance, self.func.__name__, value)
return value
67 changes: 0 additions & 67 deletions tests/test_helpers.py

This file was deleted.

0 comments on commit 371c086

Please sign in to comment.