From 60a33e41d1a835fc776094f17a7afe896d968daf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2020 05:19:43 +0000 Subject: [PATCH 1/2] Bump sievelib from 1.1.1 to 1.2.0 Bumps [sievelib](https://github.com/tonioo/sievelib) from 1.1.1 to 1.2.0. - [Release notes](https://github.com/tonioo/sievelib/releases) - [Commits](https://github.com/tonioo/sievelib/compare/1.1.1...1.2.0) Signed-off-by: dependabot[bot] --- Pipfile.lock | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index 643ccb2..3866df6 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -92,12 +92,6 @@ "index": "pypi", "version": "==3.1.1" }, - "future": { - "hashes": [ - "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d" - ], - "version": "==0.18.2" - }, "pycparser": { "hashes": [ "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0", @@ -114,10 +108,10 @@ }, "pyinstaller-hooks-contrib": { "hashes": [ - "sha256:4935b2b48c2a38ab4f8f80d77147781642bff7d31748fca07d26dbdeeefb560d", - "sha256:71982f32883309e89675bfd10093cdcaca4f894bce11a91a34559b8224cf5e63" + "sha256:bf4543a16c9c6e9dd2d70ea3fee78b81d3357a68f706df471d990213892259d9", + "sha256:dd752c88c1c7bb6920f7de248c12d4411c0463877e5e64afdc4f7e93dff9fc94" ], - "version": "==2020.8" + "version": "==2020.10" }, "pyqt5": { "hashes": [ @@ -193,11 +187,11 @@ }, "sievelib": { "hashes": [ - "sha256:b6fe5d4239dab278def5eab9ece95463ea241c99b9ba6dc8ac452394a83f697b", - "sha256:bf1e684881483e33d4c37687d147ebbe85bd09fc3b0b6c7366aac992b97581ea" + "sha256:a34ffb27dffeebe4f540c85a0aaaa6588ff7fbeac11a81a0dba1ead54bf339c5", + "sha256:c98559705d7f8aa701d8a177120fea98f79e6d6dfecc076389738ab2d5ff05cb" ], "index": "pypi", - "version": "==1.1.1" + "version": "==1.2.0" }, "six": { "hashes": [ @@ -247,10 +241,10 @@ }, "zipp": { "hashes": [ - "sha256:43f4fa8d8bb313e65d8323a3952ef8756bf40f9a5c3ea7334be23ee4ec8278b6", - "sha256:b52f22895f4cfce194bc8172f3819ee8de7540aa6d873535a8668b730b8b411f" + "sha256:102c24ef8f171fd729d46599845e95c7ab894a4cf45f5de11a44cc7444fb1108", + "sha256:ed5eee1974372595f9e416cc7bbeeb12335201d8081ca8a0743c954d4446e5cb" ], - "version": "==3.2.0" + "version": "==3.4.0" } } } From 8f203bf102dcd88eba47fcec80ed3f0f7085f500 Mon Sep 17 00:00:00 2001 From: Simon Paridon Date: Sat, 31 Oct 2020 00:14:11 +0100 Subject: [PATCH 2/2] Removed patches / hotfixes for sievelib bugs. --- strainer/controls/statusbar.py | 12 ++---------- strainer/sieve/__init__.py | 6 ------ strainer/widgets/editor/lexer.py | 8 ++++---- strainer/widgets/editor/scintilla.py | 1 - 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/strainer/controls/statusbar.py b/strainer/controls/statusbar.py index 12c67cd..da9fb30 100644 --- a/strainer/controls/statusbar.py +++ b/strainer/controls/statusbar.py @@ -91,16 +91,8 @@ def parseScript(self, text=None): def getError(self, text): if text is None: return None, tuple() - try: - parseResult = self._parser.parse(text) - except Exception: - # Workaround for sievelib bug #96 - return (0, 0), 'Error occurred while trying to parse the script.' + parseResult = self._parser.parse(text) if parseResult: return None, 'No errors found in open script.' - # Workaround for sievelib bug #93 errorPos = tuple(x - 1 for x in self._parser.error_pos) - error = self._parser.error - if len(error) > 200: - error = error[:197] + ' [...]' - return errorPos, error + return errorPos, self._parser.error diff --git a/strainer/sieve/__init__.py b/strainer/sieve/__init__.py index 0bdd818..66bf830 100644 --- a/strainer/sieve/__init__.py +++ b/strainer/sieve/__init__.py @@ -1,17 +1,11 @@ -from sievelib.commands import ExistsCommand from sievelib.parser import Lexer, Parser from .connection import SieveConnectionQueue __all__ = ('SieveConnectionQueue',) -# Patch sievelib bug #90 -ExistsCommand.args_definition[0]['type'].append('string') - # Save error line and column on error -# Due to a problem in sievelib, column number is currently at the _end_ of a token, not the start. -# Cf. tonioo/sievelib#92 for a fix. @property def error(self): return self._error diff --git a/strainer/widgets/editor/lexer.py b/strainer/widgets/editor/lexer.py index 9142752..6dde4b3 100644 --- a/strainer/widgets/editor/lexer.py +++ b/strainer/widgets/editor/lexer.py @@ -127,10 +127,10 @@ def _doStyleText(self, start: int, end: int): self._stylingPos = 0 self.startStyling(start) for style, value in self.scan(start): - self.setStyling(self._lexer.pos - self._stylingPos - len(value), 0) + self.setStyling(self._lexer.pos - self._stylingPos, 0) self.setStyling(len(value), style) - self._stylingPos = self._lexer.pos - if start + self._lexer.pos > end: + self._stylingPos = self._lexer.pos + len(value) + if start + self._stylingPos > end: break def scan(self, start): @@ -145,7 +145,7 @@ def scan(self, start): command = get_command_instance(value.decode('ascii'), checkexists=False) style = self._IDENTIFIER_STYLES[command.get_type()] except (UnknownCommand, NotImplementedError, KeyError): - value_start = start + self._lexer.pos - len(value) + value_start = start + self._lexer.pos editor.SendScintilla(QsciScintilla.SCI_INDICATORFILLRANGE, value_start, len(value)) yield style, value diff --git a/strainer/widgets/editor/scintilla.py b/strainer/widgets/editor/scintilla.py index 87ced9d..895560c 100644 --- a/strainer/widgets/editor/scintilla.py +++ b/strainer/widgets/editor/scintilla.py @@ -86,7 +86,6 @@ def setParseError(self, line, col, length=1): self.SendScintilla(QsciScintilla.SCI_SETINDICATORCURRENT, 1) self.SendScintilla(QsciScintilla.SCI_INDICATORCLEARRANGE, 0, self.length()) if line >= 0 and col >= 0: - # check if max() is still needed after sievelib #92 is merged start = max(self.positionFromLineIndex(line, col) - length, 0) self.SendScintilla(QsciScintilla.SCI_INDICATORFILLRANGE, start, length)