From a5f32376eafc3dd6425388b17302d7640e8a3664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20W=C5=82odarczyk?= Date: Tue, 30 Apr 2024 16:12:36 +0200 Subject: [PATCH 1/2] Use raw strings in some docstrings to avoid SyntaxWarning in Python 3.12 . --- cassandra/cqlengine/connection.py | 2 +- cassandra/cqlengine/query.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cassandra/cqlengine/connection.py b/cassandra/cqlengine/connection.py index 588e512a2d..eafe2bd5ef 100644 --- a/cassandra/cqlengine/connection.py +++ b/cassandra/cqlengine/connection.py @@ -315,7 +315,7 @@ def setup( lazy_connect=False, retry_connect=False, **kwargs): - """ + r""" Setup a the driver connection used by the mapper :param list hosts: list of hosts, (``contact_points`` for :class:`cassandra.cluster.Cluster`) diff --git a/cassandra/cqlengine/query.py b/cassandra/cqlengine/query.py index 73f48a5928..e27a74bb49 100644 --- a/cassandra/cqlengine/query.py +++ b/cassandra/cqlengine/query.py @@ -196,7 +196,7 @@ def _execute_callbacks(self): callback(*args, **kwargs) def add_callback(self, fn, *args, **kwargs): - """Add a function and arguments to be passed to it to be executed after the batch executes. + r"""Add a function and arguments to be passed to it to be executed after the batch executes. A batch can support multiple callbacks. @@ -272,7 +272,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): class ContextQuery(object): - """ + r""" A Context manager to allow a Model to switch context easily. Presently, the context only specifies a keyspace for model IO. From 1bdead8061dc8f0011f230e86016a29bdbe3d6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20W=C5=82odarczyk?= Date: Fri, 28 Jun 2024 20:04:51 +0200 Subject: [PATCH 2/2] Remove escaped asterisks from docstrings. --- cassandra/cqlengine/connection.py | 4 ++-- cassandra/cqlengine/query.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cassandra/cqlengine/connection.py b/cassandra/cqlengine/connection.py index eafe2bd5ef..20ef497a73 100644 --- a/cassandra/cqlengine/connection.py +++ b/cassandra/cqlengine/connection.py @@ -315,7 +315,7 @@ def setup( lazy_connect=False, retry_connect=False, **kwargs): - r""" + """ Setup a the driver connection used by the mapper :param list hosts: list of hosts, (``contact_points`` for :class:`cassandra.cluster.Cluster`) @@ -323,7 +323,7 @@ def setup( :param int consistency: The global default :class:`~.ConsistencyLevel` - default is the same as :attr:`.Session.default_consistency_level` :param bool lazy_connect: True if should not connect until first use :param bool retry_connect: True if we should retry to connect even if there was a connection failure initially - :param \*\*kwargs: Pass-through keyword arguments for :class:`cassandra.cluster.Cluster` + :param kwargs: Pass-through keyword arguments for :class:`cassandra.cluster.Cluster` """ from cassandra.cqlengine import models diff --git a/cassandra/cqlengine/query.py b/cassandra/cqlengine/query.py index e27a74bb49..afc7ceeef6 100644 --- a/cassandra/cqlengine/query.py +++ b/cassandra/cqlengine/query.py @@ -196,7 +196,7 @@ def _execute_callbacks(self): callback(*args, **kwargs) def add_callback(self, fn, *args, **kwargs): - r"""Add a function and arguments to be passed to it to be executed after the batch executes. + """Add a function and arguments to be passed to it to be executed after the batch executes. A batch can support multiple callbacks. @@ -205,8 +205,8 @@ def add_callback(self, fn, *args, **kwargs): :param fn: Callable object :type fn: callable - :param \*args: Positional arguments to be passed to the callback at the time of execution - :param \*\*kwargs: Named arguments to be passed to the callback at the time of execution + :param args: Positional arguments to be passed to the callback at the time of execution + :param kwargs: Named arguments to be passed to the callback at the time of execution """ if not callable(fn): raise ValueError("Value for argument 'fn' is {0} and is not a callable object.".format(type(fn))) @@ -272,12 +272,12 @@ def __exit__(self, exc_type, exc_val, exc_tb): class ContextQuery(object): - r""" + """ A Context manager to allow a Model to switch context easily. Presently, the context only specifies a keyspace for model IO. - :param \*args: One or more models. A model should be a class type, not an instance. - :param \*\*kwargs: (optional) Context parameters: can be *keyspace* or *connection* + :param args: One or more models. A model should be a class type, not an instance. + :param kwargs: (optional) Context parameters: can be *keyspace* or *connection* For example: