1818
1919class IOBuffer :
2020 """
21- IO stdout buffer. The API is similar to ``IO`` types.
21+ IO stdout buffer. The API is similar to IO types.
2222 """
2323
2424 async def write (self , data : str ) -> None :
2525 """
26- Write ``data`` inside the buffer.
26+ Write data inside the buffer.
27+
28+ :param data: Data to write.
29+ :type data: str
2730 """
2831 raise NotImplementedError ()
2932
@@ -38,22 +41,24 @@ class ComChannel(Plugin):
3841 @property
3942 def parallel_execution (self ) -> bool :
4043 """
41- If True, communication supports commands parallel execution.
44+ :return: If True, communication supports commands parallel execution.
45+ :rtype: bool
4246 """
4347 raise NotImplementedError ()
4448
4549 @property
4650 async def active (self ) -> bool :
4751 """
48- Return True if communication is active. False otherwise.
52+ :return: Return True if communication is active. False otherwise.
53+ :rtype: bool
4954 """
5055 raise NotImplementedError ()
5156
5257 async def communicate (self , iobuffer : Optional [IOBuffer ] = None ) -> None :
5358 """
5459 Start communication.
5560
56- :param iobuffer: buffer used to write stdout
61+ :param iobuffer: Buffer used to write stdout.
5762 :type iobuffer: IOBuffer
5863 """
5964 raise NotImplementedError ()
@@ -62,15 +67,17 @@ async def stop(self, iobuffer: Optional[IOBuffer] = None) -> None:
6267 """
6368 Stop communication.
6469
65- :param iobuffer: buffer used to write stdout
70+ :param iobuffer: Buffer used to write stdout.
6671 :type iobuffer: IOBuffer
6772 """
6873 raise NotImplementedError ()
6974
7075 async def ping (self ) -> float :
7176 """
7277 Send a ping request and verify how much reply takes in seconds.
73- :returns: float
78+
79+ :return: Time between ping and pong.
80+ :rtype: float
7481 """
7582 raise NotImplementedError ()
7683
@@ -84,48 +91,52 @@ async def run_command(
8491 """
8592 Run a command.
8693
87- :param command: command to execute
94+ :param command: Command to execute.
8895 :type command: str
89- :param cwd: current working directory
96+ :param cwd: Current working directory.
9097 :type cwd: str
91- :param env: environment variables
98+ :param env: Environment variables.
9299 :type env: dict
93- :param iobuffer: buffer used to write stdout
100+ :param iobuffer: Buffer used to write stdout.
94101 :type iobuffer: IOBuffer
95- :returns: dictionary containing command execution information
102+ :return: Dictionary containing information about the executed command.
103+
104+ .. code-block:: python
96105
97- {
98- "command": <str>,
99- "returncode": <int>,
100- "stdout": <str>,
101- "exec_time": <float>,
102- }
106+ {
107+ "command": <str>,
108+ "returncode": <int>,
109+ "stdout": <str>,
110+ "exec_time": <float>,
111+ }
103112
104- If None is returned, then callback failed.
113+ If None is returned, then callback has failed.
114+ :rtype: dict
105115 """
106116 raise NotImplementedError ()
107117
108118 async def fetch_file (self , target_path : str ) -> bytes :
109119 """
110120 Fetch file and return its content.
111121
112- :param target_path: path of the file to download from target
122+ :param target_path: Path of the file to download from target.
113123 :type target_path: str
114- :returns: bytes contained in target_path
124+ :return: Data contained in target_path.
125+ :rtype: bytes
115126 """
116127 raise NotImplementedError ()
117128
118129 async def ensure_communicate (
119130 self , iobuffer : Optional [IOBuffer ] = None , retries : int = 10
120131 ) -> None :
121132 """
122- Ensure that `` communicate`` is completed, retrying as many times we
123- want in case of `` KirkException`` error. After each error, the
133+ Ensure that communicate is completed, retrying as many times we
134+ want in case of KirkException error. After each error, the
124135 communication is stopped and a new communication is performed.
125136
126- :param iobuffer: buffer used to write stdout
137+ :param iobuffer: Buffer used to write stdout.
127138 :type iobuffer: IOBuffer
128- :param retries: number of times we retry to communicate
139+ :param retries: Number of times we retry to communicate.
129140 :type retries: int
130141 """
131142 retries = max (retries , 1 )
@@ -144,11 +155,13 @@ async def ensure_communicate(
144155def discover (path : str , extend : bool = True ) -> None :
145156 """
146157 Discover all ComChannel implementations inside `path`.
147- :param path: directory where searching for channel implementations
158+
159+ :param path: Directory where searching for channel implementations.
148160 :type path: str
149- :param extend: if True, it will add new discovered channels on top of the
161+ :param extend: If True, it will add new discovered channels on top of the
150162 ones already found. If False, previous discovered channels will be
151163 cleared.
164+ :rtype: bool
152165 """
153166 global _COM
154167
@@ -161,7 +174,8 @@ def discover(path: str, extend: bool = True) -> None:
161174
162175def get_channels () -> List [ComChannel ]:
163176 """
164- :return: list of loaded ComChannel implementations.
177+ :return: List of loaded ComChannel implementations.
178+ :rtype: list(ComChannel)
165179 """
166180 global _COM
167181 # pyrefly: ignore[bad-return]
@@ -170,14 +184,16 @@ def get_channels() -> List[ComChannel]:
170184
171185def clone_channel (name : str , new_name : str ) -> Plugin :
172186 """
173- Clone a channel implementation named `` name`` and rename it with
174- `` new_name`` . The new plugin will be registered with the other
187+ Clone a channel implementation named name and rename it with
188+ new_name. The new plugin will be registered with the other
175189 plugins.
176- :param name: plugin name
190+
191+ :param name: Plugin name.
177192 :type name: str
178- :param new_name: new cloned plugin name
193+ :param new_name: New cloned plugin name.
179194 :type new_name: str
180- :return: new plugin object
195+ :return: New plugin object.
196+ :rtype: Plugin
181197 """
182198 global _COM
183199
0 commit comments