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

View File

@@ -130,7 +130,7 @@ class ApproxBase:
def _recursive_list_map(f, x):
if isinstance(x, list):
return list(_recursive_list_map(f, xi) for xi in x)
return [_recursive_list_map(f, xi) for xi in x]
else:
return f(x)