MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / _ExpandDirectories

Function _ExpandDirectories

steps/cpplint.py:6829–6858  ·  view source on GitHub ↗

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 members of

(filenames)

Source from the content-addressed store, hash-verified

6827 return filenames
6828
6829def _ExpandDirectories(filenames):
6830 """Searches a list of filenames and replaces directories in the list with
6831 all files descending from those directories. Files with extensions not in
6832 the valid extensions list are excluded.
6833
6834 Args:
6835 filenames: A list of files or directories
6836
6837 Returns:
6838 A list of all files that are members of filenames or descended from a
6839 directory in filenames
6840 """
6841 expanded = set()
6842 for filename in filenames:
6843 if not os.path.isdir(filename):
6844 expanded.add(filename)
6845 continue
6846
6847 for root, _, files in os.walk(filename):
6848 for loopfile in files:
6849 fullname = os.path.join(root, loopfile)
6850 if fullname.startswith('.' + os.path.sep):
6851 fullname = fullname[len('.' + os.path.sep):]
6852 expanded.add(fullname)
6853
6854 filtered = []
6855 for filename in expanded:
6856 if os.path.splitext(filename)[1][1:] in GetAllExtensions():
6857 filtered.append(filename)
6858 return filtered
6859
6860def _FilterExcludedFiles(fnames):
6861 """Filters out files listed in the --exclude command line switch. File paths

Callers 1

ParseArgumentsFunction · 0.85

Calls 3

setClass · 0.85
GetAllExtensionsFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected