2525if sys .version > '3' :
2626 _bchr = lambda x : bytes ([x ])
2727 _bord = lambda x : x [0 ]
28- from io import BytesIO
28+ from io import BytesIO as _BytesIO
2929else :
3030 _bchr = chr
3131 _bord = ord
32- from cStringIO import StringIO as BytesIO
32+ from cStringIO import StringIO as _BytesIO
3333
3434MAX_SIZE = 0x02000000
3535
@@ -98,7 +98,7 @@ def stream_deserialize(cls, f):
9898
9999 def serialize (self ):
100100 """Serialize, returning bytes"""
101- f = BytesIO ()
101+ f = _BytesIO ()
102102 self .stream_serialize (f )
103103 return f .getvalue ()
104104
@@ -111,7 +111,7 @@ def deserialize(cls, buf, allow_padding=False):
111111 If allow_padding is False and not all bytes are consumed during
112112 deserialization DeserializationExtraDataError will be raised.
113113 """
114- fd = BytesIO (buf )
114+ fd = _BytesIO (buf )
115115 r = cls .stream_deserialize (fd )
116116 if not allow_padding :
117117 padding = fd .read ()
@@ -178,13 +178,13 @@ def stream_deserialize(cls, f):
178178
179179 @classmethod
180180 def serialize (cls , obj ):
181- f = BytesIO ()
181+ f = _BytesIO ()
182182 cls .stream_serialize (obj , f )
183183 return f .getvalue ()
184184
185185 @classmethod
186186 def deserialize (cls , buf ):
187- return cls .stream_deserialize (BytesIO (buf ))
187+ return cls .stream_deserialize (_BytesIO (buf ))
188188
189189
190190class VarIntSerializer (Serializer ):
@@ -320,3 +320,24 @@ def uint256_to_shortstr(u):
320320 return s [:16 ]
321321
322322
323+ __all__ = (
324+ 'MAX_SIZE' ,
325+ 'Hash' ,
326+ 'Hash160' ,
327+ 'SerializationError' ,
328+ 'SerializationTruncationError' ,
329+ 'DeserializationExtraDataError' ,
330+ 'ser_read' ,
331+ 'Serializable' ,
332+ 'ImmutableSerializable' ,
333+ 'Serializer' ,
334+ 'VarIntSerializer' ,
335+ 'BytesSerializer' ,
336+ 'VectorSerializer' ,
337+ 'uint256VectorSerializer' ,
338+ 'intVectorSerialzer' ,
339+ 'VarStringSerializer' ,
340+ 'uint256_from_str' ,
341+ 'uint256_from_compact' ,
342+ 'uint256_to_shortstr' ,
343+ )
0 commit comments