當前位置: 首頁>>代碼示例>>Python>>正文


Python warnings.DeprecationWarning方法代碼示例

本文整理匯總了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) 
開發者ID:jpush,項目名稱:jbox,代碼行數:5,代碼來源:__init__.py

示例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) 
開發者ID:seanpianka,項目名稱:Zipcodes,代碼行數:5,代碼來源:__init__.py

示例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 
開發者ID:boakley,項目名稱:robotframework-pageobjectlibrary,代碼行數:5,代碼來源:pageobject.py

示例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() 
開發者ID:uwdata,項目名稱:termite-visualizations,代碼行數:40,代碼來源:rocket.py

示例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) 
開發者ID:ehpor,項目名稱:hcipy,代碼行數:61,代碼來源:color_scheme.py


注:本文中的warnings.DeprecationWarning方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。