Skip to content
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
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ ignore = [
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D107", # Missing docstring in `__init__`
"D203", # One blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D413", # Missing blank line after last section
"EM", # flake8-errmsg
"G004", # Logging statement uses f-string
"ISC001", # This rule may cause conflicts when used with the formatter
Expand Down Expand Up @@ -162,9 +165,6 @@ runtime-evaluated-base-classes = [
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["id"]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.isort]
known-local-folder = ["apify"]
known-first-party = ["apify_client", "apify_shared", "crawlee"]
Expand Down
2 changes: 1 addition & 1 deletion src/apify/_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ async def create_proxy_configuration(
return proxy_configuration

def _get_default_exit_process(self) -> bool:
"""Returns False for IPython, Pytest, and Scrapy environments, True otherwise."""
"""Return False for IPython, Pytest, and Scrapy environments, True otherwise."""
if is_running_in_ipython():
self.log.debug('Running in IPython, setting default `exit_process` to False.')
return False
Expand Down
22 changes: 16 additions & 6 deletions src/apify/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ def is_running_in_ipython() -> bool:


def docs_group(group_name: GroupName) -> Callable: # noqa: ARG001
"""Decorator to mark symbols for rendering and grouping in documentation.
"""Mark a symbol for rendering and grouping in documentation.

This decorator is used purely for documentation purposes and does not alter the behavior
This decorator is used solely for documentation purposes and does not modify the behavior
of the decorated callable.

Args:
group_name: The documentation group to which the symbol belongs.

Returns:
The original callable without modification.
"""

def wrapper(func: Callable) -> Callable:
Expand All @@ -44,12 +50,16 @@ def wrapper(func: Callable) -> Callable:


def docs_name(symbol_name: str) -> Callable: # noqa: ARG001
"""Decorator for renaming symbols in documentation.
"""Rename a symbol for documentation rendering.

This changes the rendered name of the symbol only in the rendered web documentation.
This decorator modifies only the displayed name of the symbol in the generated documentation
and does not affect its runtime behavior.

This decorator is used purely for documentation purposes and does not alter the behavior
of the decorated callable.
Args:
symbol_name: The name to be used in the documentation.

Returns:
The original callable without modification.
"""

def wrapper(func: Callable) -> Callable:
Expand Down
2 changes: 1 addition & 1 deletion src/apify/scrapy/_async_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async def _shutdown_tasks(self) -> None:
await asyncio.gather(*tasks, return_exceptions=True)

def _force_exit_event_loop(self) -> None:
"""Forcefully shut down the event loop and its thread."""
"""Shut down the event loop and its thread forcefully."""
try:
logger.info('Forced shutdown of the event loop and its thread...')
self._eventloop.call_soon_threadsafe(self._eventloop.stop)
Expand Down
13 changes: 9 additions & 4 deletions src/apify/storages/_request_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def open(
request_list_sources_input: list[dict[str, Any]] | None = None,
http_client: HttpClient | None = None,
) -> RequestList:
"""Creates RequestList from Actor input requestListSources.
"""Initialize a new instance from request list source input.

Args:
name: Name of the returned RequestList.
Expand Down Expand Up @@ -108,9 +108,10 @@ def _create_requests_from_input(simple_url_inputs: list[_SimpleUrlInput]) -> lis

@staticmethod
async def _fetch_requests_from_url(
remote_url_requests_inputs: list[_RequestsFromUrlInput], http_client: HttpClient
remote_url_requests_inputs: list[_RequestsFromUrlInput],
http_client: HttpClient,
) -> list[Request]:
"""Crete list of requests from url.
"""Create list of requests from url.

Send GET requests to urls defined in each requests_from_url of remote_url_requests_inputs. Run extracting
callback on each response body and use URL_NO_COMMAS_REGEX regex to find all links. Create list of Requests from
Expand All @@ -119,7 +120,11 @@ async def _fetch_requests_from_url(
created_requests: list[Request] = []

def create_requests_from_response(request_input: _RequestsFromUrlInput, task: Task) -> None:
"""Callback to scrape response body with regexp and create Requests from matches."""
"""Extract links from response body and use them to create `Request` objects.

Use the regular expression to find all matching links in the response body, then create `Request`
objects from these links and the provided input attributes.
"""
matches = re.finditer(URL_NO_COMMAS_REGEX, task.result().read().decode('utf-8'))
created_requests.extend(
[
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.