Avoid unnecessary which and fix typos

This commit is contained in:
pagedown
2022-03-07 11:30:12 +08:00
parent 3095e7a256
commit 397fbe7ad3
3 changed files with 14 additions and 15 deletions

View File

@@ -73,7 +73,7 @@ def make_tarfile(ssh_opts: SSHOptions, base_env: Dict[str, str]) -> bytes:
def filter_from_globs(*pats: str) -> Callable[[tarfile.TarInfo], Optional[tarfile.TarInfo]]:
def filter(tarinfo: tarfile.TarInfo) -> Optional[tarfile.TarInfo]:
for junk_dir in ('.DS_Store', '__pycache__'):
for pat in (f'*/{junk_dir}', '*/{junk_dir}/*'):
for pat in (f'*/{junk_dir}', f'*/{junk_dir}/*'):
if fnmatch.fnmatch(tarinfo.name, pat):
return None
for pat in pats: