Exposes a single function to clients. Args: func: The function to register. name: The name of the function. If not provided, the name of the function will be used.
(self,
func: Callable[..., Any],
name: Optional[str] = None)
| 177 | color="yellow") |
| 178 | |
| 179 | def register_function(self, |
| 180 | func: Callable[..., Any], |
| 181 | name: Optional[str] = None) -> None: |
| 182 | """Exposes a single function to clients. |
| 183 | |
| 184 | Args: |
| 185 | func: The function to register. |
| 186 | name: The name of the function. If not provided, the name of the function will be used. |
| 187 | """ |
| 188 | fname = name or func.__name__ |
| 189 | if fname in self._functions: |
| 190 | logger.warning( |
| 191 | f"Function '{fname}' is already registered. Overwriting.") |
| 192 | self._functions[fname] = func |
| 193 | logger_debug(f"[server] Registered function: {fname}") |
| 194 | |
| 195 | def register_instance(self, instance: Any) -> None: |
| 196 | """Exposes all public methods of a class instance. |
no test coverage detected