mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-22 17:46:57 +03:00
Fix warning output
Warning filtering is the responsibility of the application, not a library, and this current use causes all warnings from an application (at least those after this function is evaluated the first time) to print their contents. This makes the library a better citizen in the Python ecosystem, and more closely matches what developers would expect. (For what it's worth, we also can't start using this library without this patch because the logging is too verbose and may obscure more important warnings. We depend on being able to accurately control warning and logging output)
This commit is contained in:
parent
f13e54b4a4
commit
4e59cf3ea6
|
@ -6,13 +6,11 @@ string_types = (type(b''), type(u''))
|
|||
|
||||
|
||||
def warn_deprecation(text):
|
||||
warnings.simplefilter('always', DeprecationWarning)
|
||||
warnings.warn(
|
||||
text,
|
||||
category=DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
warnings.simplefilter('default', DeprecationWarning)
|
||||
|
||||
|
||||
def deprecated(reason):
|
||||
|
|
Loading…
Reference in New Issue
Block a user