Skip to content

Commit c0b9d06

Browse files
committed
Use tuples for immutable sequences
1 parent a1d3cfb commit c0b9d06

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

coverage_pyver_pragma/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
__version__: str = "0.3.1"
4848
__email__: str = "[email protected]"
4949

50-
__all__ = ["DSL_EXCLUDE", "evaluate_exclude"]
50+
__all__ = ("DSL_EXCLUDE", "evaluate_exclude")
5151

5252
DSL_EXCLUDE = re.compile(r'.*#\s*(?:pragma|PRAGMA)[:\s]?\s*(?:no|NO)\s*(?:cover|COVER)\s*\((.*)\)')
5353
"""
@@ -80,10 +80,11 @@ def lines_matching(self, *regexes) -> Set[int]:
8080

8181
regex_c = re.compile(combined)
8282
matches = set()
83+
exclude = DSL_EXCLUDE
8384

8485
for idx, ltext in enumerate(self.lines, start=1):
8586

86-
dsl_m = DSL_EXCLUDE.match(ltext)
87+
dsl_m = exclude.match(ltext)
8788

8889
# Check if it matches the DSL regex:
8990
if dsl_m:

coverage_pyver_pragma/grammar.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
opAssoc
161161
)
162162

163-
__all__ = [
163+
__all__ = (
164164
"ImplementationTag",
165165
"LogicalAND",
166166
"LogicalNOT",
@@ -172,14 +172,16 @@
172172
"PLATFORM_TAG",
173173
"IMPLEMENTATION_TAG",
174174
"GRAMMAR",
175-
]
175+
)
176176

177177
# This ensures coverage.py records the correct coverage for these modules
178178
# when they are under test
179179

180+
# pylint: disable=loop-global-usage,dotted-import-in-loop
180181
for module in [m for m in sys.modules if m.startswith("domdf_python_tools")]: # pragma: no cover (macOS)
181182
if module in sys.modules:
182183
del sys.modules[module]
184+
# pylint: enable=loop-global-usage,dotted-import-in-loop
183185

184186
PYTHON_VERSION = os.environ.get("COV_PYTHON_VERSION", '.'.join(platform.python_version_tuple()[:2]))
185187
PLATFORM = os.environ.get("COV_PLATFORM", platform.system()).casefold()
@@ -380,7 +382,7 @@ def __bool__(self) -> bool:
380382
GREATER_THAN_EQUAL = ">="
381383
GREATER_THAN = '>'
382384

383-
OPS = [LESS_THAN, LESS_THAN_EQUAL, GREATER_THAN, GREATER_THAN_EQUAL]
385+
OPS = [LESS_THAN, LESS_THAN_EQUAL, GREATER_THAN, GREATER_THAN_EQUAL] # pylint: disable=use-tuple-over-list
384386
COMPARATOR = Optional(oneOf(' '.join(OPS))).setResultsName("comparator")
385387

386388
VERSION = Combine(CaselessLiteral("py") + Word(nums)).setResultsName("version")

0 commit comments

Comments
 (0)