/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/symbol_versioning.py

  • Committer: Robert Collins
  • Date: 2010-06-25 06:11:21 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100625061121-0cx949gxhae5aeib
The symbol_versioning module can now cleanup after itself -
``suppress_deprecation_warnings`` now returns a cleanup function.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
314
314
 
315
315
    :param override: If True, always set the ignore, if False, only set the
316
316
        ignore if there isn't already a filter.
 
317
    :return: A callable to remove the new warnings this added.
317
318
    """
318
319
    import warnings
319
320
    if not override and _check_for_filter(error_only=False):
321
322
        # then skip it.
322
323
        return
323
324
    warnings.filterwarnings('ignore', category=DeprecationWarning)
 
325
    filter = warnings.filters[0]
 
326
    def cleanup():
 
327
        warnings.filters.remove(filter)
 
328
    return cleanup
324
329
 
325
330
 
326
331
def activate_deprecation_warnings(override=True):