/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-07-28 02:47:10 UTC
  • mfrom: (7519.1.1 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200728024710-a2ylds219f1lsl62
Merge lp:brz/3.1.

Merged from https://code.launchpad.net/~jelmer/brz/merge-3.1/+merge/388173

Show diffs side-by-side

added added

removed removed

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