Skip to content

Commit 3886b73

Browse files
authored
docs: Update API docs of public components (#914)
### Description - Update API docs of public components. - Add functions (context/crawler helpers) to a "Functions" API docs section. ### Issues - Closes: #304 ### Testing - The docs were rendered locally. ### Checklist - [x] CI passed
1 parent 4fa6e46 commit 3886b73

20 files changed

+371
-244
lines changed

docs/guides/code/storages/rq_with_crawler_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
async def main() -> None:
77
# Create a new crawler (it can be any subclass of BasicCrawler). Request queue is a default
8-
# request provider, it will be opened, and fully managed if not specified.
8+
# request manager, it will be opened, and fully managed if not specified.
99
crawler = HttpCrawler()
1010

1111
# Define the default request handler, which will be called for every request.

docs/guides/code/storages/rq_with_crawler_explicit_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async def main() -> None:
1313
await request_queue.add_requests_batched(['https://apify.com/', 'https://crawlee.dev/'])
1414

1515
# Create a new crawler (it can be any subclass of BasicCrawler) and pass the request
16-
# list as request provider to it. It will be managed by the crawler.
16+
# list as request manager to it. It will be managed by the crawler.
1717
crawler = HttpCrawler(request_manager=request_queue)
1818

1919
# Define the default request handler, which will be called for every request.

src/crawlee/_autoscaling/snapshotter.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ def __init__(
102102

103103
@classmethod
104104
def from_config(cls, config: Configuration | None = None) -> Snapshotter:
105-
"""Create a new instance based on the provided configuration.
105+
"""Create a new instance based on the provided `Configuration`.
106106
107107
Args:
108-
config: The configuration object. Uses the global (default) configuration if not provided.
108+
config: The `Configuration` instance. Uses the global (default) one if not provided.
109109
"""
110110
config = service_locator.get_configuration()
111111

@@ -132,7 +132,7 @@ def _get_sorted_list_by_created_at(input_list: list[T]) -> SortedList[T]:
132132

133133
@property
134134
def active(self) -> bool:
135-
"""Indicates whether the context is active."""
135+
"""Indicate whether the context is active."""
136136
return self._active
137137

138138
async def __aenter__(self) -> Snapshotter:
@@ -178,7 +178,7 @@ async def __aexit__(
178178

179179
@ensure_context
180180
def get_memory_sample(self, duration: timedelta | None = None) -> list[Snapshot]:
181-
"""Returns a sample of the latest memory snapshots.
181+
"""Return a sample of the latest memory snapshots.
182182
183183
Args:
184184
duration: The duration of the sample from the latest snapshot. If omitted, it returns a full history.
@@ -191,7 +191,7 @@ def get_memory_sample(self, duration: timedelta | None = None) -> list[Snapshot]
191191

192192
@ensure_context
193193
def get_event_loop_sample(self, duration: timedelta | None = None) -> list[Snapshot]:
194-
"""Returns a sample of the latest event loop snapshots.
194+
"""Return a sample of the latest event loop snapshots.
195195
196196
Args:
197197
duration: The duration of the sample from the latest snapshot. If omitted, it returns a full history.
@@ -204,7 +204,7 @@ def get_event_loop_sample(self, duration: timedelta | None = None) -> list[Snaps
204204

205205
@ensure_context
206206
def get_cpu_sample(self, duration: timedelta | None = None) -> list[Snapshot]:
207-
"""Returns a sample of the latest CPU snapshots.
207+
"""Return a sample of the latest CPU snapshots.
208208
209209
Args:
210210
duration: The duration of the sample from the latest snapshot. If omitted, it returns a full history.
@@ -217,7 +217,7 @@ def get_cpu_sample(self, duration: timedelta | None = None) -> list[Snapshot]:
217217

218218
@ensure_context
219219
def get_client_sample(self, duration: timedelta | None = None) -> list[Snapshot]:
220-
"""Returns a sample of the latest client snapshots.
220+
"""Return a sample of the latest client snapshots.
221221
222222
Args:
223223
duration: The duration of the sample from the latest snapshot. If omitted, it returns a full history.
@@ -230,7 +230,7 @@ def get_client_sample(self, duration: timedelta | None = None) -> list[Snapshot]
230230

231231
@staticmethod
232232
def _get_sample(snapshots: list[Snapshot], duration: timedelta | None = None) -> list[Snapshot]:
233-
"""Returns a time-limited sample from snapshots or full history if duration is None."""
233+
"""Return a time-limited sample from snapshots or full history if duration is None."""
234234
if not duration:
235235
return snapshots
236236

0 commit comments

Comments
 (0)