Skip to content

Commit f0e1a3a

Browse files
committed
Use (?i) flag for regex. Corresponds to re.IGNORECASE
1 parent 8ef04b9 commit f0e1a3a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

coverage_pyver_pragma/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
__version__: str = "0.0.6"
5656
__email__: str = "[email protected]"
5757

58-
regex_main: str = re.compile(r"#\s*(pragma|PRAGMA)[:\s]?\s*(no|NO)\s*(cover|COVER)").pattern
58+
regex_main: str = re.compile(r"(?i)#\s*pragma[:\s]?\s*no\s*cover").pattern
5959

6060

6161
class Version(NamedTuple):
@@ -106,25 +106,25 @@ def make_regexes(
106106
# We do it with re.compile to get the syntax highlighting in PyCharm
107107
excludes = [
108108
re.compile(
109-
fr"{regex_main}\s*\((?=\s*<(py|PY|Py)3({'|'.join(less_than_versions)})){wrong_platforms_string}{wrong_implementations_string}.*\)"
109+
fr"{regex_main}\s*\((?=\s*<py3({'|'.join(less_than_versions)})){wrong_platforms_string}{wrong_implementations_string}.*\)"
110110
),
111111
re.compile(
112-
fr"{regex_main}\s*\((?=\s*<=(py|PY|Py)3({'|'.join(less_equal_versions)})){wrong_platforms_string}{wrong_implementations_string}.*\)"
112+
fr"{regex_main}\s*\((?=\s*<=py3({'|'.join(less_equal_versions)})){wrong_platforms_string}{wrong_implementations_string}.*\)"
113113
),
114114
re.compile(
115-
fr"{regex_main}\s*\((?=\s*>(py|PY|Py)3({'|'.join(greater_than_versions)})){wrong_platforms_string}{wrong_implementations_string}.*\)"
115+
fr"{regex_main}\s*\((?=\s*>py3({'|'.join(greater_than_versions)})){wrong_platforms_string}{wrong_implementations_string}.*\)"
116116
),
117117
re.compile(
118-
fr"{regex_main}\s*\((?=\s*(py|PY|Py)3({'|'.join(greater_equal_versions)})\+){wrong_platforms_string}{wrong_implementations_string}.*\)"
118+
fr"{regex_main}\s*\((?=\s*py3({'|'.join(greater_equal_versions)})\+){wrong_platforms_string}{wrong_implementations_string}.*\)"
119119
),
120120
re.compile(
121-
fr"{regex_main}\s*\((?=\s*>=(py|PY|Py)3({'|'.join(greater_equal_versions)})){wrong_platforms_string}{wrong_implementations_string}.*\)"
121+
fr"{regex_main}\s*\((?=\s*>=py3({'|'.join(greater_equal_versions)})){wrong_platforms_string}{wrong_implementations_string}.*\)"
122122
),
123123
re.compile(
124-
fr"{regex_main}\s*\((?=\s*(py|PY|Py)3({'|'.join(exact_versions)})){wrong_platforms_string}{wrong_implementations_string}.*\)"
124+
fr"{regex_main}\s*\((?=\s*py3({'|'.join(exact_versions)})){wrong_platforms_string}{wrong_implementations_string}.*\)"
125125
),
126126
re.compile(
127-
fr"{regex_main}\s*\((?!.*(py|PY|Py)[0-9]+){wrong_platforms_string}{wrong_implementations_string}.*\)"
127+
fr"{regex_main}\s*\((?!.*py[0-9]+){wrong_platforms_string}{wrong_implementations_string}.*\)"
128128
),
129129
]
130130

@@ -184,7 +184,7 @@ def make_not_exclude_regexs(
184184

185185
return [
186186
re.compile(
187-
fr"{regex_main} (?!\(.*(.{{0,2}}(py|PY|Py)3\d(\+)?|!{current_platform}|!{current_implementation}).*\)).*$"
187+
fr"{regex_main} (?!\(.*(.{{0,2}}py3\d(\+)?|!{current_platform}|!{current_implementation}).*\)).*$"
188188
),
189189
re.compile(fr"{regex_main}$"),
190190
]

0 commit comments

Comments
 (0)