Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use specific rule codes when ignoring type issues #302

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ keywords = [
"Issue Tracker" = "https://github.com/apify/apify-client-python/issues"
"Repository" = "https://github.com/apify/apify-client-python"

# We use inclusive ordered comparison clauses for external packages intentionally in order to enhance SDK's
# compatibility with external packages. This decision was discussed in detail in the following PR:
# https://github.com/apify/apify-sdk-python/pull/154.
[tool.poetry.dependencies]
python = "^3.9"
apify-shared = ">=1.1.2"
Expand Down Expand Up @@ -82,7 +79,6 @@ ignore = [
"G004", # Logging statement uses f-string
"ISC001", # This rule may cause conflicts when used with the formatter
"FIX", # flake8-fixme
"PGH003", # Use specific rule codes when ignoring type issues
"PLR0911", # Too many return statements
"PLR0913", # Too many arguments in function definition
"PLR0915", # Too many statements
Expand Down Expand Up @@ -161,15 +157,17 @@ warn_unreachable = true
warn_unused_ignores = true
exclude = []

[tool.basedpyright]
pythonVersion = "3.9"
typeCheckingMode = "standard"
include = ["scripts", "src", "tests"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"assert_never()",
]

[tool.basedpyright]
typeCheckingMode = "standard"

[tool.ipdb]
context = 7
2 changes: 1 addition & 1 deletion scripts/check_async_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import sys
from pathlib import Path

from redbaron import RedBaron # type: ignore
from redbaron import RedBaron # type: ignore[import-untyped]
from utils import sync_to_async_docstring

found_issues = False
Expand Down
2 changes: 1 addition & 1 deletion scripts/fix_async_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re
from pathlib import Path

from redbaron import RedBaron # type: ignore
from redbaron import RedBaron # type: ignore[import-untyped]
from utils import sync_to_async_docstring

# Get the directory of the source files
Expand Down
8 changes: 4 additions & 4 deletions src/apify_client/clients/resource_clients/actor_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ def create(
description: str | None = None,
seo_title: str | None = None,
seo_description: str | None = None,
versions: list[dict] | None = None, # type: ignore
versions: list[dict] | None = None, # type: ignore[valid-type]
restart_on_error: bool | None = None,
is_public: bool | None = None,
is_deprecated: bool | None = None,
is_anonymously_runnable: bool | None = None,
categories: list[str] | None = None, # type: ignore
categories: list[str] | None = None, # type: ignore[valid-type]
default_run_build: str | None = None,
default_run_max_items: int | None = None,
default_run_memory_mbytes: int | None = None,
Expand Down Expand Up @@ -173,12 +173,12 @@ async def create(
description: str | None = None,
seo_title: str | None = None,
seo_description: str | None = None,
versions: list[dict] | None = None, # type: ignore
versions: list[dict] | None = None, # type: ignore[valid-type]
restart_on_error: bool | None = None,
is_public: bool | None = None,
is_deprecated: bool | None = None,
is_anonymously_runnable: bool | None = None,
categories: list[str] | None = None, # type: ignore
categories: list[str] | None = None, # type: ignore[valid-type]
default_run_build: str | None = None,
default_run_max_items: int | None = None,
default_run_memory_mbytes: int | None = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ def create(
*,
version_number: str,
build_tag: str | None = None,
env_vars: list[dict] | None = None, # type: ignore
env_vars: list[dict] | None = None, # type: ignore[valid-type]
apply_env_vars_to_build: bool | None = None,
source_type: ActorSourceType,
source_files: list[dict] | None = None, # type: ignore
source_files: list[dict] | None = None, # type: ignore[valid-type]
git_repo_url: str | None = None,
tarball_url: str | None = None,
github_gist_url: str | None = None,
Expand Down Expand Up @@ -107,10 +107,10 @@ async def create(
*,
version_number: str,
build_tag: str | None = None,
env_vars: list[dict] | None = None, # type: ignore
env_vars: list[dict] | None = None, # type: ignore[valid-type]
apply_env_vars_to_build: bool | None = None,
source_type: ActorSourceType,
source_files: list[dict] | None = None, # type: ignore
source_files: list[dict] | None = None, # type: ignore[valid-type]
git_repo_url: str | None = None,
tarball_url: str | None = None,
github_gist_url: str | None = None,
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 @@ -110,7 +110,7 @@ def get_record(self: KeyValueStoreClient, key: str, *, as_bytes: bool = False, a
DeprecationWarning,
stacklevel=2,
)
return self.stream_record(key) # type: ignore
return self.stream_record(key) # type: ignore[return-value]

response = self.http_client.call(
url=self._url(f'records/{key}'),
Expand All @@ -120,7 +120,7 @@ def get_record(self: KeyValueStoreClient, key: str, *, as_bytes: bool = False, a

return {
'key': key,
'value': response._maybe_parsed_body, # type: ignore # noqa: SLF001
'value': response._maybe_parsed_body, # type: ignore[attr-defined] # noqa: SLF001
'content_type': response.headers['content-type'],
}

Expand Down Expand Up @@ -323,7 +323,7 @@ async def get_record(self: KeyValueStoreClientAsync, key: str) -> dict | None:

return {
'key': key,
'value': response._maybe_parsed_body, # type: ignore # noqa: SLF001
'value': response._maybe_parsed_body, # type: ignore[attr-defined] # noqa: SLF001
'content_type': response.headers['content-type'],
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def create(
is_enabled: bool,
is_exclusive: bool,
name: str | None = None,
actions: list[dict] | None = None, # type: ignore
actions: list[dict] | None = None, # type: ignore[valid-type]
description: str | None = None,
timezone: str | None = None,
title: str | None = None,
Expand Down Expand Up @@ -125,7 +125,7 @@ async def create(
is_enabled: bool,
is_exclusive: bool,
name: str | None = None,
actions: list[dict] | None = None, # type: ignore
actions: list[dict] | None = None, # type: ignore[valid-type]
description: str | None = None,
timezone: str | None = None,
title: str | None = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def list(
def create(
self: WebhookCollectionClient,
*,
event_types: list[WebhookEventType], # type: ignore
event_types: list[WebhookEventType], # type: ignore[valid-type]
request_url: str,
payload_template: str | None = None,
headers_template: str | None = None,
Expand Down Expand Up @@ -132,7 +132,7 @@ async def list(
async def create(
self: WebhookCollectionClientAsync,
*,
event_types: list[WebhookEventType], # type: ignore
event_types: list[WebhookEventType], # type: ignore[valid-type]
request_url: str,
payload_template: str | None = None,
headers_template: str | None = None,
Expand Down