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
07bec037
Commit
07bec037
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Paths passed to removeDuplicates must exist. Immv/cp scripts raise error
when called programmatically.
parent
02629feb
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
fsl/scripts/imcp.py
+7
-7
7 additions, 7 deletions
fsl/scripts/imcp.py
fsl/scripts/immv.py
+6
-7
6 additions, 7 deletions
fsl/scripts/immv.py
fsl/utils/path.py
+16
-4
16 additions, 4 deletions
fsl/utils/path.py
with
29 additions
and
18 deletions
fsl/scripts/imcp.py
+
7
−
7
View file @
07bec037
...
@@ -58,13 +58,13 @@ def main(argv=None):
...
@@ -58,13 +58,13 @@ def main(argv=None):
fileGroups
=
fslimage
.
FILE_GROUPS
)
fileGroups
=
fslimage
.
FILE_GROUPS
)
for
src
in
srcs
:
for
src
in
srcs
:
try
:
imcp
.
imcp
(
src
,
dest
,
useDefaultExt
=
True
)
imcp
.
imcp
(
src
,
dest
,
useDefaultExt
=
True
)
except
Exception
as
e
:
print
(
e
)
break
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
main
()
try
:
main
()
except
Exception
as
e
:
print
(
e
)
sys
.
exit
(
1
)
This diff is collapsed.
Click to expand it.
fsl/scripts/immv.py
+
6
−
7
View file @
07bec037
...
@@ -59,13 +59,12 @@ def main(argv=None):
...
@@ -59,13 +59,12 @@ def main(argv=None):
fileGroups
=
fslimage
.
FILE_GROUPS
)
fileGroups
=
fslimage
.
FILE_GROUPS
)
for
src
in
srcs
:
for
src
in
srcs
:
try
:
imcp
.
immv
(
src
,
dest
,
useDefaultExt
=
True
)
imcp
.
immv
(
src
,
dest
,
useDefaultExt
=
True
)
except
Exception
as
e
:
print
(
e
)
break
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
main
()
try
:
main
()
except
Exception
as
e
:
print
(
e
)
sys
.
exit
(
1
)
This diff is collapsed.
Click to expand it.
fsl/utils/path.py
+
16
−
4
View file @
07bec037
...
@@ -246,7 +246,10 @@ def removeDuplicates(paths, allowedExts=None, fileGroups=None):
...
@@ -246,7 +246,10 @@ def removeDuplicates(paths, allowedExts=None, fileGroups=None):
[
'
001.img
'
,
'
002.img
'
,
'
003.img
'
]
[
'
001.img
'
,
'
002.img
'
,
'
003.img
'
]
:arg paths: List of paths to reduce.
A :exc:`PathError` is raised if any of the paths do not exist.
:arg paths: List of paths to reduce. If ``allowedExts`` is not
``None``, may be incomplete.
:arg allowedExts: Allowed/recognised file extensions.
:arg allowedExts: Allowed/recognised file extensions.
...
@@ -257,10 +260,19 @@ def removeDuplicates(paths, allowedExts=None, fileGroups=None):
...
@@ -257,10 +260,19 @@ def removeDuplicates(paths, allowedExts=None, fileGroups=None):
for
path
in
paths
:
for
path
in
paths
:
path
=
addExt
(
path
,
mustExist
=
True
,
allowedExts
=
allowedExts
,
fileGroups
=
fileGroups
)
groupFiles
=
getFileGroup
(
path
,
allowedExts
,
fileGroups
)
groupFiles
=
getFileGroup
(
path
,
allowedExts
,
fileGroups
)
if
not
any
([
g
in
unique
for
g
in
groupFiles
]):
if
len
(
groupFiles
)
==
0
:
unique
.
append
(
path
)
if
path
not
in
unique
:
unique
.
append
(
path
)
elif
not
any
([
p
in
unique
for
p
in
groupFiles
]):
unique
.
append
(
groupFiles
[
0
])
return
unique
return
unique
...
@@ -320,7 +332,7 @@ def getFileGroup(path, allowedExts=None, fileGroups=None, fullPaths=True):
...
@@ -320,7 +332,7 @@ def getFileGroup(path, allowedExts=None, fileGroups=None, fullPaths=True):
for
group
in
fileGroups
:
for
group
in
fileGroups
:
if
ext
not
in
group
:
if
ext
!=
''
and
ext
not
in
group
:
continue
continue
groupFiles
=
[
base
+
s
for
s
in
group
]
groupFiles
=
[
base
+
s
for
s
in
group
]
...
...
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