From d19e71d25d0bffea0790d5761e6520aedc3186bc Mon Sep 17 00:00:00 2001 From: Brad Schoening Date: Tue, 21 Mar 2023 13:57:48 -0400 Subject: [PATCH 1/5] Updated to 4.1.1 --- cqlshlib/formatting.py | 2 +- cqlshlib/saferscanner.py | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/cqlshlib/formatting.py b/cqlshlib/formatting.py index b49a29a..ebf9fc7 100644 --- a/cqlshlib/formatting.py +++ b/cqlshlib/formatting.py @@ -440,7 +440,7 @@ def append(builder, dividend, divisor, unit): if dividend == 0 or dividend < divisor: return dividend - builder.append(str(dividend / divisor)) + builder.append(str(dividend // divisor)) builder.append(unit) return dividend % divisor diff --git a/cqlshlib/saferscanner.py b/cqlshlib/saferscanner.py index 3cc3430..5afd8ef 100644 --- a/cqlshlib/saferscanner.py +++ b/cqlshlib/saferscanner.py @@ -19,7 +19,11 @@ # regex in-pattern flags. Any of those can break correct operation of Scanner. import re -from sre_constants import BRANCH, SUBPATTERN, GROUPREF, GROUPREF_IGNORE, GROUPREF_EXISTS +import six +try: + from sre_constants import BRANCH, SUBPATTERN, GROUPREF, GROUPREF_IGNORE, GROUPREF_EXISTS +except ImportError: + from re._constants import BRANCH, SUBPATTERN, GROUPREF, GROUPREF_IGNORE, GROUPREF_EXISTS from sys import version_info @@ -81,4 +85,24 @@ def __init__(self, lexicon, flags=0): self.scanner = re.sre_compile.compile(p) -SaferScanner = Py38SaferScanner if version_info >= (3, 8) else Py36SaferScanner +class Py311SaferScanner(SaferScannerBase): + + def __init__(self, lexicon, flags=0): + self.lexicon = lexicon + p = [] + s = re._parser.State() + s.flags = flags + for phrase, action in lexicon: + gid = s.opengroup() + p.append(re._parser.SubPattern(s, [(SUBPATTERN, (gid, 0, 0, re._parser.parse(phrase, flags))), ])) + s.closegroup(gid, p[-1]) + p = re._parser.SubPattern(s, [(BRANCH, (None, p))]) + self.p = p + self.scanner = re._compiler.compile(p) + + +SaferScanner = Py36SaferScanner if six.PY3 else Py2SaferScanner +if version_info >= (3, 11): + SaferScanner = Py311SaferScanner +elif version_info >= (3, 8): + SaferScanner = Py38SaferScanner From a5ed8524a489fa43c867462cec77783d463b0b30 Mon Sep 17 00:00:00 2001 From: Brad Schoening Date: Tue, 21 Mar 2023 14:47:59 -0400 Subject: [PATCH 2/5] added 6.1.1 release info --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index a20910d..bc135c0 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,11 @@ Unfortunately the Cassandra project does not always increment the `cqlsh` versio release we need to document not only the `cqlsh` version but also the `cassandra` version in which it shipped. +#### 6.1.1 (March 21, 2023) + +This packages `cqlsh` `6.1.0` from [Cassandra 4.1.1](https://github.com/apache/cassandra/blob/cassandra-4.1.0/bin/cqlsh.py): +* Although this is pulled from a Cassandra `4.x` release, it is protocol compatible with Cassandra `3.x` clusters, with the exception of DESCRIBE keywords which require a 4.x cluster. + #### 6.1.0 (Jan 4, 2023) This packages `cqlsh` `6.1.0` from [Cassandra 4.1](https://github.com/apache/cassandra/blob/cassandra-4.1.0/bin/cqlsh.py): From 83cf5704f7d114e4c7c35d3687d27738bbd9aa70 Mon Sep 17 00:00:00 2001 From: Brad Schoening Date: Tue, 21 Mar 2023 14:58:01 -0400 Subject: [PATCH 3/5] Update supported python versions to align with 4.1.1 --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index 420db07..3d174a0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,6 +22,8 @@ classifiers = Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 [options] packages = cqlsh, cqlshlib From b2d8af96be1d90e8294cef1b0a7047886112de03 Mon Sep 17 00:00:00 2001 From: Brad Schoening Date: Tue, 21 Mar 2023 18:30:16 -0400 Subject: [PATCH 4/5] updated release note --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bc135c0..e17190e 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ shipped. #### 6.1.1 (March 21, 2023) This packages `cqlsh` `6.1.0` from [Cassandra 4.1.1](https://github.com/apache/cassandra/blob/cassandra-4.1.0/bin/cqlsh.py): +* Now supports Python 3.11. * Although this is pulled from a Cassandra `4.x` release, it is protocol compatible with Cassandra `3.x` clusters, with the exception of DESCRIBE keywords which require a 4.x cluster. #### 6.1.0 (Jan 4, 2023) From 36e2cc41e570437011cd877566d1203e53dc9db6 Mon Sep 17 00:00:00 2001 From: Brad Schoening Date: Wed, 22 Mar 2023 09:48:34 -0400 Subject: [PATCH 5/5] updated date --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e17190e..ea30a55 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Unfortunately the Cassandra project does not always increment the `cqlsh` versio release we need to document not only the `cqlsh` version but also the `cassandra` version in which it shipped. -#### 6.1.1 (March 21, 2023) +#### 6.1.1 (March 22, 2023) This packages `cqlsh` `6.1.0` from [Cassandra 4.1.1](https://github.com/apache/cassandra/blob/cassandra-4.1.0/bin/cqlsh.py): * Now supports Python 3.11.