Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 0 additions & 104 deletions hazelcast/serialization/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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:
Expand Down
6 changes: 0 additions & 6 deletions hazelcast/serialization/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 0 additions & 12 deletions hazelcast/serialization/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
42 changes: 0 additions & 42 deletions hazelcast/serialization/portable/classdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
12 changes: 0 additions & 12 deletions hazelcast/serialization/portable/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions hazelcast/serialization/portable/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
20 changes: 4 additions & 16 deletions tests/integration/backward_compatible/util.py
Original file line number Diff line number Diff line change
@@ -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)
18 changes: 0 additions & 18 deletions tests/unit/serialization/input_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
23 changes: 0 additions & 23 deletions tests/unit/serialization/output_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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())
Loading