diff --git a/pyproject.toml b/pyproject.toml index 468ecbba..4a237758 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ classifiers = [ ] keywords = ["apify", "api", "client", "automation", "crawling", "scraping"] dependencies = [ - "apify-shared<2.0.0", + "apify-shared>=2.0.0,<3.0.0", "colorama>=0.4.0", "impit>=0.5.3", "more_itertools>=10.0.0", diff --git a/src/apify_client/_http_client.py b/src/apify_client/_http_client.py index 46898f6f..aa4d0e6c 100644 --- a/src/apify_client/_http_client.py +++ b/src/apify_client/_http_client.py @@ -11,7 +11,6 @@ from urllib.parse import urlencode import impit -from apify_shared.utils import ignore_docs from apify_client._logging import log_context, logger_name from apify_client._statistics import Statistics @@ -21,7 +20,7 @@ if TYPE_CHECKING: from collections.abc import Callable - from apify_shared.types import JSONSerializable + from apify_client._types import JSONSerializable DEFAULT_BACKOFF_EXPONENTIAL_FACTOR = 2 DEFAULT_BACKOFF_RANDOM_FACTOR = 1 @@ -30,7 +29,6 @@ class _BaseHTTPClient: - @ignore_docs def __init__( self, *, diff --git a/src/apify_client/_types.py b/src/apify_client/_types.py new file mode 100644 index 00000000..5cfe08c9 --- /dev/null +++ b/src/apify_client/_types.py @@ -0,0 +1,42 @@ +from __future__ import annotations + +from typing import Any, Generic, TypeVar + +JSONSerializable = str | int | float | bool | None | dict[str, Any] | list[Any] +"""Type for representing json-serializable values. It's close enough to the real thing supported +by json.parse, and the best we can do until mypy supports recursive types. It was suggested in +a discussion with (and approved by) Guido van Rossum, so I'd consider it correct enough. +""" + +T = TypeVar('T') + + +class ListPage(Generic[T]): + """A single page of items returned from a list() method.""" + + items: list[T] + """List of returned objects on this page.""" + + count: int + """Count of the returned objects on this page.""" + + offset: int + """The limit on the number of returned objects offset specified in the API call.""" + + limit: int + """The offset of the first object specified in the API call""" + + total: int + """Total number of objects matching the API call criteria.""" + + desc: bool + """Whether the listing is descending or not.""" + + def __init__(self: ListPage, data: dict) -> None: + """Initialize a ListPage instance from the API response data.""" + self.items = data.get('items', []) + self.offset = data.get('offset', 0) + self.limit = data.get('limit', 0) + self.count = data['count'] if 'count' in data else len(self.items) + self.total = data.get('total', self.offset + self.count) + self.desc = data.get('desc', False) diff --git a/src/apify_client/_utils.py b/src/apify_client/_utils.py index 4b3057cf..04f1fdf0 100644 --- a/src/apify_client/_utils.py +++ b/src/apify_client/_utils.py @@ -2,21 +2,20 @@ import asyncio import base64 +import contextlib +import io +import json import json as jsonlib import random +import re import time from collections.abc import Callable +from datetime import datetime, timezone +from enum import Enum from http import HTTPStatus from typing import TYPE_CHECKING, Any, TypeVar, cast import impit -from apify_shared.utils import ( - is_content_type_json, - is_content_type_text, - is_content_type_xml, - is_file_or_bytes, - maybe_extract_enum_member_value, -) from apify_client.errors import InvalidResponseBodyError @@ -29,11 +28,102 @@ PARSE_DATE_FIELDS_MAX_DEPTH = 3 PARSE_DATE_FIELDS_KEY_SUFFIX = 'At' - RECORD_NOT_FOUND_EXCEPTION_TYPES = ['record-not-found', 'record-or-token-not-found'] T = TypeVar('T') StopRetryingType = Callable[[], None] +ListOrDict = TypeVar('ListOrDict', list, dict) + + +def filter_out_none_values_recursively(dictionary: dict) -> dict: + """Return copy of the dictionary, recursively omitting all keys for which values are None.""" + return cast('dict', filter_out_none_values_recursively_internal(dictionary)) + + +def filter_out_none_values_recursively_internal( + dictionary: dict, + *, + remove_empty_dicts: bool | None = None, +) -> dict | None: + """Recursively filters out None values from a dictionary. + + Unfortunately, it's necessary to have an internal function for the correct result typing, + without having to create complicated overloads + """ + result = {} + for k, v in dictionary.items(): + if isinstance(v, dict): + v = filter_out_none_values_recursively_internal( # noqa: PLW2901 + v, remove_empty_dicts=remove_empty_dicts is True or remove_empty_dicts is None + ) + if v is not None: + result[k] = v + if not result and remove_empty_dicts: + return None + return result + + +def parse_date_fields(data: ListOrDict, max_depth: int = PARSE_DATE_FIELDS_MAX_DEPTH) -> ListOrDict: + """Recursively parse date fields in a list or dictionary up to the specified depth.""" + if max_depth < 0: + return data + + if isinstance(data, list): + return [parse_date_fields(item, max_depth - 1) for item in data] + + if isinstance(data, dict): + + def parse(key: str, value: object) -> object: + parsed_value = value + if key.endswith(PARSE_DATE_FIELDS_KEY_SUFFIX) and isinstance(value, str): + with contextlib.suppress(ValueError): + parsed_value = datetime.strptime(value, '%Y-%m-%dT%H:%M:%S.%fZ').replace(tzinfo=timezone.utc) + elif isinstance(value, dict): + parsed_value = parse_date_fields(value, max_depth - 1) + elif isinstance(value, list): + parsed_value = parse_date_fields(value, max_depth) + return parsed_value + + return {key: parse(key, value) for (key, value) in data.items()} + + return data + + +def is_content_type_json(content_type: str) -> bool: + """Check if the given content type is JSON.""" + return bool(re.search(r'^application/json', content_type, flags=re.IGNORECASE)) + + +def is_content_type_xml(content_type: str) -> bool: + """Check if the given content type is XML.""" + return bool(re.search(r'^application/.*xml$', content_type, flags=re.IGNORECASE)) + + +def is_content_type_text(content_type: str) -> bool: + """Check if the given content type is text.""" + return bool(re.search(r'^text/', content_type, flags=re.IGNORECASE)) + + +def is_file_or_bytes(value: Any) -> bool: + """Check if the input value is a file-like object or bytes. + + The check for IOBase is not ideal, it would be better to use duck typing, + but then the check would be super complex, judging from how the 'requests' library does it. + This way should be good enough for the vast majority of use cases, if it causes issues, we can improve it later. + """ + return isinstance(value, (bytes, bytearray, io.IOBase)) + + +def json_dumps(obj: Any) -> str: + """Dump JSON to a string with the correct settings and serializer.""" + return json.dumps(obj, ensure_ascii=False, indent=2, default=str) + + +def maybe_extract_enum_member_value(maybe_enum_member: Any) -> Any: + """Extract the value of an enumeration member if it is an Enum, otherwise return the original value.""" + if isinstance(maybe_enum_member, Enum): + return maybe_enum_member.value + return maybe_enum_member def to_safe_id(id: str) -> str: diff --git a/src/apify_client/client.py b/src/apify_client/client.py index 435ef546..648c65ff 100644 --- a/src/apify_client/client.py +++ b/src/apify_client/client.py @@ -1,7 +1,5 @@ from __future__ import annotations -from apify_shared.utils import ignore_docs - from apify_client._http_client import HTTPClient, HTTPClientAsync from apify_client._statistics import Statistics from apify_client.clients import ( @@ -61,7 +59,6 @@ class _BaseApifyClient: http_client: HTTPClient | HTTPClientAsync - @ignore_docs def __init__( self, token: str | None = None, diff --git a/src/apify_client/clients/base/actor_job_base_client.py b/src/apify_client/clients/base/actor_job_base_client.py index 678994ea..aed80855 100644 --- a/src/apify_client/clients/base/actor_job_base_client.py +++ b/src/apify_client/clients/base/actor_job_base_client.py @@ -7,9 +7,8 @@ from datetime import datetime, timezone from apify_shared.consts import ActorJobStatus -from apify_shared.utils import ignore_docs, parse_date_fields -from apify_client._utils import catch_not_found_or_throw, pluck_data +from apify_client._utils import catch_not_found_or_throw, parse_date_fields, pluck_data from apify_client.clients.base.resource_client import ResourceClient, ResourceClientAsync from apify_client.errors import ApifyApiError @@ -19,7 +18,6 @@ DEFAULT_WAIT_WHEN_JOB_NOT_EXIST_SEC = 3 -@ignore_docs class ActorJobBaseClient(ResourceClient): """Base sub-client class for Actor runs and Actor builds.""" @@ -74,7 +72,6 @@ def _abort(self, *, gracefully: bool | None = None) -> dict: return parse_date_fields(pluck_data(jsonlib.loads(response.text))) -@ignore_docs class ActorJobBaseClientAsync(ResourceClientAsync): """Base async sub-client class for Actor runs and Actor builds.""" diff --git a/src/apify_client/clients/base/base_client.py b/src/apify_client/clients/base/base_client.py index 0197c1b9..2660c6cb 100644 --- a/src/apify_client/clients/base/base_client.py +++ b/src/apify_client/clients/base/base_client.py @@ -2,8 +2,6 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import ignore_docs - from apify_client._logging import WithLogDetailsClient from apify_client._utils import to_safe_id @@ -45,14 +43,12 @@ def _sub_resource_init_options(self, **kwargs: Any) -> dict: } -@ignore_docs class BaseClient(_BaseBaseClient): """Base class for sub-clients.""" http_client: HTTPClient root_client: ApifyClient - @ignore_docs def __init__( self, *, @@ -88,14 +84,12 @@ def __init__( self.url = f'{self.url}/{self.safe_id}' -@ignore_docs class BaseClientAsync(_BaseBaseClient): """Base class for async sub-clients.""" http_client: HTTPClientAsync root_client: ApifyClientAsync - @ignore_docs def __init__( self, *, diff --git a/src/apify_client/clients/base/resource_client.py b/src/apify_client/clients/base/resource_client.py index f5e7a2bc..10cf7755 100644 --- a/src/apify_client/clients/base/resource_client.py +++ b/src/apify_client/clients/base/resource_client.py @@ -2,14 +2,11 @@ import json as jsonlib -from apify_shared.utils import ignore_docs, parse_date_fields - -from apify_client._utils import catch_not_found_or_throw, pluck_data +from apify_client._utils import catch_not_found_or_throw, parse_date_fields, pluck_data from apify_client.clients.base.base_client import BaseClient, BaseClientAsync from apify_client.errors import ApifyApiError -@ignore_docs class ResourceClient(BaseClient): """Base class for sub-clients manipulating a single resource.""" @@ -53,7 +50,6 @@ def _delete(self, timeout_secs: int | None = None) -> None: catch_not_found_or_throw(exc) -@ignore_docs class ResourceClientAsync(BaseClientAsync): """Base class for async sub-clients manipulating a single resource.""" diff --git a/src/apify_client/clients/base/resource_collection_client.py b/src/apify_client/clients/base/resource_collection_client.py index f007c596..d8a7e76b 100644 --- a/src/apify_client/clients/base/resource_collection_client.py +++ b/src/apify_client/clients/base/resource_collection_client.py @@ -3,9 +3,7 @@ import json as jsonlib from typing import Any, Generic, TypeVar -from apify_shared.utils import ignore_docs, parse_date_fields - -from apify_client._utils import pluck_data +from apify_client._utils import parse_date_fields, pluck_data from apify_client.clients.base.base_client import BaseClient, BaseClientAsync T = TypeVar('T') @@ -32,7 +30,6 @@ class ListPage(Generic[T]): desc: bool """Whether the listing is descending or not""" - @ignore_docs def __init__(self, data: dict) -> None: """Initialize a ListPage instance from the API response data.""" self.items = data.get('items', []) @@ -43,7 +40,6 @@ def __init__(self, data: dict) -> None: self.desc = data.get('desc', False) -@ignore_docs class ResourceCollectionClient(BaseClient): """Base class for sub-clients manipulating a resource collection.""" @@ -77,7 +73,6 @@ def _get_or_create(self, name: str | None = None, resource: dict | None = None) return parse_date_fields(pluck_data(jsonlib.loads(response.text))) -@ignore_docs class ResourceCollectionClientAsync(BaseClientAsync): """Base class for async sub-clients manipulating a resource collection.""" diff --git a/src/apify_client/clients/resource_clients/actor.py b/src/apify_client/clients/resource_clients/actor.py index 9b64795b..1caa73b4 100644 --- a/src/apify_client/clients/resource_clients/actor.py +++ b/src/apify_client/clients/resource_clients/actor.py @@ -3,14 +3,14 @@ import json as jsonlib from typing import TYPE_CHECKING, Any, Literal -from apify_shared.utils import ( +from apify_client._utils import ( + encode_key_value_store_record_value, + encode_webhook_list_to_base64, filter_out_none_values_recursively, - ignore_docs, maybe_extract_enum_member_value, parse_date_fields, + pluck_data, ) - -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 ( @@ -98,7 +98,6 @@ def get_actor_representation( class ActorClient(ResourceClient): """Sub-client for manipulating a single Actor.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'acts') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -503,7 +502,6 @@ def validate_input( class ActorClientAsync(ResourceClientAsync): """Async sub-client for manipulating a single Actor.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'acts') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/actor_collection.py b/src/apify_client/clients/resource_clients/actor_collection.py index b08d33d0..3746dfbb 100644 --- a/src/apify_client/clients/resource_clients/actor_collection.py +++ b/src/apify_client/clients/resource_clients/actor_collection.py @@ -2,8 +2,7 @@ from typing import TYPE_CHECKING, Any, Literal -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs - +from apify_client._utils import filter_out_none_values_recursively from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync from apify_client.clients.resource_clients.actor import get_actor_representation @@ -14,7 +13,6 @@ class ActorCollectionClient(ResourceCollectionClient): """Sub-client for manipulating Actors.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'acts') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -140,7 +138,6 @@ def create( class ActorCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for manipulating Actors.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'acts') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/actor_env_var.py b/src/apify_client/clients/resource_clients/actor_env_var.py index de3a1032..4fcc3968 100644 --- a/src/apify_client/clients/resource_clients/actor_env_var.py +++ b/src/apify_client/clients/resource_clients/actor_env_var.py @@ -2,8 +2,7 @@ from typing import Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs - +from apify_client._utils import filter_out_none_values_recursively from apify_client.clients.base import ResourceClient, ResourceClientAsync @@ -24,7 +23,6 @@ def get_actor_env_var_representation( class ActorEnvVarClient(ResourceClient): """Sub-client for manipulating a single Actor environment variable.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'env-vars') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -77,7 +75,6 @@ def delete(self) -> None: class ActorEnvVarClientAsync(ResourceClientAsync): """Async sub-client for manipulating a single Actor environment variable.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'env-vars') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/actor_env_var_collection.py b/src/apify_client/clients/resource_clients/actor_env_var_collection.py index 962be3e9..217bdd22 100644 --- a/src/apify_client/clients/resource_clients/actor_env_var_collection.py +++ b/src/apify_client/clients/resource_clients/actor_env_var_collection.py @@ -2,8 +2,7 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs - +from apify_client._utils import filter_out_none_values_recursively from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync from apify_client.clients.resource_clients.actor_env_var import get_actor_env_var_representation @@ -14,7 +13,6 @@ class ActorEnvVarCollectionClient(ResourceCollectionClient): """Sub-client for manipulating actor env vars.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'env-vars') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -60,7 +58,6 @@ def create( class ActorEnvVarCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for manipulating actor env vars.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'env-vars') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/actor_version.py b/src/apify_client/clients/resource_clients/actor_version.py index db48c041..fe40e772 100644 --- a/src/apify_client/clients/resource_clients/actor_version.py +++ b/src/apify_client/clients/resource_clients/actor_version.py @@ -2,8 +2,7 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs, maybe_extract_enum_member_value - +from apify_client._utils import filter_out_none_values_recursively, maybe_extract_enum_member_value 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 ( @@ -43,7 +42,6 @@ def _get_actor_version_representation( class ActorVersionClient(ResourceClient): """Sub-client for manipulating a single Actor version.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'versions') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -132,7 +130,6 @@ def env_var(self, env_var_name: str) -> ActorEnvVarClient: class ActorVersionClientAsync(ResourceClientAsync): """Async sub-client for manipulating a single Actor version.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'versions') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/actor_version_collection.py b/src/apify_client/clients/resource_clients/actor_version_collection.py index a335e97d..6c3b1b5d 100644 --- a/src/apify_client/clients/resource_clients/actor_version_collection.py +++ b/src/apify_client/clients/resource_clients/actor_version_collection.py @@ -2,8 +2,7 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs - +from apify_client._utils import filter_out_none_values_recursively from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync from apify_client.clients.resource_clients.actor_version import _get_actor_version_representation @@ -16,7 +15,6 @@ class ActorVersionCollectionClient(ResourceCollectionClient): """Sub-client for manipulating Actor versions.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'versions') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -86,7 +84,6 @@ def create( class ActorVersionCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for manipulating Actor versions.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'versions') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/build.py b/src/apify_client/clients/resource_clients/build.py index b427fcfa..0c12d5b4 100644 --- a/src/apify_client/clients/resource_clients/build.py +++ b/src/apify_client/clients/resource_clients/build.py @@ -3,8 +3,6 @@ import json as jsonlib from typing import Any -from apify_shared.utils import ignore_docs - from apify_client.clients.base import ActorJobBaseClient, ActorJobBaseClientAsync from apify_client.clients.resource_clients.log import LogClient, LogClientAsync @@ -12,7 +10,6 @@ class BuildClient(ActorJobBaseClient): """Sub-client for manipulating a single Actor build.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-builds') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -89,7 +86,6 @@ def log(self) -> LogClient: class BuildClientAsync(ActorJobBaseClientAsync): """Async sub-client for manipulating a single Actor build.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-builds') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/build_collection.py b/src/apify_client/clients/resource_clients/build_collection.py index 7da31df2..4eada958 100644 --- a/src/apify_client/clients/resource_clients/build_collection.py +++ b/src/apify_client/clients/resource_clients/build_collection.py @@ -2,8 +2,6 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import ignore_docs - from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync if TYPE_CHECKING: @@ -13,7 +11,6 @@ class BuildCollectionClient(ResourceCollectionClient): """Sub-client for listing Actor builds.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-builds') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -47,7 +44,6 @@ def list( class BuildCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for listing Actor builds.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-builds') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/dataset.py b/src/apify_client/clients/resource_clients/dataset.py index 80dfc65a..453833ca 100644 --- a/src/apify_client/clients/resource_clients/dataset.py +++ b/src/apify_client/clients/resource_clients/dataset.py @@ -5,10 +5,8 @@ from contextlib import asynccontextmanager, contextmanager from typing import TYPE_CHECKING, Any -from apify_shared.models import ListPage -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs - -from apify_client._utils import catch_not_found_or_throw, pluck_data +from apify_client._types import ListPage +from apify_client._utils import catch_not_found_or_throw, filter_out_none_values_recursively, pluck_data from apify_client.clients.base import ResourceClient, ResourceClientAsync from apify_client.errors import ApifyApiError @@ -17,7 +15,8 @@ import impit from apify_shared.consts import StorageGeneralAccess - from apify_shared.types import JSONSerializable + + from apify_client._types import JSONSerializable _SMALL_TIMEOUT = 5 # For fast and common actions. Suitable for idempotent actions. _MEDIUM_TIMEOUT = 30 # For actions that may take longer. @@ -26,7 +25,6 @@ class DatasetClient(ResourceClient): """Sub-client for manipulating a single dataset.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'datasets') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -564,7 +562,6 @@ def get_statistics(self) -> dict | None: class DatasetClientAsync(ResourceClientAsync): """Async sub-client for manipulating a single dataset.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'datasets') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/dataset_collection.py b/src/apify_client/clients/resource_clients/dataset_collection.py index d28f915c..602497ce 100644 --- a/src/apify_client/clients/resource_clients/dataset_collection.py +++ b/src/apify_client/clients/resource_clients/dataset_collection.py @@ -2,8 +2,7 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs - +from apify_client._utils import filter_out_none_values_recursively from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync if TYPE_CHECKING: @@ -13,7 +12,6 @@ class DatasetCollectionClient(ResourceCollectionClient): """Sub-client for manipulating datasets.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'datasets') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -59,7 +57,6 @@ def get_or_create(self, *, name: str | None = None, schema: dict | None = None) class DatasetCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for manipulating datasets.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'datasets') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/key_value_store.py b/src/apify_client/clients/resource_clients/key_value_store.py index c199c39b..731e9349 100644 --- a/src/apify_client/clients/resource_clients/key_value_store.py +++ b/src/apify_client/clients/resource_clients/key_value_store.py @@ -5,12 +5,12 @@ from http import HTTPStatus from typing import TYPE_CHECKING, Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs, parse_date_fields - from apify_client._utils import ( catch_not_found_or_throw, encode_key_value_store_record_value, + filter_out_none_values_recursively, maybe_parse_response, + parse_date_fields, pluck_data, ) from apify_client.clients.base import ResourceClient, ResourceClientAsync @@ -28,7 +28,6 @@ class KeyValueStoreClient(ResourceClient): """Sub-client for manipulating a single key-value store.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'key-value-stores') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -269,7 +268,6 @@ def delete_record(self, key: str) -> None: class KeyValueStoreClientAsync(ResourceClientAsync): """Async sub-client for manipulating a single key-value store.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'key-value-stores') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/key_value_store_collection.py b/src/apify_client/clients/resource_clients/key_value_store_collection.py index 242b07b8..8af38903 100644 --- a/src/apify_client/clients/resource_clients/key_value_store_collection.py +++ b/src/apify_client/clients/resource_clients/key_value_store_collection.py @@ -2,8 +2,7 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs - +from apify_client._utils import filter_out_none_values_recursively from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync if TYPE_CHECKING: @@ -13,7 +12,6 @@ class KeyValueStoreCollectionClient(ResourceCollectionClient): """Sub-client for manipulating key-value stores.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'key-value-stores') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -64,7 +62,6 @@ def get_or_create( class KeyValueStoreCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for manipulating key-value stores.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'key-value-stores') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/log.py b/src/apify_client/clients/resource_clients/log.py index 51332449..759ae1fd 100644 --- a/src/apify_client/clients/resource_clients/log.py +++ b/src/apify_client/clients/resource_clients/log.py @@ -11,8 +11,6 @@ from threading import Thread from typing import TYPE_CHECKING, Any, cast -from apify_shared.utils import ignore_docs - from apify_client._utils import catch_not_found_or_throw from apify_client.clients.base import ResourceClient, ResourceClientAsync from apify_client.errors import ApifyApiError @@ -30,7 +28,6 @@ class LogClient(ResourceClient): """Sub-client for manipulating logs.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'logs') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -118,7 +115,6 @@ def stream(self, *, raw: bool = False) -> Iterator[impit.Response | None]: class LogClientAsync(ResourceClientAsync): """Async sub-client for manipulating logs.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'logs') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/request_queue.py b/src/apify_client/clients/resource_clients/request_queue.py index 8dd238ea..14e57113 100644 --- a/src/apify_client/clients/resource_clients/request_queue.py +++ b/src/apify_client/clients/resource_clients/request_queue.py @@ -8,10 +8,14 @@ from queue import Queue from typing import TYPE_CHECKING, Any, TypedDict -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs, parse_date_fields from more_itertools import constrained_batches -from apify_client._utils import catch_not_found_or_throw, pluck_data +from apify_client._utils import ( + catch_not_found_or_throw, + filter_out_none_values_recursively, + parse_date_fields, + pluck_data, +) from apify_client.clients.base import ResourceClient, ResourceClientAsync from apify_client.errors import ApifyApiError @@ -45,7 +49,6 @@ class BatchAddRequestsResult(TypedDict): class RequestQueueClient(ResourceClient): """Sub-client for manipulating a single request queue.""" - @ignore_docs def __init__( # noqa: D417 self, *args: Any, @@ -426,7 +429,6 @@ def unlock_requests(self: RequestQueueClient) -> dict: class RequestQueueClientAsync(ResourceClientAsync): """Async sub-client for manipulating a single request queue.""" - @ignore_docs def __init__( # noqa: D417 self, *args: Any, diff --git a/src/apify_client/clients/resource_clients/request_queue_collection.py b/src/apify_client/clients/resource_clients/request_queue_collection.py index d3311401..f2ee80bb 100644 --- a/src/apify_client/clients/resource_clients/request_queue_collection.py +++ b/src/apify_client/clients/resource_clients/request_queue_collection.py @@ -2,8 +2,6 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import ignore_docs - from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync if TYPE_CHECKING: @@ -13,7 +11,6 @@ class RequestQueueCollectionClient(ResourceCollectionClient): """Sub-client for manipulating request queues.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'request-queues') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -58,7 +55,6 @@ def get_or_create(self, *, name: str | None = None) -> dict: class RequestQueueCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for manipulating request queues.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'request-queues') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/run.py b/src/apify_client/clients/resource_clients/run.py index 90158763..0392e815 100644 --- a/src/apify_client/clients/resource_clients/run.py +++ b/src/apify_client/clients/resource_clients/run.py @@ -9,10 +9,14 @@ from datetime import timedelta from typing import TYPE_CHECKING, Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs, parse_date_fields - from apify_client._logging import create_redirect_logger -from apify_client._utils import encode_key_value_store_record_value, pluck_data, to_safe_id +from apify_client._utils import ( + encode_key_value_store_record_value, + filter_out_none_values_recursively, + parse_date_fields, + 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 @@ -36,7 +40,6 @@ class RunClient(ActorJobBaseClient): """Sub-client for manipulating a single Actor run.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-runs') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -355,7 +358,6 @@ def get_status_message_watcher( class RunClientAsync(ActorJobBaseClientAsync): """Async sub-client for manipulating a single Actor run.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-runs') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/run_collection.py b/src/apify_client/clients/resource_clients/run_collection.py index 41f9634d..924daf37 100644 --- a/src/apify_client/clients/resource_clients/run_collection.py +++ b/src/apify_client/clients/resource_clients/run_collection.py @@ -2,8 +2,7 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import ignore_docs, maybe_extract_enum_member_value - +from apify_client._utils import maybe_extract_enum_member_value from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync if TYPE_CHECKING: @@ -15,7 +14,6 @@ class RunCollectionClient(ResourceCollectionClient): """Sub-client for listing Actor runs.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-runs') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -61,7 +59,6 @@ def list( class RunCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for listing Actor runs.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-runs') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/schedule.py b/src/apify_client/clients/resource_clients/schedule.py index 2af40792..8aed0ace 100644 --- a/src/apify_client/clients/resource_clients/schedule.py +++ b/src/apify_client/clients/resource_clients/schedule.py @@ -3,9 +3,7 @@ import json as jsonlib from typing import Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs - -from apify_client._utils import catch_not_found_or_throw, pluck_data_as_list +from apify_client._utils import catch_not_found_or_throw, filter_out_none_values_recursively, pluck_data_as_list from apify_client.clients.base import ResourceClient, ResourceClientAsync from apify_client.errors import ApifyApiError @@ -36,7 +34,6 @@ def _get_schedule_representation( class ScheduleClient(ResourceClient): """Sub-client for manipulating a single schedule.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'schedules') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -126,7 +123,6 @@ def get_log(self) -> list | None: class ScheduleClientAsync(ResourceClientAsync): """Async sub-client for manipulating a single schedule.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'schedules') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/schedule_collection.py b/src/apify_client/clients/resource_clients/schedule_collection.py index 61dbe839..e8386edf 100644 --- a/src/apify_client/clients/resource_clients/schedule_collection.py +++ b/src/apify_client/clients/resource_clients/schedule_collection.py @@ -2,8 +2,7 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs - +from apify_client._utils import filter_out_none_values_recursively from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync from apify_client.clients.resource_clients.schedule import _get_schedule_representation @@ -14,7 +13,6 @@ class ScheduleCollectionClient(ResourceCollectionClient): """Sub-client for manipulating schedules.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'schedules') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -91,7 +89,6 @@ def create( class ScheduleCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for manipulating schedules.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'schedules') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/store_collection.py b/src/apify_client/clients/resource_clients/store_collection.py index f6de47c0..f04200a0 100644 --- a/src/apify_client/clients/resource_clients/store_collection.py +++ b/src/apify_client/clients/resource_clients/store_collection.py @@ -2,8 +2,6 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import ignore_docs - from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync if TYPE_CHECKING: @@ -13,7 +11,6 @@ class StoreCollectionClient(ResourceCollectionClient): """Sub-client for Apify store.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'store') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -60,7 +57,6 @@ def list( class StoreCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for Apify store.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'store') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/task.py b/src/apify_client/clients/resource_clients/task.py index d05ac363..5db942b4 100644 --- a/src/apify_client/clients/resource_clients/task.py +++ b/src/apify_client/clients/resource_clients/task.py @@ -3,14 +3,14 @@ import json as jsonlib from typing import TYPE_CHECKING, Any, cast -from apify_shared.utils import ( +from apify_client._utils import ( + catch_not_found_or_throw, + encode_webhook_list_to_base64, filter_out_none_values_recursively, - ignore_docs, maybe_extract_enum_member_value, parse_date_fields, + pluck_data, ) - -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 @@ -64,7 +64,6 @@ def get_task_representation( class TaskClient(ResourceClient): """Sub-client for manipulating a single task.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-tasks') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -321,7 +320,6 @@ def webhooks(self) -> WebhookCollectionClient: class TaskClientAsync(ResourceClientAsync): """Async sub-client for manipulating a single task.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-tasks') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/task_collection.py b/src/apify_client/clients/resource_clients/task_collection.py index 811f8961..7956eda1 100644 --- a/src/apify_client/clients/resource_clients/task_collection.py +++ b/src/apify_client/clients/resource_clients/task_collection.py @@ -2,8 +2,7 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs - +from apify_client._utils import filter_out_none_values_recursively from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync from apify_client.clients.resource_clients.task import get_task_representation @@ -14,7 +13,6 @@ class TaskCollectionClient(ResourceCollectionClient): """Sub-client for manipulating tasks.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-tasks') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -108,7 +106,6 @@ def create( class TaskCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for manipulating tasks.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'actor-tasks') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/user.py b/src/apify_client/clients/resource_clients/user.py index 049028f0..b3984b0b 100644 --- a/src/apify_client/clients/resource_clients/user.py +++ b/src/apify_client/clients/resource_clients/user.py @@ -3,9 +3,12 @@ import json as jsonlib from typing import Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs, parse_date_fields - -from apify_client._utils import catch_not_found_or_throw, pluck_data +from apify_client._utils import ( + catch_not_found_or_throw, + filter_out_none_values_recursively, + parse_date_fields, + pluck_data, +) from apify_client.clients.base import ResourceClient, ResourceClientAsync from apify_client.errors import ApifyApiError @@ -13,7 +16,6 @@ class UserClient(ResourceClient): """Sub-client for querying user data.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_id = kwargs.pop('resource_id', None) if resource_id is None: @@ -105,7 +107,6 @@ def update_limits( class UserClientAsync(ResourceClientAsync): """Async sub-client for querying user data.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_id = kwargs.pop('resource_id', None) if resource_id is None: diff --git a/src/apify_client/clients/resource_clients/webhook.py b/src/apify_client/clients/resource_clients/webhook.py index dbc5f241..06544719 100644 --- a/src/apify_client/clients/resource_clients/webhook.py +++ b/src/apify_client/clients/resource_clients/webhook.py @@ -3,14 +3,13 @@ import json as jsonlib from typing import TYPE_CHECKING, Any -from apify_shared.utils import ( +from apify_client._utils import ( + catch_not_found_or_throw, filter_out_none_values_recursively, - ignore_docs, maybe_extract_enum_member_value, parse_date_fields, + pluck_data, ) - -from apify_client._utils import catch_not_found_or_throw, pluck_data from apify_client.clients.base import ResourceClient, ResourceClientAsync from apify_client.clients.resource_clients.webhook_dispatch_collection import ( WebhookDispatchCollectionClient, @@ -64,7 +63,6 @@ def get_webhook_representation( class WebhookClient(ResourceClient): """Sub-client for manipulating a single webhook.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'webhooks') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -175,7 +173,6 @@ def dispatches(self) -> WebhookDispatchCollectionClient: class WebhookClientAsync(ResourceClientAsync): """Async sub-client for manipulating a single webhook.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'webhooks') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/webhook_collection.py b/src/apify_client/clients/resource_clients/webhook_collection.py index 65ce54b2..2add4361 100644 --- a/src/apify_client/clients/resource_clients/webhook_collection.py +++ b/src/apify_client/clients/resource_clients/webhook_collection.py @@ -2,8 +2,7 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import filter_out_none_values_recursively, ignore_docs - +from apify_client._utils import filter_out_none_values_recursively from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync from apify_client.clients.resource_clients.webhook import get_webhook_representation @@ -16,7 +15,6 @@ class WebhookCollectionClient(ResourceCollectionClient): """Sub-client for manipulating webhooks.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'webhooks') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -101,7 +99,6 @@ def create( class WebhookCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for manipulating webhooks.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'webhooks') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/webhook_dispatch.py b/src/apify_client/clients/resource_clients/webhook_dispatch.py index 323d8959..30a2a26e 100644 --- a/src/apify_client/clients/resource_clients/webhook_dispatch.py +++ b/src/apify_client/clients/resource_clients/webhook_dispatch.py @@ -2,15 +2,12 @@ from typing import Any -from apify_shared.utils import ignore_docs - from apify_client.clients.base import ResourceClient, ResourceClientAsync class WebhookDispatchClient(ResourceClient): """Sub-client for querying information about a webhook dispatch.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'webhook-dispatches') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -29,7 +26,6 @@ def get(self) -> dict | None: class WebhookDispatchClientAsync(ResourceClientAsync): """Async sub-client for querying information about a webhook dispatch.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'webhook-dispatches') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/clients/resource_clients/webhook_dispatch_collection.py b/src/apify_client/clients/resource_clients/webhook_dispatch_collection.py index 2cdb87cf..60ac1df1 100644 --- a/src/apify_client/clients/resource_clients/webhook_dispatch_collection.py +++ b/src/apify_client/clients/resource_clients/webhook_dispatch_collection.py @@ -2,8 +2,6 @@ from typing import TYPE_CHECKING, Any -from apify_shared.utils import ignore_docs - from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync if TYPE_CHECKING: @@ -13,7 +11,6 @@ class WebhookDispatchCollectionClient(ResourceCollectionClient): """Sub-client for listing webhook dispatches.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'webhook-dispatches') super().__init__(*args, resource_path=resource_path, **kwargs) @@ -43,7 +40,6 @@ def list( class WebhookDispatchCollectionClientAsync(ResourceCollectionClientAsync): """Async sub-client for listing webhook dispatches.""" - @ignore_docs def __init__(self, *args: Any, **kwargs: Any) -> None: resource_path = kwargs.pop('resource_path', 'webhook-dispatches') super().__init__(*args, resource_path=resource_path, **kwargs) diff --git a/src/apify_client/errors.py b/src/apify_client/errors.py index 118c4456..d34552fe 100644 --- a/src/apify_client/errors.py +++ b/src/apify_client/errors.py @@ -3,8 +3,6 @@ import json as jsonlib from typing import TYPE_CHECKING -from apify_shared.utils import ignore_docs - if TYPE_CHECKING: import impit @@ -21,7 +19,6 @@ class ApifyApiError(ApifyClientError): or validation errors, which are thrown immediately, because a correction by the user is needed. """ - @ignore_docs def __init__(self, response: impit.Response, attempt: int, method: str = 'GET') -> None: """Initialize a new instance. @@ -66,7 +63,6 @@ class InvalidResponseBodyError(ApifyClientError): identifying this error in the HTTPClient. """ - @ignore_docs def __init__(self, response: impit.Response) -> None: """Initialize a new instance. diff --git a/uv.lock b/uv.lock index 7a392dae..a38b2b67 100644 --- a/uv.lock +++ b/uv.lock @@ -35,7 +35,7 @@ dev = [ [package.metadata] requires-dist = [ - { name = "apify-shared", specifier = "<2.0.0" }, + { name = "apify-shared", specifier = ">=2.0.0,<3.0.0" }, { name = "colorama", specifier = ">=0.4.0" }, { name = "impit", specifier = ">=0.5.3" }, { name = "more-itertools", specifier = ">=10.0.0" }, @@ -63,11 +63,11 @@ dev = [ [[package]] name = "apify-shared" -version = "1.5.0" +version = "2.0.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/63/3e/96de53973fa0704d9b99339fad1838b53d9340870bafc7a9a9f41a7d266f/apify_shared-1.5.0.tar.gz", hash = "sha256:1cba58f0144127f7b52cced426a6527e9722620e9fd1c4ddb6f9c8ce16db0ef1", size = 14639, upload-time = "2025-08-05T11:10:20.617Z" } +sdist = { url = "https://files.pythonhosted.org/packages/e6/f4/710d95d6d5e1afde0b35359b0eb2ad7363ec81eeab348b5a109959d19513/apify_shared-2.0.0.tar.gz", hash = "sha256:c3ee4f7556f6fd61b9e2d39288d6c4d272b7c3ee0ebf0bb6b8acf46e5605b688", size = 46601, upload-time = "2025-08-13T13:32:22.7Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/7a/87/fe6b3e7eec76e083ce54bb1b4a19b7dd8f6d3441a3a05e053af6607fcda4/apify_shared-1.5.0-py3-none-any.whl", hash = "sha256:46409a75140d25f3487da87adbf446390214e08cda79c2938aaee085e8f7f9dd", size = 13467, upload-time = "2025-08-05T11:10:19.187Z" }, + { url = "https://files.pythonhosted.org/packages/8d/51/37e94ec858360c85b6b690c5694894c5b051416dcb829c324a507fea8d42/apify_shared-2.0.0-py3-none-any.whl", hash = "sha256:e4c74aba7277190efa52958fa7d1696fd361a828b604cc88858e9a29396c2f27", size = 16191, upload-time = "2025-08-13T13:32:21.286Z" }, ] [[package]]