~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/util/_bencode_py.py

  • Committer: Vincent Ladeuil
  • Date: 2010-02-10 15:46:03 UTC
  • mfrom: (4985.3.21 update)
  • mto: This revision was merged to the branch mainline in revision 5021.
  • Revision ID: v.ladeuil+lp@free.fr-20100210154603-k4no1gvfuqpzrw7p
Update performs two merges in a more logical order but stop on conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
# publish, distribute, sublicense, and/or sell copies of the Software,
10
10
# and to permit persons to whom the Software is furnished to do so,
11
11
# subject to the following conditions:
12
 
 
12
#
13
13
# The above copyright notice and this permission notice shall be
14
14
# included in all copies or substantial portions of the Software.
15
15
#
86
86
        return (r, f + 1)
87
87
 
88
88
    def bdecode(self, x):
 
89
        if type(x) != str:
 
90
            raise TypeError
89
91
        try:
90
92
            r, l = self.decode_func[x[0]](x, 0)
91
93
        except (IndexError, KeyError):
152
154
        encode_int(int(x), r)
153
155
    encode_func[BooleanType] = encode_bool
154
156
 
 
157
from bzrlib._static_tuple_py import StaticTuple
 
158
encode_func[StaticTuple] = encode_list
 
159
try:
 
160
    from bzrlib._static_tuple_c import StaticTuple
 
161
except ImportError:
 
162
    pass
 
163
else:
 
164
    encode_func[StaticTuple] = encode_list
 
165
 
155
166
 
156
167
def bencode(x):
157
168
    r = []