diff --git a/hazelcast/serialization/api.py b/hazelcast/serialization/api.py index 592b008a74..589a886306 100644 --- a/hazelcast/serialization/api.py +++ b/hazelcast/serialization/api.py @@ -118,18 +118,6 @@ def write_string(self, val: str) -> None: """ raise NotImplementedError() - def write_utf(self, val: str) -> None: - """Writes UTF-8 string to this output stream. - - .. deprecated:: 4.1 - This method is deprecated and will be removed in the - next major version. Use :func:`write_string` instead. - - Args: - val: The UTF-8 string to be written. - """ - raise NotImplementedError() - def write_byte_array(self, val: bytearray) -> None: """Writes a byte array to this output stream. @@ -202,18 +190,6 @@ def write_string_array(self, val: typing.Sequence[str]) -> None: """ raise NotImplementedError() - def write_utf_array(self, val: typing.Sequence[str]) -> None: - """Writes a UTF-8 String array to this output stream. - - .. deprecated:: 4.1 - This method is deprecated and will be removed in the - next major version. Use :func:`write_string_array` instead. - - Args: - val: The UTF-8 String array to be written. - """ - raise NotImplementedError() - def write_object(self, val: typing.Any) -> None: """Writes an object to this output stream. @@ -354,18 +330,6 @@ def read_string(self) -> str: """ raise NotImplementedError() - def read_utf(self) -> str: - """Reads a UTF-8 string from input stream and returns it. - - .. deprecated:: 4.1 - This method is deprecated and will be removed in the - next major version. Use :func:`read_string` instead. - - Returns: - The UTF-8 string read. - """ - raise NotImplementedError() - def read_byte_array(self) -> bytearray: """Reads a byte array from input stream and returns it. @@ -438,18 +402,6 @@ def read_string_array(self) -> typing.List[str]: """ raise NotImplementedError() - def read_utf_array(self) -> typing.List[str]: - """Reads a UTF-8 string array from input stream and returns it. - - .. deprecated:: 4.1 - This method is deprecated and will be removed in the - next major version. Use :func:`read_string_array` instead. - - Returns: - The UTF-8 string array read. - """ - raise NotImplementedError() - def read_object(self) -> typing.Any: """Reads an object from input stream and returns it. @@ -702,21 +654,6 @@ def read_string(self, field_name: str) -> str: """ raise NotImplementedError() - def read_utf(self, field_name: str) -> str: - """Reads a UTF-8 String. - - .. deprecated:: 4.1 - This method is deprecated and will be removed in the - next major version. Use :func:`read_string` instead. - - Args: - field_name: Name of the field. - - Returns: - The UTF-8 String read. - """ - raise NotImplementedError() - def read_boolean(self, field_name: str) -> bool: """Reads a primitive bool. @@ -948,21 +885,6 @@ def read_string_array(self, field_name: str) -> typing.List[str]: """ raise NotImplementedError() - def read_utf_array(self, field_name: str) -> typing.List[str]: - """Reads a UTF-8 String array. - - .. deprecated:: 4.1 - This method is deprecated and will be removed in the - next major version. Use :func:`read_string_array` instead. - - Args: - field_name: Name of the field. - - Returns: - The UTF-8 String array read. - """ - raise NotImplementedError() - def read_decimal_array(self, field_name: str) -> typing.List[decimal.Decimal]: """Reads a decimal array. @@ -1073,19 +995,6 @@ def write_string(self, field_name: str, value: str) -> None: """ raise NotImplementedError() - def write_utf(self, field_name: str, value: str) -> None: - """Writes an UTF string. - - .. deprecated:: 4.1 - This method is deprecated and will be removed in the - next major version. Use :func:`write_string` instead. - - Args: - field_name: Name of the field. - value: UTF string value to be written. - """ - raise NotImplementedError() - def write_boolean(self, field_name: str, value: bool) -> None: """Writes a primitive bool. @@ -1286,19 +1195,6 @@ def write_string_array(self, field_name: str, values: typing.Sequence[str]) -> N """ raise NotImplementedError() - def write_utf_array(self, field_name: str, values: typing.Sequence[str]) -> None: - """Writes a UTF-8 String array. - - .. deprecated:: 4.1 - This method is deprecated and will be removed in the - next major version. Use :func:`write_string_array` instead. - - Args: - field_name: Name of the field. - values: UTF-8 String array to be written. - """ - raise NotImplementedError() - def write_decimal_array( self, field_name: str, values: typing.Sequence[decimal.Decimal] ) -> None: diff --git a/hazelcast/serialization/input.py b/hazelcast/serialization/input.py index 3d873659a0..5220c23faa 100644 --- a/hazelcast/serialization/input.py +++ b/hazelcast/serialization/input.py @@ -209,12 +209,6 @@ def get_byte_order(self): return "BIG_ENDIAN" return "LITTLE_ENDIAN" - def read_utf(self): - return self.read_string() - - def read_utf_array(self): - return self.read_string_array() - def _bulk_read(self, item_size, fmt_char): length = self.read_int() if length == NULL_ARRAY_LENGTH: diff --git a/hazelcast/serialization/output.py b/hazelcast/serialization/output.py index 79ee30bb07..e5e6a05f46 100644 --- a/hazelcast/serialization/output.py +++ b/hazelcast/serialization/output.py @@ -206,12 +206,6 @@ def write_zero_bytes(self, count): self._buffer[self._pos : self._pos + count] = bytes(count) self._pos += count - def write_utf(self, val): - self.write_string(val) - - def write_utf_array(self, val): - self.write_string_array(val) - def _bulk_write(self, val, item_size, fmt_char): length = len(val) if val is not None else NULL_ARRAY_LENGTH self.write_int(length) @@ -313,9 +307,3 @@ def to_byte_array(self): def get_byte_order(self): pass - - def write_utf(self, val): - pass - - def write_utf_array(self, val): - pass diff --git a/hazelcast/serialization/portable/classdef.py b/hazelcast/serialization/portable/classdef.py index 04347803ca..03b49e7c8b 100644 --- a/hazelcast/serialization/portable/classdef.py +++ b/hazelcast/serialization/portable/classdef.py @@ -364,27 +364,6 @@ class definition. self._add_field_by_type(field_name, FieldType.STRING, self.version) return self - def add_utf_field(self, field_name: str) -> "ClassDefinitionBuilder": - """Adds the field with the string type to the - class definition. - - Args: - field_name: Name of the field to add. - - Returns: - Itself for chaining. - - Raises: - HazelcastSerializationError: If this method is called - after :func:`build` or a field with the same - name is already registered. - - .. deprecated:: 4.1 - This method is deprecated and will be removed in the - next major version. Use :func:`add_string_field` instead. - """ - return self.add_string_field(field_name) - def add_decimal_field(self, field_name: str) -> "ClassDefinitionBuilder": """Adds the field with the decimal type to the class definition. @@ -666,27 +645,6 @@ class definition. self._add_field_by_type(field_name, FieldType.STRING_ARRAY, self.version) return self - def add_utf_array_field(self, field_name: str) -> "ClassDefinitionBuilder": - """Adds the field with the string array type to the - class definition. - - Args: - field_name: Name of the field to add. - - Returns: - Itself for chaining. - - Raises: - HazelcastSerializationError: If this method is called - after :func:`build` or a field with the same - name is already registered. - - .. deprecated:: 4.1 - This method is deprecated and will be removed in the - next major version. Use :func:`add_string_array_field` instead. - """ - return self.add_string_array_field(field_name) - def add_decimal_array_field(self, field_name: str) -> "ClassDefinitionBuilder": """Adds the field with the decimal array type to the class definition. diff --git a/hazelcast/serialization/portable/reader.py b/hazelcast/serialization/portable/reader.py index 84cc01d48d..919325e90f 100644 --- a/hazelcast/serialization/portable/reader.py +++ b/hazelcast/serialization/portable/reader.py @@ -262,12 +262,6 @@ def read_timestamp_with_timezone_array(self, field_name): _read_portable_timestamp_with_timezone, ) - def read_utf(self, field_name): - return self.read_string(field_name) - - def read_utf_array(self, field_name): - return self.read_string_array(field_name) - def _read_nullable_field(self, field_name, field_type, func): current_pos = self._in.position() try: @@ -616,12 +610,6 @@ def read_portable_array(self, field_name): super().read_portable_array, ) - def read_utf(self, field_name): - return self.read_string(field_name) - - def read_utf_array(self, field_name): - return self.read_string_array(field_name) - def read_decimal_array(self, field_name): return self._validate_type_compatibility_and_read( field_name, FieldType.DECIMAL_ARRAY, super().read_decimal_array diff --git a/hazelcast/serialization/portable/writer.py b/hazelcast/serialization/portable/writer.py index f36a66a06b..1d9adbdddb 100644 --- a/hazelcast/serialization/portable/writer.py +++ b/hazelcast/serialization/portable/writer.py @@ -192,12 +192,6 @@ def get_raw_data_output(self): self._raw = True return self._out - def write_utf(self, field_name, value): - self.write_string(field_name, value) - - def write_utf_array(self, field_name, values): - self.write_string_array(field_name, values) - def _write_nullable_field(self, field_name: str, field_type: FieldType, value, func): self._set_position(field_name, field_type) is_none = value is None @@ -436,12 +430,6 @@ def write_null_portable(self, field_name, factory_id, class_id): def get_raw_data_output(self): return EmptyObjectDataOutput() - def write_utf(self, field_name, value): - self.write_string(field_name, value) - - def write_utf_array(self, field_name, values): - self.write_string_array(field_name, values) - def _create_nested_class_def(self, portable, nested_builder): _writer = ClassDefinitionWriter(self.portable_context, class_def_builder=nested_builder) portable.write_portable(_writer) diff --git a/tests/integration/backward_compatible/util.py b/tests/integration/backward_compatible/util.py index 534a149705..c4a4ff2106 100644 --- a/tests/integration/backward_compatible/util.py +++ b/tests/integration/backward_compatible/util.py @@ -1,26 +1,14 @@ def read_string_from_input(inp): - if hasattr(inp, "read_string"): - return inp.read_string() - else: - return inp.read_utf() + return inp.read_string() def write_string_to_output(out, value): - if hasattr(out, "write_string"): - out.write_string(value) - else: - out.write_utf(value) + out.write_string(value) def read_string_from_reader(reader, field_name): - if hasattr(reader, "read_string"): - return reader.read_string(field_name) - else: - return reader.read_utf(field_name) + return reader.read_string(field_name) def write_string_to_writer(writer, field_name, value): - if hasattr(writer, "write_string"): - writer.write_string(field_name, value) - else: - writer.write_utf(field_name, value) + writer.write_string(field_name, value) diff --git a/tests/unit/serialization/input_test.py b/tests/unit/serialization/input_test.py index 01ea98d39e..18832acfe4 100644 --- a/tests/unit/serialization/input_test.py +++ b/tests/unit/serialization/input_test.py @@ -236,15 +236,6 @@ def test_read_string(self): with self.assertRaises(EOFError): inp.read_string() - def test_read_utf(self): - inp = _ObjectDataInput(bytearray([0, 0, 0, 3, 97, 98, 99, 0, 0, 0, 4, 240, 159, 145, 185])) - self.assertEqual("abc", inp.read_utf()) - self.assertEqual("👹", inp.read_utf()) - self.assertEqual(15, inp.position()) - - with self.assertRaises(EOFError): - inp.read_utf() - def test_read_byte_array(self): b = bytearray([0, 0, 0, 10] + list(range(10))) inp = _ObjectDataInput(b) @@ -344,12 +335,3 @@ def test_read_string_array(self): with self.assertRaises(EOFError): inp.read_string_array() - - def test_read_utf_array(self): - b = bytearray([0, 0, 0, 1, 0, 0, 0, 3, 97, 98, 99]) - inp = _ObjectDataInput(b) - self.assertEqual(["abc"], inp.read_utf_array()) - self.assertEqual(len(b), inp.position()) - - with self.assertRaises(EOFError): - inp.read_utf_array() diff --git a/tests/unit/serialization/output_test.py b/tests/unit/serialization/output_test.py index 83fa76afd1..685de63864 100644 --- a/tests/unit/serialization/output_test.py +++ b/tests/unit/serialization/output_test.py @@ -224,17 +224,6 @@ def test_write_string(self): ) self.assertEqual(17, out.position()) - def test_write_utf(self): - out = _ObjectDataOutput(10, None) - out.write_utf("a") - out.write_utf(None) - out.write_utf("👹") - self.assertEqual( - bytearray([0, 0, 0, 1, 97, 255, 255, 255, 255, 0, 0, 0, 4, 240, 159, 145, 185]), - out.to_byte_array(), - ) - self.assertEqual(17, out.position()) - def test_write_bytes(self): out = _ObjectDataOutput(10, None) out.write_bytes("a") @@ -350,15 +339,3 @@ def test_write_string_array(self): out.to_byte_array(), ) self.assertEqual(21, out.position()) - - def test_write_utf_array(self): - out = _ObjectDataOutput(1, None) - out.write_utf_array(["a", "👹"]) - out.write_utf_array(None) - self.assertEqual( - bytearray( - [0, 0, 0, 2, 0, 0, 0, 1, 97, 0, 0, 0, 4, 240, 159, 145, 185, 255, 255, 255, 255] - ), - out.to_byte_array(), - ) - self.assertEqual(21, out.position())