Created
November 27, 2019 13:45
-
-
Save nnsnodnb/677f27e93402062d76db03f0e79249db to your computer and use it in GitHub Desktop.
django-silk がインストールされてないけど同じコードを扱いたいときあるじゃん?
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
class custom_profile(object): | |
def __init__(self, name=None, _dynamic=False): | |
super().__init__() | |
def __new__(cls, *args, **kwargs): | |
try: | |
from silk.profiling.profiler import silk_profile | |
except ImportError: | |
class silk_profile(object): | |
def __init__(self, *_args, **_kwargs): | |
pass | |
return silk_profile(**kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment