Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
fslpy
Commits
b57dfd23
Commit
b57dfd23
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/path.py
+8
-11
8 additions, 11 deletions
fsl/utils/path.py
with
8 additions
and
11 deletions
fsl/utils/path.py
+
8
−
11
View file @
b57dfd23
...
...
@@ -293,7 +293,7 @@ def getFileGroup(path,
extensions in the group are returned.
:arg unambiguous: Defaults to ``False``. If ``True``, and the path
is not unambiguou
o
sly part of one group, or part of
is not unambiguously part of one group, or part of
no groups, a :exc:`PathError` is raised.
Otherwise, the path is returned.
"""
...
...
@@ -318,12 +318,13 @@ def getFileGroup(path,
groupFiles
=
[
base
+
s
for
s
in
group
]
exist
=
[
op
.
exists
(
f
)
for
f
in
groupFiles
]
if
any
(
exist
):
partialMatches
+=
1
if
all
(
exist
):
fullMatches
+=
1
else
:
continue
if
any
(
exist
):
partialMatches
+=
1
matchedGroups
.
append
(
group
)
matchedGroupFiles
.
append
(
groupFiles
)
if
all
(
exist
):
fullMatches
+=
1
matchedGroups
.
append
(
group
)
matchedGroupFiles
.
append
(
groupFiles
)
# Path is not part of any group
if
partialMatches
==
0
:
...
...
@@ -410,11 +411,7 @@ def removeDuplicates(paths, allowedExts=None, fileGroups=None):
groupFiles
=
getFileGroup
(
path
,
allowedExts
,
fileGroups
)
if
len
(
groupFiles
)
==
0
:
if
path
not
in
unique
:
unique
.
append
(
path
)
elif
not
any
([
p
in
unique
for
p
in
groupFiles
]):
if
not
any
([
p
in
unique
for
p
in
groupFiles
]):
unique
.
append
(
groupFiles
[
0
])
return
unique
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment