Skip to content

Commit

Permalink
Relative imports are replaced with absolute imports (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
vdusek authored Jan 8, 2024
1 parent 7f5867d commit e82098c
Show file tree
Hide file tree
Showing 39 changed files with 88 additions and 90 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## [1.6.2](../../releases/tag/v1.6.2) - Unreleased

...
### Internal changes

- Relative imports were replaced for absolute imports

## [1.6.1](../../releases/tag/v1.6.1) - 2023-12-11

Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ requires-python = ">=3.8"
# compatibility with a wide range of external packages. This decision was discussed in detail in the following PR:
# https://github.com/apify/apify-sdk-python/pull/154
dependencies = [
"apify-shared ~= 1.1.0",
"apify-shared ~= 1.1.1",
"httpx >= 0.25.1",
]

Expand Down Expand Up @@ -94,7 +94,6 @@ ignore = [
"S303", # Use of insecure MD2, MD4, MD5, or SHA1 hash function
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...
"TID252", # Relative imports from parent modules are bannedRuff
"TRY003", # Avoid specifying long messages outside the exception class
]

Expand Down Expand Up @@ -126,7 +125,7 @@ docstring-quotes = "double"
inline-quotes = "single"

[tool.ruff.lint.isort]
known-first-party = ["apify", "apify_client", "apify_shared"]
known-local-folder = ["apify_client"]

[tool.ruff.lint.pydocstyle]
convention = "google"
1 change: 0 additions & 1 deletion src/apify_client/_errors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import httpx

from apify_shared.utils import ignore_docs


Expand Down
7 changes: 3 additions & 4 deletions src/apify_client/_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
from typing import TYPE_CHECKING, Any, Callable

import httpx

from apify_shared.utils import ignore_docs, is_content_type_json, is_content_type_text, is_content_type_xml

from ._errors import ApifyApiError, InvalidResponseBodyError, is_retryable_error
from ._logging import log_context, logger_name
from ._utils import retry_with_exp_backoff, retry_with_exp_backoff_async
from apify_client._errors import ApifyApiError, InvalidResponseBodyError, is_retryable_error
from apify_client._logging import log_context, logger_name
from apify_client._utils import retry_with_exp_backoff, retry_with_exp_backoff_async

if TYPE_CHECKING:
from apify_shared.types import JSONSerializable
Expand Down
2 changes: 1 addition & 1 deletion src/apify_client/_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Conditional import only executed when type checking, otherwise we'd get circular dependency issues
if TYPE_CHECKING:
from .clients.base.base_client import _BaseBaseClient
from apify_client.clients.base.base_client import _BaseBaseClient

# Name of the logger used throughout the library
logger_name = __name__.split('.')[0]
Expand Down
2 changes: 1 addition & 1 deletion src/apify_client/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from apify_shared.utils import is_file_or_bytes, maybe_extract_enum_member_value

if TYPE_CHECKING:
from ._errors import ApifyApiError
from apify_client._errors import ApifyApiError

PARSE_DATE_FIELDS_MAX_DEPTH = 3
PARSE_DATE_FIELDS_KEY_SUFFIX = 'At'
Expand Down
4 changes: 2 additions & 2 deletions src/apify_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from apify_shared.utils import ignore_docs

from ._http_client import HTTPClient, HTTPClientAsync
from .clients import (
from apify_client._http_client import HTTPClient, HTTPClientAsync
from apify_client.clients import (
ActorClient,
ActorClientAsync,
ActorCollectionClient,
Expand Down
6 changes: 3 additions & 3 deletions src/apify_client/clients/base/actor_job_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from apify_shared.consts import ActorJobStatus
from apify_shared.utils import ignore_docs, parse_date_fields

from ..._errors import ApifyApiError
from ..._utils import catch_not_found_or_throw, pluck_data
from .resource_client import ResourceClient, ResourceClientAsync
from apify_client._errors import ApifyApiError
from apify_client._utils import catch_not_found_or_throw, pluck_data
from apify_client.clients.base.resource_client import ResourceClient, ResourceClientAsync

DEFAULT_WAIT_FOR_FINISH_SEC = 999999

Expand Down
8 changes: 4 additions & 4 deletions src/apify_client/clients/base/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

from apify_shared.utils import ignore_docs

from ..._logging import WithLogDetailsClient
from ..._utils import to_safe_id
from apify_client._logging import WithLogDetailsClient
from apify_client._utils import to_safe_id

# Conditional import only executed when type checking, otherwise we'd get circular dependency issues
if TYPE_CHECKING:
from ..._http_client import HTTPClient, HTTPClientAsync
from ...client import ApifyClient, ApifyClientAsync
from apify_client import ApifyClient, ApifyClientAsync
from apify_client._http_client import HTTPClient, HTTPClientAsync


class _BaseBaseClient(metaclass=WithLogDetailsClient):
Expand Down
6 changes: 3 additions & 3 deletions src/apify_client/clients/base/resource_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from apify_shared.utils import ignore_docs, parse_date_fields

from ..._errors import ApifyApiError
from ..._utils import catch_not_found_or_throw, pluck_data
from .base_client import BaseClient, BaseClientAsync
from apify_client._errors import ApifyApiError
from apify_client._utils import catch_not_found_or_throw, pluck_data
from apify_client.clients.base.base_client import BaseClient, BaseClientAsync


@ignore_docs
Expand Down
4 changes: 2 additions & 2 deletions src/apify_client/clients/base/resource_collection_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from apify_shared.models import ListPage
from apify_shared.utils import ignore_docs, parse_date_fields

from ..._utils import pluck_data
from .base_client import BaseClient, BaseClientAsync
from apify_client._utils import pluck_data
from apify_client.clients.base.base_client import BaseClient, BaseClientAsync


@ignore_docs
Expand Down
16 changes: 8 additions & 8 deletions src/apify_client/clients/resource_clients/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
parse_date_fields,
)

from ..._utils import encode_key_value_store_record_value, encode_webhook_list_to_base64, pluck_data
from ..base import ResourceClient, ResourceClientAsync
from .actor_version import ActorVersionClient, ActorVersionClientAsync
from .actor_version_collection import ActorVersionCollectionClient, ActorVersionCollectionClientAsync
from .build_collection import BuildCollectionClient, BuildCollectionClientAsync
from .run import RunClient, RunClientAsync
from .run_collection import RunCollectionClient, RunCollectionClientAsync
from .webhook_collection import WebhookCollectionClient, WebhookCollectionClientAsync
from apify_client._utils import encode_key_value_store_record_value, encode_webhook_list_to_base64, pluck_data
from apify_client.clients.base import ResourceClient, ResourceClientAsync
from apify_client.clients.resource_clients.actor_version import ActorVersionClient, ActorVersionClientAsync
from apify_client.clients.resource_clients.actor_version_collection import ActorVersionCollectionClient, ActorVersionCollectionClientAsync
from apify_client.clients.resource_clients.build_collection import BuildCollectionClient, BuildCollectionClientAsync
from apify_client.clients.resource_clients.run import RunClient, RunClientAsync
from apify_client.clients.resource_clients.run_collection import RunCollectionClient, RunCollectionClientAsync
from apify_client.clients.resource_clients.webhook_collection import WebhookCollectionClient, WebhookCollectionClientAsync

if TYPE_CHECKING:
from apify_shared.consts import ActorJobStatus, MetaOrigin
Expand Down
4 changes: 2 additions & 2 deletions src/apify_client/clients/resource_clients/actor_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs

from ..base import ResourceCollectionClient, ResourceCollectionClientAsync
from .actor import get_actor_representation
from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync
from apify_client.clients.resource_clients.actor import get_actor_representation

if TYPE_CHECKING:
from apify_shared.models import ListPage
Expand Down
2 changes: 1 addition & 1 deletion src/apify_client/clients/resource_clients/actor_env_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs

from ..base import ResourceClient, ResourceClientAsync
from apify_client.clients.base import ResourceClient, ResourceClientAsync


def get_actor_env_var_representation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs

from ..base import ResourceCollectionClient, ResourceCollectionClientAsync
from .actor_env_var import get_actor_env_var_representation
from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync
from apify_client.clients.resource_clients.actor_env_var import get_actor_env_var_representation

if TYPE_CHECKING:
from apify_shared.models import ListPage
Expand Down
6 changes: 3 additions & 3 deletions src/apify_client/clients/resource_clients/actor_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs, maybe_extract_enum_member_value

from ..base import ResourceClient, ResourceClientAsync
from .actor_env_var import ActorEnvVarClient, ActorEnvVarClientAsync
from .actor_env_var_collection import ActorEnvVarCollectionClient, ActorEnvVarCollectionClientAsync
from apify_client.clients.base import ResourceClient, ResourceClientAsync
from apify_client.clients.resource_clients.actor_env_var import ActorEnvVarClient, ActorEnvVarClientAsync
from apify_client.clients.resource_clients.actor_env_var_collection import ActorEnvVarCollectionClient, ActorEnvVarCollectionClientAsync

if TYPE_CHECKING:
from apify_shared.consts import ActorSourceType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs

from ..base import ResourceCollectionClient, ResourceCollectionClientAsync
from .actor_version import _get_actor_version_representation
from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync
from apify_client.clients.resource_clients.actor_version import _get_actor_version_representation

if TYPE_CHECKING:
from apify_shared.consts import ActorSourceType
Expand Down
2 changes: 1 addition & 1 deletion src/apify_client/clients/resource_clients/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from apify_shared.utils import ignore_docs

from ..base import ActorJobBaseClient, ActorJobBaseClientAsync
from apify_client.clients.base import ActorJobBaseClient, ActorJobBaseClientAsync


class BuildClient(ActorJobBaseClient):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from apify_shared.utils import ignore_docs

from ..base import ResourceCollectionClient, ResourceCollectionClientAsync
from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync

if TYPE_CHECKING:
from apify_shared.models import ListPage
Expand Down
3 changes: 1 addition & 2 deletions src/apify_client/clients/resource_clients/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
from apify_shared.models import ListPage
from apify_shared.utils import filter_out_none_values_recursively, ignore_docs

from ..base import ResourceClient, ResourceClientAsync
from apify_client.clients.base import ResourceClient, ResourceClientAsync

if TYPE_CHECKING:
import httpx

from apify_shared.types import JSONSerializable


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs

from ..base import ResourceCollectionClient, ResourceCollectionClientAsync
from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync

if TYPE_CHECKING:
from apify_shared.models import ListPage
Expand Down
6 changes: 3 additions & 3 deletions src/apify_client/clients/resource_clients/key_value_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs, parse_date_fields

from ..._errors import ApifyApiError
from ..._utils import catch_not_found_or_throw, encode_key_value_store_record_value, pluck_data
from ..base import ResourceClient, ResourceClientAsync
from apify_client._errors import ApifyApiError
from apify_client._utils import catch_not_found_or_throw, encode_key_value_store_record_value, pluck_data
from apify_client.clients.base import ResourceClient, ResourceClientAsync


class KeyValueStoreClient(ResourceClient):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs

from ..base import ResourceCollectionClient, ResourceCollectionClientAsync
from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync

if TYPE_CHECKING:
from apify_shared.models import ListPage
Expand Down
6 changes: 3 additions & 3 deletions src/apify_client/clients/resource_clients/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

from apify_shared.utils import ignore_docs

from ..._errors import ApifyApiError
from ..._utils import catch_not_found_or_throw
from ..base import ResourceClient, ResourceClientAsync
from apify_client._errors import ApifyApiError
from apify_client._utils import catch_not_found_or_throw
from apify_client.clients.base import ResourceClient, ResourceClientAsync

if TYPE_CHECKING:
import httpx
Expand Down
6 changes: 3 additions & 3 deletions src/apify_client/clients/resource_clients/request_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs, parse_date_fields

from ..._errors import ApifyApiError
from ..._utils import catch_not_found_or_throw, pluck_data
from ..base import ResourceClient, ResourceClientAsync
from apify_client._errors import ApifyApiError
from apify_client._utils import catch_not_found_or_throw, pluck_data
from apify_client.clients.base import ResourceClient, ResourceClientAsync


class RequestQueueClient(ResourceClient):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from apify_shared.utils import ignore_docs

from ..base import ResourceCollectionClient, ResourceCollectionClientAsync
from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync

if TYPE_CHECKING:
from apify_shared.models import ListPage
Expand Down
12 changes: 6 additions & 6 deletions src/apify_client/clients/resource_clients/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs, parse_date_fields

from ..._utils import encode_key_value_store_record_value, pluck_data, to_safe_id
from ..base import ActorJobBaseClient, ActorJobBaseClientAsync
from .dataset import DatasetClient, DatasetClientAsync
from .key_value_store import KeyValueStoreClient, KeyValueStoreClientAsync
from .log import LogClient, LogClientAsync
from .request_queue import RequestQueueClient, RequestQueueClientAsync
from apify_client._utils import encode_key_value_store_record_value, pluck_data, to_safe_id
from apify_client.clients.base import ActorJobBaseClient, ActorJobBaseClientAsync
from apify_client.clients.resource_clients.dataset import DatasetClient, DatasetClientAsync
from apify_client.clients.resource_clients.key_value_store import KeyValueStoreClient, KeyValueStoreClientAsync
from apify_client.clients.resource_clients.log import LogClient, LogClientAsync
from apify_client.clients.resource_clients.request_queue import RequestQueueClient, RequestQueueClientAsync


class RunClient(ActorJobBaseClient):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from apify_shared.utils import ignore_docs, maybe_extract_enum_member_value

from ..base import ResourceCollectionClient, ResourceCollectionClientAsync
from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync

if TYPE_CHECKING:
from apify_shared.consts import ActorJobStatus
Expand Down
6 changes: 3 additions & 3 deletions src/apify_client/clients/resource_clients/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs

from ..._errors import ApifyApiError
from ..._utils import catch_not_found_or_throw, pluck_data_as_list
from ..base import ResourceClient, ResourceClientAsync
from apify_client._errors import ApifyApiError
from apify_client._utils import catch_not_found_or_throw, pluck_data_as_list
from apify_client.clients.base import ResourceClient, ResourceClientAsync


def _get_schedule_representation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs

from ..base import ResourceCollectionClient, ResourceCollectionClientAsync
from .schedule import _get_schedule_representation
from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync
from apify_client.clients.resource_clients.schedule import _get_schedule_representation

if TYPE_CHECKING:
from apify_shared.models import ListPage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from apify_shared.utils import ignore_docs

from ..base import ResourceCollectionClient, ResourceCollectionClientAsync
from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync

if TYPE_CHECKING:
from apify_shared.models import ListPage
Expand Down
12 changes: 6 additions & 6 deletions src/apify_client/clients/resource_clients/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
parse_date_fields,
)

from ..._errors import ApifyApiError
from ..._utils import catch_not_found_or_throw, encode_webhook_list_to_base64, pluck_data
from ..base import ResourceClient, ResourceClientAsync
from .run import RunClient, RunClientAsync
from .run_collection import RunCollectionClient, RunCollectionClientAsync
from .webhook_collection import WebhookCollectionClient, WebhookCollectionClientAsync
from apify_client._errors import ApifyApiError
from apify_client._utils import catch_not_found_or_throw, encode_webhook_list_to_base64, pluck_data
from apify_client.clients.base import ResourceClient, ResourceClientAsync
from apify_client.clients.resource_clients.run import RunClient, RunClientAsync
from apify_client.clients.resource_clients.run_collection import RunCollectionClient, RunCollectionClientAsync
from apify_client.clients.resource_clients.webhook_collection import WebhookCollectionClient, WebhookCollectionClientAsync

if TYPE_CHECKING:
from apify_shared.consts import ActorJobStatus, MetaOrigin
Expand Down
Loading

0 comments on commit e82098c

Please sign in to comment.