/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 breezy/ui/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-07 02:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 7492.
  • Revision ID: jelmer@jelmer.uk-20200207021430-m49iq3x4x8xlib6x
Drop python2 support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
    )
55
55
""")
56
56
 
57
 
from ..sixish import (
58
 
    PY3,
59
 
    string_types,
60
 
    text_type,
61
 
    )
62
 
 
63
57
 
64
58
_valid_boolean_strings = dict(yes=True, no=False,
65
59
                              y=True, n=False,
89
83
    if accepted_values is None:
90
84
        accepted_values = _valid_boolean_strings
91
85
    val = None
92
 
    if isinstance(s, string_types):
 
86
    if isinstance(s, str):
93
87
        try:
94
88
            val = accepted_values[s.lower()]
95
89
        except KeyError:
319
313
            fail = "brz warning: %r, %r" % (warning_id, message_args)
320
314
            warnings.warn("no template for warning: "
321
315
                          + fail)   # so tests will fail etc
322
 
            return text_type(fail)
 
316
            return str(fail)
323
317
        try:
324
 
            return text_type(template) % message_args
 
318
            return str(template) % message_args
325
319
        except ValueError as e:
326
320
            fail = "brz unprintable warning: %r, %r, %s" % (
327
321
                warning_id, message_args, e)
328
322
            warnings.warn(fail)   # so tests will fail etc
329
 
            return text_type(fail)
 
323
            return str(fail)
330
324
 
331
325
    def choose(self, msg, choices, default=None):
332
326
        """Prompt the user for a list of alternatives.