Skip to content

Commit

Permalink
Import fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Dec 19, 2024
1 parent 3c1b112 commit 579e0f3
Show file tree
Hide file tree
Showing 31 changed files with 62 additions and 89 deletions.
2 changes: 1 addition & 1 deletion reportportal_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# noinspection PyProtectedMember
from reportportal_client._internal.local import current, set_current
from reportportal_client.aio.client import AsyncRPClient, BatchedRPClient, ThreadedRPClient
from reportportal_client.client import RP, RPClient, OutputType
from reportportal_client.client import RP, OutputType, RPClient
from reportportal_client.logs import RPLogger, RPLogHandler
from reportportal_client.steps import step

Expand Down
5 changes: 2 additions & 3 deletions reportportal_client/_internal/aio/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
import asyncio
import sys
from types import TracebackType
from typing import Coroutine, Any, Optional, Type, Callable
from typing import Any, Callable, Coroutine, Optional, Type

from aenum import Enum
from aiohttp import ClientSession, ClientResponse, ServerConnectionError, \
ClientResponseError
from aiohttp import ClientResponse, ClientResponseError, ClientSession, ServerConnectionError

DEFAULT_RETRY_NUMBER: int = 5
DEFAULT_RETRY_DELAY: float = 0.005
Expand Down
4 changes: 2 additions & 2 deletions reportportal_client/_internal/aio/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import sys
import time
from asyncio import Future
from typing import Optional, List, TypeVar, Generic, Union, Generator, Awaitable, Coroutine, Any
from typing import Any, Awaitable, Coroutine, Generator, Generic, List, Optional, TypeVar, Union

from reportportal_client.aio.tasks import Task, BlockingOperationError
from reportportal_client.aio.tasks import BlockingOperationError, Task

_T = TypeVar('_T')

Expand Down
1 change: 0 additions & 1 deletion reportportal_client/_internal/local/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ from typing import Optional

from reportportal_client import RP


def current() -> Optional[RP]: ...


Expand Down
6 changes: 3 additions & 3 deletions reportportal_client/_internal/logs/batcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

import logging
import threading
from typing import List, Optional, TypeVar, Generic, Dict, Any
from typing import Any, Dict, Generic, List, Optional, TypeVar

from reportportal_client.core.rp_requests import RPRequestLog, AsyncRPRequestLog
from reportportal_client.logs import MAX_LOG_BATCH_SIZE, MAX_LOG_BATCH_PAYLOAD_SIZE
from reportportal_client.core.rp_requests import AsyncRPRequestLog, RPRequestLog
from reportportal_client.logs import MAX_LOG_BATCH_PAYLOAD_SIZE, MAX_LOG_BATCH_SIZE

logger = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions reportportal_client/_internal/services/client_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
import os
from uuid import uuid4

from .constants import CLIENT_ID_PROPERTY, RP_FOLDER_PATH, \
RP_PROPERTIES_FILE_PATH
from .constants import CLIENT_ID_PROPERTY, RP_FOLDER_PATH, RP_PROPERTIES_FILE_PATH

logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
Expand Down
1 change: 0 additions & 1 deletion reportportal_client/_internal/services/client_id.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from typing import Optional, Text


def _read_client_id() -> Optional[Text]: ...


Expand Down
1 change: 0 additions & 1 deletion reportportal_client/_internal/services/constants.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from typing import Text


def _decode_string(text: Text) -> Text: ...


Expand Down
3 changes: 2 additions & 1 deletion reportportal_client/_internal/static/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

"""This module provides base abstract class for RP request objects."""

from abc import ABCMeta as _ABCMeta, abstractmethod
from abc import ABCMeta as _ABCMeta
from abc import abstractmethod

__all__ = ['AbstractBaseClass', 'abstractmethod']

Expand Down
8 changes: 4 additions & 4 deletions reportportal_client/aio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

"""Common package for Asynchronous I/O clients and utilities."""

from reportportal_client.aio.client import (ThreadedRPClient, BatchedRPClient, AsyncRPClient,
DEFAULT_TASK_TIMEOUT, DEFAULT_SHUTDOWN_TIMEOUT,
DEFAULT_TASK_TRIGGER_NUM, DEFAULT_TASK_TRIGGER_INTERVAL)
from reportportal_client.aio.tasks import Task, BlockingOperationError
from reportportal_client.aio.client import (DEFAULT_SHUTDOWN_TIMEOUT, DEFAULT_TASK_TIMEOUT,
DEFAULT_TASK_TRIGGER_INTERVAL, DEFAULT_TASK_TRIGGER_NUM, AsyncRPClient,
BatchedRPClient, ThreadedRPClient)
from reportportal_client.aio.tasks import BlockingOperationError, Task

__all__ = [
'Task',
Expand Down
23 changes: 10 additions & 13 deletions reportportal_client/aio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,35 @@
import time as datetime
import warnings
from os import getenv
from typing import Union, Tuple, List, Dict, Any, Optional, Coroutine, TypeVar
from typing import Any, Coroutine, Dict, List, Optional, Tuple, TypeVar, Union

import aiohttp
import certifi

# noinspection PyProtectedMember
from reportportal_client._internal.aio.http import RetryingClientSession
# noinspection PyProtectedMember
from reportportal_client._internal.aio.tasks import (BatchedTaskFactory, ThreadedTaskFactory,
TriggerTaskBatcher, BackgroundTaskList,
DEFAULT_TASK_TRIGGER_NUM, DEFAULT_TASK_TRIGGER_INTERVAL)
from reportportal_client._internal.aio.tasks import (DEFAULT_TASK_TRIGGER_INTERVAL, DEFAULT_TASK_TRIGGER_NUM,
BackgroundTaskList, BatchedTaskFactory, ThreadedTaskFactory,
TriggerTaskBatcher)
# noinspection PyProtectedMember
from reportportal_client._internal.local import set_current
# noinspection PyProtectedMember
from reportportal_client._internal.logs.batcher import LogBatcher
# noinspection PyProtectedMember
from reportportal_client._internal.services.statistics import async_send_event
# noinspection PyProtectedMember
from reportportal_client._internal.static.abstract import (
AbstractBaseClass,
abstractmethod
)
from reportportal_client._internal.static.abstract import AbstractBaseClass, abstractmethod
# noinspection PyProtectedMember
from reportportal_client._internal.static.defines import NOT_FOUND, NOT_SET
from reportportal_client.aio.tasks import Task
from reportportal_client.client import RP, OutputType
from reportportal_client.core.rp_issues import Issue
from reportportal_client.core.rp_requests import (LaunchStartRequest, AsyncHttpRequest, AsyncItemStartRequest,
AsyncItemFinishRequest, LaunchFinishRequest, RPFile,
AsyncRPRequestLog, AsyncRPLogBatch)
from reportportal_client.helpers import (root_uri_join, verify_value_length, await_if_necessary,
agent_name_version, LifoQueue, uri_join)
from reportportal_client.core.rp_requests import (AsyncHttpRequest, AsyncItemFinishRequest, AsyncItemStartRequest,
AsyncRPLogBatch, AsyncRPRequestLog, LaunchFinishRequest,
LaunchStartRequest, RPFile)
from reportportal_client.helpers import (LifoQueue, agent_name_version, await_if_necessary, root_uri_join, uri_join,
verify_value_length)
from reportportal_client.logs import MAX_LOG_BATCH_PAYLOAD_SIZE
from reportportal_client.steps import StepReporter

Expand Down
2 changes: 1 addition & 1 deletion reportportal_client/aio/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import asyncio
from abc import abstractmethod
from asyncio import Future
from typing import TypeVar, Generic, Union, Generator, Awaitable, Optional
from typing import Awaitable, Generator, Generic, Optional, TypeVar, Union

# noinspection PyProtectedMember
from reportportal_client._internal.static.abstract import AbstractBaseClass
Expand Down
12 changes: 6 additions & 6 deletions reportportal_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import warnings
from abc import abstractmethod
from os import getenv
from typing import Union, Tuple, Any, Optional, TextIO, List, Dict
from typing import Any, Dict, List, Optional, TextIO, Tuple, Union

import aenum
import requests
from requests.adapters import HTTPAdapter, Retry, DEFAULT_RETRIES
from requests.adapters import DEFAULT_RETRIES, HTTPAdapter, Retry

# noinspection PyProtectedMember
from reportportal_client._internal.local import set_current
Expand All @@ -36,10 +36,10 @@
# noinspection PyProtectedMember
from reportportal_client._internal.static.defines import NOT_FOUND
from reportportal_client.core.rp_issues import Issue
from reportportal_client.core.rp_requests import (HttpRequest, ItemStartRequest, ItemFinishRequest, RPFile,
LaunchStartRequest, LaunchFinishRequest, RPRequestLog,
RPLogBatch)
from reportportal_client.helpers import uri_join, verify_value_length, agent_name_version, LifoQueue
from reportportal_client.core.rp_requests import (HttpRequest, ItemFinishRequest, ItemStartRequest,
LaunchFinishRequest, LaunchStartRequest, RPFile, RPLogBatch,
RPRequestLog)
from reportportal_client.helpers import LifoQueue, agent_name_version, uri_join, verify_value_length
from reportportal_client.logs import MAX_LOG_BATCH_PAYLOAD_SIZE
from reportportal_client.steps import StepReporter

Expand Down
1 change: 0 additions & 1 deletion reportportal_client/core/rp_file.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from typing import Any, Dict, Optional, Text


class RPFile:
content: Any = ...
content_type: Text = ...
Expand Down
1 change: 0 additions & 1 deletion reportportal_client/core/rp_issues.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from typing import Dict, List, Optional, Text


class Issue:
_external_issues: List = ...
auto_analyzed: bool = ...
Expand Down
17 changes: 5 additions & 12 deletions reportportal_client/core/rp_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,19 @@
import asyncio
import logging
from dataclasses import dataclass
from typing import Callable, Optional, Union, List, Tuple, Any, TypeVar
from typing import Any, Callable, List, Optional, Tuple, TypeVar, Union

import aiohttp

from reportportal_client import helpers
# noinspection PyProtectedMember
from reportportal_client._internal.static.abstract import (
AbstractBaseClass,
abstractmethod
)
from reportportal_client._internal.static.abstract import AbstractBaseClass, abstractmethod
# noinspection PyProtectedMember
from reportportal_client._internal.static.defines import (
DEFAULT_PRIORITY,
LOW_PRIORITY,
RP_LOG_LEVELS, Priority
)
from reportportal_client._internal.static.defines import DEFAULT_PRIORITY, LOW_PRIORITY, RP_LOG_LEVELS, Priority
from reportportal_client.core.rp_file import RPFile
from reportportal_client.core.rp_issues import Issue
from reportportal_client.core.rp_responses import RPResponse, AsyncRPResponse
from reportportal_client.helpers import dict_to_payload, await_if_necessary
from reportportal_client.core.rp_responses import AsyncRPResponse, RPResponse
from reportportal_client.helpers import await_if_necessary, dict_to_payload

try:
# noinspection PyPackageRequirements
Expand Down
4 changes: 2 additions & 2 deletions reportportal_client/core/rp_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"""

import logging
from typing import Any, Optional, Generator, Mapping, Tuple, Union
from typing import Any, Generator, Mapping, Optional, Tuple, Union

from aiohttp import ClientResponse, ClientError
from aiohttp import ClientError, ClientResponse
from requests import Response

# noinspection PyProtectedMember
Expand Down
4 changes: 2 additions & 2 deletions reportportal_client/core/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import queue
import threading
import warnings
from threading import current_thread, Thread
from threading import Thread, current_thread

from aenum import auto, Enum, unique
from aenum import Enum, auto, unique

# noinspection PyProtectedMember
from reportportal_client._internal.static.defines import Priority
Expand Down
3 changes: 2 additions & 1 deletion reportportal_client/core/worker.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ from aenum import Enum

# noinspection PyProtectedMember
from reportportal_client._internal.static.defines import Priority
from reportportal_client.core.rp_requests import RPRequestBase as RPRequest, HttpRequest
from reportportal_client.core.rp_requests import HttpRequest
from reportportal_client.core.rp_requests import RPRequestBase as RPRequest

logger: Logger
THREAD_TIMEOUT: int
Expand Down
4 changes: 2 additions & 2 deletions reportportal_client/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import uuid
from platform import machine, processor, system
from types import MappingProxyType
from typing import Optional, Any, List, Dict, Callable, Tuple, Union, TypeVar, Generic, Iterable
from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, Tuple, TypeVar, Union

from reportportal_client.core.rp_file import RPFile

Expand Down Expand Up @@ -207,7 +207,7 @@ def get_package_parameters(package_name: str, parameters: List[str] = None) -> L
if not parameters:
return result

from importlib.metadata import distribution, PackageNotFoundError
from importlib.metadata import PackageNotFoundError, distribution
try:
package_info = distribution(package_name)
except PackageNotFoundError:
Expand Down
2 changes: 1 addition & 1 deletion reportportal_client/logs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# noinspection PyProtectedMember
from reportportal_client._internal.local import current, set_current
from reportportal_client.helpers import timestamp, TYPICAL_MULTIPART_FOOTER_LENGTH
from reportportal_client.helpers import TYPICAL_MULTIPART_FOOTER_LENGTH, timestamp

MAX_LOG_BATCH_SIZE: int = 20
MAX_LOG_BATCH_PAYLOAD_SIZE: int = int((64 * 1024 * 1024) * 0.98) - TYPICAL_MULTIPART_FOOTER_LENGTH
Expand Down
9 changes: 2 additions & 7 deletions reportportal_client/logs/log_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@
from reportportal_client import helpers
# noinspection PyProtectedMember
from reportportal_client._internal.static.defines import NOT_FOUND
from reportportal_client.core.rp_requests import (
HttpRequest,
RPFile,
RPLogBatch,
RPRequestLog
)
from reportportal_client.core.rp_requests import HttpRequest, RPFile, RPLogBatch, RPRequestLog
from reportportal_client.core.worker import APIWorker
from reportportal_client.logs import MAX_LOG_BATCH_SIZE, MAX_LOG_BATCH_PAYLOAD_SIZE
from reportportal_client.logs import MAX_LOG_BATCH_PAYLOAD_SIZE, MAX_LOG_BATCH_SIZE

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion reportportal_client/steps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_my_nested_step():
"""
from functools import wraps
from typing import Callable, TypeVar, Optional, Dict, Union, Type, Any
from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union

import reportportal_client as rp
# noinspection PyProtectedMember
Expand Down
4 changes: 2 additions & 2 deletions tests/_internal/services/test_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
from requests.exceptions import RequestException

# noinspection PyProtectedMember
from reportportal_client._internal.services.constants import ENDPOINT, CLIENT_INFO
from reportportal_client._internal.services.constants import CLIENT_INFO, ENDPOINT
# noinspection PyProtectedMember
from reportportal_client._internal.services.statistics import send_event, async_send_event
from reportportal_client._internal.services.statistics import async_send_event, send_event

VERSION_VAR = '__version__'
EVENT_NAME = 'start_launch'
Expand Down
2 changes: 1 addition & 1 deletion tests/aio/test_aio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from reportportal_client import OutputType
# noinspection PyProtectedMember
from reportportal_client._internal.aio.http import RetryingClientSession, DEFAULT_RETRY_NUMBER
from reportportal_client._internal.aio.http import DEFAULT_RETRY_NUMBER, RetryingClientSession
# noinspection PyProtectedMember
from reportportal_client._internal.static.defines import NOT_SET
from reportportal_client.aio.client import Client
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# noinspection PyPackageRequirements
from pytest import fixture

from reportportal_client.aio.client import Client, AsyncRPClient, BatchedRPClient, ThreadedRPClient
from reportportal_client.aio.client import AsyncRPClient, BatchedRPClient, Client, ThreadedRPClient
from reportportal_client.client import RPClient


Expand Down
6 changes: 3 additions & 3 deletions tests/core/test_rp_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
# limitations under the License

import json
import pytest

from unittest import mock

from reportportal_client.core.rp_responses import RPResponse, AsyncRPResponse
import pytest

from reportportal_client.core.rp_responses import AsyncRPResponse, RPResponse


class JSONDecodeError(ValueError):
Expand Down
6 changes: 1 addition & 5 deletions tests/core/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
import time
from unittest import mock

from reportportal_client.core.rp_requests import (
HttpRequest,
RPLogBatch,
RPRequestLog
)
from reportportal_client.core.rp_requests import HttpRequest, RPLogBatch, RPRequestLog
from reportportal_client.core.worker import APIWorker
from reportportal_client.helpers import timestamp

Expand Down
2 changes: 1 addition & 1 deletion tests/logs/test_rp_log_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# noinspection PyProtectedMember
from reportportal_client._internal.local import set_current
from reportportal_client.logs import RPLogHandler, RPLogger
from reportportal_client.logs import RPLogger, RPLogHandler


@pytest.mark.parametrize(
Expand Down
Loading

0 comments on commit 579e0f3

Please sign in to comment.