Skip to content

Commit

Permalink
pw_models.PasswordKind: Replace cache with lru_cache
Browse files Browse the repository at this point in the history
`functools.cache` was introduced in Python 3.9, while this is expected
to run on Python 3.7, so the older solution is used instead.
  • Loading branch information
nbraud committed Aug 26, 2021
1 parent 104a492 commit 9f626e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/pw_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
from enum import IntEnum, unique
from functools import cache
from functools import lru_cache
from hashlib import blake2b
import unicodedata

Expand Down Expand Up @@ -111,7 +111,7 @@ class PasswordKind(IntEnum):
AEAD_XCHACHA20_BCRYPT = 0

@property
@cache
@lru_cache(1)
def oracle(self) -> KeyedOracle:
if self == PasswordKind.AEAD_XCHACHA20_BCRYPT:
return XChacha20(Bcrypt(), self)
Expand Down

0 comments on commit 9f626e6

Please sign in to comment.