-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# TODO Ideally, needs doublewraps as well? | ||
def mcachew(*args, **kwargs): | ||
""" | ||
Stands for 'Maybe cachew'. | ||
Defensive wrapper around @cachew to make it an optional dependency. | ||
""" | ||
try: | ||
import cachew | ||
except ModuleNotFoundError: | ||
import warnings | ||
warnings.warn('cachew library not found. You might want to install it to speed things up. See https://github.com/karlicoss/cachew') | ||
return lambda orig_func: orig_func | ||
else: | ||
return cachew.cachew(*args, **kwargs) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters