Skip to content

Commit ef1457c

Browse files
committed
Fix pylint warnings in examples
The `__init__.py` files were not previously checked with `pylint` because of sybil bug. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 5480c61 commit ef1457c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/frequenz/sdk/actor/__init__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class communicates through message passing. Even when no particular message pass
7777
???+ example
7878
7979
```python
80+
import asyncio
8081
from frequenz.sdk.actor import Actor, run
8182
8283
class MyActor(Actor):
@@ -85,7 +86,7 @@ async def _run(self) -> None:
8586
print("Hello World!")
8687
await asyncio.sleep(1)
8788
88-
await run(MyActor()) # (1)!
89+
await asyncio.run(MyActor()) # (1)!
8990
```
9091
9192
1. This line will block until the actor completes its execution or is manually stopped.
@@ -187,26 +188,26 @@ class we are implementing to make sure actors are properly initialized.
187188
class EchoActor(Actor): # (1)!
188189
def __init__(
189190
self,
190-
input: Receiver[int], # (2)!
191+
receiver: Receiver[int], # (2)!
191192
output: Sender[int], # (3)!
192193
name: str | None = None, # (4)!
193194
) -> None:
194195
super().__init__(name=name) # (5)!
195-
self._input: Receiver[int] = input # (6)!
196+
self._input: Receiver[int] = receiver # (6)!
196197
self._output: Sender[int] = output # (7)!
197198
```
198199
199200
1. We define a new actor class called `EchoActor` that inherits from
200201
[`Actor`][frequenz.sdk.actor.Actor].
201202
202-
2. We accept an `input` argument that will be used to receive messages from
203+
2. We accept an `receiver` argument that will be used to receive messages from
203204
a channel.
204205
3. We accept an `output` argument that will be used to send messages to a channel.
205206
4. We accept an optional `name` argument that will be used to identify the actor in
206207
logs.
207208
5. We call [`Actor.__init__()`][frequenz.sdk.actor.Actor.__init__] to make sure the
208209
actor is properly initialized.
209-
6. We store the `input` argument in a *private* attribute to use it later.
210+
6. We store the `receiver` argument in a *private* attribute to use it later.
210211
7. We store the `output` argument in a *private* attribute to use it later.
211212
212213
### The `_run()` Method
@@ -231,12 +232,12 @@ def __init__(
231232
class EchoActor(Actor):
232233
def __init__(
233234
self,
234-
input: Receiver[int],
235+
receiver: Receiver[int],
235236
output: Sender[int],
236237
name: str | None = None,
237238
) -> None:
238239
super().__init__(name=name)
239-
self._input: Receiver[int] = input
240+
self._input: Receiver[int] = receiver
240241
self._output: Sender[int] = output
241242
242243
async def _run(self) -> None: # (1)!
@@ -245,7 +246,7 @@ async def _run(self) -> None: # (1)!
245246
```
246247
247248
1. We implement the abstract [`_run()`][_run] method.
248-
2. We receive messages from the `input` channel one by one.
249+
2. We receive messages from the `receiver` one by one.
249250
3. We send the received message to the `output` channel.
250251
251252
### Stopping

0 commit comments

Comments
 (0)