Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
mantidproject
mantid
Commits
fc7c9b6e
Commit
fc7c9b6e
authored
7 years ago
by
Brandon Hewer
Browse files
Options
Downloads
Patches
Plain Diff
Update RenameWorkspaces docs
Refs #20818
parent
7644d4a7
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
docs/source/algorithms/RenameWorkspaces-v1.rst
+8
-8
8 additions, 8 deletions
docs/source/algorithms/RenameWorkspaces-v1.rst
with
8 additions
and
8 deletions
docs/source/algorithms/RenameWorkspaces-v1.rst
+
8
−
8
View file @
fc7c9b6e
...
@@ -50,13 +50,13 @@ Usage
...
@@ -50,13 +50,13 @@ Usage
ws_before_rename = mtd.getObjectNames()
ws_before_rename = mtd.getObjectNames()
ws_before_rename.sort()
ws_before_rename.sort()
print
'Workspaces in the ADS _before_ renaming:
',
ws_before_rename
print
(
'Workspaces in the ADS _before_ renaming:
{}'.format(
ws_before_rename
))
RenameWorkspaces(names, WorkspaceNames=['new_ws1', 'new_ws2', 'new_ws3'])
RenameWorkspaces(names, WorkspaceNames=['new_ws1', 'new_ws2', 'new_ws3'])
ws_after_rename = mtd.getObjectNames()
ws_after_rename = mtd.getObjectNames()
ws_after_rename.sort()
ws_after_rename.sort()
print
'Workspaces in the ADS _after_ renaming:
',
ws_after_rename
print
(
'Workspaces in the ADS _after_ renaming:
{}'.format(
ws_after_rename
))
Output:
Output:
...
@@ -80,13 +80,13 @@ Output:
...
@@ -80,13 +80,13 @@ Output:
ws_before_rename = mtd.getObjectNames()
ws_before_rename = mtd.getObjectNames()
ws_before_rename.sort()
ws_before_rename.sort()
print
'Workspaces in the ADS _before_ renaming:
',
ws_before_rename
print
(
'Workspaces in the ADS _before_ renaming:
{}'.format(
ws_before_rename
))
RenameWorkspaces(names, Prefix='new_', Suffix='_name')
RenameWorkspaces(names, Prefix='new_', Suffix='_name')
ws_after_rename = mtd.getObjectNames()
ws_after_rename = mtd.getObjectNames()
ws_after_rename.sort()
ws_after_rename.sort()
print
'Workspaces in the ADS _after_ renaming:
',
ws_after_rename
print
(
'Workspaces in the ADS _after_ renaming:
{}'.format(
ws_after_rename
))
Output:
Output:
...
@@ -112,16 +112,16 @@ Output:
...
@@ -112,16 +112,16 @@ Output:
CreateWorkspace([0], [0], OutputWorkspace=name)
CreateWorkspace([0], [0], OutputWorkspace=name)
#This will fail telling us that 'new_ws1' already exists
#This will fail telling us that 'new_ws1' already exists
print
'Trying to rename with OverwriteExisting set to false.'
print
(
'Trying to rename with OverwriteExisting set to false.'
)
try:
try:
RenameWorkspaces(names, Prefix='new_', OverwriteExisting=False)
RenameWorkspaces(names, Prefix='new_', OverwriteExisting=False)
except RuntimeError:
except RuntimeError:
print
'RuntimeError: A workspace called new_ws1 already exists'
print
(
'RuntimeError: A workspace called new_ws1 already exists'
)
#This will succeed in renaming and 'new_ws1' will be replaced with 'ws1'
#This will succeed in renaming and 'new_ws1' will be replaced with 'ws1'
print
'Trying to rename with OverwriteExisting set to true.'
print
(
'Trying to rename with OverwriteExisting set to true.'
)
RenameWorkspaces(names, Prefix='new_', OverwriteExisting=True)
RenameWorkspaces(names, Prefix='new_', OverwriteExisting=True)
print
'Succeeded'
print
(
'Succeeded'
)
Output:
Output:
...
...
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