39
39
import logging
40
40
import os
41
41
import struct
42
- import sys
43
42
44
43
try :
45
44
# Python 2
@@ -1663,6 +1662,7 @@ def _convert_type_to_char(self, type_char):
1663
1662
1664
1663
# ------------------------------------------------------------------------------
1665
1664
1665
+
1666
1666
def read (data , fmt_str ):
1667
1667
"""
1668
1668
Reads input bytes and extract the given structure. Returns both the read
@@ -1677,16 +1677,16 @@ def read(data, fmt_str):
1677
1677
1678
1678
1679
1679
def read_string (data , length_fmt = "H" ):
1680
- """
1681
- Reads a serialized string
1680
+ """
1681
+ Reads a serialized string
1682
1682
1683
- :param data: Bytes where to read the string from
1684
- :param length_fmt: Structure format of the string length (H or Q)
1685
- :return: The deserialized string
1686
- """
1687
- (length ,), data = read (data , ">{0}" .format (length_fmt ))
1688
- ba , data = data [:length ], data [length :]
1689
- return to_unicode (ba ), data
1683
+ :param data: Bytes where to read the string from
1684
+ :param length_fmt: Structure format of the string length (H or Q)
1685
+ :return: The deserialized string
1686
+ """
1687
+ (length ,), data = read (data , ">{0}" .format (length_fmt ))
1688
+ ba , data = data [:length ], data [length :]
1689
+ return to_unicode (ba ), data
1690
1690
1691
1691
1692
1692
class DefaultObjectTransformer (object ):
@@ -1718,6 +1718,7 @@ class JavaPrimitiveClass(JavaObject):
1718
1718
"""
1719
1719
Parent of Java classes matching a primitive (Bool, Integer, Long, ...)
1720
1720
"""
1721
+
1721
1722
def __init__ (self , unmarshaller ):
1722
1723
JavaObject .__init__ (self )
1723
1724
self .value = None
@@ -1729,7 +1730,7 @@ def __repr__(self):
1729
1730
return repr (self .value )
1730
1731
1731
1732
def __hash__ (self ):
1732
- return hash (self .value )
1733
+ return hash (self .value )
1733
1734
1734
1735
def __eq__ (self , other ):
1735
1736
return self .value == other
@@ -1827,6 +1828,7 @@ class JavaTime(JavaObject):
1827
1828
The semantic of the fields depends on the type of time that has been
1828
1829
parsed
1829
1830
"""
1831
+
1830
1832
DURATION_TYPE = 1
1831
1833
INSTANT_TYPE = 2
1832
1834
LOCAL_DATE_TYPE = 3
@@ -1905,27 +1907,27 @@ def do_instant(self, unmarshaller, data):
1905
1907
return data
1906
1908
1907
1909
def do_local_date (self , unmarshaller , data ):
1908
- (self .year , self .month , self .day ), data = read (data , ' >ibb' )
1910
+ (self .year , self .month , self .day ), data = read (data , " >ibb" )
1909
1911
return data
1910
1912
1911
1913
def do_local_time (self , unmarshaller , data ):
1912
- (hour ,), data = read (data , '>b' )
1914
+ (hour ,), data = read (data , ">b" )
1913
1915
minute = 0
1914
1916
second = 0
1915
1917
nano = 0
1916
1918
1917
1919
if hour < 0 :
1918
1920
hour = ~ hour
1919
1921
else :
1920
- (minute ,), data = read (data , '>b' )
1922
+ (minute ,), data = read (data , ">b" )
1921
1923
if minute < 0 :
1922
1924
minute = ~ minute
1923
1925
else :
1924
- (second ,), data = read (data , '>b' )
1926
+ (second ,), data = read (data , ">b" )
1925
1927
if second < 0 :
1926
1928
second = ~ second
1927
1929
else :
1928
- (nano ,), data = read (data , '>i' )
1930
+ (nano ,), data = read (data , ">i" )
1929
1931
1930
1932
self .hour = hour
1931
1933
self .minute = minute
0 commit comments