本文整理汇总了Python中warnings.DeprecationWarning方法的典型用法代码示例。如果您正苦于以下问题:Python warnings.DeprecationWarning方法的具体用法?Python warnings.DeprecationWarning怎么用?Python warnings.DeprecationWarning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类warnings
的用法示例。
在下文中一共展示了warnings.DeprecationWarning方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_app
# 需要导入模块: import warnings [as 别名]
# 或者: from warnings import DeprecationWarning [as 别名]
def create_app(self, *args, **kwargs):
warnings.warn("create_app() is deprecated; use __call__().", warnings.DeprecationWarning)
return self(*args,**kwargs)
示例2: is_valid
# 需要导入模块: import warnings [as 别名]
# 或者: from warnings import DeprecationWarning [as 别名]
def is_valid(zipcode):
warnings.warn("is_valid is deprecated; use is_real", warnings.DeprecationWarning)
return is_real(zipcode)
示例3: se2lib
# 需要导入模块: import warnings [as 别名]
# 或者: from warnings import DeprecationWarning [as 别名]
def se2lib(self):
warnings.warn("se2lib is deprecated. Use selib intead.", warnings.DeprecationWarning)
return self.selib
示例4: stop
# 需要导入模块: import warnings [as 别名]
# 或者: from warnings import DeprecationWarning [as 别名]
def stop(self, stoplogging=False):
log.info('Stopping %s' % SERVER_SOFTWARE)
self.startstop_lock.acquire()
try:
# Stop listeners
for l in self.listeners:
l.ready = False
# Encourage a context switch
time.sleep(0.01)
for l in self.listeners:
if l.isAlive():
l.join()
# Stop Monitor
self._monitor.stop()
if self._monitor.isAlive():
self._monitor.join()
# Stop Worker threads
self._threadpool.stop()
if stoplogging:
logging.shutdown()
msg = "Calling logging.shutdown() is now the responsibility of \
the application developer. Please update your \
applications to no longer call rocket.stop(True)"
try:
import warnings
raise warnings.DeprecationWarning(msg)
except ImportError:
raise RuntimeError(msg)
finally:
self.startstop_lock.release()
示例5: set_color_scheme
# 需要导入模块: import warnings [as 别名]
# 或者: from warnings import DeprecationWarning [as 别名]
def set_color_scheme(dark=False, publication_quality=False, cmap='viridis'): # pragma: no cover
"""
Apply a color scheme to all matplotlib figures. The setting
publication_quality uses LaTeX for all text in the figure.
"""
import warnings
warnings.warn('set_color_scheme() is deprecated. Copy the color scheme to your own file if you want to continue using it in the future.',
warnings.DeprecationWarning, stacklevel=2)
import matplotlib as mpl
mpl.rc('lines', linewidth=1.5, markeredgewidth=0.25)
mpl.rc('image', cmap=cmap)
mpl.rc('legend', scatterpoints=1, numpoints=1, labelspacing=0.3)
mpl.rc('axes.formatter', limits=(-4,4))
mpl.rc('text.latex', preamble=['\\usepackage{amsmath}'])
mpl.rc('xtick', labelsize='small')
mpl.rc('ytick', labelsize='small')
mpl.rc('axes', titlesize='medium', labelsize='medium')
mpl.rc('legend', fontsize='medium')
mpl.rc('savefig', transparent=True)
if dark:
mpl.rc('axes', prop_cycle=palettes['light'], facecolor='k', labelcolor='w', edgecolor='w')
mpl.rc('xtick', color='w')
mpl.rc('ytick', color='w')
mpl.rc('grid', color='w')
mpl.rc('figure', facecolor='k', edgecolor='k')
mpl.rc('text', color='w')
else:
mpl.rc('axes', prop_cycle=palettes['dark'], facecolor='w', labelcolor='k', edgecolor='k')
mpl.rc('xtick', color='k')
mpl.rc('ytick', color='k')
mpl.rc('grid', color='k')
mpl.rc('figure', facecolor='w', edgecolor='w')
mpl.rc('text', color='k')
if publication_quality:
mpl.rc('text', usetex=True)
mpl.rc('font', family='sans-serif')
mpl.rc('font', serif=['computer modern roman'], monospace=['computer modern typewriter'])
mpl.rcParams['font.sans-serif'] = ['computer modern sans serif']
mpl.rc('font', size=11)
mpl.rc('figure', figsize=(7.2, 5.1))
else:
mpl.rc('text', usetex=False)
mpl.rc('font', family='sans-serif')
mpl.rc('font', serif=['Bitstream Vera Serif', 'New Century Schoolbook', 'Century Schoolbook L', 'Utopia',
'ITC Bookman', 'Bookman','Nimbus Roman No9 L', 'Times New Roman', 'Times', 'Palatino', 'Charter', 'serif'])
mpl.rcParams['font.sans-serif'] = ['Bitstream Vera Sans', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucid', 'Arial',
'Helvetica', 'Avant Garde', 'sans-serif']
mpl.rc('font', monospace=['Bitstream Vera Sans Mono', 'Andale Mono', 'Nimbus Mono L', 'Courier New', 'Courier',
'Fixed', 'Terminal', 'monospace'])
mpl.rc('figure', figsize=(10, 7.1))
mpl.rc('font', size=14)