From 50ecb021625d4847e39a86802bebed07e7ad1cf3 Mon Sep 17 00:00:00 2001 From: Gary Donovan Date: Mon, 3 Feb 2020 10:54:44 +1100 Subject: [PATCH] Fix bug in example of custom keygen for classmethod --- README.md | 2 +- atools/_memoize_decorator.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5d0ad6a..5eaf0da 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ Python 3.6+ decorators including # You can create a consistent hash key to avoid this. class Foo: @classmethod - @memoize(db=True, get_key=lambda cls: (f'{cls.__package__}:{cls.__name__}', a)) + @memoize(db=True, get_key=lambda cls, a: (f'{cls.__package__}:{cls.__name__}', a)) def bar(cls, a) -> Any: ... - Alternative location of 'db' can also be given as pathlib.Path or str. diff --git a/atools/_memoize_decorator.py b/atools/_memoize_decorator.py index ffe8028..9cde874 100644 --- a/atools/_memoize_decorator.py +++ b/atools/_memoize_decorator.py @@ -484,7 +484,7 @@ def bar(cls, a) -> Any: ... # You can create a consistent hash key to avoid this. class Foo: @classmethod - @memoize(db=True, keygen=lambda cls: (f'{cls.__package__}:{cls.__name__}', a)) + @memoize(db=True, keygen=lambda cls, a: (f'{cls.__package__}:{cls.__name__}', a)) def bar(cls, a) -> Any: ... - Alternative location of 'db' can also be given as pathlib.Path or str.