Python warnings.DeprecationWarning() Examples
The following are 5
code examples of warnings.DeprecationWarning().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
warnings
, or try the search function
.
Example #1
Source File: __init__.py From Zipcodes with MIT License | 5 votes |
def is_valid(zipcode): warnings.warn("is_valid is deprecated; use is_real", warnings.DeprecationWarning) return is_real(zipcode)
Example #2
Source File: pageobject.py From robotframework-pageobjectlibrary with Apache License 2.0 | 5 votes |
def se2lib(self): warnings.warn("se2lib is deprecated. Use selib intead.", warnings.DeprecationWarning) return self.selib
Example #3
Source File: rocket.py From termite-visualizations with BSD 3-Clause "New" or "Revised" License | 5 votes |
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()
Example #4
Source File: __init__.py From jbox with MIT License | 4 votes |
def create_app(self, *args, **kwargs): warnings.warn("create_app() is deprecated; use __call__().", warnings.DeprecationWarning) return self(*args,**kwargs)
Example #5
Source File: color_scheme.py From hcipy with MIT License | 4 votes |
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)