~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/util/bencode.py

  • Committer: Frank Aspell
  • Date: 2009-02-22 16:54:02 UTC
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: frankaspell@googlemail.com-20090222165402-2myrucnu7er5w4ha
Fixing various typos

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
91
89
        try:
92
90
            r, l = self.decode_func[x[0]](x, 0)
93
91
        except (IndexError, KeyError):
154
152
        encode_int(int(x), r)
155
153
    encode_func[BooleanType] = encode_bool
156
154
 
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
 
 
166
155
 
167
156
def bencode(x):
168
157
    r = []