Skip to content

Commit 8271d5b

Browse files
committed
Some more formatting
1 parent b890a4f commit 8271d5b

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

javaobj/v2/core.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,18 @@ def _do_object(self, type_code=0):
513513
return instance
514514

515515
def _is_default_supported(self, class_name):
516+
# type: (str) -> bool
517+
"""
518+
Checks if this class is supported by the default object transformer
519+
"""
516520
default_transf = [
517521
x
518522
for x in self.__transformers
519523
if isinstance(x, DefaultObjectTransformer)
520524
]
521525
return (
522-
len(default_transf) and class_name in default_transf[0]._type_mapper
526+
bool(default_transf)
527+
and class_name in default_transf[0]._type_mapper
523528
)
524529

525530
def _read_class_data(self, instance):
@@ -682,7 +687,9 @@ def _do_array(self, type_code):
682687

683688
# Array content
684689
for transformer in self.__transformers:
685-
content = transformer.load_array(self.__reader, field_type.type_code(), size)
690+
content = transformer.load_array(
691+
self.__reader, field_type.type_code(), size
692+
)
686693
if content is not None:
687694
break
688695
else:

javaobj/v2/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import absolute_import
77

8-
from typing import Any, IO, Iterable
8+
from typing import Any, IO
99

1010
try:
1111
# Python 2

javaobj/v2/transformers.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"""
2626

2727
# Standard library
28-
from typing import List, Optional, Tuple, Union
28+
from typing import List, Optional, Tuple
2929
import functools
3030

3131
# Numpy (optional)
@@ -37,7 +37,7 @@
3737

3838
# Javaobj
3939
from .api import ObjectTransformer
40-
from .beans import JavaInstance, JavaClassDesc, FieldType, BlockData
40+
from .beans import JavaInstance, JavaClassDesc, BlockData
4141
from ..constants import TerminalCode, TypeCode
4242
from ..utils import to_bytes, log_error, log_debug, read_struct, read_string
4343

@@ -118,13 +118,20 @@ def load_from_instance(self, indent=0):
118118

119119

120120
class JavaBool(JavaPrimitiveClass):
121+
"""
122+
Represents a Java Boolean object
123+
"""
124+
121125
HANDLED_CLASSES = "java.lang.Boolean"
122126

123127
def __bool__(self):
124128
return self.value
125129

126130

127131
class JavaInt(JavaPrimitiveClass):
132+
"""
133+
Represents a Java Integer or Long object
134+
"""
128135

129136
HANDLED_CLASSES = ("java.lang.Integer", "java.lang.Long")
130137

@@ -137,7 +144,10 @@ class JavaMap(dict, JavaInstance):
137144
Python-Java dictionary/map bridge type
138145
"""
139146

140-
HANDLED_CLASSES = ("java.util.HashMap", "java.util.TreeMap") # type: Tuple[str, ...]
147+
HANDLED_CLASSES = (
148+
"java.util.HashMap",
149+
"java.util.TreeMap",
150+
) # type: Tuple[str, ...]
141151

142152
def __init__(self):
143153
dict.__init__(self)
@@ -204,7 +214,10 @@ class JavaSet(set, JavaInstance):
204214
Python-Java set bridge type
205215
"""
206216

207-
HANDLED_CLASSES = ("java.util.HashSet", "java.util.LinkedHashSet") # type: Tuple[str, ...]
217+
HANDLED_CLASSES = (
218+
"java.util.HashSet",
219+
"java.util.LinkedHashSet",
220+
) # type: Tuple[str, ...]
208221

209222
def __init__(self):
210223
set.__init__(self)

0 commit comments

Comments
 (0)