Searches a list of filenames and replaces directories in the list with all files descending from those directories. Files with extensions not in the valid extensions list are excluded. Args: filenames: A list of files or directories Returns: A list of all files that are
(filenames)
| 7947 | |
| 7948 | |
| 7949 | def _ExpandDirectories(filenames): |
| 7950 | """Searches a list of filenames and replaces directories in the list with |
| 7951 | all files descending from those directories. Files with extensions not in |
| 7952 | the valid extensions list are excluded. |
| 7953 | |
| 7954 | Args: |
| 7955 | filenames: A list of files or directories |
| 7956 | |
| 7957 | Returns: |
| 7958 | A list of all files that are members of filenames or descended from a |
| 7959 | directory in filenames |
| 7960 | """ |
| 7961 | expanded = set() |
| 7962 | for filename in filenames: |
| 7963 | if not os.path.isdir(filename): |
| 7964 | expanded.add(filename) |
| 7965 | continue |
| 7966 | |
| 7967 | for root, _, files in os.walk(filename): |
| 7968 | for loopfile in files: |
| 7969 | fullname = os.path.join(root, loopfile) |
| 7970 | fullname = fullname.removeprefix("." + os.path.sep) |
| 7971 | expanded.add(fullname) |
| 7972 | |
| 7973 | return [ |
| 7974 | filename for filename in expanded if os.path.splitext(filename)[1][1:] in GetAllExtensions() |
| 7975 | ] |
| 7976 | |
| 7977 | |
| 7978 | def _FilterExcludedFiles(fnames): |
no test coverage detected
searching dependent graphs…