/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: 2019-03-05 07:32:38 UTC
  • mto: (7290.1.21 work)
  • mto: This revision was merged to the branch mainline in revision 7311.
  • Revision ID: jelmer@jelmer.uk-20190305073238-zlqn981opwnqsmzi
Add appveyor configuration.

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