Пример #1
0
 def add_mpint(self, z):
     """
     Add a long int to the stream, encoded as an infinite-precision
     integer.  This method only works on positive numbers.
     
     :param long z: long int to add
     """
     self.add_string(util.deflate_long(z))
     return self
Пример #2
0
 def add_int(self, n):
     """
     Add an integer to the stream.
     
     :param int n: integer to add
     """
     if n >= Message.big_int:
         self.packet.write(max_byte)
         self.add_string(util.deflate_long(n))
     else:
         self.packet.write(struct.pack('>I', n))
     return self