Skip to content

Commit

Permalink
chore: update Ruff to 0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
vdusek committed Nov 25, 2024
1 parent ed6d3c7 commit 61046b7
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 210 deletions.
330 changes: 162 additions & 168 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pytest-only = "~2.1.0"
pytest-timeout = "~2.3.0"
pytest-xdist = "~3.6.0"
redbaron = "~0.9.0"
ruff = "~0.7.0"
ruff = "~0.8.0"
setuptools = "~75.0.0" # setuptools are used by pytest but not explicitly required

[tool.ruff]
Expand All @@ -70,8 +70,6 @@ line-length = 150
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN101", # Missing type annotation for `self` in method
"ANN102", # Missing type annotation for `{name}` in classmethod
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {filename}
"ASYNC109", # Async function definition with a `timeout` parameter
"BLE001", # Do not catch blind exception
Expand Down Expand Up @@ -167,7 +165,7 @@ exclude = []
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"assert_never()"
"assert_never()",
]

[tool.basedpyright]
Expand Down
8 changes: 5 additions & 3 deletions src/apify_client/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
import random
import time
from http import HTTPStatus
from typing import TYPE_CHECKING, Any, Awaitable, Callable, Dict, List, TypeVar, cast
from typing import TYPE_CHECKING, Any, Callable, TypeVar, cast

from apify_shared.utils import is_file_or_bytes, maybe_extract_enum_member_value

if TYPE_CHECKING:
from collections.abc import Awaitable

from apify_client._errors import ApifyApiError

PARSE_DATE_FIELDS_MAX_DEPTH = 3
Expand All @@ -31,14 +33,14 @@ def to_safe_id(id: str) -> str:

def pluck_data(parsed_response: Any) -> dict:
if isinstance(parsed_response, dict) and 'data' in parsed_response:
return cast(Dict, parsed_response['data'])
return cast(dict, parsed_response['data'])

raise ValueError('The "data" property is missing in the response.')


def pluck_data_as_list(parsed_response: Any) -> list:
if isinstance(parsed_response, dict) and 'data' in parsed_response:
return cast(List, parsed_response['data'])
return cast(list, parsed_response['data'])

raise ValueError('The "data" property is missing in the response.')

Expand Down
20 changes: 10 additions & 10 deletions src/apify_client/clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@
)

__all__ = [
'ActorJobBaseClient',
'ActorJobBaseClientAsync',
'BaseClient',
'BaseClientAsync',
'ResourceClient',
'ResourceClientAsync',
'ResourceCollectionClient',
'ResourceCollectionClientAsync',
'ActorClient',
'ActorClientAsync',
'ActorCollectionClient',
Expand All @@ -82,10 +74,14 @@
'ActorEnvVarClientAsync',
'ActorEnvVarCollectionClient',
'ActorEnvVarCollectionClientAsync',
'ActorJobBaseClient',
'ActorJobBaseClientAsync',
'ActorVersionClient',
'ActorVersionClientAsync',
'ActorVersionCollectionClient',
'ActorVersionCollectionClientAsync',
'BaseClient',
'BaseClientAsync',
'BuildClient',
'BuildClientAsync',
'BuildCollectionClient',
Expand All @@ -104,6 +100,10 @@
'RequestQueueClientAsync',
'RequestQueueCollectionClient',
'RequestQueueCollectionClientAsync',
'ResourceClient',
'ResourceClientAsync',
'ResourceCollectionClient',
'ResourceCollectionClientAsync',
'RunClient',
'RunClientAsync',
'RunCollectionClient',
Expand All @@ -112,6 +112,8 @@
'ScheduleClientAsync',
'ScheduleCollectionClient',
'ScheduleCollectionClientAsync',
'StoreCollectionClient',
'StoreCollectionClientAsync',
'TaskClient',
'TaskClientAsync',
'TaskCollectionClient',
Expand All @@ -126,6 +128,4 @@
'WebhookDispatchClientAsync',
'WebhookDispatchCollectionClient',
'WebhookDispatchCollectionClientAsync',
'StoreCollectionClient',
'StoreCollectionClientAsync',
]
44 changes: 22 additions & 22 deletions src/apify_client/clients/resource_clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,46 +39,46 @@
'ActorVersionClientAsync',
'ActorVersionCollectionClient',
'ActorVersionCollectionClientAsync',
'RunClient',
'BuildClient',
'BuildClientAsync',
'RunCollectionClient',
'BuildCollectionClient',
'BuildCollectionClientAsync',
'BuildClient',
'DatasetClient',
'DatasetClientAsync',
'BuildCollectionClient',
'DatasetCollectionClient',
'DatasetCollectionClientAsync',
'DatasetClient',
'KeyValueStoreClient',
'KeyValueStoreClientAsync',
'DatasetCollectionClient',
'KeyValueStoreCollectionClient',
'KeyValueStoreCollectionClientAsync',
'KeyValueStoreClient',
'LogClient',
'LogClientAsync',
'KeyValueStoreCollectionClient',
'RequestQueueClientAsync',
'RequestQueueClient',
'RequestQueueCollectionClientAsync',
'RequestQueueClientAsync',
'RequestQueueCollectionClient',
'RequestQueueCollectionClientAsync',
'RunClient',
'RunClientAsync',
'LogClient',
'RunCollectionClient',
'RunCollectionClientAsync',
'WebhookClient',
'ScheduleClient',
'ScheduleClientAsync',
'WebhookCollectionClient',
'ScheduleCollectionClient',
'ScheduleCollectionClientAsync',
'WebhookDispatchClient',
'StoreCollectionClient',
'StoreCollectionClientAsync',
'TaskClient',
'TaskClientAsync',
'WebhookDispatchCollectionClient',
'TaskCollectionClient',
'TaskCollectionClientAsync',
'TaskClient',
'UserClient',
'UserClientAsync',
'TaskCollectionClient',
'WebhookClient',
'WebhookClientAsync',
'ScheduleClient',
'WebhookCollectionClient',
'WebhookCollectionClientAsync',
'ScheduleCollectionClient',
'WebhookDispatchClient',
'WebhookDispatchClientAsync',
'UserClient',
'WebhookDispatchCollectionClient',
'WebhookDispatchCollectionClientAsync',
'StoreCollectionClient',
'StoreCollectionClientAsync',
]
4 changes: 3 additions & 1 deletion src/apify_client/clients/resource_clients/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

import warnings
from contextlib import asynccontextmanager, contextmanager
from typing import TYPE_CHECKING, Any, AsyncIterator, Iterator
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.clients.base import ResourceClient, ResourceClientAsync

if TYPE_CHECKING:
from collections.abc import AsyncIterator, Iterator

import httpx
from apify_shared.types import JSONSerializable

Expand Down
5 changes: 4 additions & 1 deletion src/apify_client/clients/resource_clients/key_value_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

import warnings
from contextlib import asynccontextmanager, contextmanager
from typing import Any, AsyncIterator, Iterator
from typing import TYPE_CHECKING, Any

from apify_shared.utils import filter_out_none_values_recursively, ignore_docs, parse_date_fields

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

if TYPE_CHECKING:
from collections.abc import AsyncIterator, Iterator


class KeyValueStoreClient(ResourceClient):
"""Sub-client for manipulating a single key-value store."""
Expand Down
4 changes: 3 additions & 1 deletion src/apify_client/clients/resource_clients/log.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from contextlib import asynccontextmanager, contextmanager
from typing import TYPE_CHECKING, Any, AsyncIterator, Iterator
from typing import TYPE_CHECKING, Any

from apify_shared.utils import ignore_docs

Expand All @@ -10,6 +10,8 @@
from apify_client.clients.base import ResourceClient, ResourceClientAsync

if TYPE_CHECKING:
from collections.abc import AsyncIterator, Iterator

import httpx


Expand Down

0 comments on commit 61046b7

Please sign in to comment.