Code Duplication    Length = 31-31 lines in 2 locations

core/build-support/cpplint.py 1 location

@@ 6413-6443 (lines=31) @@
6410
6411
  return filenames
6412
6413
def _ExpandDirectories(filenames):
6414
  """Searches a list of filenames and replaces directories in the list with
6415
  all files descending from those directories. Files with extensions not in
6416
  the valid extensions list are excluded.
6417
6418
  Args:
6419
    filenames: A list of files or directories
6420
6421
  Returns:
6422
    A list of all files that are members of filenames or descended from a
6423
    directory in filenames
6424
  """
6425
  expanded = set()
6426
  for filename in filenames:
6427
      if not os.path.isdir(filename):
6428
        expanded.add(filename)
6429
        continue
6430
6431
      for root, _, files in os.walk(filename):
6432
        for loopfile in files:
6433
          fullname = os.path.join(root, loopfile)
6434
          if fullname.startswith('.' + os.path.sep):
6435
            fullname = fullname[len('.' + os.path.sep):]
6436
          expanded.add(fullname)
6437
6438
  filtered = []
6439
  for filename in expanded:
6440
      if os.path.splitext(filename)[1][1:] in GetAllExtensions():
6441
          filtered.append(filename)
6442
6443
  return filtered
6444
6445
def _FilterExcludedFiles(filenames):
6446
  """Filters out files listed in the --exclude command line switch. File paths

sdk/build-support/cpplint.py 1 location

@@ 6413-6443 (lines=31) @@
6410
6411
  return filenames
6412
6413
def _ExpandDirectories(filenames):
6414
  """Searches a list of filenames and replaces directories in the list with
6415
  all files descending from those directories. Files with extensions not in
6416
  the valid extensions list are excluded.
6417
6418
  Args:
6419
    filenames: A list of files or directories
6420
6421
  Returns:
6422
    A list of all files that are members of filenames or descended from a
6423
    directory in filenames
6424
  """
6425
  expanded = set()
6426
  for filename in filenames:
6427
      if not os.path.isdir(filename):
6428
        expanded.add(filename)
6429
        continue
6430
6431
      for root, _, files in os.walk(filename):
6432
        for loopfile in files:
6433
          fullname = os.path.join(root, loopfile)
6434
          if fullname.startswith('.' + os.path.sep):
6435
            fullname = fullname[len('.' + os.path.sep):]
6436
          expanded.add(fullname)
6437
6438
  filtered = []
6439
  for filename in expanded:
6440
      if os.path.splitext(filename)[1][1:] in GetAllExtensions():
6441
          filtered.append(filename)
6442
6443
  return filtered
6444
6445
def _FilterExcludedFiles(filenames):
6446
  """Filters out files listed in the --exclude command line switch. File paths