Skip to content

Commit

Permalink
(agrf) Fix magic.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Jan 1, 2025
1 parent fa5a110 commit d662e73
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions agrf/magic/functor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from abc import ABC, abstractmethod
from collections.abc import Collection, Mapping, Hashable


def deep_freeze(thing):
if thing is None or isinstance(thing, str):
return thing
Expand All @@ -15,15 +13,14 @@ def deep_freeze(thing):
return thing


class CachedFunctorMixin(ABC):
class CachedFunctorMixin:
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.attr_cache = {}
self.call_cache = {}

@abstractmethod
def fmap(self, f):
pass
raise NotImplementedError()

def __getattr__(self, name):
if name in self.attr_cache:
Expand Down

0 comments on commit d662e73

Please sign in to comment.