Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD 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
FSL
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,
...
@@ -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 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.
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
...
...
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