StreamingCallable is a DynamicMap callback wrapper which keeps a handle to start and stop a dynamic stream.
| 94 | |
| 95 | |
| 96 | class StreamingCallable(Callable): |
| 97 | """ |
| 98 | StreamingCallable is a DynamicMap callback wrapper which keeps |
| 99 | a handle to start and stop a dynamic stream. |
| 100 | """ |
| 101 | |
| 102 | periodic = param.Parameter() |
| 103 | |
| 104 | def clone(self, callable=None, **overrides): |
| 105 | """ |
| 106 | Allows making a copy of the Callable optionally overriding |
| 107 | the callable and other parameters. |
| 108 | """ |
| 109 | old = {k: v for k, v in self.param.values().items() if k not in ['callable', 'name']} |
| 110 | params = dict(old, **overrides) |
| 111 | callable = self.callable if callable is None else callable |
| 112 | return self.__class__(callable, **params) |
| 113 | |
| 114 | def start(self): |
| 115 | """ |
| 116 | Start the periodic callback |
| 117 | """ |
| 118 | if not self.periodic._running: |
| 119 | self.periodic.start() |
| 120 | else: |
| 121 | raise Exception('PeriodicCallback already running.') |
| 122 | |
| 123 | def stop(self): |
| 124 | """ |
| 125 | Stop the periodic callback |
| 126 | """ |
| 127 | if self.periodic._running: |
| 128 | self.periodic.stop() |
| 129 | else: |
| 130 | raise Exception('PeriodicCallback not running.') |
| 131 | |
| 132 | |
| 133 | class HoloViewsConverter: |
no outgoing calls
no test coverage detected
searching dependent graphs…