Skip to content

Commit

Permalink
Remove redundant character escape in some regexes (#2051)
Browse files Browse the repository at this point in the history
  • Loading branch information
noviluni authored May 3, 2021
1 parent 20d08c1 commit 726a275
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/tox/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
INTERRUPT_TIMEOUT = 0.3
TERMINATE_TIMEOUT = 0.2

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


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

Expand Down Expand Up @@ -1536,7 +1536,7 @@ def expand_section_names(config):
The parser will see it as two different sections: [testenv:py36-cov], [testenv:py37-cov]
"""
factor_re = re.compile(r"\{\s*([\w\s,-]+)\s*\}")
factor_re = re.compile(r"{\s*([\w\s,-]+)\s*}")
split_re = re.compile(r"\s*,\s*")
to_remove = set()
for section in list(config.sections):
Expand Down
2 changes: 1 addition & 1 deletion src/tox/package/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_latest_version_of_package(package_spec):
return candidates[0]


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


def get_version_from_filename(basename):
Expand Down

0 comments on commit 726a275

Please sign in to comment.