@@ -163,18 +163,18 @@ def configure_parser(self, arg_parser: ArgumentParser, subparser: _SubParsersAct
163
163
164
164
def start (self ) -> None :
165
165
"""
166
- Delegate to :meth:`~trinity.extensibility.plugin.BasePlugin._start ` and set ``running``
166
+ Delegate to :meth:`~trinity.extensibility.plugin.BasePlugin.do_start ` and set ``running``
167
167
to ``True``. Broadcast a :class:`~trinity.extensibility.events.PluginStartedEvent` on the
168
168
:class:`~lahja.eventbus.EventBus` and hence allow other plugins to act accordingly.
169
169
"""
170
170
self .running = True
171
- self ._start ()
171
+ self .do_start ()
172
172
self .event_bus .broadcast (
173
173
PluginStartedEvent (type (self ))
174
174
)
175
175
self .logger .info ("Plugin started: %s" , self .name )
176
176
177
- def _start (self ) -> None :
177
+ def do_start (self ) -> None :
178
178
"""
179
179
Perform the actual plugin start routine. In the case of a `BaseIsolatedPlugin` this method
180
180
will be called in a separate process.
@@ -190,18 +190,18 @@ class BaseSyncStopPlugin(BasePlugin):
190
190
A :class:`~trinity.extensibility.plugin.BaseSyncStopPlugin` unwinds synchronoulsy, hence blocks
191
191
until the shutdown is done.
192
192
"""
193
- def _stop (self ) -> None :
193
+ def do_stop (self ) -> None :
194
194
"""
195
195
Stop the plugin. Should be overwritten by subclasses.
196
196
"""
197
197
pass
198
198
199
199
def stop (self ) -> None :
200
200
"""
201
- Delegate to :meth:`~trinity.extensibility.plugin.BaseSyncStopPlugin._stop ` causing the
201
+ Delegate to :meth:`~trinity.extensibility.plugin.BaseSyncStopPlugin.do_stop ` causing the
202
202
plugin to stop and setting ``running`` to ``False``.
203
203
"""
204
- self ._stop ()
204
+ self .do_stop ()
205
205
self .running = False
206
206
207
207
@@ -211,18 +211,18 @@ class BaseAsyncStopPlugin(BasePlugin):
211
211
needs to be awaited.
212
212
"""
213
213
214
- async def _stop (self ) -> None :
214
+ async def do_stop (self ) -> None :
215
215
"""
216
216
Asynchronously stop the plugin. Should be overwritten by subclasses.
217
217
"""
218
218
pass
219
219
220
220
async def stop (self ) -> None :
221
221
"""
222
- Delegate to :meth:`~trinity.extensibility.plugin.BaseAsyncStopPlugin._stop ` causing the
222
+ Delegate to :meth:`~trinity.extensibility.plugin.BaseAsyncStopPlugin.do_stop ` causing the
223
223
plugin to stop asynchronously and setting ``running`` to ``False``.
224
224
"""
225
- await self ._stop ()
225
+ await self .do_stop ()
226
226
self .running = False
227
227
228
228
@@ -250,7 +250,7 @@ class BaseIsolatedPlugin(BaseSyncStopPlugin):
250
250
251
251
def start (self ) -> None :
252
252
"""
253
- Prepare the plugin to get started and eventually call ``_start `` in a separate process.
253
+ Prepare the plugin to get started and eventually call ``do_start `` in a separate process.
254
254
"""
255
255
self .running = True
256
256
self ._process = ctx .Process (
@@ -268,9 +268,9 @@ def _prepare_start(self) -> None:
268
268
self .event_bus .broadcast (
269
269
PluginStartedEvent (type (self ))
270
270
)
271
- self ._start ()
271
+ self .do_start ()
272
272
273
- def _stop (self ) -> None :
273
+ def do_stop (self ) -> None :
274
274
self .context .event_bus .stop ()
275
275
kill_process_gracefully (self ._process , self .logger )
276
276
@@ -290,7 +290,7 @@ def configure_parser(self, arg_parser: ArgumentParser, subparser: _SubParsersAct
290
290
def handle_event (self , activation_event : BaseEvent ) -> None :
291
291
self .logger .info ("Debug plugin: handle_event called: %s" , activation_event )
292
292
293
- def _start (self ) -> None :
293
+ def do_start (self ) -> None :
294
294
self .logger .info ("Debug plugin: start called" )
295
295
asyncio .ensure_future (self .count_forever ())
296
296
@@ -301,5 +301,5 @@ async def count_forever(self) -> None:
301
301
i += 1
302
302
await asyncio .sleep (1 )
303
303
304
- async def _stop (self ) -> None :
304
+ async def do_stop (self ) -> None :
305
305
self .logger .info ("Debug plugin: stop called" )
0 commit comments