core.cachew: make disabled_cachew defensive
This commit is contained in:
parent
ef72ac3386
commit
e34c04ebc8
2 changed files with 7 additions and 1 deletions
|
@ -20,7 +20,12 @@ def disable_cachew():
|
|||
|
||||
@contextmanager
|
||||
def disabled_cachew():
|
||||
import cachew
|
||||
try:
|
||||
import cachew
|
||||
except ModuleNotFoundError:
|
||||
# no need to disable anything
|
||||
yield
|
||||
return
|
||||
old = disable_cachew()
|
||||
try:
|
||||
yield
|
||||
|
|
|
@ -202,6 +202,7 @@ if TYPE_CHECKING:
|
|||
|
||||
mcachew: McachewType
|
||||
|
||||
# TODO ugh. I think it needs doublewrap, otherwise @mcachew without args doesn't work
|
||||
def mcachew(*args, **kwargs): # type: ignore[no-redef]
|
||||
"""
|
||||
Stands for 'Maybe cachew'.
|
||||
|
|
Loading…
Add table
Reference in a new issue