Skip to content

Commit

Permalink
refactor(src): use list comprehension
Browse files Browse the repository at this point in the history
Co-authored-by: Nejc Habjan <[email protected]>
  • Loading branch information
antoineauger and nejch committed Nov 22, 2024
1 parent fe49ba6 commit aecb771
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions djlint/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ def __init__(
)

def get_resolved_exclude_paths(self) -> list[Path]:
exclude_paths = []
for p in self.exclude.split("|"):
exclude_paths.append(Path(p.strip().replace("\\.", ".")).resolve())
return exclude_paths
return [
Path(p.strip().replace("\\.", ".")).resolve()
for p in self.exclude.split("|")
]
4 changes: 2 additions & 2 deletions djlint/src.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def get_src(src: Iterable[Path], config: Config) -> list[Path]:
paths.extend(
x
for x in normalized_item.glob(f"**/*.{extension}")
if not any([
if not any(
x.is_relative_to(p) for p in config.get_resolved_exclude_paths()
])
)
and no_pragma(config, x)
and (
(config.use_gitignore and not config.gitignore.match_file(x))
Expand Down

0 comments on commit aecb771

Please sign in to comment.