From e0e30f763070d3e637ea74cf243da8a6bdf4f9c0 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 28 Jul 2026 11:00:47 +0300 Subject: [PATCH 1/5] initial commit --- hazelcast/core.py | 2 +- hazelcast/errors.py | 2 +- hazelcast/security.py | 6 +++--- hazelcast/serialization/api.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hazelcast/core.py b/hazelcast/core.py index 7063c66db0..7ffc601001 100644 --- a/hazelcast/core.py +++ b/hazelcast/core.py @@ -485,7 +485,7 @@ class MapEntry(typing.Generic[KeyType, ValueType]): __slots__ = ("_key", "_value") - def __init__(self, key: KeyType = None, value: ValueType = None): + def __init__(self, key: KeyType|None = None, value: ValueType|None = None): self._key = key self._value = value diff --git a/hazelcast/errors.py b/hazelcast/errors.py index 427be74183..c53214103a 100644 --- a/hazelcast/errors.py +++ b/hazelcast/errors.py @@ -11,7 +11,7 @@ def retryable(cls): class HazelcastError(Exception): """General HazelcastError class.""" - def __init__(self, message: str = None, cause: Exception = None): + def __init__(self, message: str|None = None, cause: Exception|None = None): super(HazelcastError, self).__init__(message, cause) def __str__(self): diff --git a/hazelcast/security.py b/hazelcast/security.py index 8a9c8af0b7..6e7daefff1 100644 --- a/hazelcast/security.py +++ b/hazelcast/security.py @@ -6,7 +6,7 @@ class TokenProvider: """TokenProvider is a base class for token providers.""" - def token(self, address: Address = None) -> bytes: + def token(self, address: Address|None = None) -> bytes: """Returns a token to be used for token-based authentication. Args: @@ -15,7 +15,7 @@ def token(self, address: Address = None) -> bytes: Returns: token as a bytes object. """ - pass + return bytes() class BasicTokenProvider(TokenProvider): @@ -29,5 +29,5 @@ def __init__(self, token: typing.Union[str, bytes] = ""): else: raise TypeError("token must be either a str or bytes object") - def token(self, address: Address = None) -> bytes: + def token(self, address: Address|None = None) -> bytes: return self._token diff --git a/hazelcast/serialization/api.py b/hazelcast/serialization/api.py index 6b323b7930..c058088945 100644 --- a/hazelcast/serialization/api.py +++ b/hazelcast/serialization/api.py @@ -15,7 +15,7 @@ class ObjectDataOutput: or arrays of them to series of bytes and write them on a stream. """ - def write_from(self, buff: bytearray, offset: int = None, length: int = None) -> None: + def write_from(self, buff: bytearray, offset: int|None = None, length: int|None = None) -> None: """Writes the content of the buffer to this output stream. Args: @@ -237,7 +237,7 @@ class ObjectDataInput: reconstruct it to any of primitive types or arrays of them. """ - def read_into(self, buff: bytearray, offset: int = None, length: int = None) -> bytearray: + def read_into(self, buff: bytearray, offset: int|None = None, length: int|None = None) -> bytearray: """Reads the content of the buffer into an array of bytes. Args: From 3c2010108c84db04f73e361ccf09a64a95e7c77e Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 28 Jul 2026 11:03:42 +0300 Subject: [PATCH 2/5] initial commit --- hazelcast/aggregator.py | 26 ++-- hazelcast/client.py | 2 +- hazelcast/cluster.py | 6 +- hazelcast/db.py | 22 ++-- hazelcast/future.py | 2 +- hazelcast/internal/asyncio_cluster.py | 6 +- hazelcast/internal/asyncio_proxy/list.py | 4 +- hazelcast/internal/asyncio_proxy/map.py | 2 +- hazelcast/internal/asyncio_proxy/multi_map.py | 12 +- hazelcast/internal/asyncio_proxy/queue.py | 4 +- .../internal/asyncio_proxy/replicated_map.py | 14 +-- .../internal/asyncio_proxy/ringbuffer.py | 2 +- hazelcast/internal/asyncio_proxy/set.py | 4 +- hazelcast/internal/asyncio_proxy/topic.py | 2 +- .../asyncio_proxy/vector_collection.py | 6 +- hazelcast/internal/asyncio_sql.py | 2 +- hazelcast/predicate.py | 2 +- hazelcast/proxy/list.py | 8 +- hazelcast/proxy/map.py | 116 +++++++++--------- hazelcast/proxy/multi_map.py | 24 ++-- hazelcast/proxy/queue.py | 8 +- hazelcast/proxy/replicated_map.py | 28 ++--- hazelcast/proxy/ringbuffer.py | 4 +- hazelcast/proxy/set.py | 8 +- hazelcast/proxy/topic.py | 4 +- hazelcast/proxy/transactional_map.py | 6 +- hazelcast/proxy/vector_collection.py | 10 +- hazelcast/sql.py | 2 +- 28 files changed, 168 insertions(+), 168 deletions(-) diff --git a/hazelcast/aggregator.py b/hazelcast/aggregator.py index 950425698c..e9525da3ef 100644 --- a/hazelcast/aggregator.py +++ b/hazelcast/aggregator.py @@ -177,7 +177,7 @@ def get_class_id(self): return 18 -def count(attribute_path: str = None) -> Aggregator[int]: +def count(attribute_path: str | None = None) -> Aggregator[int]: """Creates an aggregator that counts the input values. Accepts ``None`` input values and ``None`` extracted values. @@ -191,7 +191,7 @@ def count(attribute_path: str = None) -> Aggregator[int]: return _CountAggregator(attribute_path) -def distinct(attribute_path: str = None) -> Aggregator[typing.Set[AggregatorResultType]]: +def distinct(attribute_path: str | None = None) -> Aggregator[typing.Set[AggregatorResultType]]: """Creates an aggregator that calculates the distinct set of input values. Accepts ``None`` input values and ``None`` extracted values. @@ -205,7 +205,7 @@ def distinct(attribute_path: str = None) -> Aggregator[typing.Set[AggregatorResu return _DistinctValuesAggregator(attribute_path) -def double_avg(attribute_path: str = None) -> Aggregator[float]: +def double_avg(attribute_path: str | None = None) -> Aggregator[float]: """Creates an aggregator that calculates the average of the input values. Does NOT accept ``None`` input values or ``None`` extracted values. @@ -225,7 +225,7 @@ def double_avg(attribute_path: str = None) -> Aggregator[float]: return _DoubleAverageAggregator(attribute_path) -def double_sum(attribute_path: str = None) -> Aggregator[float]: +def double_sum(attribute_path: str | None = None) -> Aggregator[float]: """Creates an aggregator that calculates the sum of the input values. Does NOT accept ``None`` input values or ``None`` extracted values. @@ -245,7 +245,7 @@ def double_sum(attribute_path: str = None) -> Aggregator[float]: return _DoubleSumAggregator(attribute_path) -def fixed_point_sum(attribute_path: str = None) -> Aggregator[int]: +def fixed_point_sum(attribute_path: str | None = None) -> Aggregator[int]: """Creates an aggregator that calculates the sum of the input values. Does NOT accept ``None`` input values or ``None`` extracted values. @@ -263,7 +263,7 @@ def fixed_point_sum(attribute_path: str = None) -> Aggregator[int]: return _FixedPointSumAggregator(attribute_path) -def floating_point_sum(attribute_path: str = None) -> Aggregator[float]: +def floating_point_sum(attribute_path: str | None = None) -> Aggregator[float]: """Creates an aggregator that calculates the sum of the input values. Does NOT accept ``None`` input values or ``None`` extracted values. @@ -281,7 +281,7 @@ def floating_point_sum(attribute_path: str = None) -> Aggregator[float]: return _FloatingPointSumAggregator(attribute_path) -def int_avg(attribute_path: str = None) -> Aggregator[int]: +def int_avg(attribute_path: str | None = None) -> Aggregator[int]: """Creates an aggregator that calculates the average of the input values. Does NOT accept ``None`` input values or ``None`` extracted values. @@ -301,7 +301,7 @@ def int_avg(attribute_path: str = None) -> Aggregator[int]: return _IntegerAverageAggregator(attribute_path) -def int_sum(attribute_path: str = None) -> Aggregator[int]: +def int_sum(attribute_path: str | None = None) -> Aggregator[int]: """Creates an aggregator that calculates the sum of the input values. Does NOT accept ``None`` input values or ``None`` extracted values. @@ -321,7 +321,7 @@ def int_sum(attribute_path: str = None) -> Aggregator[int]: return _IntegerSumAggregator(attribute_path) -def long_avg(attribute_path: str = None) -> Aggregator[int]: +def long_avg(attribute_path: str | None = None) -> Aggregator[int]: """Creates an aggregator that calculates the average of the input values. Does NOT accept ``None`` input values or ``None`` extracted values. @@ -341,7 +341,7 @@ def long_avg(attribute_path: str = None) -> Aggregator[int]: return _LongAverageAggregator(attribute_path) -def long_sum(attribute_path: str = None) -> Aggregator[int]: +def long_sum(attribute_path: str | None = None) -> Aggregator[int]: """Creates an aggregator that calculates the sum of the input values. Does NOT accept ``None`` input values or ``None`` extracted values. @@ -361,7 +361,7 @@ def long_sum(attribute_path: str = None) -> Aggregator[int]: return _LongSumAggregator(attribute_path) -def max_(attribute_path: str = None) -> Aggregator[AggregatorResultType]: +def max_(attribute_path: str | None = None) -> Aggregator[AggregatorResultType]: """Creates an aggregator that calculates the max of the input values. Accepts ``None`` input values and ``None`` extracted values. @@ -381,7 +381,7 @@ def max_(attribute_path: str = None) -> Aggregator[AggregatorResultType]: return _MaxAggregator(attribute_path) -def min_(attribute_path: str = None) -> Aggregator[AggregatorResultType]: +def min_(attribute_path: str | None = None) -> Aggregator[AggregatorResultType]: """Creates an aggregator that calculates the min of the input values. Accepts ``None`` input values and ``None`` extracted values. @@ -401,7 +401,7 @@ def min_(attribute_path: str = None) -> Aggregator[AggregatorResultType]: return _MinAggregator(attribute_path) -def number_avg(attribute_path: str = None) -> Aggregator[float]: +def number_avg(attribute_path: str | None = None) -> Aggregator[float]: """Creates an aggregator that calculates the average of the input values. Does NOT accept ``None`` input values or ``None`` extracted values. diff --git a/hazelcast/client.py b/hazelcast/client.py index a3b03bf5b0..942beb1d6d 100644 --- a/hazelcast/client.py +++ b/hazelcast/client.py @@ -78,7 +78,7 @@ class HazelcastClient: _CLIENT_ID = AtomicInteger() - def __init__(self, config: Config = None, **kwargs): + def __init__(self, config: Config | None = None, **kwargs): """The client can be configured either by: - providing a configuration object as the first parameter of the diff --git a/hazelcast/cluster.py b/hazelcast/cluster.py index a1e3325893..c94de936ad 100644 --- a/hazelcast/cluster.py +++ b/hazelcast/cluster.py @@ -67,8 +67,8 @@ def __init__(self, internal_cluster_service): def add_listener( self, - member_added: typing.Callable[[MemberInfo], None] = None, - member_removed: typing.Callable[[MemberInfo], None] = None, + member_added: typing.Callable[[MemberInfo], None] | None = None, + member_removed: typing.Callable[[MemberInfo], None] | None = None, fire_for_existing=False, ) -> str: """ @@ -105,7 +105,7 @@ def remove_listener(self, registration_id: str) -> bool: return self._service.remove_listener(registration_id) def get_members( - self, member_selector: typing.Callable[[MemberInfo], bool] = None + self, member_selector: typing.Callable[[MemberInfo], bool] | None = None ) -> typing.List[MemberInfo]: """ Lists the current members in the cluster. diff --git a/hazelcast/db.py b/hazelcast/db.py index bcc44a10f8..243447a317 100644 --- a/hazelcast/db.py +++ b/hazelcast/db.py @@ -409,11 +409,11 @@ def connect( config=None, *, dsn="", - user: str = None, - password: str = None, - host: str = None, - port: int = None, - cluster_name: str = None, + user: str | None = None, + password: str | None = None, + host: str | None = None, + port: int | None = None, + cluster_name: str | None = None, ) -> Connection: """Creates a new Connection to the cluster @@ -521,14 +521,14 @@ def _map_type(code: int) -> Type: def _make_config( - config: Config = None, + config: Config | None = None, *, dsn="", - user: str = None, - password: str = None, - host: str = None, - port: int = None, - cluster_name: str = None, + user: str | None = None, + password: str | None = None, + host: str | None = None, + port: int | None = None, + cluster_name: str | None = None, ) -> Config: kwargs_used = user or password or host or port or cluster_name if config is not None: diff --git a/hazelcast/future.py b/hazelcast/future.py index 0d64c092fc..4db634300c 100644 --- a/hazelcast/future.py +++ b/hazelcast/future.py @@ -35,7 +35,7 @@ def set_result(self, result: ResultType) -> None: self._event.set() self._invoke_callbacks() - def set_exception(self, exception: Exception, traceback: types.TracebackType = None) -> None: + def set_exception(self, exception: Exception, traceback: types.TracebackType | None = None) -> None: """Sets the exception for this Future in case of errors. Args: diff --git a/hazelcast/internal/asyncio_cluster.py b/hazelcast/internal/asyncio_cluster.py index a809a66d93..93679d48e4 100644 --- a/hazelcast/internal/asyncio_cluster.py +++ b/hazelcast/internal/asyncio_cluster.py @@ -68,8 +68,8 @@ def __init__(self, internal_cluster_service): def add_listener( self, - member_added: typing.Callable[[MemberInfo], None] = None, - member_removed: typing.Callable[[MemberInfo], None] = None, + member_added: typing.Callable[[MemberInfo], None] | None = None, + member_removed: typing.Callable[[MemberInfo], None] | None = None, fire_for_existing=False, ) -> str: """ @@ -106,7 +106,7 @@ def remove_listener(self, registration_id: str) -> bool: return self._service.remove_listener(registration_id) def get_members( - self, member_selector: typing.Callable[[MemberInfo], bool] = None + self, member_selector: typing.Callable[[MemberInfo], bool] | None = None ) -> typing.List[MemberInfo]: """ Lists the current members in the cluster. diff --git a/hazelcast/internal/asyncio_proxy/list.py b/hazelcast/internal/asyncio_proxy/list.py index 6dd09fbde5..f634c56a63 100644 --- a/hazelcast/internal/asyncio_proxy/list.py +++ b/hazelcast/internal/asyncio_proxy/list.py @@ -146,8 +146,8 @@ async def add_all_at(self, index: int, items: typing.Sequence[ItemType]) -> bool async def add_listener( self, include_value: bool = False, - item_added_func: typing.Callable[[ItemEvent[ItemType]], None] = None, - item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] = None, + item_added_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, + item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, ) -> str: """Adds an item listener for this list. Listener will be notified for all list add/remove events. diff --git a/hazelcast/internal/asyncio_proxy/map.py b/hazelcast/internal/asyncio_proxy/map.py index 69d7f43013..9eead17318 100644 --- a/hazelcast/internal/asyncio_proxy/map.py +++ b/hazelcast/internal/asyncio_proxy/map.py @@ -122,7 +122,7 @@ def __init__(self, service_name, name, context): async def add_entry_listener( self, include_value: bool = False, - key: KeyType = None, + key: KeyType | None = None, predicate: Predicate | None = None, added_func: EntryEventCallable | None = None, removed_func: EntryEventCallable | None = None, diff --git a/hazelcast/internal/asyncio_proxy/multi_map.py b/hazelcast/internal/asyncio_proxy/multi_map.py index 4f537d67c9..fbcc0b086f 100644 --- a/hazelcast/internal/asyncio_proxy/multi_map.py +++ b/hazelcast/internal/asyncio_proxy/multi_map.py @@ -61,10 +61,10 @@ def __init__(self, service_name, name, context): async def add_entry_listener( self, include_value: bool = False, - key: KeyType = None, - added_func: EntryEventCallable = None, - removed_func: EntryEventCallable = None, - clear_all_func: EntryEventCallable = None, + key: KeyType | None = None, + added_func: EntryEventCallable | None = None, + removed_func: EntryEventCallable | None = None, + clear_all_func: EntryEventCallable | None = None, ) -> str: """Adds an entry listener for this multimap. @@ -339,7 +339,7 @@ def handler(message): request = multi_map_key_set_codec.encode_request(self.name) return await self._invoke(request, handler) - async def lock(self, key: KeyType, lease_time: float = None) -> None: + async def lock(self, key: KeyType, lease_time: float | None = None) -> None: """Acquires the lock for the specified key infinitely or for the specified lease time if provided. @@ -578,7 +578,7 @@ def handler(message): request = multi_map_values_codec.encode_request(self.name) return await self._invoke(request, handler) - async def try_lock(self, key: KeyType, lease_time: float = None, timeout: float = 0) -> bool: + async def try_lock(self, key: KeyType, lease_time: float | None = None, timeout: float = 0) -> bool: """Tries to acquire the lock for the specified key. When the lock is not available: diff --git a/hazelcast/internal/asyncio_proxy/queue.py b/hazelcast/internal/asyncio_proxy/queue.py index 60f9bf3ee2..31c68214ae 100644 --- a/hazelcast/internal/asyncio_proxy/queue.py +++ b/hazelcast/internal/asyncio_proxy/queue.py @@ -88,8 +88,8 @@ async def add_all(self, items: typing.Sequence[ItemType]) -> bool: async def add_listener( self, include_value: bool = False, - item_added_func: typing.Callable[[ItemEvent[ItemType]], None] = None, - item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] = None, + item_added_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, + item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, ) -> str: """Adds an item listener for this queue. Listener will be notified for all queue add/remove events. diff --git a/hazelcast/internal/asyncio_proxy/replicated_map.py b/hazelcast/internal/asyncio_proxy/replicated_map.py index 0c185c1195..645541f26e 100644 --- a/hazelcast/internal/asyncio_proxy/replicated_map.py +++ b/hazelcast/internal/asyncio_proxy/replicated_map.py @@ -58,13 +58,13 @@ def __init__(self, service_name, name, context): async def add_entry_listener( self, - key: KeyType = None, - predicate: Predicate = None, - added_func: EntryEventCallable = None, - removed_func: EntryEventCallable = None, - updated_func: EntryEventCallable = None, - evicted_func: EntryEventCallable = None, - clear_all_func: EntryEventCallable = None, + key: KeyType | None = None, + predicate: Predicate | None = None, + added_func: EntryEventCallable | None = None, + removed_func: EntryEventCallable | None = None, + updated_func: EntryEventCallable | None = None, + evicted_func: EntryEventCallable | None = None, + clear_all_func: EntryEventCallable | None = None, ) -> str: """Adds a continuous entry listener for this map. diff --git a/hazelcast/internal/asyncio_proxy/ringbuffer.py b/hazelcast/internal/asyncio_proxy/ringbuffer.py index da1dcf5471..4523b937f9 100644 --- a/hazelcast/internal/asyncio_proxy/ringbuffer.py +++ b/hazelcast/internal/asyncio_proxy/ringbuffer.py @@ -212,7 +212,7 @@ def handler(message): return await self._invoke(request, handler) async def read_many( - self, start_sequence: int, min_count: int, max_count: int, filter: typing.Any = None + self, start_sequence: int, min_count: int, max_count: int, filter: typing.Any | None = None ) -> ReadResult: """Reads a batch of items from the Ringbuffer. diff --git a/hazelcast/internal/asyncio_proxy/set.py b/hazelcast/internal/asyncio_proxy/set.py index 92fd7ac7b1..44fa885485 100644 --- a/hazelcast/internal/asyncio_proxy/set.py +++ b/hazelcast/internal/asyncio_proxy/set.py @@ -80,8 +80,8 @@ async def add_all(self, items: typing.Sequence[ItemType]) -> bool: async def add_listener( self, include_value: bool = False, - item_added_func: typing.Callable[[ItemEvent[ItemType]], None] = None, - item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] = None, + item_added_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, + item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, ) -> str: """Adds an item listener for this container. diff --git a/hazelcast/internal/asyncio_proxy/topic.py b/hazelcast/internal/asyncio_proxy/topic.py index f393b3f52b..fe94adb13b 100644 --- a/hazelcast/internal/asyncio_proxy/topic.py +++ b/hazelcast/internal/asyncio_proxy/topic.py @@ -35,7 +35,7 @@ class Topic(PartitionSpecificProxy, typing.Generic[MessageType]): """ async def add_listener( - self, on_message: typing.Callable[[TopicMessage[MessageType]], None] = None + self, on_message: typing.Callable[[TopicMessage[MessageType]], None] | None = None ) -> str: """Subscribes to this topic. diff --git a/hazelcast/internal/asyncio_proxy/vector_collection.py b/hazelcast/internal/asyncio_proxy/vector_collection.py index 3e81813f63..36ad237aec 100644 --- a/hazelcast/internal/asyncio_proxy/vector_collection.py +++ b/hazelcast/internal/asyncio_proxy/vector_collection.py @@ -201,7 +201,7 @@ async def search_near_vector( include_value: bool = False, include_vectors: bool = False, limit: int = 10, - hints: Dict[str, str] = None + hints: Dict[str, str] | None = None ) -> List[SearchResult]: """Returns the Documents closest to the given vector. @@ -270,7 +270,7 @@ async def delete(self, key: Any) -> None: check_not_none(key, "key can't be None") return await self._delete_internal(key) - async def optimize(self, index_name: str = None) -> None: + async def optimize(self, index_name: str | None = None) -> None: """Optimize index by fully removing nodes marked for deletion, trimming neighbor sets to the advertised degree, and updating the entry node as necessary. @@ -338,7 +338,7 @@ def _search_near_vector_internal( include_value: bool = False, include_vectors: bool = False, limit: int = 10, - hints: Dict[str, str] = None + hints: Dict[str, str] | None = None ) -> asyncio.Future[List[SearchResult]]: def handler(message): results: List[ diff --git a/hazelcast/internal/asyncio_sql.py b/hazelcast/internal/asyncio_sql.py index 966aab5941..c8a73a523e 100644 --- a/hazelcast/internal/asyncio_sql.py +++ b/hazelcast/internal/asyncio_sql.py @@ -91,7 +91,7 @@ async def execute( cursor_buffer_size: int = _DEFAULT_CURSOR_BUFFER_SIZE, timeout: float = _TIMEOUT_NOT_SET, expected_result_type: int = SqlExpectedResultType.ANY, - schema: str = None + schema: str | None = None ) -> "SqlResult": """Executes an SQL statement. diff --git a/hazelcast/predicate.py b/hazelcast/predicate.py index aa00813a1c..5ef40b2f53 100644 --- a/hazelcast/predicate.py +++ b/hazelcast/predicate.py @@ -649,7 +649,7 @@ def true() -> Predicate: return _TruePredicate() -def paging(predicate: Predicate, page_size: int, comparator: typing.Any = None) -> PagingPredicate: +def paging(predicate: Predicate, page_size: int, comparator: typing.Any | None = None) -> PagingPredicate: """Creates a paging predicate with an inner predicate, page size and comparator. Results will be filtered via inner predicate and will be ordered via comparator if provided. diff --git a/hazelcast/proxy/list.py b/hazelcast/proxy/list.py index 376cbf763a..3f333f3335 100644 --- a/hazelcast/proxy/list.py +++ b/hazelcast/proxy/list.py @@ -135,8 +135,8 @@ def add_all_at(self, index: int, items: typing.Sequence[ItemType]) -> Future[boo def add_listener( self, include_value: bool = False, - item_added_func: typing.Callable[[ItemEvent[ItemType]], None] = None, - item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] = None, + item_added_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, + item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, ) -> Future[str]: """Adds an item listener for this list. Listener will be notified for all list add/remove events. @@ -538,8 +538,8 @@ def add_all_at( # type: ignore[override] def add_listener( # type: ignore[override] self, include_value: bool = False, - item_added_func: typing.Callable[[ItemEvent[ItemType]], None] = None, - item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] = None, + item_added_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, + item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, ) -> str: return self._wrapped.add_listener( include_value, item_added_func, item_removed_func diff --git a/hazelcast/proxy/map.py b/hazelcast/proxy/map.py index fa1aad8dc3..56eaafde37 100644 --- a/hazelcast/proxy/map.py +++ b/hazelcast/proxy/map.py @@ -135,17 +135,17 @@ def __init__(self, service_name, name, context): def add_entry_listener( self, include_value: bool = False, - key: KeyType = None, - predicate: Predicate = None, - added_func: EntryEventCallable = None, - removed_func: EntryEventCallable = None, - updated_func: EntryEventCallable = None, - evicted_func: EntryEventCallable = None, - evict_all_func: EntryEventCallable = None, - clear_all_func: EntryEventCallable = None, - merged_func: EntryEventCallable = None, - expired_func: EntryEventCallable = None, - loaded_func: EntryEventCallable = None, + key: KeyType | None = None, + predicate: Predicate | None = None, + added_func: EntryEventCallable | None = None, + removed_func: EntryEventCallable | None = None, + updated_func: EntryEventCallable | None = None, + evicted_func: EntryEventCallable | None = None, + evict_all_func: EntryEventCallable | None = None, + clear_all_func: EntryEventCallable | None = None, + merged_func: EntryEventCallable | None = None, + expired_func: EntryEventCallable | None = None, + loaded_func: EntryEventCallable | None = None, ) -> Future[str]: """Adds a continuous entry listener for this map. @@ -324,10 +324,10 @@ def handle_event_entry( def add_index( self, - attributes: typing.Sequence[str] = None, + attributes: typing.Sequence[str] | None = None, index_type: typing.Union[int, str] = IndexType.SORTED, - name: str = None, - bitmap_index_options: typing.Dict[str, typing.Any] = None, + name: str | None = None, + bitmap_index_options: typing.Dict[str, typing.Any] | None = None, ) -> Future[None]: """Adds an index to this map for the specified entries so that queries can run faster. @@ -412,7 +412,7 @@ def add_interceptor(self, interceptor: typing.Any) -> Future[str]: return self._invoke(request, map_add_interceptor_codec.decode_response) def aggregate( - self, aggregator: Aggregator[AggregatorResultType], predicate: Predicate = None + self, aggregator: Aggregator[AggregatorResultType], predicate: Predicate | None = None ) -> Future[AggregatorResultType]: """Applies the aggregation logic on map entries and filter the result with the predicate, if given. @@ -537,7 +537,7 @@ def delete(self, key: KeyType) -> Future[None]: return self._delete_internal(key_data) def entry_set( - self, predicate: Predicate = None + self, predicate: Predicate | None = None ) -> Future[typing.List[typing.Tuple[KeyType, ValueType]]]: """Returns a list clone of the mappings contained in this map. @@ -620,7 +620,7 @@ def evict_all(self) -> Future[None]: return self._invoke(request) def execute_on_entries( - self, entry_processor: typing.Any, predicate: Predicate = None + self, entry_processor: typing.Any, predicate: Predicate | None = None ) -> Future[typing.List[typing.Any]]: """Applies the user defined EntryProcessor to all the entries in the map or entries in the map which satisfies the predicate if provided. @@ -912,7 +912,7 @@ def is_locked(self, key: KeyType) -> Future[bool]: request = map_is_locked_codec.encode_request(self.name, key_data) return self._invoke_on_key(request, key_data, map_is_locked_codec.decode_response) - def key_set(self, predicate: Predicate = None) -> Future[typing.List[ValueType]]: + def key_set(self, predicate: Predicate | None = None) -> Future[typing.List[ValueType]]: """Returns a List clone of the keys contained in this map or the keys of the entries filtered with the predicate if provided. @@ -966,7 +966,7 @@ def handler(message): return self._invoke(request, handler) def load_all( - self, keys: typing.Sequence[KeyType] = None, replace_existing_values: bool = True + self, keys: typing.Sequence[KeyType] | None = None, replace_existing_values: bool = True ) -> Future[None]: """Loads all keys from the store at server side or loads the given keys if provided. @@ -988,7 +988,7 @@ def load_all( request = map_load_all_codec.encode_request(self.name, replace_existing_values) return self._invoke(request) - def lock(self, key: KeyType, lease_time: float = None) -> Future[None]: + def lock(self, key: KeyType, lease_time: float | None = None) -> Future[None]: """Acquires the lock for the specified key infinitely or for the specified lease time if provided. @@ -1038,7 +1038,7 @@ def lock(self, key: KeyType, lease_time: float = None) -> Future[None]: return invocation.future def project( - self, projection: Projection[ProjectionType], predicate: Predicate = None + self, projection: Projection[ProjectionType], predicate: Predicate | None = None ) -> Future[ProjectionType]: """Applies the projection logic on map entries and filter the result with the predicate, if given. @@ -1084,7 +1084,7 @@ def handler(message): return self._invoke(request, handler) def put( - self, key: KeyType, value: ValueType, ttl: float = None, max_idle: float = None + self, key: KeyType, value: ValueType, ttl: float | None = None, max_idle: float | None = None ) -> Future[typing.Optional[ValueType]]: """Associates the specified value with the specified key in this map. @@ -1168,7 +1168,7 @@ def put_all(self, map: typing.Dict[KeyType, ValueType]) -> Future[None]: return combine_futures(futures) def put_if_absent( - self, key: KeyType, value: ValueType, ttl: float = None, max_idle: float = None + self, key: KeyType, value: ValueType, ttl: float | None = None, max_idle: float | None = None ) -> Future[typing.Optional[ValueType]]: """Associates the specified key with the given value if it is not already associated. @@ -1219,7 +1219,7 @@ def put_if_absent( return self._put_if_absent_internal(key_data, value_data, ttl, max_idle) def put_transient( - self, key: KeyType, value: ValueType, ttl: float = None, max_idle: float = None + self, key: KeyType, value: ValueType, ttl: float | None = None, max_idle: float | None = None ) -> Future[None]: """Same as ``put``, but MapStore defined at the server side will not be called. @@ -1435,7 +1435,7 @@ def replace_if_same( return self._replace_if_same_internal(key_data, old_value_data, new_value_data) def set( - self, key: KeyType, value: ValueType, ttl: float = None, max_idle: float = None + self, key: KeyType, value: ValueType, ttl: float | None = None, max_idle: float | None = None ) -> Future[None]: """Puts an entry into this map. @@ -1501,7 +1501,7 @@ def size(self) -> Future[int]: request = map_size_codec.encode_request(self.name) return self._invoke(request, map_size_codec.decode_response) - def try_lock(self, key: KeyType, lease_time: float = None, timeout: float = 0) -> Future[bool]: + def try_lock(self, key: KeyType, lease_time: float | None = None, timeout: float = 0) -> Future[bool]: """Tries to acquire the lock for the specified key. When the lock is not available: @@ -1618,7 +1618,7 @@ def unlock(self, key: KeyType) -> Future[None]: ) return self._invoke_on_key(request, key_data) - def values(self, predicate: Predicate = None) -> Future[typing.List[ValueType]]: + def values(self, predicate: Predicate | None = None) -> Future[typing.List[ValueType]]: """Returns a list clone of the values contained in this map or values of the entries which are filtered with the predicate if provided. @@ -2014,17 +2014,17 @@ def __init__( def add_entry_listener( # type: ignore[override] self, include_value: bool = False, - key: KeyType = None, - predicate: Predicate = None, - added_func: EntryEventCallable = None, - removed_func: EntryEventCallable = None, - updated_func: EntryEventCallable = None, - evicted_func: EntryEventCallable = None, - evict_all_func: EntryEventCallable = None, - clear_all_func: EntryEventCallable = None, - merged_func: EntryEventCallable = None, - expired_func: EntryEventCallable = None, - loaded_func: EntryEventCallable = None, + key: KeyType | None = None, + predicate: Predicate | None = None, + added_func: EntryEventCallable | None = None, + removed_func: EntryEventCallable | None = None, + updated_func: EntryEventCallable | None = None, + evicted_func: EntryEventCallable | None = None, + evict_all_func: EntryEventCallable | None = None, + clear_all_func: EntryEventCallable | None = None, + merged_func: EntryEventCallable | None = None, + expired_func: EntryEventCallable | None = None, + loaded_func: EntryEventCallable | None = None, ) -> str: return self._wrapped.add_entry_listener( include_value, @@ -2043,10 +2043,10 @@ def add_entry_listener( # type: ignore[override] def add_index( # type: ignore[override] self, - attributes: typing.Sequence[str] = None, + attributes: typing.Sequence[str] | None = None, index_type: typing.Union[int, str] = IndexType.SORTED, - name: str = None, - bitmap_index_options: typing.Dict[str, typing.Any] = None, + name: str | None = None, + bitmap_index_options: typing.Dict[str, typing.Any] | None = None, ) -> None: return self._wrapped.add_index(attributes, index_type, name, bitmap_index_options).result() @@ -2059,7 +2059,7 @@ def add_interceptor( # type: ignore[override] def aggregate( # type: ignore[override] self, aggregator: Aggregator[AggregatorResultType], - predicate: Predicate = None, + predicate: Predicate | None = None, ) -> AggregatorResultType: return self._wrapped.aggregate(aggregator, predicate).result() @@ -2088,7 +2088,7 @@ def delete( # type: ignore[override] def entry_set( # type: ignore[override] self, - predicate: Predicate = None, + predicate: Predicate | None = None, ) -> typing.List[typing.Tuple[KeyType, ValueType]]: return self._wrapped.entry_set(predicate).result() @@ -2106,7 +2106,7 @@ def evict_all( # type: ignore[override] def execute_on_entries( # type: ignore[override] self, entry_processor: typing.Any, - predicate: Predicate = None, + predicate: Predicate | None = None, ) -> typing.List[typing.Any]: return self._wrapped.execute_on_entries(entry_processor, predicate).result() @@ -2166,13 +2166,13 @@ def is_locked( # type: ignore[override] def key_set( # type: ignore[override] self, - predicate: Predicate = None, + predicate: Predicate | None = None, ) -> typing.List[ValueType]: return self._wrapped.key_set(predicate).result() def load_all( # type: ignore[override] self, - keys: typing.Sequence[KeyType] = None, + keys: typing.Sequence[KeyType] | None = None, replace_existing_values: bool = True, ) -> None: return self._wrapped.load_all(keys, replace_existing_values).result() @@ -2180,14 +2180,14 @@ def load_all( # type: ignore[override] def lock( # type: ignore[override] self, key: KeyType, - lease_time: float = None, + lease_time: float | None = None, ) -> None: return self._wrapped.lock(key, lease_time).result() def project( # type: ignore[override] self, projection: Projection[ProjectionType], - predicate: Predicate = None, + predicate: Predicate | None = None, ) -> ProjectionType: return self._wrapped.project(projection, predicate).result() @@ -2195,8 +2195,8 @@ def put( # type: ignore[override] self, key: KeyType, value: ValueType, - ttl: float = None, - max_idle: float = None, + ttl: float | None = None, + max_idle: float | None = None, ) -> typing.Optional[ValueType]: return self._wrapped.put(key, value, ttl, max_idle).result() @@ -2210,8 +2210,8 @@ def put_if_absent( # type: ignore[override] self, key: KeyType, value: ValueType, - ttl: float = None, - max_idle: float = None, + ttl: float | None = None, + max_idle: float | None = None, ) -> typing.Optional[ValueType]: return self._wrapped.put_if_absent(key, value, ttl, max_idle).result() @@ -2219,8 +2219,8 @@ def put_transient( # type: ignore[override] self, key: KeyType, value: ValueType, - ttl: float = None, - max_idle: float = None, + ttl: float | None = None, + max_idle: float | None = None, ) -> None: return self._wrapped.put_transient(key, value, ttl, max_idle).result() @@ -2271,8 +2271,8 @@ def set( # type: ignore[override] self, key: KeyType, value: ValueType, - ttl: float = None, - max_idle: float = None, + ttl: float | None = None, + max_idle: float | None = None, ) -> None: return self._wrapped.set(key, value, ttl, max_idle).result() @@ -2291,7 +2291,7 @@ def size( # type: ignore[override] def try_lock( # type: ignore[override] self, key: KeyType, - lease_time: float = None, + lease_time: float | None = None, timeout: float = 0, ) -> bool: return self._wrapped.try_lock(key, lease_time, timeout).result() @@ -2319,7 +2319,7 @@ def unlock( # type: ignore[override] def values( # type: ignore[override] self, - predicate: Predicate = None, + predicate: Predicate | None = None, ) -> typing.List[ValueType]: return self._wrapped.values(predicate).result() diff --git a/hazelcast/proxy/multi_map.py b/hazelcast/proxy/multi_map.py index 267e56f46f..326b054229 100644 --- a/hazelcast/proxy/multi_map.py +++ b/hazelcast/proxy/multi_map.py @@ -52,10 +52,10 @@ def __init__(self, service_name, name, context): def add_entry_listener( self, include_value: bool = False, - key: KeyType = None, - added_func: EntryEventCallable = None, - removed_func: EntryEventCallable = None, - clear_all_func: EntryEventCallable = None, + key: KeyType | None = None, + added_func: EntryEventCallable | None = None, + removed_func: EntryEventCallable | None = None, + clear_all_func: EntryEventCallable | None = None, ) -> Future[str]: """Adds an entry listener for this multimap. @@ -326,7 +326,7 @@ def handler(message): request = multi_map_key_set_codec.encode_request(self.name) return self._invoke(request, handler) - def lock(self, key: KeyType, lease_time: float = None) -> Future[None]: + def lock(self, key: KeyType, lease_time: float | None = None) -> Future[None]: """Acquires the lock for the specified key infinitely or for the specified lease time if provided. @@ -561,7 +561,7 @@ def handler(message): request = multi_map_values_codec.encode_request(self.name) return self._invoke(request, handler) - def try_lock(self, key: KeyType, lease_time: float = None, timeout: float = 0) -> Future[bool]: + def try_lock(self, key: KeyType, lease_time: float | None = None, timeout: float = 0) -> Future[bool]: """Tries to acquire the lock for the specified key. When the lock is not available: @@ -640,10 +640,10 @@ def __init__(self, wrapped: MultiMap[KeyType, ValueType]): def add_entry_listener( # type: ignore[override] self, include_value: bool = False, - key: KeyType = None, - added_func: EntryEventCallable = None, - removed_func: EntryEventCallable = None, - clear_all_func: EntryEventCallable = None, + key: KeyType | None = None, + added_func: EntryEventCallable | None = None, + removed_func: EntryEventCallable | None = None, + clear_all_func: EntryEventCallable | None = None, ) -> str: return self._wrapped.add_entry_listener( include_value, key, added_func, removed_func, clear_all_func @@ -704,7 +704,7 @@ def key_set( # type: ignore[override] def lock( # type: ignore[override] self, key: KeyType, - lease_time: float = None, + lease_time: float | None = None, ) -> None: return self._wrapped.lock(key, lease_time).result() @@ -758,7 +758,7 @@ def values( # type: ignore[override] def try_lock( # type: ignore[override] self, key: KeyType, - lease_time: float = None, + lease_time: float | None = None, timeout: float = 0, ) -> bool: return self._wrapped.try_lock(key, lease_time, timeout).result() diff --git a/hazelcast/proxy/queue.py b/hazelcast/proxy/queue.py index c9df42dab2..4aa3cd45c9 100644 --- a/hazelcast/proxy/queue.py +++ b/hazelcast/proxy/queue.py @@ -78,8 +78,8 @@ def add_all(self, items: typing.Sequence[ItemType]) -> Future[bool]: def add_listener( self, include_value: bool = False, - item_added_func: typing.Callable[[ItemEvent[ItemType]], None] = None, - item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] = None, + item_added_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, + item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, ) -> Future[str]: """Adds an item listener for this queue. Listener will be notified for all queue add/remove events. @@ -439,8 +439,8 @@ def add_all( # type: ignore[override] def add_listener( # type: ignore[override] self, include_value: bool = False, - item_added_func: typing.Callable[[ItemEvent[ItemType]], None] = None, - item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] = None, + item_added_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, + item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, ) -> str: return self._wrapped.add_listener( include_value, item_added_func, item_removed_func diff --git a/hazelcast/proxy/replicated_map.py b/hazelcast/proxy/replicated_map.py index 78e527112a..a0e5274283 100644 --- a/hazelcast/proxy/replicated_map.py +++ b/hazelcast/proxy/replicated_map.py @@ -54,13 +54,13 @@ def __init__(self, service_name, name, context): def add_entry_listener( self, - key: KeyType = None, - predicate: Predicate = None, - added_func: EntryEventCallable = None, - removed_func: EntryEventCallable = None, - updated_func: EntryEventCallable = None, - evicted_func: EntryEventCallable = None, - clear_all_func: EntryEventCallable = None, + key: KeyType | None = None, + predicate: Predicate | None = None, + added_func: EntryEventCallable | None = None, + removed_func: EntryEventCallable | None = None, + updated_func: EntryEventCallable | None = None, + evicted_func: EntryEventCallable | None = None, + clear_all_func: EntryEventCallable | None = None, ) -> Future[str]: """Adds a continuous entry listener for this map. @@ -466,13 +466,13 @@ def __init__(self, wrapped: ReplicatedMap[KeyType, ValueType]): def add_entry_listener( # type: ignore[override] self, - key: KeyType = None, - predicate: Predicate = None, - added_func: EntryEventCallable = None, - removed_func: EntryEventCallable = None, - updated_func: EntryEventCallable = None, - evicted_func: EntryEventCallable = None, - clear_all_func: EntryEventCallable = None, + key: KeyType | None = None, + predicate: Predicate | None = None, + added_func: EntryEventCallable | None = None, + removed_func: EntryEventCallable | None = None, + updated_func: EntryEventCallable | None = None, + evicted_func: EntryEventCallable | None = None, + clear_all_func: EntryEventCallable | None = None, ) -> str: return self._wrapped.add_entry_listener( key, predicate, added_func, removed_func, updated_func, evicted_func, clear_all_func diff --git a/hazelcast/proxy/ringbuffer.py b/hazelcast/proxy/ringbuffer.py index 94bcec17bd..6ace84da6a 100644 --- a/hazelcast/proxy/ringbuffer.py +++ b/hazelcast/proxy/ringbuffer.py @@ -330,7 +330,7 @@ def handler(message): return self._invoke(request, handler) def read_many( - self, start_sequence: int, min_count: int, max_count: int, filter: typing.Any = None + self, start_sequence: int, min_count: int, max_count: int, filter: typing.Any | None = None ) -> Future[ReadResult]: """Reads a batch of items from the Ringbuffer. @@ -478,7 +478,7 @@ def read_many( # type: ignore[override] start_sequence: int, min_count: int, max_count: int, - filter: typing.Any = None, + filter: typing.Any | None = None, ) -> ReadResult: return self._wrapped.read_many(start_sequence, min_count, max_count, filter).result() diff --git a/hazelcast/proxy/set.py b/hazelcast/proxy/set.py index 6fd1e83acd..db164c8c01 100644 --- a/hazelcast/proxy/set.py +++ b/hazelcast/proxy/set.py @@ -69,8 +69,8 @@ def add_all(self, items: typing.Sequence[ItemType]) -> Future[bool]: def add_listener( self, include_value: bool = False, - item_added_func: typing.Callable[[ItemEvent[ItemType]], None] = None, - item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] = None, + item_added_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, + item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, ) -> Future[str]: """Adds an item listener for this container. @@ -296,8 +296,8 @@ def add_all( # type: ignore[override] def add_listener( # type: ignore[override] self, include_value: bool = False, - item_added_func: typing.Callable[[ItemEvent[ItemType]], None] = None, - item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] = None, + item_added_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, + item_removed_func: typing.Callable[[ItemEvent[ItemType]], None] | None = None, ) -> str: return self._wrapped.add_listener( include_value, item_added_func, item_removed_func diff --git a/hazelcast/proxy/topic.py b/hazelcast/proxy/topic.py index 60ab821f99..ff6d89e492 100644 --- a/hazelcast/proxy/topic.py +++ b/hazelcast/proxy/topic.py @@ -28,7 +28,7 @@ class Topic(PartitionSpecificProxy["BlockingTopic"], typing.Generic[MessageType] """ def add_listener( - self, on_message: typing.Callable[[TopicMessage[MessageType]], None] = None + self, on_message: typing.Callable[[TopicMessage[MessageType]], None] | None = None ) -> Future[str]: """Subscribes to this topic. @@ -119,7 +119,7 @@ def __init__(self, wrapped: Topic[MessageType]): def add_listener( # type: ignore[override] self, - on_message: typing.Callable[[TopicMessage[MessageType]], None] = None, + on_message: typing.Callable[[TopicMessage[MessageType]], None] | None = None, ) -> str: return self._wrapped.add_listener(on_message).result() diff --git a/hazelcast/proxy/transactional_map.py b/hazelcast/proxy/transactional_map.py index 64d8ad367d..e79a9bbcef 100644 --- a/hazelcast/proxy/transactional_map.py +++ b/hazelcast/proxy/transactional_map.py @@ -133,7 +133,7 @@ def is_empty(self) -> bool: ) return self._invoke(request, transactional_map_is_empty_codec.decode_response) - def put(self, key: KeyType, value: ValueType, ttl: float = None) -> typing.Optional[ValueType]: + def put(self, key: KeyType, value: ValueType, ttl: float | None = None) -> typing.Optional[ValueType]: """Transactional implementation of :func:`Map.put(key, value, ttl) ` @@ -365,7 +365,7 @@ def delete(self, key: KeyType) -> None: ) return self._invoke(request) - def key_set(self, predicate: Predicate = None) -> typing.List[KeyType]: + def key_set(self, predicate: Predicate | None = None) -> typing.List[KeyType]: """Transactional implementation of :func:`Map.key_set(predicate) ` @@ -401,7 +401,7 @@ def handler(message): return self._invoke(request, handler) - def values(self, predicate: Predicate = None) -> typing.List[ValueType]: + def values(self, predicate: Predicate | None = None) -> typing.List[ValueType]: """Transactional implementation of :func:`Map.values(predicate) ` diff --git a/hazelcast/proxy/vector_collection.py b/hazelcast/proxy/vector_collection.py index b39eb1f4d8..ca868048bb 100644 --- a/hazelcast/proxy/vector_collection.py +++ b/hazelcast/proxy/vector_collection.py @@ -202,7 +202,7 @@ def search_near_vector( include_value: bool = False, include_vectors: bool = False, limit: int = 10, - hints: Dict[str, str] = None + hints: Dict[str, str] | None = None ) -> Future[List[SearchResult]]: """Returns the Documents closest to the given vector. @@ -271,7 +271,7 @@ def delete(self, key: Any) -> Future[None]: check_not_none(key, "key can't be None") return self._delete_internal(key) - def optimize(self, index_name: str = None) -> Future[None]: + def optimize(self, index_name: str | None = None) -> Future[None]: """Optimize index by fully removing nodes marked for deletion, trimming neighbor sets to the advertised degree, and updating the entry node as necessary. @@ -339,7 +339,7 @@ def _search_near_vector_internal( include_value: bool = False, include_vectors: bool = False, limit: int = 10, - hints: Dict[str, str] = None + hints: Dict[str, str] | None = None ) -> Future[List[SearchResult]]: def handler(message): results: List[ @@ -448,7 +448,7 @@ def search_near_vector( include_value: bool = False, include_vectors: bool = False, limit: int = 10, - hints: Dict[str, str] = None + hints: Dict[str, str] | None = None ) -> List[SearchResult]: future = self._wrapped.search_near_vector( vector, @@ -477,7 +477,7 @@ def put_if_absent(self, key: Any, document: Document) -> Optional[Document]: def clear(self) -> None: return self._wrapped.clear().result() - def optimize(self, index_name: str = None) -> None: + def optimize(self, index_name: str | None = None) -> None: return self._wrapped.optimize(index_name).result() def size(self) -> int: diff --git a/hazelcast/sql.py b/hazelcast/sql.py index 7d74d8eec1..b6bafd9888 100644 --- a/hazelcast/sql.py +++ b/hazelcast/sql.py @@ -110,7 +110,7 @@ def execute( cursor_buffer_size: int = _DEFAULT_CURSOR_BUFFER_SIZE, timeout: float = _TIMEOUT_NOT_SET, expected_result_type: int = SqlExpectedResultType.ANY, - schema: str = None + schema: str | None = None ) -> Future["SqlResult"]: """Executes an SQL statement. From 1f0b998b0b90c2e259dc1cf3e1d28afebe2a6453 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 28 Jul 2026 11:50:59 +0300 Subject: [PATCH 3/5] fix lint --- .../map/map_portable_versioning_example.py | 1 + examples/sql/dbapi_example.py | 6 ++-- examples/sql/sql_async_example.py | 6 ++-- examples/sql/sql_compact_example.py | 6 ++-- examples/sql/sql_example.py | 6 ++-- examples/sql/sql_json_example.py | 12 +++---- hazelcast/asyncore.py | 6 +--- hazelcast/core.py | 3 +- hazelcast/errors.py | 2 +- hazelcast/future.py | 4 ++- hazelcast/internal/asyncio_proxy/map.py | 1 - hazelcast/internal/asyncio_proxy/multi_map.py | 4 ++- .../asyncio_proxy/vector_collection.py | 6 ++-- hazelcast/predicate.py | 4 ++- hazelcast/proxy/map.py | 35 ++++++++++++++----- hazelcast/proxy/multi_map.py | 4 ++- hazelcast/proxy/transactional_map.py | 4 ++- hazelcast/proxy/vector_collection.py | 6 ++-- hazelcast/reactor.py | 5 +-- hazelcast/security.py | 4 +-- hazelcast/serialization/__init__.py | 1 + hazelcast/serialization/api.py | 9 +++-- .../serialization/serialization_const.py | 1 + hazelcast/serialization/util.py | 3 ++ hazelcast/vector.py | 1 - tests/integration/asyncio/client_test.py | 4 +-- .../asyncio/proxy/map_nearcache_test.py | 7 ++-- tests/integration/asyncio/sql_test.py | 29 +++++---------- tests/integration/asyncio/statistics_test.py | 14 +++----- .../backward_compatible/client_test.py | 11 ++---- .../proxy/cp/count_down_latch_test.py | 1 - .../proxy/map_nearcache_test.py | 7 ++-- .../backward_compatible/proxy/map_test.py | 1 - .../compact_compatibility_test.py | 6 ++-- .../serialization/serializers_test.py | 27 ++++++-------- .../backward_compatible/sql_test.py | 35 ++++++------------- .../backward_compatible/statistics_test.py | 14 +++----- tests/integration/compact_test.py | 1 - tests/integration/dbapi/dbapi20.py | 6 ++-- tests/unit/serialization/portable_test.py | 1 - tests/unit/serialization/serializers_test.py | 2 +- 41 files changed, 129 insertions(+), 177 deletions(-) diff --git a/examples/map/map_portable_versioning_example.py b/examples/map/map_portable_versioning_example.py index 80d7c0a488..1291a376b8 100644 --- a/examples/map/map_portable_versioning_example.py +++ b/examples/map/map_portable_versioning_example.py @@ -91,6 +91,7 @@ def __eq__(self, other): # However, having a version that changes across incompatible field types such as int and String will cause # a type error as members with older versions of the class tries to access it. We will demonstrate this below. + # Version3: Changed age field type from int to String. (Incompatible type change) class Employee3(Portable): FACTORY_ID = 666 diff --git a/examples/sql/dbapi_example.py b/examples/sql/dbapi_example.py index 4f1ec24189..d8e6f13bfe 100644 --- a/examples/sql/dbapi_example.py +++ b/examples/sql/dbapi_example.py @@ -7,8 +7,7 @@ cur = conn.cursor() # create a mapping -cur.execute( - """ +cur.execute(""" CREATE OR REPLACE MAPPING stocks ( __key INT, operation_date DATE, @@ -22,8 +21,7 @@ 'keyFormat' = 'int', 'valueFormat' = 'json-flat' ) - """ -) + """) # add some data data = [ diff --git a/examples/sql/sql_async_example.py b/examples/sql/sql_async_example.py index ddb6545c7d..63e8baf77d 100644 --- a/examples/sql/sql_async_example.py +++ b/examples/sql/sql_async_example.py @@ -15,16 +15,14 @@ integers.set(i, i) # Create mapping for the integers. This needs to be done only once per map. -client.sql.execute( - """ +client.sql.execute(""" CREATE OR REPLACE MAPPING integers TYPE IMap OPTIONS ( 'keyFormat' = 'int', 'valueFormat' = 'int' ) - """ -).result() + """).result() # Fetch values in between (40, 50) result_future = client.sql.execute("SELECT * FROM integers WHERE this > ? AND this < ?", 40, 50) diff --git a/examples/sql/sql_compact_example.py b/examples/sql/sql_compact_example.py index cb0c79a800..b56a599f4c 100644 --- a/examples/sql/sql_compact_example.py +++ b/examples/sql/sql_compact_example.py @@ -33,8 +33,7 @@ def get_class(self): client = HazelcastClient(compact_serializers=[PersonSerializer()]) -client.sql.execute( - """ +client.sql.execute(""" CREATE MAPPING IF NOT EXISTS persons ( __key INT, name VARCHAR, @@ -46,8 +45,7 @@ def get_class(self): 'valueFormat' = 'compact', 'valueCompactTypeName' = 'Person' ) -""" -).result() +""").result() persons = client.get_map("persons").blocking() diff --git a/examples/sql/sql_example.py b/examples/sql/sql_example.py index 805ecf4b7b..6a3d74258c 100644 --- a/examples/sql/sql_example.py +++ b/examples/sql/sql_example.py @@ -38,8 +38,7 @@ def __repr__(self): customers.set(3, Customer("Joe", 33, True)) # Create mapping for the customers. This needs to be done only once per map. -client.sql.execute( - """ +client.sql.execute(""" CREATE MAPPING customers ( __key INT, name VARCHAR, @@ -53,8 +52,7 @@ def __repr__(self): 'valuePortableFactoryId' = '1', 'valuePortableClassId' = '1' ) - """ -).result() + """).result() # Project a single column that fits the criterion result = client.sql.execute("SELECT name FROM customers WHERE age < 35 AND is_active").result() diff --git a/examples/sql/sql_json_example.py b/examples/sql/sql_json_example.py index 62d3e01fd2..e0f9531b05 100644 --- a/examples/sql/sql_json_example.py +++ b/examples/sql/sql_json_example.py @@ -11,25 +11,21 @@ employees.put(2, HazelcastJsonValue('{"name": "Jake", "age": 18}')) # Create mapping for the employees map. This needs to be done only once per map. -client.sql.execute( - """ +client.sql.execute(""" CREATE OR REPLACE MAPPING employees TYPE IMap OPTIONS ( 'keyFormat' = 'int', 'valueFormat' = 'json' ) - """ -).result() + """).result() # Select the names of employees older than 25 -result = client.sql.execute( - """ +result = client.sql.execute(""" SELECT JSON_VALUE(this, '$.name') AS name FROM employees WHERE JSON_VALUE(this, '$.age' RETURNING INT) > 25 - """ -).result() + """).result() for row in result: print(f"Name: {row['name']}") diff --git a/hazelcast/asyncore.py b/hazelcast/asyncore.py index 1ea47b1f01..bde4c70d90 100644 --- a/hazelcast/asyncore.py +++ b/hazelcast/asyncore.py @@ -60,11 +60,7 @@ _DISCONNECTED = frozenset({ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE, EBADF}) -try: - _d: dict = socket_map - del _d -except NameError: - socket_map: dict = {} +socket_map: dict = {} def _strerror(err): try: diff --git a/hazelcast/core.py b/hazelcast/core.py index 7ffc601001..602f7be421 100644 --- a/hazelcast/core.py +++ b/hazelcast/core.py @@ -1,4 +1,5 @@ """Hazelcast Core objects and constants.""" + import json import typing import uuid @@ -485,7 +486,7 @@ class MapEntry(typing.Generic[KeyType, ValueType]): __slots__ = ("_key", "_value") - def __init__(self, key: KeyType|None = None, value: ValueType|None = None): + def __init__(self, key: KeyType | None = None, value: ValueType | None = None): self._key = key self._value = value diff --git a/hazelcast/errors.py b/hazelcast/errors.py index c53214103a..04c02c512f 100644 --- a/hazelcast/errors.py +++ b/hazelcast/errors.py @@ -11,7 +11,7 @@ def retryable(cls): class HazelcastError(Exception): """General HazelcastError class.""" - def __init__(self, message: str|None = None, cause: Exception|None = None): + def __init__(self, message: str | None = None, cause: Exception | None = None): super(HazelcastError, self).__init__(message, cause) def __str__(self): diff --git a/hazelcast/future.py b/hazelcast/future.py index 4db634300c..82314532ea 100644 --- a/hazelcast/future.py +++ b/hazelcast/future.py @@ -35,7 +35,9 @@ def set_result(self, result: ResultType) -> None: self._event.set() self._invoke_callbacks() - def set_exception(self, exception: Exception, traceback: types.TracebackType | None = None) -> None: + def set_exception( + self, exception: Exception, traceback: types.TracebackType | None = None + ) -> None: """Sets the exception for this Future in case of errors. Args: diff --git a/hazelcast/internal/asyncio_proxy/map.py b/hazelcast/internal/asyncio_proxy/map.py index 9eead17318..3bcdce1f4c 100644 --- a/hazelcast/internal/asyncio_proxy/map.py +++ b/hazelcast/internal/asyncio_proxy/map.py @@ -93,7 +93,6 @@ deserialize_list_in_place, ) - EntryEventCallable = typing.Callable[[EntryEvent[KeyType, ValueType]], None] diff --git a/hazelcast/internal/asyncio_proxy/multi_map.py b/hazelcast/internal/asyncio_proxy/multi_map.py index fbcc0b086f..4cd10c4f16 100644 --- a/hazelcast/internal/asyncio_proxy/multi_map.py +++ b/hazelcast/internal/asyncio_proxy/multi_map.py @@ -578,7 +578,9 @@ def handler(message): request = multi_map_values_codec.encode_request(self.name) return await self._invoke(request, handler) - async def try_lock(self, key: KeyType, lease_time: float | None = None, timeout: float = 0) -> bool: + async def try_lock( + self, key: KeyType, lease_time: float | None = None, timeout: float = 0 + ) -> bool: """Tries to acquire the lock for the specified key. When the lock is not available: diff --git a/hazelcast/internal/asyncio_proxy/vector_collection.py b/hazelcast/internal/asyncio_proxy/vector_collection.py index 36ad237aec..26d1837914 100644 --- a/hazelcast/internal/asyncio_proxy/vector_collection.py +++ b/hazelcast/internal/asyncio_proxy/vector_collection.py @@ -341,9 +341,9 @@ def _search_near_vector_internal( hints: Dict[str, str] | None = None ) -> asyncio.Future[List[SearchResult]]: def handler(message): - results: List[ - SearchResult - ] = vector_collection_search_near_vector_codec.decode_response(message) + results: List[SearchResult] = ( + vector_collection_search_near_vector_codec.decode_response(message) + ) for result in results: if result.key is not None: result.key = self._to_object(result.key) diff --git a/hazelcast/predicate.py b/hazelcast/predicate.py index 5ef40b2f53..9e60cdfddd 100644 --- a/hazelcast/predicate.py +++ b/hazelcast/predicate.py @@ -649,7 +649,9 @@ def true() -> Predicate: return _TruePredicate() -def paging(predicate: Predicate, page_size: int, comparator: typing.Any | None = None) -> PagingPredicate: +def paging( + predicate: Predicate, page_size: int, comparator: typing.Any | None = None +) -> PagingPredicate: """Creates a paging predicate with an inner predicate, page size and comparator. Results will be filtered via inner predicate and will be ordered via comparator if provided. diff --git a/hazelcast/proxy/map.py b/hazelcast/proxy/map.py index 56eaafde37..a8e52b39c8 100644 --- a/hazelcast/proxy/map.py +++ b/hazelcast/proxy/map.py @@ -92,7 +92,6 @@ deserialize_list_in_place, ) - EntryEventCallable = typing.Callable[[EntryEvent[KeyType, ValueType]], None] @@ -1084,7 +1083,11 @@ def handler(message): return self._invoke(request, handler) def put( - self, key: KeyType, value: ValueType, ttl: float | None = None, max_idle: float | None = None + self, + key: KeyType, + value: ValueType, + ttl: float | None = None, + max_idle: float | None = None, ) -> Future[typing.Optional[ValueType]]: """Associates the specified value with the specified key in this map. @@ -1168,7 +1171,11 @@ def put_all(self, map: typing.Dict[KeyType, ValueType]) -> Future[None]: return combine_futures(futures) def put_if_absent( - self, key: KeyType, value: ValueType, ttl: float | None = None, max_idle: float | None = None + self, + key: KeyType, + value: ValueType, + ttl: float | None = None, + max_idle: float | None = None, ) -> Future[typing.Optional[ValueType]]: """Associates the specified key with the given value if it is not already associated. @@ -1219,7 +1226,11 @@ def put_if_absent( return self._put_if_absent_internal(key_data, value_data, ttl, max_idle) def put_transient( - self, key: KeyType, value: ValueType, ttl: float | None = None, max_idle: float | None = None + self, + key: KeyType, + value: ValueType, + ttl: float | None = None, + max_idle: float | None = None, ) -> Future[None]: """Same as ``put``, but MapStore defined at the server side will not be called. @@ -1435,7 +1446,11 @@ def replace_if_same( return self._replace_if_same_internal(key_data, old_value_data, new_value_data) def set( - self, key: KeyType, value: ValueType, ttl: float | None = None, max_idle: float | None = None + self, + key: KeyType, + value: ValueType, + ttl: float | None = None, + max_idle: float | None = None, ) -> Future[None]: """Puts an entry into this map. @@ -1501,7 +1516,9 @@ def size(self) -> Future[int]: request = map_size_codec.encode_request(self.name) return self._invoke(request, map_size_codec.decode_response) - def try_lock(self, key: KeyType, lease_time: float | None = None, timeout: float = 0) -> Future[bool]: + def try_lock( + self, key: KeyType, lease_time: float | None = None, timeout: float = 0 + ) -> Future[bool]: """Tries to acquire the lock for the specified key. When the lock is not available: @@ -2066,7 +2083,7 @@ def aggregate( # type: ignore[override] def clear( # type: ignore[override] self, ) -> None: - return self._wrapped.clear().result() + self._wrapped.clear().result() def contains_key( # type: ignore[override] self, @@ -2101,7 +2118,7 @@ def evict( # type: ignore[override] def evict_all( # type: ignore[override] self, ) -> None: - return self._wrapped.evict_all().result() + self._wrapped.evict_all().result() def execute_on_entries( # type: ignore[override] self, @@ -2175,7 +2192,7 @@ def load_all( # type: ignore[override] keys: typing.Sequence[KeyType] | None = None, replace_existing_values: bool = True, ) -> None: - return self._wrapped.load_all(keys, replace_existing_values).result() + self._wrapped.load_all(keys, replace_existing_values).result() def lock( # type: ignore[override] self, diff --git a/hazelcast/proxy/multi_map.py b/hazelcast/proxy/multi_map.py index 326b054229..c7bf706fa8 100644 --- a/hazelcast/proxy/multi_map.py +++ b/hazelcast/proxy/multi_map.py @@ -561,7 +561,9 @@ def handler(message): request = multi_map_values_codec.encode_request(self.name) return self._invoke(request, handler) - def try_lock(self, key: KeyType, lease_time: float | None = None, timeout: float = 0) -> Future[bool]: + def try_lock( + self, key: KeyType, lease_time: float | None = None, timeout: float = 0 + ) -> Future[bool]: """Tries to acquire the lock for the specified key. When the lock is not available: diff --git a/hazelcast/proxy/transactional_map.py b/hazelcast/proxy/transactional_map.py index e79a9bbcef..5749329d80 100644 --- a/hazelcast/proxy/transactional_map.py +++ b/hazelcast/proxy/transactional_map.py @@ -133,7 +133,9 @@ def is_empty(self) -> bool: ) return self._invoke(request, transactional_map_is_empty_codec.decode_response) - def put(self, key: KeyType, value: ValueType, ttl: float | None = None) -> typing.Optional[ValueType]: + def put( + self, key: KeyType, value: ValueType, ttl: float | None = None + ) -> typing.Optional[ValueType]: """Transactional implementation of :func:`Map.put(key, value, ttl) ` diff --git a/hazelcast/proxy/vector_collection.py b/hazelcast/proxy/vector_collection.py index ca868048bb..60c7d827c7 100644 --- a/hazelcast/proxy/vector_collection.py +++ b/hazelcast/proxy/vector_collection.py @@ -342,9 +342,9 @@ def _search_near_vector_internal( hints: Dict[str, str] | None = None ) -> Future[List[SearchResult]]: def handler(message): - results: List[ - SearchResult - ] = vector_collection_search_near_vector_codec.decode_response(message) + results: List[SearchResult] = ( + vector_collection_search_near_vector_codec.decode_response(message) + ) for result in results: if result.key is not None: result.key = self._to_object(result.key) diff --git a/hazelcast/reactor.py b/hazelcast/reactor.py index df591d75af..43c97e309d 100644 --- a/hazelcast/reactor.py +++ b/hazelcast/reactor.py @@ -1,7 +1,4 @@ -try: - import asyncore -except ImportError: - import hazelcast.asyncore as asyncore # type: ignore +import hazelcast.asyncore as asyncore # type: ignore import errno import io import logging diff --git a/hazelcast/security.py b/hazelcast/security.py index 6e7daefff1..07ac956e3d 100644 --- a/hazelcast/security.py +++ b/hazelcast/security.py @@ -6,7 +6,7 @@ class TokenProvider: """TokenProvider is a base class for token providers.""" - def token(self, address: Address|None = None) -> bytes: + def token(self, address: Address | None = None) -> bytes: """Returns a token to be used for token-based authentication. Args: @@ -29,5 +29,5 @@ def __init__(self, token: typing.Union[str, bytes] = ""): else: raise TypeError("token must be either a str or bytes object") - def token(self, address: Address|None = None) -> bytes: + def token(self, address: Address | None = None) -> bytes: return self._token diff --git a/hazelcast/serialization/__init__.py b/hazelcast/serialization/__init__.py index c9ea28baa9..35a1e18983 100644 --- a/hazelcast/serialization/__init__.py +++ b/hazelcast/serialization/__init__.py @@ -1,5 +1,6 @@ """ Serialization Module """ + from hazelcast.serialization.bits import * from hazelcast.serialization.service import SerializationServiceV1 diff --git a/hazelcast/serialization/api.py b/hazelcast/serialization/api.py index c058088945..592b008a74 100644 --- a/hazelcast/serialization/api.py +++ b/hazelcast/serialization/api.py @@ -1,6 +1,7 @@ """ User API for Serialization. """ + import abc import datetime import decimal @@ -15,7 +16,9 @@ class ObjectDataOutput: or arrays of them to series of bytes and write them on a stream. """ - def write_from(self, buff: bytearray, offset: int|None = None, length: int|None = None) -> None: + def write_from( + self, buff: bytearray, offset: int | None = None, length: int | None = None + ) -> None: """Writes the content of the buffer to this output stream. Args: @@ -237,7 +240,9 @@ class ObjectDataInput: reconstruct it to any of primitive types or arrays of them. """ - def read_into(self, buff: bytearray, offset: int|None = None, length: int|None = None) -> bytearray: + def read_into( + self, buff: bytearray, offset: int | None = None, length: int | None = None + ) -> bytearray: """Reads the content of the buffer into an array of bytes. Args: diff --git a/hazelcast/serialization/serialization_const.py b/hazelcast/serialization/serialization_const.py index 3af96c37a0..182ffa5cfb 100644 --- a/hazelcast/serialization/serialization_const.py +++ b/hazelcast/serialization/serialization_const.py @@ -1,6 +1,7 @@ """ Serialization type ids """ + # Serialization Constants CONSTANT_TYPE_NULL = 0 CONSTANT_TYPE_PORTABLE = -1 diff --git a/hazelcast/serialization/util.py b/hazelcast/serialization/util.py index 43e72ba532..990e7284ed 100644 --- a/hazelcast/serialization/util.py +++ b/hazelcast/serialization/util.py @@ -29,6 +29,9 @@ def read_big_decimal(inp: ObjectDataInput) -> decimal.Decimal: @staticmethod def write_big_decimal(out: ObjectDataOutput, value: decimal.Decimal) -> None: sign, digits, exponent = value.as_tuple() + if not type(exponent) == int: + # exponent may be an int, or n, N, F + raise ValueError(f"this decimal number cannot be stored: {value}") unscaled_value = int("".join([str(digit) for digit in digits])) if sign == 1: unscaled_value = -1 * unscaled_value diff --git a/hazelcast/vector.py b/hazelcast/vector.py index c3ef693bc8..dc6c596ede 100644 --- a/hazelcast/vector.py +++ b/hazelcast/vector.py @@ -2,7 +2,6 @@ import enum from typing import Any, Dict, List, Optional, Union - __all__ = "Document", "Vector", "IndexConfig", "SearchResult", "Metric", "Type" diff --git a/tests/integration/asyncio/client_test.py b/tests/integration/asyncio/client_test.py index 7e390482e0..d1c486953a 100644 --- a/tests/integration/asyncio/client_test.py +++ b/tests/integration/asyncio/client_test.py @@ -54,9 +54,7 @@ def get_labels_from_member(self, client_uuid): result = client.getLabels().iterator().next(); break; } - }""" % str( - client_uuid - ) + }""" % str(client_uuid) return self.rc.executeOnController(self.cluster.id, script, Lang.JAVASCRIPT).result diff --git a/tests/integration/asyncio/proxy/map_nearcache_test.py b/tests/integration/asyncio/proxy/map_nearcache_test.py index 9665ad1a15..d55924fd62 100644 --- a/tests/integration/asyncio/proxy/map_nearcache_test.py +++ b/tests/integration/asyncio/proxy/map_nearcache_test.py @@ -85,14 +85,11 @@ def assertion(): async def test_invalidate_nonexist_key(self): await self.fill_map_and_near_cache(10) initial_cache_size = len(self.map._near_cache) - script = ( - """ + script = """ var map = instance_0.getMap("%s"); map.put("key-99","x"); map.put("key-NonExist","x"); - map.remove("key-NonExist");""" - % self.map.name - ) + map.remove("key-NonExist");""" % self.map.name response = self.rc.executeOnController(self.cluster.id, script, Lang.JAVASCRIPT) self.assertTrue(response.success) diff --git a/tests/integration/asyncio/sql_test.py b/tests/integration/asyncio/sql_test.py index 80cd93d9f9..866cfc384a 100644 --- a/tests/integration/asyncio/sql_test.py +++ b/tests/integration/asyncio/sql_test.py @@ -14,7 +14,6 @@ from tests.integration.backward_compatible.sql_test import Student, LITE_MEMBER_CONFIG from tests.util import random_string - SERVER_CONFIG = """ %s - """ - % client_heartbeat_seconds - ) + """ % client_heartbeat_seconds cluster = self.create_cluster(rc, cluster_config) cluster.start_member() @@ -114,9 +111,7 @@ def get_labels_from_member(self, client_uuid): result = client.getLabels().iterator().next(); break; } - }""" % str( - client_uuid - ) + }""" % str(client_uuid) return self.rc.executeOnController(self.cluster.id, script, Lang.JAVASCRIPT).result diff --git a/tests/integration/backward_compatible/proxy/cp/count_down_latch_test.py b/tests/integration/backward_compatible/proxy/cp/count_down_latch_test.py index 2e8f31f5aa..2fa138542c 100644 --- a/tests/integration/backward_compatible/proxy/cp/count_down_latch_test.py +++ b/tests/integration/backward_compatible/proxy/cp/count_down_latch_test.py @@ -9,7 +9,6 @@ from tests.integration.backward_compatible.proxy.cp import CPTestCase from tests.util import get_current_timestamp, random_string - inf = 2**31 - 1 diff --git a/tests/integration/backward_compatible/proxy/map_nearcache_test.py b/tests/integration/backward_compatible/proxy/map_nearcache_test.py index 9fa7fb5dcf..356a974da6 100644 --- a/tests/integration/backward_compatible/proxy/map_nearcache_test.py +++ b/tests/integration/backward_compatible/proxy/map_nearcache_test.py @@ -79,14 +79,11 @@ def assertion(): def test_invalidate_nonexist_key(self): self.fill_map_and_near_cache(10) initial_cache_size = len(self.map._wrapped._near_cache) - script = ( - """ + script = """ var map = instance_0.getMap("%s"); map.put("key-99","x"); map.put("key-NonExist","x"); - map.remove("key-NonExist");""" - % self.map.name - ) + map.remove("key-NonExist");""" % self.map.name response = self.rc.executeOnController(self.cluster.id, script, Lang.JAVASCRIPT) self.assertTrue(response.success) diff --git a/tests/integration/backward_compatible/proxy/map_test.py b/tests/integration/backward_compatible/proxy/map_test.py index 5a323bcfda..5d51595711 100644 --- a/tests/integration/backward_compatible/proxy/map_test.py +++ b/tests/integration/backward_compatible/proxy/map_test.py @@ -2,7 +2,6 @@ import time import unittest - try: from hazelcast.aggregator import ( count, diff --git a/tests/integration/backward_compatible/serialization/compact_compatibility/compact_compatibility_test.py b/tests/integration/backward_compatible/serialization/compact_compatibility/compact_compatibility_test.py index 36c5a8f07b..812c742c5e 100644 --- a/tests/integration/backward_compatible/serialization/compact_compatibility/compact_compatibility_test.py +++ b/tests/integration/backward_compatible/serialization/compact_compatibility/compact_compatibility_test.py @@ -1838,8 +1838,7 @@ def setUp(self) -> None: self.map_name = random_string() self.map = self.client.get_map(self.map_name).blocking() - self.client.sql.execute( - f""" + self.client.sql.execute(f""" CREATE MAPPING "{self.map_name}" ( __key INT, stringField VARCHAR @@ -1850,8 +1849,7 @@ def setUp(self) -> None: 'valueFormat' = 'compact', 'valueCompactTypeName' = 'com.hazelcast.serialization.compact.InnerCompact' ) - """ - ).result() + """).result() def tearDown(self) -> None: self.map.destroy() diff --git a/tests/integration/backward_compatible/serialization/serializers_test.py b/tests/integration/backward_compatible/serialization/serializers_test.py index 246c9d16d8..1b9403d9ca 100644 --- a/tests/integration/backward_compatible/serialization/serializers_test.py +++ b/tests/integration/backward_compatible/serialization/serializers_test.py @@ -33,8 +33,7 @@ def tearDown(self): disposable() def get_from_server(self): - script = ( - """ + script = """ function foo() { var map = instance_0.getMap("%s"); var res = map.get("key"); @@ -44,9 +43,7 @@ def get_from_server(self): return res; } } - result = ""+foo();""" - % self.map.name - ) + result = ""+foo();""" % self.map.name response = self.rc.executeOnController(self.cluster.id, script, Lang.JAVASCRIPT) return response.result.decode("utf-8") @@ -132,7 +129,7 @@ def test_emoji(self): self.assertEqual(value, response) def test_utf_chars(self): - value = "\u0040\u0041\u01DF\u06A0\u12E0\u1D306" + value = "\u0040\u0041\u01df\u06a0\u12e0\u1d306" self.map.set("key", value) self.assertEqual(value, self.map.get("key")) response = self.get_from_server() @@ -359,7 +356,9 @@ def test_double_array_from_server(self): self.assertEqual([3123.0, -123.0], self.map.get("key")) def test_string_array_from_server(self): - self.assertTrue(self.set_on_server('Java.to(["hey", "1βšδΈ­πŸ’¦2πŸ˜­β€πŸ™†πŸ˜”5"], "java.lang.String[]")')) + self.assertTrue( + self.set_on_server('Java.to(["hey", "1βšδΈ­πŸ’¦2πŸ˜­β€πŸ™†πŸ˜”5"], "java.lang.String[]")') + ) self.assertEqual(["hey", "1βšδΈ­πŸ’¦2πŸ˜­β€πŸ™†πŸ˜”5"], self.map.get("key")) def test_date_from_server(self): @@ -422,31 +421,25 @@ def test_java_class_from_server(self): self.assertEqual("java.lang.String", self.map.get("key")) def test_array_list_from_server(self): - script = ( - """ + script = """ var list = new java.util.ArrayList(); list.add(1); list.add(2); list.add(3); var map = instance_0.getMap("%s"); - map.set("key", list);""" - % self.map.name - ) + map.set("key", list);""" % self.map.name response = self.rc.executeOnController(self.cluster.id, script, Lang.JAVASCRIPT) self.assertTrue(response.success) self.assertEqual([1, 2, 3], self.map.get("key")) def test_linked_list_from_server(self): - script = ( - """ + script = """ var list = new java.util.LinkedList(); list.add("a"); list.add("b"); list.add("c"); var map = instance_0.getMap("%s"); - map.set("key", list);""" - % self.map.name - ) + map.set("key", list);""" % self.map.name response = self.rc.executeOnController(self.cluster.id, script, Lang.JAVASCRIPT) self.assertTrue(response.success) self.assertEqual(["a", "b", "c"], self.map.get("key")) diff --git a/tests/integration/backward_compatible/sql_test.py b/tests/integration/backward_compatible/sql_test.py index 9b6db37a80..38a251f376 100644 --- a/tests/integration/backward_compatible/sql_test.py +++ b/tests/integration/backward_compatible/sql_test.py @@ -590,13 +590,10 @@ def test_lazy_deserialization(self): # Using a Portable that is not defined on the client-side. self._create_mapping_for_portable(666, 1, {}) - script = ( - """ + script = """ var m = instance_0.getMap("%s"); m.put(1, new com.hazelcast.client.test.Employee(1, "Joe")); - """ - % self.map_name - ) + """ % self.map_name res = self.rc.executeOnController(self.cluster.id, script, Lang.JAVASCRIPT) self.assertTrue(res.success) @@ -619,13 +616,10 @@ def test_deserialization_error(self): # Using a Portable that is not defined on the client-side. self._create_mapping_for_portable(666, 1, {}) - script = ( - """ + script = """ var m = instance_0.getMap("%s"); m.put(1, new com.hazelcast.client.test.Employee(1, "Joe")); - """ - % self.map_name - ) + """ % self.map_name res = self.rc.executeOnController(self.cluster.id, script, Lang.JAVASCRIPT) self.assertTrue(res.success) @@ -972,8 +966,7 @@ def setUp(self): def test_mixed_cluster(self): map_name = random_string() - create_mapping_query = ( - """ + create_mapping_query = """ CREATE MAPPING "%s" ( __key INT, this INT @@ -983,9 +976,7 @@ def test_mixed_cluster(self): 'keyFormat' = 'int', 'valueFormat' = 'int' ) - """ - % map_name - ) + """ % map_name self.client.sql.execute(create_mapping_query).result() @@ -1013,8 +1004,7 @@ def test_streaming_sql_query(self): break def test_federated_query(self): - query = ( - """ + query = """ CREATE MAPPING "%s" ( __key INT, name VARCHAR, @@ -1025,19 +1015,14 @@ def test_federated_query(self): 'keyFormat' = 'int', 'valueFormat' = 'json-flat' ) - """ - % self.map_name - ) + """ % self.map_name self.execute(query) - insert_into_query = ( - """ + insert_into_query = """ INSERT INTO "%s" (__key, name, age) VALUES (1, 'John', 42) - """ - % self.map_name - ) + """ % self.map_name with self.execute(insert_into_query) as result: self.assertEqual(0, self.update_count(result)) diff --git a/tests/integration/backward_compatible/statistics_test.py b/tests/integration/backward_compatible/statistics_test.py index 2cfd8dc1f4..7457a9f4e3 100644 --- a/tests/integration/backward_compatible/statistics_test.py +++ b/tests/integration/backward_compatible/statistics_test.py @@ -231,8 +231,7 @@ def test_metrics_blob(self): client.shutdown() def get_metrics_blob(self, client_uuid): - script = ( - """ + script = """ stats = instance_0.getOriginal().node.getClientEngine().getClientStatistics(); keys = stats.keySet().toArray(); for(i=0; i < keys.length; i++) { @@ -240,15 +239,12 @@ def get_metrics_blob(self, client_uuid): result = stats.get(keys[i]).metricsBlob(); break; } - }""" - % client_uuid - ) + }""" % client_uuid return self.rc.executeOnController(self.cluster.id, script, Lang.JAVASCRIPT) def get_client_stats_from_server(self, client_uuid): - script = ( - """ + script = """ stats = instance_0.getOriginal().node.getClientEngine().getClientStatistics(); keys = stats.keySet().toArray(); for(i=0; i < keys.length; i++) { @@ -256,9 +252,7 @@ def get_client_stats_from_server(self, client_uuid): result = stats.get(keys[i]).clientAttributes(); break; } - }""" - % client_uuid - ) + }""" % client_uuid return self.rc.executeOnController(self.cluster.id, script, Lang.JAVASCRIPT) diff --git a/tests/integration/compact_test.py b/tests/integration/compact_test.py index 31646d5737..90da5b1201 100644 --- a/tests/integration/compact_test.py +++ b/tests/integration/compact_test.py @@ -10,7 +10,6 @@ from tests.base import HazelcastTestCase from tests.util import random_string - # The tests under this file are meant to be not # run with the backward compatibility tests, as # they test implementation details through private diff --git a/tests/integration/dbapi/dbapi20.py b/tests/integration/dbapi/dbapi20.py index 53ddda1376..b43b1f8d48 100644 --- a/tests/integration/dbapi/dbapi20.py +++ b/tests/integration/dbapi/dbapi20.py @@ -1,7 +1,7 @@ #!/usr/bin/env python -""" Python DB API 2.0 driver compliance unit test suite. - - This software is Public Domain and may be used without restrictions. +"""Python DB API 2.0 driver compliance unit test suite. + +This software is Public Domain and may be used without restrictions. """ __version__ = "1.15.0" diff --git a/tests/unit/serialization/portable_test.py b/tests/unit/serialization/portable_test.py index 858251d0aa..305d0dae3d 100644 --- a/tests/unit/serialization/portable_test.py +++ b/tests/unit/serialization/portable_test.py @@ -10,7 +10,6 @@ from hazelcast.serialization.portable.classdef import ClassDefinitionBuilder from tests.unit.serialization.identified_test import create_identified, SerializationV1Identified - FACTORY_ID = 1 diff --git a/tests/unit/serialization/serializers_test.py b/tests/unit/serialization/serializers_test.py index 6b5813753b..889966e7b6 100644 --- a/tests/unit/serialization/serializers_test.py +++ b/tests/unit/serialization/serializers_test.py @@ -51,7 +51,7 @@ def test_string(self): self.validate("client") self.validate("1βšδΈ­πŸ’¦2πŸ˜­β€πŸ™†πŸ˜”5") self.validate("IΓ±tΓ«rnΓ’tiΓ΄nΓ lizΓ¦tiΓΈn") - self.validate("\u0040\u0041\u01DF\u06A0\u12E0\u1D30") + self.validate("\u0040\u0041\u01df\u06a0\u12e0\u1d30") def test_bytearray(self): self.validate(bytearray("abc".encode())) From bcac94435ac7b1626f4eed4fee7f6190e474a57e Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 28 Jul 2026 13:52:24 +0300 Subject: [PATCH 4/5] add newer python releases to workflows; upgrade actions/* steps; updated dev an test requirements --- .github/workflows/coverage_runner.yml | 10 +++++----- .github/workflows/get-python-versions.yml | 2 +- .github/workflows/linter_docs_mypy.yaml | 12 ++++++------ .github/workflows/nightly_runner.yml | 4 ++-- .../workflows/update_lets_encrypt_certificate.yml | 4 ++-- requirements-dev.txt | 8 ++++---- requirements-test.txt | 11 +++++------ setup.py | 2 +- 8 files changed, 26 insertions(+), 27 deletions(-) diff --git a/.github/workflows/coverage_runner.yml b/.github/workflows/coverage_runner.yml index 2ad0eaff36..6feb1aebf9 100644 --- a/.github/workflows/coverage_runner.yml +++ b/.github/workflows/coverage_runner.yml @@ -50,7 +50,7 @@ jobs: steps: - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} @@ -62,17 +62,17 @@ jobs: - name: Checkout code for PR if: github.event_name == 'pull_request_target' - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: ref: refs/pull/${{ github.event.pull_request.number }}/merge - name: Checkout repository for push event if: github.event_name == 'push' - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Checkout PR coming from community. if: github.event_name == 'workflow_dispatch' - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: ref: refs/pull/${{ github.event.inputs.pr_number }}/merge @@ -89,7 +89,7 @@ jobs: HAZELCAST_ENTERPRISE_KEY,CN/HZ_LICENSE_KEY - name: Checkout to certificates - uses: actions/checkout@v3 + uses: actions/checkout@v7 with: repository: hazelcast/private-test-artifacts path: certs diff --git a/.github/workflows/get-python-versions.yml b/.github/workflows/get-python-versions.yml index eedfd6a09a..44c649b83f 100644 --- a/.github/workflows/get-python-versions.yml +++ b/.github/workflows/get-python-versions.yml @@ -20,7 +20,7 @@ jobs: steps: - id: extract-versions run: | - python_versions='[ "3.11", "3.12", "3.13" ]' + python_versions='[ "3.11", "3.12", "3.13", "3.14", "3.15" ]' echo "python-versions=${python_versions}" >> $GITHUB_OUTPUT echo "earliest-python-version=$(echo "${python_versions}" | jq --raw-output '.[0]')" >> $GITHUB_OUTPUT diff --git a/.github/workflows/linter_docs_mypy.yaml b/.github/workflows/linter_docs_mypy.yaml index 36dd77c86b..9dd75fc590 100644 --- a/.github/workflows/linter_docs_mypy.yaml +++ b/.github/workflows/linter_docs_mypy.yaml @@ -18,12 +18,12 @@ jobs: name: Run black to check the code style steps: - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: ${{ needs.python-versions.outputs.latest-python-version }} - name: Checkout to code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install dependencies run: | @@ -39,12 +39,12 @@ jobs: name: Generate documentation steps: - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: ${{ needs.python-versions.outputs.latest-python-version }} - name: Checkout to code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install dependencies run: | @@ -61,12 +61,12 @@ jobs: name: Run mypy to check type annotations steps: - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: ${{ needs.python-versions.outputs.latest-python-version }} - name: Checkout to code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install dependencies run: | diff --git a/.github/workflows/nightly_runner.yml b/.github/workflows/nightly_runner.yml index ec7c07c278..7061844002 100644 --- a/.github/workflows/nightly_runner.yml +++ b/.github/workflows/nightly_runner.yml @@ -20,7 +20,7 @@ jobs: fail-fast: false steps: - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} - name: Install JDK @@ -29,7 +29,7 @@ jobs: distribution: 'temurin' java-version: '17' - name: Checkout to code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install dependencies run: | pip install -r requirements-test.txt diff --git a/.github/workflows/update_lets_encrypt_certificate.yml b/.github/workflows/update_lets_encrypt_certificate.yml index 3d58e8410e..a5fa9cc5b2 100644 --- a/.github/workflows/update_lets_encrypt_certificate.yml +++ b/.github/workflows/update_lets_encrypt_certificate.yml @@ -9,7 +9,7 @@ jobs: name: Update Let's Encrypt certificate steps: - name: Checkout to certificates - uses: actions/checkout@v3 + uses: actions/checkout@v7 with: repository: hazelcast/private-test-artifacts path: certs @@ -20,7 +20,7 @@ jobs: run: | unzip certs.jar - name: Checkout to client - uses: actions/checkout@v3 + uses: actions/checkout@v7 with: repository: hazelcast/hazelcast-python-client path: client diff --git a/requirements-dev.txt b/requirements-dev.txt index 6abac41cf5..599b46fe5a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ -r requirements-test.txt -black==22.3.0 -Sphinx==7.2.6 -sphinx-rtd-theme==2.0.0 -mypy==0.940 +black==26.5.1 +Sphinx==9.1.0 +sphinx-rtd-theme==3.1.0 +mypy==2.3.0 diff --git a/requirements-test.txt b/requirements-test.txt index 97d2937a54..7bd4c6b680 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,6 +1,5 @@ -thrift==0.13.0 -psutil>=5.8.0 -mock==3.0.5 -parameterized==0.7.4 -pytest==6.2.5 -pytest-cov==3.0.0 \ No newline at end of file +thrift==0.24.0 +psutil>=7.2.2 +mock==5.2.0 +parameterized==0.9.0 +pytest-cov==7.1.0 \ No newline at end of file diff --git a/setup.py b/setup.py index f834e02c32..09fe98d354 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,6 @@ long_description=long_description, url="https://github.com/hazelcast/hazelcast-python-client", author="Hazelcast Inc. Developers", - author_email="hazelcast@googlegroups.com", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -39,6 +38,7 @@ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Libraries :: Python Modules", ], From 047aeb84eabefe3bd9f67b185b665c279127c114 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 28 Jul 2026 13:53:49 +0300 Subject: [PATCH 5/5] remove Python 3.15 from workflow --- .github/workflows/get-python-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get-python-versions.yml b/.github/workflows/get-python-versions.yml index 44c649b83f..e7cbb5b5c7 100644 --- a/.github/workflows/get-python-versions.yml +++ b/.github/workflows/get-python-versions.yml @@ -20,7 +20,7 @@ jobs: steps: - id: extract-versions run: | - python_versions='[ "3.11", "3.12", "3.13", "3.14", "3.15" ]' + python_versions='[ "3.11", "3.12", "3.13", "3.14" ]' echo "python-versions=${python_versions}" >> $GITHUB_OUTPUT echo "earliest-python-version=$(echo "${python_versions}" | jq --raw-output '.[0]')" >> $GITHUB_OUTPUT