Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c1e4917
Cherrypick changes from CLIENT-4425-docs-fix-broken-internal-referenc…
juliannguyen4 Apr 13, 2026
b84d623
Ignore all warnings related to type aliases for now
juliannguyen4 Apr 13, 2026
54bf152
Currently getting a parser error. I suspect the first * is causing it.
juliannguyen4 Apr 13, 2026
641c70e
Regex looks wrong
juliannguyen4 Apr 13, 2026
7b4644e
Fix remaining errors, 2 of them I forgot to cherrypick. The optional …
juliannguyen4 Apr 13, 2026
0a0bd5a
Fix
juliannguyen4 Apr 13, 2026
589c7da
Fix invalid type hint. any with lowercase refers to a built in method…
juliannguyen4 Apr 13, 2026
bf056d2
TypeExpression evaluates to a confusing value in the rendered docs. A…
juliannguyen4 Apr 13, 2026
f1d12fd
Since there is no cross reference available for TypeExpression, maybe…
juliannguyen4 Apr 13, 2026
fb4af96
Document TypeExpression in attempt to make Sphinx not expand it in _B…
juliannguyen4 Apr 13, 2026
6c182bd
Revert
juliannguyen4 Apr 13, 2026
0490c2f
Follow the sphinx autodoc docs to prevent sphinx from expanding this …
juliannguyen4 Apr 13, 2026
a165171
Make sure Python interpreter doesn't evaluate type aliases at runtime…
juliannguyen4 Apr 13, 2026
386a3f6
Since TypeExpression is referenced by cdt_ctx_all_children*, add a do…
juliannguyen4 Apr 13, 2026
495e91c
Docstring still not showing up. Maybe a space needed?
juliannguyen4 Apr 13, 2026
2b54cc2
Still doesn't work. Try this
juliannguyen4 Apr 13, 2026
8b4f122
typing.Callable looks too verbose in the rst code. Try seeing if Pyth…
juliannguyen4 Apr 13, 2026
f71d1b0
Revert "typing.Callable looks too verbose in the rst code. Try seeing…
juliannguyen4 Apr 13, 2026
d845848
TypeExpression cross ref now works, so add these back.
juliannguyen4 Apr 13, 2026
0ab3075
Add back TypeExpression
juliannguyen4 Apr 13, 2026
c070691
use better syntax
juliannguyen4 Apr 13, 2026
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
7 changes: 4 additions & 3 deletions aerospike_helpers/batch/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class BatchRecord:

BatchRecord should usually be read from as a result and not created by the user. Its subclasses can be used as
input to batch_write.
Client methods :meth:`~Client.batch_apply`, :meth:`~Client.batch_operate`, :meth:`~Client.batch_remove`
with batch_records field as a list of these BatchRecord objects containing the batch request results.
Client methods :meth:`~aerospike.Client.batch_apply`, :meth:`~aerospike.Client.batch_operate`,
:meth:`~aerospike.Client.batch_remove` with batch_records field as a list of these BatchRecord objects
containing the batch request results.

Attributes:
key (:obj:`tuple`): The aerospike key to operate on.
Expand Down Expand Up @@ -126,7 +127,7 @@ class Read(BatchRecord):
ops (:ref:`aerospike_operation_helpers.operations`): list of aerospike operation dictionaries to perform on
the record at key.
meta (dict): the metadata to set for this command
read_all_bins (bool, optional): An optional bool, if True, read all bins in the record.
read_all_bins (:obj:`bool`, optional): An optional bool, if True, read all bins in the record.
policy (:ref:`aerospike_batch_read_policies`, optional): An optional dictionary of batch read policy flags.
"""

Expand Down
5 changes: 4 additions & 1 deletion aerospike_helpers/cdt_ctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
"""
import aerospike

# Somehow sphinx-autodoc-typehints isn't setting TYPE_CHECKING to true, so there's a
# NameError when using Any
from typing import Any

def index_type_string(index_type):
"""
Expand Down Expand Up @@ -299,7 +302,7 @@ def cdt_ctx_map_value(value):
return _cdt_ctx(id=aerospike.CDT_CTX_MAP_VALUE, value=value)


def cdt_ctx_map_key_create(key: any, order: int = 0) -> _cdt_ctx:
def cdt_ctx_map_key_create(key: Any, order: int = 0) -> _cdt_ctx:
"""
Create a map with the given sort order at the given key.

Expand Down
4 changes: 2 additions & 2 deletions aerospike_helpers/expressions/arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class Min(_BaseExpr):
def __init__(self, *args: "TypeNumber"):
"""Args:
`*args` (TypeNumber): Variable amount of float or integer expressions or values from which to find the
minimum value.
minimum value.
:return: (integer or float value).
Expand All @@ -424,7 +424,7 @@ class Max(_BaseExpr):
def __init__(self, *args: "TypeNumber"):
"""Args:
`*args` (TypeNumber): Variable amount of float or integer expressions or values from which to find the
maximum value.
maximum value.
:return: (integer or float value).
Expand Down
2 changes: 1 addition & 1 deletion aerospike_helpers/expressions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ class Let(_BaseExpr):
def __init__(self, *exprs: _BaseExpr):
"""Args:
`*exprs` (_BaseExpr): Variable number of :class:`~aerospike_helpers.expressions.base.Def` expressions
followed by a scoped expression.
followed by a scoped expression.

:return: (result of scoped expression)

Expand Down
4 changes: 2 additions & 2 deletions aerospike_helpers/expressions/bitwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ def __init__(self, bit_offset: int, bit_size: int, value: bool, bin: "TypeBinNam
"""Args:
bit_offset (int): Bit index of where to start reading.
bit_size (int): Number of bits to read.
value bool: Bit value to check for.
value (bool): Bit value to check for.
bin (TypeBinName): A :class:`~aerospike_helpers.expressions.base.BlobBin` expression.

:return: Index of the left most bit starting from bit_offset set to value. Returns -1 if not found.
Expand Down Expand Up @@ -672,7 +672,7 @@ def __init__(self, bit_offset: int, bit_size: int, sign: bool, bin: "TypeBinName
"""Args:
bit_offset (int): Bit index of where to start reading.
bit_size (int): Number of bits to get.
sign bool: True for signed, False for unsigned.
sign (bool): True for signed, False for unsigned.
bin (TypeBinName): A :class:`~aerospike_helpers.expressions.base.BlobBin` expression.

:return: Integer expression.
Expand Down
10 changes: 9 additions & 1 deletion aerospike_helpers/expressions/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Resources used by all expressions.
"""

# from __future__ import annotations
from __future__ import annotations
from itertools import chain
from typing import List, Optional, Tuple, Union, Dict, Any

Expand Down Expand Up @@ -143,6 +143,8 @@ def compile(self):
TypeFixedEle = Union[int, float, str, bytes, dict]
TypeFixed = Optional[Dict[str, TypeFixedEle]]
TypeCompiledOp = Tuple[int, TypeResultType, TypeFixed, int]

#: Compiled expression that can be passed to the Python client API.
TypeExpression = List[TypeCompiledOp]

TypeChild = Union[int, float, str, bytes, _AtomExpr]
Expand All @@ -152,6 +154,9 @@ def compile(self):


class _BaseExpr(_AtomExpr):
"""
Base class for all expressions.
"""
_op: int = 0
_rt: TypeResultType = None
_fixed: TypeFixed = None
Expand All @@ -169,6 +174,9 @@ def _vop(self, v) -> TypeCompiledOp:
)

def compile(self) -> TypeExpression:
"""
Returns an expression object that can be passed to the Python client API.
"""
expression = [self._get_op()]
work = chain(self._children)

Expand Down
19 changes: 12 additions & 7 deletions aerospike_helpers/operations/bitwise_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@


def bit_resize(bin_name: str, byte_size, policy=None, resize_flags: int = 0):
"""Creates a bit_resize_operation to be used with :meth:`aerospike.operate` or :meth:`aerospike.operate_ordered`.
"""Creates a bit_resize_operation to be used with :meth:`aerospike.Client.operate` or
:meth:`aerospike.Client.operate_ordered`.

Change the size of a bytes bin stored in a record on the Aerospike Server.

Expand All @@ -184,7 +185,8 @@ def bit_resize(bin_name: str, byte_size, policy=None, resize_flags: int = 0):


def bit_remove(bin_name: str, byte_offset, byte_size, policy=None):
"""Creates a bit_remove_operation to be used with :meth:`aerospike.operate` or :meth:`aerospike.operate_ordered`.
"""Creates a bit_remove_operation to be used with :meth:`aerospike.Client.operate` or
:meth:`aerospike.Client.operate_ordered`.

Remove bytes from bitmap at byte_offset for byte_size.

Expand All @@ -208,7 +210,8 @@ def bit_remove(bin_name: str, byte_offset, byte_size, policy=None):


def bit_set(bin_name: str, bit_offset, bit_size, value_byte_size, value, policy=None):
"""Creates a bit_set_operation to be used with :meth:`aerospike.operate` or :meth:`aerospike.operate_ordered`.
"""Creates a bit_set_operation to be used with :meth:`aerospike.Client.operate` or
:meth:`aerospike.Client.operate_ordered`.

Set the value on a bitmap at bit_offset for bit_size in a record on the Aerospike Server.

Expand Down Expand Up @@ -236,7 +239,8 @@ def bit_set(bin_name: str, bit_offset, bit_size, value_byte_size, value, policy=


def bit_set_int(bin_name: str, bit_offset: int, bit_size: int, value: int, policy: dict = None):
"""Creates a bit_set_int_operation to be used with :meth:`aerospike.operate` or :meth:`aerospike.operate_ordered`.
"""Creates a bit_set_int_operation to be used with :meth:`aerospike.Client.operate` or
:meth:`aerospike.Client.operate_ordered`.

Set the value on a bitmap starting at bit_offset for bit_size in a record on the Aerospike Server.

Expand All @@ -262,7 +266,8 @@ def bit_set_int(bin_name: str, bit_offset: int, bit_size: int, value: int, polic


def bit_count(bin_name: str, bit_offset, bit_size):
"""Creates a bit_count_operation to be used with :meth:`aerospike.operate` or :meth:`aerospike.operate_ordered`.
"""Creates a bit_count_operation to be used with :meth:`aerospike.Client.operate` or
:meth:`aerospike.Client.operate_ordered`.

Server returns an integer count of all set bits starting at bit_offset for bit_size bits.

Expand Down Expand Up @@ -501,7 +506,7 @@ def bit_or(bin_name: str, bit_offset, bit_size, value_byte_size, value, policy=N
bit_offset (int): The offset where the bits will start being compared.
bit_size (int): How many bits of value to or.
value_byte_size (int): Length of value in bytes.
value (bytes/byte array): Value to be used in or operation.
value (bytes | bytearray): Value to be used in or operation.
policy (dict): The :ref:`bit_policy <aerospike_bit_policies>` dictionary. default: None.

Returns:
Expand Down Expand Up @@ -618,7 +623,7 @@ def bit_xor(bin_name: str, bit_offset, bit_size, value_byte_size, value, policy=
bit_offset (int): The offset where the bits will start being compared.
bit_size (int): How many bits of value to xor.
value_byte_size (int): Length of value in bytes.
value (bytes/byte array): Value to be used in xor operation.
value (bytes | bytearray): Value to be used in xor operation.
policy (dict): The :ref:`bit_policy <aerospike_bit_policies>` dictionary. default: None.

Returns:
Expand Down
16 changes: 8 additions & 8 deletions doc/aerospike.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Serialization
Register a user-defined serializer available to all `Client`
instances.

:param callable callback: the function to invoke for serialization.
:param typing.Callable callback: the function to invoke for serialization.


.. seealso:: To use this function with :meth:`Client.put`, \
Expand All @@ -232,7 +232,7 @@ Serialization
of type `AS_BYTES_BLOB <http://www.aerospike.com/apidocs/c/d0/dd4/as__bytes_8h.html#a0cf2a6a1f39668f606b19711b3a98bf3>`_
through this deserializer.

:param callable callback: the function to invoke for deserialization.
:param typing.Callable callback: the function to invoke for deserialization.

.. py:function:: unset_serializers()

Expand Down Expand Up @@ -313,7 +313,7 @@ The following example shows several different methods to configuring logging for
def callback(level: int, function: str, path: str, line: int, message: str):
pass

:param optional callable log_handler: the function used as the logging handler.
:param typing.Callable | None log_handler: the function used as the logging handler.

.. py:function:: set_log_level(loglevel)

Expand Down Expand Up @@ -432,7 +432,7 @@ Only the `hosts` key is required; the rest of the keys are optional.
server configuration file, as well as the server's CA certificate.

* **user** (:class:`str`)
(Optional) A defined user with roles in the cluster. See :meth:`admin_create_user`.
(Optional) A defined user with roles in the cluster. See :meth:`aerospike.Client.admin_create_user`.
* **password** (:class:`str`)
(Optional) The password will be hashed by the client using bcrypt.
* **config_provider** (:class:`aerospike.ConfigProvider`)
Expand Down Expand Up @@ -782,14 +782,14 @@ Only the `hosts` key is required; the rest of the keys are optional.
Compress data for transmission if the object size is greater than a given number of bytes

Default: ``0``, meaning 'never compress'
* **cluster_name** (:class:`Optional[str]`)
* **cluster_name** (:class:`str` | :class:`None`)
Expected cluster name. If set to a string value, the ``cluster_name`` must match the cluster-name field
in the service section in each server configuration. This ensures that the specified
seed nodes belong to the expected cluster on startup. If not, the client will refuse
to add the node to the client's view of the cluster.

Default: :py:obj:`None`
* **app_id** (:class:`Optional[str]`)
* **app_id** (:class:`str` | :class:`None`)
Application identifier.

If this is set to :py:obj:`None`, this is set to the client's username by default. If client doesn't have a username,
Expand Down Expand Up @@ -1721,7 +1721,7 @@ Permission codes define the type of permission granted for a user's role.

Regex Flag Values
------------------
Flags used by the :class:`aerospike_operation_helpers.expressions.base.CmpRegex` Aerospike expression.
Flags used by the :class:`aerospike_helpers.expressions.base.CmpRegex` Aerospike expression.
See :ref:`aerospike_operation_helpers.expressions` for more information.

.. data:: REGEX_NONE
Expand Down Expand Up @@ -1861,7 +1861,7 @@ Path Expression Select Flags
This is a synonym for :data:`aerospike.EXP_PATH_SELECT_VALUE` to make it clear in your
source code that you're expecting a map. See also :data:`aerospike.EXP_PATH_SELECT_MAP_KEY_VALUE`.

.. data:: EXP_PATH_SELECT_MAP_KEYS
.. data:: EXP_PATH_SELECT_MAP_KEY

Return the list of map keys of the nodes finally selected by the context.

Expand Down
4 changes: 2 additions & 2 deletions doc/aerospike_helpers.batch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ aerospike\_helpers\.batch package
aerospike\_helpers\.batch\.records module
-----------------------------------------

Classes for the use with client batch APIs :meth:`~Client.batch_write`, :meth:`~Client.batch_operate`,
:meth:`~Client.batch_apply`, :meth:`~Client.batch_remove`.
Classes for the use with client batch APIs :meth:`~aerospike.Client.batch_write`,
:meth:`~aerospike.Client.batch_operate`, :meth:`~aerospike.Client.batch_apply`, :meth:`~aerospike.Client.batch_remove`.

.. automodule:: aerospike_helpers.batch.records
:members:
Expand Down
1 change: 1 addition & 0 deletions doc/aerospike_helpers.cdt_ctx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ aerospike\_helpers\.cdt_ctx module
:members:
:undoc-members:
:show-inheritance:
:private-members: _cdt_ctx
17 changes: 11 additions & 6 deletions doc/aerospike_helpers.expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ In the Python client, Aerospike expressions are built using a series of classes
comparison and logical operators, bins, metadata operations, and bin operations.
Expressions are constructed using a Lisp like syntax by instantiating an expression that yields a boolean,
such as :meth:`~aerospike_helpers.expressions.base.Eq` or :meth:`~aerospike_helpers.expressions.base.And`,
while passing them other expressions and constants as arguments, and finally calling the :meth:`compile` method.
while passing them other expressions and constants as arguments, and finally calling the
:meth:`~aerospike_helpers.expressions.resources._BaseExpr.compile` method.

Example::

Expand Down Expand Up @@ -168,6 +169,7 @@ aerospike\_helpers\.expressions\.base module
:members:
:special-members:
:show-inheritance:
:private-members: _Key

aerospike\_helpers\.expressions\.list module
--------------------------------------------
Expand Down Expand Up @@ -215,9 +217,12 @@ aerospike\_helpers\.expressions\.bitwise_operators module
aerospike\_helpers\.expressions\.resources module
--------------------------------------------------

.. automodule:: aerospike_helpers.expressions.resources
.. autodata:: aerospike_helpers.expressions.resources.TypeExpression

.. autoclass:: ResultType
:members:
:undoc-members:
:member-order: bysource
.. autoclass:: aerospike_helpers.expressions.resources.ResultType
:members:
:undoc-members:

.. autoclass:: aerospike_helpers.expressions.resources._BaseExpr

.. automethod:: aerospike_helpers.expressions.resources._BaseExpr.compile
Loading
Loading