Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong escape sequences #405

Merged
merged 1 commit into from
Jan 8, 2025
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
4 changes: 2 additions & 2 deletions cassandra/cqlengine/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@ def setup(
retry_connect=False,
**kwargs):
"""
Setup a the driver connection used by the mapper
Setup the driver connection used by the mapper

:param list hosts: list of hosts, (``contact_points`` for :class:`cassandra.cluster.Cluster`)
:param str default_keyspace: The default keyspace to use
: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`
"""

dkropachev marked this conversation as resolved.
Show resolved Hide resolved
from cassandra.cqlengine import models
Expand Down
8 changes: 4 additions & 4 deletions cassandra/cqlengine/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -276,8 +276,8 @@ class ContextQuery(object):
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:

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/standard/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def test_raise_error_on_control_connection_timeout(self):
get_node(1).pause()
cluster = TestCluster(contact_points=['127.0.0.1'], connect_timeout=1)

with self.assertRaisesRegex(NoHostAvailable, "OperationTimedOut\('errors=Timed out creating connection \(1 seconds\)"):
with self.assertRaisesRegex(NoHostAvailable, r"OperationTimedOut\('errors=Timed out creating connection \(1 seconds\)"):
dkropachev marked this conversation as resolved.
Show resolved Hide resolved
cluster.connect()
cluster.shutdown()

Expand Down
6 changes: 3 additions & 3 deletions tests/integration/standard/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ def test_function_no_parameters(self):

with self.VerifiedFunction(self, **kwargs) as vf:
fn_meta = self.keyspace_function_meta[vf.signature]
self.assertRegex(fn_meta.as_cql_query(), "CREATE FUNCTION.*%s\(\) .*" % kwargs['name'])
self.assertRegex(fn_meta.as_cql_query(), r'CREATE FUNCTION.*%s\(\) .*' % kwargs['name'])
dkropachev marked this conversation as resolved.
Show resolved Hide resolved

def test_functions_follow_keyspace_alter(self):
"""
Expand Down Expand Up @@ -1725,12 +1725,12 @@ def test_function_cql_called_on_null(self):
kwargs['called_on_null_input'] = True
with self.VerifiedFunction(self, **kwargs) as vf:
fn_meta = self.keyspace_function_meta[vf.signature]
self.assertRegex(fn_meta.as_cql_query(), "CREATE FUNCTION.*\) CALLED ON NULL INPUT RETURNS .*")
self.assertRegex(fn_meta.as_cql_query(), r'CREATE FUNCTION.*\) CALLED ON NULL INPUT RETURNS .*')

kwargs['called_on_null_input'] = False
with self.VerifiedFunction(self, **kwargs) as vf:
fn_meta = self.keyspace_function_meta[vf.signature]
self.assertRegex(fn_meta.as_cql_query(), "CREATE FUNCTION.*\) RETURNS NULL ON NULL INPUT RETURNS .*")
self.assertRegex(fn_meta.as_cql_query(), r'CREATE FUNCTION.*\) RETURNS NULL ON NULL INPUT RETURNS .*')


@requires_java_udf
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/standard/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_client_ip_in_trace(self):
client_ip = trace.client

# Ip address should be in the local_host range
pat = re.compile("127.0.0.\d{1,3}")
pat = re.compile(r'127.0.0.\d{1,3}')

# Ensure that ip is set
self.assertIsNotNone(client_ip, "Client IP was not set in trace with C* >= 2.2")
Expand Down
Loading