Merge pull request #626 from guykisel/case_conflict_performance

optimize check_case_conflict.parents
This commit is contained in:
Anthony Sottile 2021-07-10 12:45:01 -04:00 committed by GitHub
commit fe1db5fdb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,4 @@
import argparse
import os.path
from typing import Iterable
from typing import Iterator
from typing import Optional
@ -15,10 +14,11 @@ def lower_set(iterable: Iterable[str]) -> Set[str]:
def parents(file: str) -> Iterator[str]:
file = os.path.dirname(file)
while file:
yield file
file = os.path.dirname(file)
path_parts = file.split('/')
path_parts.pop()
while path_parts:
yield '/'.join(path_parts)
path_parts.pop()
def directories_for(files: Set[str]) -> Set[str]: