Replace some for loops, and other minor changes (#8660)

* Replace for loop using the  operator

* Replace for loop with a generator expression inside any()

* Replace for loop with a dictionary comprehension

* Use list comprehension

* Simplify arguments for range()

* Change newfuncargs variable to in-line dictionary comprehension

* is_ancestor: return base.is_relative_to(query)

* Remove unneeded import of pathlib

* Try using PurePath

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Import PurePath on new line

* Revert and remove is_relative_to

Co-authored-by: Zachary Kneupper <zacharykneupper@Zacharys-MBP.lan>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Zack Kneupper
2021-05-14 03:32:50 -04:00
committed by GitHub
parent 364bbe42fc
commit 33c6ad5bf7
4 changed files with 6 additions and 15 deletions
+1 -4
View File
@@ -145,10 +145,7 @@ def _is_doctest(config: Config, path: Path, parent: Collector) -> bool:
if path.suffix in (".txt", ".rst") and parent.session.isinitpath(path):
return True
globs = config.getoption("doctestglob") or ["test*.txt"]
for glob in globs:
if fnmatch_ex(glob, path):
return True
return False
return any(fnmatch_ex(glob, path) for glob in globs)
class ReprFailDoctest(TerminalRepr):