Skip to content

Instantly share code, notes, and snippets.

@nnsnodnb
Created November 27, 2019 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nnsnodnb/677f27e93402062d76db03f0e79249db to your computer and use it in GitHub Desktop.
Save nnsnodnb/677f27e93402062d76db03f0e79249db to your computer and use it in GitHub Desktop.
django-silk がインストールされてないけど同じコードを扱いたいときあるじゃん?
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