refactor: use list comprehension rather filter+lambda

pull/1205/head
Samuel Gaist 2022-10-26 17:59:56 +02:00
rodzic 3028d07182
commit d6670f4378
1 zmienionych plików z 11 dodań i 9 usunięć

Wyświetl plik

@ -612,16 +612,18 @@ class BuildPack:
exclude = []
for ignore_file in [".dockerignore", ".containerignore"]:
if os.path.exists(ignore_file):
with open(ignore_file, "r") as f:
for ignore_file_name in [".dockerignore", ".containerignore"]:
if os.path.exists(ignore_file_name):
with open(ignore_file_name, "r") as ignore_file:
cleaned_lines = [
line.strip() for line in ignore_file.read().splitlines()
]
exclude.extend(
list(
filter(
lambda x: x != "" and x[0] != "#",
[l.strip() for l in f.read().splitlines()],
)
)
[
line
for line in cleaned_lines
if line != "" and line[0] != "#"
]
)
if not exclude: