Skip to content

Commit 726a275

Browse files
authored
Remove redundant character escape in some regexes (#2051)
1 parent 20d08c1 commit 726a275

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/tox/config/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@
6161
INTERRUPT_TIMEOUT = 0.3
6262
TERMINATE_TIMEOUT = 0.2
6363

64-
_FACTOR_LINE_PATTERN = re.compile(r"^([\w{}\.!,-]+)\:\s+(.+)")
65-
_ENVSTR_SPLIT_PATTERN = re.compile(r"((?:\{[^}]+\})+)|,")
66-
_ENVSTR_EXPAND_PATTERN = re.compile(r"\{([^}]+)\}")
64+
_FACTOR_LINE_PATTERN = re.compile(r"^([\w{}.!,-]+):\s+(.+)")
65+
_ENVSTR_SPLIT_PATTERN = re.compile(r"((?:{[^}]+})+)|,")
66+
_ENVSTR_EXPAND_PATTERN = re.compile(r"{([^}]+)}")
6767
_WHITESPACE_PATTERN = re.compile(r"\s+")
6868

6969

@@ -1412,7 +1412,7 @@ def _list_section_factors(self, section):
14121412
factors = set()
14131413
if section in self._cfg:
14141414
for _, value in self._cfg[section].items():
1415-
exprs = re.findall(r"^([\w{}\.!,-]+)\:\s+", value, re.M)
1415+
exprs = re.findall(r"^([\w{}.!,-]+):\s+", value, re.M)
14161416
factors.update(*mapcat(_split_factor_expr_all, exprs))
14171417
return factors
14181418

@@ -1536,7 +1536,7 @@ def expand_section_names(config):
15361536
The parser will see it as two different sections: [testenv:py36-cov], [testenv:py37-cov]
15371537
15381538
"""
1539-
factor_re = re.compile(r"\{\s*([\w\s,-]+)\s*\}")
1539+
factor_re = re.compile(r"{\s*([\w\s,-]+)\s*}")
15401540
split_re = re.compile(r"\s*,\s*")
15411541
to_remove = set()
15421542
for section in list(config.sections):

src/tox/package/local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def get_latest_version_of_package(package_spec):
4949
return candidates[0]
5050

5151

52-
_REGEX_FILE_NAME_WITH_VERSION = re.compile(r"[\w_\-\+\.]+-(.*)\.(zip|tar\.gz)")
52+
_REGEX_FILE_NAME_WITH_VERSION = re.compile(r"[\w_+.-]+-(.*)\.(zip|tar\.gz)")
5353

5454

5555
def get_version_from_filename(basename):

0 commit comments

Comments
 (0)