Skip to content

Commit 6a69ec7

Browse files
committed
Fix wrong escape sequences
Following warnings shows up all over the code: ``` cassandra/cqlengine/connection.py:318: SyntaxWarning: invalid escape sequence '\*' ``` Let's fix it.
1 parent d62eb38 commit 6a69ec7

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

cassandra/cqlengine/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,14 @@ def setup(
316316
retry_connect=False,
317317
**kwargs):
318318
"""
319-
Setup a the driver connection used by the mapper
319+
Setup the driver connection used by the mapper
320320
321321
:param list hosts: list of hosts, (``contact_points`` for :class:`cassandra.cluster.Cluster`)
322322
:param str default_keyspace: The default keyspace to use
323323
:param int consistency: The global default :class:`~.ConsistencyLevel` - default is the same as :attr:`.Session.default_consistency_level`
324324
:param bool lazy_connect: True if should not connect until first use
325325
:param bool retry_connect: True if we should retry to connect even if there was a connection failure initially
326-
:param \*\*kwargs: Pass-through keyword arguments for :class:`cassandra.cluster.Cluster`
326+
:param kwargs: Pass-through keyword arguments for :class:`cassandra.cluster.Cluster`
327327
"""
328328

329329
from cassandra.cqlengine import models

cassandra/cqlengine/query.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ def add_callback(self, fn, *args, **kwargs):
205205
206206
:param fn: Callable object
207207
:type fn: callable
208-
:param \*args: Positional arguments to be passed to the callback at the time of execution
209-
:param \*\*kwargs: Named arguments to be passed to the callback at the time of execution
208+
:param args: Positional arguments to be passed to the callback at the time of execution
209+
:param kwargs: Named arguments to be passed to the callback at the time of execution
210210
"""
211211
if not callable(fn):
212212
raise ValueError("Value for argument 'fn' is {0} and is not a callable object.".format(type(fn)))
@@ -276,8 +276,8 @@ class ContextQuery(object):
276276
A Context manager to allow a Model to switch context easily. Presently, the context only
277277
specifies a keyspace for model IO.
278278
279-
:param \*args: One or more models. A model should be a class type, not an instance.
280-
:param \*\*kwargs: (optional) Context parameters: can be *keyspace* or *connection*
279+
:param args: One or more models. A model should be a class type, not an instance.
280+
:param kwargs: (optional) Context parameters: can be *keyspace* or *connection*
281281
282282
For example:
283283

tests/integration/standard/test_cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def test_raise_error_on_control_connection_timeout(self):
150150
get_node(1).pause()
151151
cluster = TestCluster(contact_points=['127.0.0.1'], connect_timeout=1)
152152

153-
with self.assertRaisesRegex(NoHostAvailable, "OperationTimedOut\('errors=Timed out creating connection \(1 seconds\)"):
153+
with self.assertRaisesRegex(NoHostAvailable, r"OperationTimedOut\('errors=Timed out creating connection \(1 seconds\)"):
154154
cluster.connect()
155155
cluster.shutdown()
156156

tests/integration/standard/test_metadata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ def test_function_no_parameters(self):
16771677

16781678
with self.VerifiedFunction(self, **kwargs) as vf:
16791679
fn_meta = self.keyspace_function_meta[vf.signature]
1680-
self.assertRegex(fn_meta.as_cql_query(), "CREATE FUNCTION.*%s\(\) .*" % kwargs['name'])
1680+
self.assertRegex(fn_meta.as_cql_query(), r'CREATE FUNCTION.*%s\(\) .*' % kwargs['name'])
16811681

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

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

17351735

17361736
@requires_java_udf

tests/integration/standard/test_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def test_client_ip_in_trace(self):
167167
client_ip = trace.client
168168

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

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

0 commit comments

Comments
 (0)