diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2018-09-29 15:52:21 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-09-29 15:52:21 +0200 |
commit | cb931bfa8430e6f5b4f51207bbd1b633f3f91e19 (patch) | |
tree | 6e7e6d1861c7d072ad7efba71c6f289dd19ddd94 | |
parent | 76ce7c13b4a3059cdad08ccd9264c3d52a6683c2 (diff) | |
download | pylint-git-cb931bfa8430e6f5b4f51207bbd1b633f3f91e19.tar.gz |
Save the first group into a variable and use that instead
-rw-r--r-- | pylint/lint.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pylint/lint.py b/pylint/lint.py index 2e14508d5..3c21bcabf 100644 --- a/pylint/lint.py +++ b/pylint/lint.py @@ -803,11 +803,13 @@ class PyLinter( match = utils.OPTION_RGX.search(content) if match is None: continue + + first_group = match.group(1) if ( - match.group(1).strip() == "disable-all" - or match.group(1).strip() == "skip-file" + first_group.strip() == "disable-all" + or first_group.strip() == "skip-file" ): - if match.group(1).strip() == "disable-all": + if first_group.strip() == "disable-all": self.add_message( "deprecated-pragma", line=start[0], @@ -817,10 +819,10 @@ class PyLinter( self._ignore_file = True return try: - opt, value = match.group(1).split("=", 1) + opt, value = first_group.split("=", 1) except ValueError: self.add_message( - "bad-inline-option", args=match.group(1).strip(), line=start[0] + "bad-inline-option", args=first_group.strip(), line=start[0] ) continue opt = opt.strip() |