summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2018-11-28 09:19:04 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2018-11-28 09:19:28 +0100
commit7de1f56047d5939f1d5670884160301792d1d51b (patch)
treed2c895be6fe8ef123ed96e49580a3c5c8865dfc2
parent754ce1dffae4c8e5a1f40decc24ebf03024ab97d (diff)
downloadpylint-git-7de1f56047d5939f1d5670884160301792d1d51b.tar.gz
Replace StopIterationCalls in ForwardSlashChunker with returns.
Thanks @antonenk. Close #2579
-rw-r--r--pylint/checkers/spelling.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/pylint/checkers/spelling.py b/pylint/checkers/spelling.py
index df99f6b3e..7493d6b02 100644
--- a/pylint/checkers/spelling.py
+++ b/pylint/checkers/spelling.py
@@ -110,7 +110,7 @@ class SphinxDirectives(Filter):
return bool(self._pattern.match(word))
-class ForwardSlashChunkder(Chunker):
+class ForwardSlashChunker(Chunker):
"""
This chunker allows splitting words like 'before/after' into 'before' and 'after'
"""
@@ -118,7 +118,7 @@ class ForwardSlashChunkder(Chunker):
def next(self):
while True:
if not self._text:
- raise StopIteration()
+ return
if "/" not in self._text:
text = self._text
self._offset = 0
@@ -146,9 +146,9 @@ class ForwardSlashChunkder(Chunker):
if not pre_text or not post_text:
break
if not pre_text[-1].isalpha() or not post_text[0].isalpha():
- raise StopIteration()
+ return
self._text = pre_text + " " + post_text
- raise StopIteration()
+ return
class SpellingChecker(BaseTokenChecker):
@@ -265,7 +265,7 @@ class SpellingChecker(BaseTokenChecker):
self.tokenizer = get_tokenizer(
dict_name,
- chunkers=[ForwardSlashChunkder],
+ chunkers=[ForwardSlashChunker],
filters=[
EmailFilter,
URLFilter,