Subject: Make the deprecation warning switchable Author: Christoph Biedl Date: 2018-01-08 Forwarded: soon --- a/magic/__init__.py +++ b/magic/__init__.py @@ -19,6 +19,7 @@ import sys import glob +import os import os.path import ctypes import ctypes.util @@ -325,9 +326,10 @@ def deprecation_wrapper(compat, fn, alternate): def _(*args, **kwargs): - warnings.warn( - "Using compatability mode with libmagic's python binding", - DeprecationWarning) + if "PYTHONMAGIC_WARN_DEPRECATED" in os.environ: + warnings.warn( + "Using compatibility mode with libmagic's python binding", + DeprecationWarning) return compat[fn](*args, **kwargs) return _