Skip to content

Commit e042c2c

Browse files
committed
Re-format with black
1 parent b6dbfd1 commit e042c2c

File tree

3 files changed

+36
-30
lines changed

3 files changed

+36
-30
lines changed

javaobj/core.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import logging
4040
import os
4141
import struct
42-
import sys
4342

4443
try:
4544
# Python 2
@@ -1663,6 +1662,7 @@ def _convert_type_to_char(self, type_char):
16631662

16641663
# ------------------------------------------------------------------------------
16651664

1665+
16661666
def read(data, fmt_str):
16671667
"""
16681668
Reads input bytes and extract the given structure. Returns both the read
@@ -1677,16 +1677,16 @@ def read(data, fmt_str):
16771677

16781678

16791679
def read_string(data, length_fmt="H"):
1680-
"""
1681-
Reads a serialized string
1680+
"""
1681+
Reads a serialized string
16821682
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
16901690

16911691

16921692
class DefaultObjectTransformer(object):
@@ -1718,6 +1718,7 @@ class JavaPrimitiveClass(JavaObject):
17181718
"""
17191719
Parent of Java classes matching a primitive (Bool, Integer, Long, ...)
17201720
"""
1721+
17211722
def __init__(self, unmarshaller):
17221723
JavaObject.__init__(self)
17231724
self.value = None
@@ -1729,7 +1730,7 @@ def __repr__(self):
17291730
return repr(self.value)
17301731

17311732
def __hash__(self):
1732-
return hash(self.value)
1733+
return hash(self.value)
17331734

17341735
def __eq__(self, other):
17351736
return self.value == other
@@ -1827,6 +1828,7 @@ class JavaTime(JavaObject):
18271828
The semantic of the fields depends on the type of time that has been
18281829
parsed
18291830
"""
1831+
18301832
DURATION_TYPE = 1
18311833
INSTANT_TYPE = 2
18321834
LOCAL_DATE_TYPE = 3
@@ -1905,27 +1907,27 @@ def do_instant(self, unmarshaller, data):
19051907
return data
19061908

19071909
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")
19091911
return data
19101912

19111913
def do_local_time(self, unmarshaller, data):
1912-
(hour,), data = read(data, '>b')
1914+
(hour,), data = read(data, ">b")
19131915
minute = 0
19141916
second = 0
19151917
nano = 0
19161918

19171919
if hour < 0:
19181920
hour = ~hour
19191921
else:
1920-
(minute,), data = read(data, '>b')
1922+
(minute,), data = read(data, ">b")
19211923
if minute < 0:
19221924
minute = ~minute
19231925
else:
1924-
(second,), data = read(data, '>b')
1926+
(second,), data = read(data, ">b")
19251927
if second < 0:
19261928
second = ~second
19271929
else:
1928-
(nano,), data = read(data, '>i')
1930+
(nano,), data = read(data, ">i")
19291931

19301932
self.hour = hour
19311933
self.minute = minute

javaobj/modifiedutf8.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
https://github.com/swstephe/py2jdbc/
1111
1212
:authors: Scott Stephens (@swstephe), @guywithface
13+
:license: Apache License 2.0
14+
:version: 0.3.0
15+
:status: Alpha
1316
"""
1417

15-
1618
# Module version
1719
__version_info__ = (0, 3, 0)
1820
__version__ = ".".join(str(x) for x in __version_info__)

setup.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def read(fname):
5353
with open(os.path.join(os.path.dirname(__file__), fname)) as fd:
5454
return fd.read()
5555

56+
5657
# ------------------------------------------------------------------------------
5758

5859

@@ -65,19 +66,20 @@ def read(fname):
6566
maintainer_email="thomas.calmant@gmail.com",
6667
url="https://github.com/tcalmant/python-javaobj",
6768
description="Module for serializing and de-serializing Java objects.",
68-
license='Apache License 2.0',
69+
license="Apache License 2.0",
6970
keywords="python java marshalling serialization",
70-
packages=['javaobj'],
71+
packages=["javaobj"],
7172
test_suite="tests.tests",
72-
long_description=read('README.rst'),
73+
long_description=read("README.rst"),
7374
classifiers=[
74-
"Development Status :: 3 - Alpha",
75-
"License :: OSI Approved :: Apache Software License",
76-
'Operating System :: OS Independent',
77-
'Programming Language :: Python :: 2.7',
78-
'Programming Language :: Python :: 3.4',
79-
'Programming Language :: Python :: 3.5',
80-
'Programming Language :: Python :: 3.6',
81-
'Programming Language :: Python :: 3.7',
82-
"Topic :: Software Development :: Libraries :: Python Modules",
83-
])
75+
"Development Status :: 3 - Alpha",
76+
"License :: OSI Approved :: Apache Software License",
77+
"Operating System :: OS Independent",
78+
"Programming Language :: Python :: 2.7",
79+
"Programming Language :: Python :: 3.4",
80+
"Programming Language :: Python :: 3.5",
81+
"Programming Language :: Python :: 3.6",
82+
"Programming Language :: Python :: 3.7",
83+
"Topic :: Software Development :: Libraries :: Python Modules",
84+
],
85+
)

0 commit comments

Comments
 (0)