/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/util/_bencode_py.py

  • Committer: Jelmer Vernooij
  • Date: 2020-07-05 12:50:01 UTC
  • mfrom: (7490.40.46 work)
  • mto: (7490.40.48 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200705125001-7s3vo0p55szbbws7
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#
16
16
# Modifications copyright (C) 2008 Canonical Ltd
17
17
 
 
18
from __future__ import absolute_import
 
19
 
18
20
import sys
19
21
 
20
22
 
142
144
encode_func = {}
143
145
encode_func[type(Bencached(0))] = encode_bencached
144
146
encode_func[int] = encode_int
145
 
def int_to_bytes(n):
146
 
    return b'%d' % n
 
147
if sys.version_info < (3,):
 
148
    encode_func[long] = encode_int
 
149
    int_to_bytes = str
 
150
else:
 
151
    def int_to_bytes(n):
 
152
        return b'%d' % n
147
153
encode_func[bytes] = encode_string
148
154
encode_func[list] = encode_list
149
155
encode_func[tuple] = encode_list