~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/symbol_versioning.py

  • Committer: Martin Pool
  • Date: 2010-07-16 15:20:17 UTC
  • mfrom: (5346.3.1 pathnotchild)
  • mto: This revision was merged to the branch mainline in revision 5351.
  • Revision ID: mbp@canonical.com-20100716152017-t4c73h9y1uoih7fb
PathNotChild should not give a traceback.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2006-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
41
41
    """Generate a message that something was deprecated in a release.
42
42
 
43
43
    >>> deprecated_in((1, 4, 0))
44
 
    '%s was deprecated in version 1.4.'
 
44
    '%s was deprecated in version 1.4.0.'
45
45
    """
46
46
    return ("%%s was deprecated in version %s."
47
47
            % bzrlib._format_version_tuple(version_tuple))
280
280
            return self._warn_deprecated(list.remove, value)
281
281
 
282
282
        def pop(self, index=None):
283
 
            """pop'ing from from %s is deprecated""" % (variable_name,)
 
283
            """pop'ing from %s is deprecated""" % (variable_name,)
284
284
            if index:
285
285
                return self._warn_deprecated(list.pop, index)
286
286
            else:
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):