Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/coverage_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/get-python-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]'

echo "python-versions=${python_versions}" >> $GITHUB_OUTPUT
echo "earliest-python-version=$(echo "${python_versions}" | jq --raw-output '.[0]')" >> $GITHUB_OUTPUT
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/linter_docs_mypy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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: |
Expand All @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update_lets_encrypt_certificate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions examples/map/map_portable_versioning_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions examples/sql/dbapi_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
cur = conn.cursor()

# create a mapping
cur.execute(
"""
cur.execute("""
CREATE OR REPLACE MAPPING stocks (
__key INT,
operation_date DATE,
Expand All @@ -22,8 +21,7 @@
'keyFormat' = 'int',
'valueFormat' = 'json-flat'
)
"""
)
""")

# add some data
data = [
Expand Down
6 changes: 2 additions & 4 deletions examples/sql/sql_async_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions examples/sql/sql_compact_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -46,8 +45,7 @@ def get_class(self):
'valueFormat' = 'compact',
'valueCompactTypeName' = 'Person'
)
"""
).result()
""").result()


persons = client.get_map("persons").blocking()
Expand Down
6 changes: 2 additions & 4 deletions examples/sql/sql_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()
Expand Down
12 changes: 4 additions & 8 deletions examples/sql/sql_json_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']}")
26 changes: 13 additions & 13 deletions hazelcast/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions hazelcast/asyncore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion hazelcast/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading