/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/sixish.py

  • Committer: Jelmer Vernooij
  • Date: 2018-02-18 21:42:57 UTC
  • mto: This revision was merged to the branch mainline in revision 6859.
  • Revision ID: jelmer@jelmer.uk-20180218214257-jpevutp1wa30tz3v
Update TODO to reference Breezy, not Bazaar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2017 Bazaar hackers
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
16
 
 
17
"""
 
18
Module to aid writing a Python dialect compatible with 2.7 and 3.4+.
 
19
 
 
20
Initially pretty much just a subset of six while things get worked out.
 
21
"""
 
22
 
 
23
from __future__ import absolute_import
 
24
 
 
25
from six import (
 
26
    binary_type,
 
27
    indexbytes,
 
28
    int2byte,
 
29
    PY3,
 
30
    reraise,
 
31
    string_types,
 
32
    text_type,
 
33
    viewitems,
 
34
    viewkeys,
 
35
    viewvalues,
 
36
)
 
37
 
 
38
 
 
39
# The io module exists in Python 2.7 but lacks optimisation. Most uses are not
 
40
# performance critical, but want to measure before switching from cStringIO.
 
41
if PY3:
 
42
    import io as _io
 
43
    BytesIO = _io.BytesIO
 
44
    StringIO = _io.StringIO
 
45
    from builtins import range, map, zip
 
46
else:
 
47
    from cStringIO import StringIO as BytesIO
 
48
    from StringIO import StringIO
 
49
    from future_builtins import zip, map
 
50
    range = xrange
 
51
 
 
52
 
 
53
# GZ 2017-06-10: Work out if interning bits of inventory is behaviour we want
 
54
# to retain outside of StaticTuple, if so need to implement for Python 3.
 
55
if PY3:
 
56
    def bytesintern(b):
 
57
        """Dummy intern() function."""
 
58
        return b
 
59
else:
 
60
    bytesintern = intern