kopia lustrzana https://github.com/jupyterhub/repo2docker
refactor: use list comprehension rather filter+lambda
rodzic
3028d07182
commit
d6670f4378
|
@ -612,16 +612,18 @@ class BuildPack:
|
||||||
|
|
||||||
exclude = []
|
exclude = []
|
||||||
|
|
||||||
for ignore_file in [".dockerignore", ".containerignore"]:
|
for ignore_file_name in [".dockerignore", ".containerignore"]:
|
||||||
if os.path.exists(ignore_file):
|
if os.path.exists(ignore_file_name):
|
||||||
with open(ignore_file, "r") as f:
|
with open(ignore_file_name, "r") as ignore_file:
|
||||||
|
cleaned_lines = [
|
||||||
|
line.strip() for line in ignore_file.read().splitlines()
|
||||||
|
]
|
||||||
exclude.extend(
|
exclude.extend(
|
||||||
list(
|
[
|
||||||
filter(
|
line
|
||||||
lambda x: x != "" and x[0] != "#",
|
for line in cleaned_lines
|
||||||
[l.strip() for l in f.read().splitlines()],
|
if line != "" and line[0] != "#"
|
||||||
)
|
]
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if not exclude:
|
if not exclude:
|
||||||
|
|
Ładowanie…
Reference in New Issue