Skip to content

Commit 82b4863

Browse files
tchaikovfruch
authored andcommitted
cassandra/cluster.py: use raw string when appropriate
Python complains at seeing ```py re.compile(r'^\s*BEGIN\s+[a-zA-Z]*\s*BATCH', re.UNICODE) ``` ``` <>:1: SyntaxWarning: invalid escape sequence '\s' ``` but the interpreter continues on, and take "\s" as it is without escaping it. still, it's not a valid string literal. because "\s" is not an escape sequence, while "\\s" is, but we don't have to escape "\" here, we can just use the raw string. simpler this way. in this change, we trade the invalid escape sequence with a raw string to silence this warning. Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
1 parent 0ab7128 commit 82b4863

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cassandra/cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5451,7 +5451,7 @@ def cancel_continuous_paging(self):
54515451
except AttributeError:
54525452
raise DriverException("Attempted to cancel paging with no active session. This is only for requests with ContinuousdPagingOptions.")
54535453

5454-
batch_regex = re.compile('^\s*BEGIN\s+[a-zA-Z]*\s*BATCH')
5454+
batch_regex = re.compile(r'^\s*BEGIN\s+[a-zA-Z]*\s*BATCH')
54555455

54565456
@property
54575457
def was_applied(self):

0 commit comments

Comments
 (0)