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
a815d36c
There was a problem fetching the pipeline summary.
Commit
a815d36c
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Little example of using Notifier.skip.
parent
93db5c85
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/notifier.py
+14
-0
14 additions, 0 deletions
fsl/utils/notifier.py
with
14 additions
and
0 deletions
fsl/utils/notifier.py
+
14
−
0
View file @
a815d36c
...
@@ -189,6 +189,20 @@ class Notifier(object):
...
@@ -189,6 +189,20 @@ class Notifier(object):
def
skip
(
self
,
name
,
topic
=
None
):
def
skip
(
self
,
name
,
topic
=
None
):
"""
Context manager which disables the speciifed listener, and
"""
Context manager which disables the speciifed listener, and
restores its state before returning.
restores its state before returning.
You can use this method if you have some code which triggers a
notification, but you do not your own listener to be notified.
For example::
def __myListener(*a):
pass
notifier.register(
'
myListener
'
, __myListener)
with notifier.skip(
'
myListener
'
):
# if a notification is triggered
# by the code here, the __myListener
# function will not be called.
"""
"""
state
=
self
.
isEnabled
(
name
,
topic
)
state
=
self
.
isEnabled
(
name
,
topic
)
...
...
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