|
13 | 13 |
|
14 | 14 | """This module contains common functions-helpers of the client and agents.""" |
15 | 15 |
|
16 | | -import asyncio |
17 | 16 | import fnmatch |
18 | 17 | import inspect |
19 | 18 | import re |
|
23 | 22 | from datetime import datetime, timezone |
24 | 23 | from platform import machine, processor, system |
25 | 24 | from types import MappingProxyType |
26 | | -from typing import Any, Callable, Coroutine, Generic, Iterable, Optional, Sized, TypeVar, Union |
| 25 | +from typing import Any, Callable, Generic, Iterable, Optional, Sized, TypeVar, Union |
27 | 26 |
|
28 | | -from reportportal_client.aio import Task |
29 | 27 | from reportportal_client.core.rp_file import RPFile |
30 | 28 |
|
31 | 29 | try: |
@@ -402,20 +400,6 @@ def agent_name_version(attributes: Optional[Union[list, dict]] = None) -> tuple[ |
402 | 400 | return agent_name, agent_version |
403 | 401 |
|
404 | 402 |
|
405 | | -async def await_if_necessary(obj: Union[_T, Task[_T], Coroutine[_T, None, None]]) -> Optional[_T]: |
406 | | - """Await Coroutine, Feature or coroutine Function if given argument is one of them, or return immediately. |
407 | | -
|
408 | | - :param obj: value, Coroutine, Feature or coroutine Function |
409 | | - :return: result which was returned by Coroutine, Feature or coroutine Function |
410 | | - """ |
411 | | - if obj: |
412 | | - if asyncio.isfuture(obj) or asyncio.iscoroutine(obj): |
413 | | - return await obj |
414 | | - elif asyncio.iscoroutinefunction(obj): |
415 | | - return await obj() |
416 | | - return obj |
417 | | - |
418 | | - |
419 | 403 | def is_binary(iterable: Union[bytes, bytearray, str]) -> bool: |
420 | 404 | """Check if given iterable is binary. |
421 | 405 |
|
|
0 commit comments