Skip to content
Snippets Groups Projects
Commit b57dfd23 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Removed dead code - getFileGroups will never return an empty list. Also

simplified a little bit of code in getFileGroup
parent ee216387
No related branches found
No related tags found
No related merge requests found
...@@ -293,7 +293,7 @@ def getFileGroup(path, ...@@ -293,7 +293,7 @@ def getFileGroup(path,
extensions in the group are returned. extensions in the group are returned.
:arg unambiguous: Defaults to ``False``. If ``True``, and the path :arg unambiguous: Defaults to ``False``. If ``True``, and the path
is not unambiguouosly part of one group, or part of is not unambiguously part of one group, or part of
no groups, a :exc:`PathError` is raised. no groups, a :exc:`PathError` is raised.
Otherwise, the path is returned. Otherwise, the path is returned.
""" """
...@@ -318,12 +318,13 @@ def getFileGroup(path, ...@@ -318,12 +318,13 @@ def getFileGroup(path,
groupFiles = [base + s for s in group] groupFiles = [base + s for s in group]
exist = [op.exists(f) for f in groupFiles] exist = [op.exists(f) for f in groupFiles]
if any(exist): partialMatches += 1 if any(exist):
if all(exist): fullMatches += 1 partialMatches += 1
else: continue
matchedGroups .append(group) if all(exist):
matchedGroupFiles.append(groupFiles) fullMatches += 1
matchedGroups .append(group)
matchedGroupFiles.append(groupFiles)
# Path is not part of any group # Path is not part of any group
if partialMatches == 0: if partialMatches == 0:
...@@ -410,11 +411,7 @@ def removeDuplicates(paths, allowedExts=None, fileGroups=None): ...@@ -410,11 +411,7 @@ def removeDuplicates(paths, allowedExts=None, fileGroups=None):
groupFiles = getFileGroup(path, allowedExts, fileGroups) groupFiles = getFileGroup(path, allowedExts, fileGroups)
if len(groupFiles) == 0: if not any([p in unique for p in groupFiles]):
if path not in unique:
unique.append(path)
elif not any([p in unique for p in groupFiles]):
unique.append(groupFiles[0]) unique.append(groupFiles[0])
return unique return unique
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment