From 0170e2a96688466a9145482dfe1d127f89efdcbb Mon Sep 17 00:00:00 2001 From: Thomas Calmant Date: Mon, 1 Jun 2026 01:38:00 +0200 Subject: [PATCH 1/3] Fixed some type hints Signed-off-by: Thomas Calmant --- javaobj/v1/beans.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/javaobj/v1/beans.py b/javaobj/v1/beans.py index 03a0f26..fbd5a50 100644 --- a/javaobj/v1/beans.py +++ b/javaobj/v1/beans.py @@ -27,8 +27,8 @@ from __future__ import absolute_import -from typing import List import struct +from typing import List # noqa: F401 from ..utils import UNICODE_TYPE @@ -62,12 +62,12 @@ def __init__(self): """ Sets up members """ - self.name = None # type: str - self.serialVersionUID = None # type: int # pylint:disable=C0103 - self.flags = None # type: int + self.name = None # type: str | None + self.serialVersionUID = None # type: int | None # pylint:disable=C0103 + self.flags = None # type: int | None self.fields_names = [] # type: List[str] self.fields_types = [] # type: List[JavaString] - self.superclass = None # type: JavaClass + self.superclass = None # type: JavaClass | None def __str__(self): """ @@ -110,7 +110,7 @@ def __init__(self): """ Sets up members """ - self.classdesc = None # type: JavaClass + self.classdesc = None # type: JavaClass | None self.annotations = [] def get_class(self): From 80634eba82f2721d22a804d74ca120a0639f06f6 Mon Sep 17 00:00:00 2001 From: Thomas Calmant Date: Mon, 1 Jun 2026 01:42:21 +0200 Subject: [PATCH 2/3] Version bump + copyright + reordered imports Signed-off-by: Thomas Calmant --- javaobj/__init__.py | 4 ++-- javaobj/constants.py | 4 ++-- javaobj/modifiedutf8.py | 3 +-- javaobj/utils.py | 6 +++--- javaobj/v1/__init__.py | 10 +++++----- javaobj/v1/beans.py | 4 ++-- javaobj/v1/core.py | 8 ++++---- javaobj/v1/marshaller.py | 26 +++++++++++++------------- javaobj/v1/transformers.py | 15 +++++++-------- javaobj/v1/unmarshaller.py | 35 ++++++++++++++++++----------------- javaobj/v2/__init__.py | 8 ++++---- javaobj/v2/api.py | 12 ++++++------ javaobj/v2/beans.py | 6 +++--- javaobj/v2/core.py | 4 ++-- javaobj/v2/main.py | 4 ++-- javaobj/v2/stream.py | 8 ++++---- javaobj/v2/transformers.py | 12 ++++++------ setup.py | 4 ++-- tests/test_v1.py | 4 ++-- tests/test_v2.py | 4 ++-- 20 files changed, 90 insertions(+), 91 deletions(-) diff --git a/javaobj/__init__.py b/javaobj/__init__.py index d1b146d..ebd99ed 100644 --- a/javaobj/__init__.py +++ b/javaobj/__init__.py @@ -13,12 +13,12 @@ :authors: Volodymyr Buell, Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/javaobj/constants.py b/javaobj/constants.py index d4dd1cb..d23f1e1 100644 --- a/javaobj/constants.py +++ b/javaobj/constants.py @@ -4,12 +4,12 @@ :authors: Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/javaobj/modifiedutf8.py b/javaobj/modifiedutf8.py index ac29ce5..4444e39 100644 --- a/javaobj/modifiedutf8.py +++ b/javaobj/modifiedutf8.py @@ -11,7 +11,7 @@ :authors: Scott Stephens (@swstephe), @guywithface :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha """ @@ -19,7 +19,6 @@ import sys - # Module version __version_info__ = (0, 4, 4) __version__ = ".".join(str(x) for x in __version_info__) diff --git a/javaobj/utils.py b/javaobj/utils.py index 2d6f761..e86046d 100644 --- a/javaobj/utils.py +++ b/javaobj/utils.py @@ -7,12 +7,12 @@ :authors: Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -30,12 +30,12 @@ from __future__ import absolute_import # Standard library -from typing import IO, Tuple # noqa: F401 import gzip import logging import os import struct import sys +from typing import IO, Tuple # noqa: F401 # Modified UTF-8 parser from .modifiedutf8 import byte_to_int, decode_modified_utf8 diff --git a/javaobj/v1/__init__.py b/javaobj/v1/__init__.py index cc4aaaa..db03c7a 100644 --- a/javaobj/v1/__init__.py +++ b/javaobj/v1/__init__.py @@ -4,12 +4,12 @@ :authors: Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,11 +26,11 @@ from . import beans, core, transformers # noqa: F401 from .core import ( # noqa: F401 - load, - loads, - dumps, JavaObjectMarshaller, JavaObjectUnmarshaller, + dumps, + load, + loads, ) from .transformers import DefaultObjectTransformer # noqa: F401 diff --git a/javaobj/v1/beans.py b/javaobj/v1/beans.py index fbd5a50..d9cf1d6 100644 --- a/javaobj/v1/beans.py +++ b/javaobj/v1/beans.py @@ -5,12 +5,12 @@ :authors: Volodymyr Buell, Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/javaobj/v1/core.py b/javaobj/v1/core.py index ae5eeb5..489ce9e 100644 --- a/javaobj/v1/core.py +++ b/javaobj/v1/core.py @@ -13,12 +13,12 @@ :authors: Volodymyr Buell, Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -44,10 +44,10 @@ from io import BytesIO # Javaobj modules +from ..utils import java_data_fd from .marshaller import JavaObjectMarshaller -from .unmarshaller import JavaObjectUnmarshaller from .transformers import DefaultObjectTransformer -from ..utils import java_data_fd +from .unmarshaller import JavaObjectUnmarshaller # ------------------------------------------------------------------------------ diff --git a/javaobj/v1/marshaller.py b/javaobj/v1/marshaller.py index 9e5bdeb..87dbcd5 100644 --- a/javaobj/v1/marshaller.py +++ b/javaobj/v1/marshaller.py @@ -13,12 +13,12 @@ :authors: Volodymyr Buell, Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -48,26 +48,26 @@ from io import BytesIO # Javaobj modules -from .beans import ( - JavaClass, - JavaString, - JavaObject, - JavaByteArray, - JavaEnum, - JavaArray, -) from ..constants import ( - StreamConstants, ClassDescFlags, + StreamConstants, TerminalCode, TypeCode, ) from ..utils import ( + BYTES_TYPE, + UNICODE_TYPE, log_debug, log_error, to_bytes, - BYTES_TYPE, - UNICODE_TYPE, +) +from .beans import ( + JavaArray, + JavaByteArray, + JavaClass, + JavaEnum, + JavaObject, + JavaString, ) # ------------------------------------------------------------------------------ diff --git a/javaobj/v1/transformers.py b/javaobj/v1/transformers.py index 2a28f1a..29b7d70 100644 --- a/javaobj/v1/transformers.py +++ b/javaobj/v1/transformers.py @@ -5,12 +5,12 @@ :authors: Volodymyr Buell, Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,20 +27,19 @@ from __future__ import absolute_import -from typing import Callable, Dict import functools +from typing import Callable, Dict # noqa: F401 -from .beans import JavaClass, JavaObject -from .unmarshaller import JavaObjectUnmarshaller from ..constants import ClassDescFlags, TerminalCode, TypeCode from ..utils import ( log_debug, log_error, - to_bytes, - read_struct, read_string, + read_struct, + to_bytes, ) - +from .beans import JavaClass, JavaObject +from .unmarshaller import JavaObjectUnmarshaller __all__ = ("DefaultObjectTransformer",) diff --git a/javaobj/v1/unmarshaller.py b/javaobj/v1/unmarshaller.py index 47c6cc1..344fe45 100644 --- a/javaobj/v1/unmarshaller.py +++ b/javaobj/v1/unmarshaller.py @@ -13,12 +13,12 @@ :authors: Volodymyr Buell, Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -35,34 +35,35 @@ from __future__ import absolute_import -# Standard library -from typing import Any, Union -import os import struct -# Javaobj modules -from .beans import ( - JavaClass, - JavaString, - JavaObject, - JavaByteArray, - JavaEnum, - JavaArray, -) +# Standard library +from typing import Any, Union # noqa: F401 + from ..constants import ( - StreamConstants, ClassDescFlags, + StreamCodeDebug, + StreamConstants, TerminalCode, TypeCode, - StreamCodeDebug, ) from ..utils import ( + hexdump, log_debug, log_error, read_to_str, to_unicode, unicode_char, - hexdump, +) + +# Javaobj modules +from .beans import ( + JavaArray, + JavaByteArray, + JavaClass, + JavaEnum, + JavaObject, + JavaString, ) numpy = None # Imported only when really used diff --git a/javaobj/v2/__init__.py b/javaobj/v2/__init__.py index e9745ea..f9591d6 100644 --- a/javaobj/v2/__init__.py +++ b/javaobj/v2/__init__.py @@ -15,12 +15,12 @@ :authors: Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -35,8 +35,8 @@ limitations under the License. """ -from . import api, beans, core, main, stream, transformers # noqa: 401 -from .main import load, loads # noqa: 401 +from . import api, beans, core, main, stream, transformers # noqa: F401 +from .main import load, loads # noqa: F401 # ------------------------------------------------------------------------------ diff --git a/javaobj/v2/api.py b/javaobj/v2/api.py index 8d9cd0d..0792dab 100644 --- a/javaobj/v2/api.py +++ b/javaobj/v2/api.py @@ -4,12 +4,12 @@ :authors: Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,15 +26,15 @@ from __future__ import absolute_import -from typing import List, Optional +from typing import List, Optional # noqa: F401 -from ..constants import TypeCode # pylint:disable=W0611 -from .beans import ( # pylint:disable=W0611 +from ..constants import TypeCode # noqa: F401 +from .beans import ( # noqa: F401 JavaClassDesc, JavaInstance, ParsedJavaContent, ) -from .stream import DataStreamReader # pylint:disable=W0611 +from .stream import DataStreamReader # noqa: F401 # ------------------------------------------------------------------------------ diff --git a/javaobj/v2/beans.py b/javaobj/v2/beans.py index 0b81f16..748a9d2 100644 --- a/javaobj/v2/beans.py +++ b/javaobj/v2/beans.py @@ -4,12 +4,12 @@ :authors: Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ import logging from enum import IntEnum -from typing import Any, Dict, List, Optional, Set +from typing import Any, Dict, List, Optional, Set # noqa: F401 from ..constants import ClassDescFlags, TypeCode from ..modifiedutf8 import byte_to_int, decode_modified_utf8 diff --git a/javaobj/v2/core.py b/javaobj/v2/core.py index 880be3c..82b7ede 100644 --- a/javaobj/v2/core.py +++ b/javaobj/v2/core.py @@ -5,12 +5,12 @@ :authors: Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/javaobj/v2/main.py b/javaobj/v2/main.py index 24b51b0..51710ab 100644 --- a/javaobj/v2/main.py +++ b/javaobj/v2/main.py @@ -5,7 +5,7 @@ from __future__ import absolute_import -from typing import IO, Any # pylint:disable=W0611 +from typing import IO, Any # noqa: F401 try: # Python 2 @@ -15,7 +15,7 @@ from io import BytesIO from ..utils import java_data_fd -from .api import ObjectTransformer # pylint:disable=W0611 +from .api import ObjectTransformer # noqa: F401 from .core import JavaStreamParser from .transformers import DefaultObjectTransformer, NumpyArrayTransformer diff --git a/javaobj/v2/stream.py b/javaobj/v2/stream.py index 7cb8a9f..988f4d7 100644 --- a/javaobj/v2/stream.py +++ b/javaobj/v2/stream.py @@ -4,12 +4,12 @@ :authors: Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,10 +27,10 @@ from __future__ import absolute_import import struct -from typing import IO, Any, Tuple # pylint:disable=W0611 +from typing import IO, Any, Tuple # noqa: F401 from ..modifiedutf8 import decode_modified_utf8 -from ..utils import UNICODE_TYPE, unicode_char # pylint:disable=W0611 +from ..utils import UNICODE_TYPE, unicode_char # noqa: F401 # ------------------------------------------------------------------------------ diff --git a/javaobj/v2/transformers.py b/javaobj/v2/transformers.py index 82bfd96..872ad4f 100644 --- a/javaobj/v2/transformers.py +++ b/javaobj/v2/transformers.py @@ -4,12 +4,12 @@ :authors: Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ # Standard library import functools -from typing import List, Optional, Tuple +from typing import List, Optional, Tuple # noqa: F401 # Numpy (optional) try: @@ -37,13 +37,13 @@ # Javaobj from ..constants import TerminalCode, TypeCode from ..utils import log_debug, log_error, read_string, read_struct, to_bytes -from .api import IJavaStreamParser, ObjectTransformer -from .beans import ( # pylint:disable=W0611 +from .api import IJavaStreamParser, ObjectTransformer # noqa: F401 +from .beans import ( # noqa: F401 BlockData, JavaClassDesc, JavaInstance, ) -from .stream import DataStreamReader +from .stream import DataStreamReader # noqa: F401 # ------------------------------------------------------------------------------ diff --git a/setup.py b/setup.py index 5e2b29c..c5052dd 100644 --- a/setup.py +++ b/setup.py @@ -7,12 +7,12 @@ :authors: Volodymyr Buell, Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/tests/test_v1.py b/tests/test_v1.py index 65fcd5f..5f61c5d 100644 --- a/tests/test_v1.py +++ b/tests/test_v1.py @@ -8,12 +8,12 @@ :authors: Volodymyr Buell, Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/tests/test_v2.py b/tests/test_v2.py index b4b8503..20e6d3e 100644 --- a/tests/test_v2.py +++ b/tests/test_v2.py @@ -8,12 +8,12 @@ :authors: Volodymyr Buell, Thomas Calmant :license: Apache License 2.0 -:version: 0.4.4 +:version: 0.5.0 :status: Alpha .. - Copyright 2024 Thomas Calmant + Copyright 2026 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From b88526c3ea2e0938c0cbddbe227be59b5a22326d Mon Sep 17 00:00:00 2001 From: Thomas Calmant Date: Mon, 1 Jun 2026 01:42:45 +0200 Subject: [PATCH 3/3] Updated requirements.txt Signed-off-by: Thomas Calmant --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 17b0412..5a89e21 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -enum34;python_version<="3.4" -typing;python_version<="3.4" +enum34;python_version<"3.4" +typing;python_version<"3.5"