Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
craete | (*args: Any, **kwargs: Any) | [Deprecated] miss-spelled function.
This function is undocumented and will be removed in future release.
| [Deprecated] miss-spelled function. | async def craete(*args: Any, **kwargs: Any) -> Page:
"""[Deprecated] miss-spelled function.
This function is undocumented and will be removed in future release.
"""
logger.warning(
'`craete` function is deprecated and will be removed in future. '
'Use `Page.create` instead.'
)
r... | [
"async",
"def",
"craete",
"(",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Page",
":",
"logger",
".",
"warning",
"(",
"'`craete` function is deprecated and will be removed in future. '",
"'Use `Page.create` instead.'",
")",
"return",
... | [
1800,
0
] | [
1809,
45
] | python | en | ['en', 'en', 'en'] | True |
Page.create | (client: CDPSession, target: 'Target',
ignoreHTTPSErrors: bool, defaultViewport: Optional[Dict],
screenshotTaskQueue: list = None) | Async function which makes new page object. | Async function which makes new page object. | async def create(client: CDPSession, target: 'Target',
ignoreHTTPSErrors: bool, defaultViewport: Optional[Dict],
screenshotTaskQueue: list = None) -> 'Page':
"""Async function which makes new page object."""
await client.send('Page.enable'),
frameTree = ... | [
"async",
"def",
"create",
"(",
"client",
":",
"CDPSession",
",",
"target",
":",
"'Target'",
",",
"ignoreHTTPSErrors",
":",
"bool",
",",
"defaultViewport",
":",
"Optional",
"[",
"Dict",
"]",
",",
"screenshotTaskQueue",
":",
"list",
"=",
"None",
")",
"->",
"... | [
87,
4
] | [
110,
19
] | python | en | ['en', 'en', 'en'] | True |
Page.target | (self) | Return a target this page created from. | Return a target this page created from. | def target(self) -> 'Target':
"""Return a target this page created from."""
return self._target | [
"def",
"target",
"(",
"self",
")",
"->",
"'Target'",
":",
"return",
"self",
".",
"_target"
] | [
219,
4
] | [
221,
27
] | python | en | ['en', 'en', 'en'] | True |
Page.browser | (self) | Get the browser the page belongs to. | Get the browser the page belongs to. | def browser(self) -> 'Browser':
"""Get the browser the page belongs to."""
return self._target.browser | [
"def",
"browser",
"(",
"self",
")",
"->",
"'Browser'",
":",
"return",
"self",
".",
"_target",
".",
"browser"
] | [
224,
4
] | [
226,
35
] | python | en | ['en', 'en', 'en'] | True |
Page.mainFrame | (self) | Get main :class:`~pyppeteer.frame_manager.Frame` of this page. | Get main :class:`~pyppeteer.frame_manager.Frame` of this page. | def mainFrame(self) -> Optional['Frame']:
"""Get main :class:`~pyppeteer.frame_manager.Frame` of this page."""
return self._frameManager._mainFrame | [
"def",
"mainFrame",
"(",
"self",
")",
"->",
"Optional",
"[",
"'Frame'",
"]",
":",
"return",
"self",
".",
"_frameManager",
".",
"_mainFrame"
] | [
244,
4
] | [
246,
44
] | python | en | ['en', 'en', 'en'] | True |
Page.keyboard | (self) | Get :class:`~pyppeteer.input.Keyboard` object. | Get :class:`~pyppeteer.input.Keyboard` object. | def keyboard(self) -> Keyboard:
"""Get :class:`~pyppeteer.input.Keyboard` object."""
return self._keyboard | [
"def",
"keyboard",
"(",
"self",
")",
"->",
"Keyboard",
":",
"return",
"self",
".",
"_keyboard"
] | [
249,
4
] | [
251,
29
] | python | en | ['en', 'en', 'hi'] | True |
Page.touchscreen | (self) | Get :class:`~pyppeteer.input.Touchscreen` object. | Get :class:`~pyppeteer.input.Touchscreen` object. | def touchscreen(self) -> Touchscreen:
"""Get :class:`~pyppeteer.input.Touchscreen` object."""
return self._touchscreen | [
"def",
"touchscreen",
"(",
"self",
")",
"->",
"Touchscreen",
":",
"return",
"self",
".",
"_touchscreen"
] | [
254,
4
] | [
256,
32
] | python | de | ['de', 'lb', 'en'] | False |
Page.coverage | (self) | Return :class:`~pyppeteer.coverage.Coverage`. | Return :class:`~pyppeteer.coverage.Coverage`. | def coverage(self) -> Coverage:
"""Return :class:`~pyppeteer.coverage.Coverage`."""
return self._coverage | [
"def",
"coverage",
"(",
"self",
")",
"->",
"Coverage",
":",
"return",
"self",
".",
"_coverage"
] | [
259,
4
] | [
261,
29
] | python | en | ['nl', 'en', 'en'] | False |
Page.tap | (self, selector: str) | Tap the element which matches the ``selector``.
:arg str selector: A selector to search element to touch.
| Tap the element which matches the ``selector``. | async def tap(self, selector: str) -> None:
"""Tap the element which matches the ``selector``.
:arg str selector: A selector to search element to touch.
"""
frame = self.mainFrame
if frame is None:
raise PageError('no main frame')
await frame.tap(selector) | [
"async",
"def",
"tap",
"(",
"self",
",",
"selector",
":",
"str",
")",
"->",
"None",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"frame",
"is",
"None",
":",
"raise",
"PageError",
"(",
"'no main frame'",
")",
"await",
"frame",
".",
"tap",
"(",
"... | [
263,
4
] | [
271,
33
] | python | en | ['en', 'en', 'en'] | True |
Page.tracing | (self) | Get tracing object. | Get tracing object. | def tracing(self) -> 'Tracing':
"""Get tracing object."""
return self._tracing | [
"def",
"tracing",
"(",
"self",
")",
"->",
"'Tracing'",
":",
"return",
"self",
".",
"_tracing"
] | [
274,
4
] | [
276,
28
] | python | en | ['en', 'en', 'en'] | True |
Page.frames | (self) | Get all frames of this page. | Get all frames of this page. | def frames(self) -> List['Frame']:
"""Get all frames of this page."""
return list(self._frameManager.frames()) | [
"def",
"frames",
"(",
"self",
")",
"->",
"List",
"[",
"'Frame'",
"]",
":",
"return",
"list",
"(",
"self",
".",
"_frameManager",
".",
"frames",
"(",
")",
")"
] | [
279,
4
] | [
281,
48
] | python | en | ['en', 'en', 'en'] | True |
Page.workers | (self) | Get all workers of this page. | Get all workers of this page. | def workers(self) -> List[Worker]:
"""Get all workers of this page."""
return list(self._workers.values()) | [
"def",
"workers",
"(",
"self",
")",
"->",
"List",
"[",
"Worker",
"]",
":",
"return",
"list",
"(",
"self",
".",
"_workers",
".",
"values",
"(",
")",
")"
] | [
284,
4
] | [
286,
43
] | python | en | ['en', 'en', 'en'] | True |
Page.setRequestInterception | (self, value: bool) | Enable/disable request interception.
Activating request interception enables
:class:`~pyppeteer.network_manager.Request` class's
:meth:`~pyppeteer.network_manager.Request.abort`,
:meth:`~pyppeteer.network_manager.Request.continue_`, and
:meth:`~pyppeteer.network_manager.Request.... | Enable/disable request interception. | async def setRequestInterception(self, value: bool) -> None:
"""Enable/disable request interception.
Activating request interception enables
:class:`~pyppeteer.network_manager.Request` class's
:meth:`~pyppeteer.network_manager.Request.abort`,
:meth:`~pyppeteer.network_manager.Re... | [
"async",
"def",
"setRequestInterception",
"(",
"self",
",",
"value",
":",
"bool",
")",
"->",
"None",
":",
"# noqa: E501",
"return",
"await",
"self",
".",
"_networkManager",
".",
"setRequestInterception",
"(",
"value",
")"
] | [
288,
4
] | [
321,
71
] | python | en | ['en', 'fr', 'en'] | True |
Page.setOfflineMode | (self, enabled: bool) | Set offline mode enable/disable. | Set offline mode enable/disable. | async def setOfflineMode(self, enabled: bool) -> None:
"""Set offline mode enable/disable."""
await self._networkManager.setOfflineMode(enabled) | [
"async",
"def",
"setOfflineMode",
"(",
"self",
",",
"enabled",
":",
"bool",
")",
"->",
"None",
":",
"await",
"self",
".",
"_networkManager",
".",
"setOfflineMode",
"(",
"enabled",
")"
] | [
323,
4
] | [
325,
58
] | python | en | ['en', 'en', 'en'] | True |
Page.setDefaultNavigationTimeout | (self, timeout: int) | Change the default maximum navigation timeout.
This method changes the default timeout of 30 seconds for the following
methods:
* :meth:`goto`
* :meth:`goBack`
* :meth:`goForward`
* :meth:`reload`
* :meth:`waitForNavigation`
:arg int timeout: Maximum na... | Change the default maximum navigation timeout. | def setDefaultNavigationTimeout(self, timeout: int) -> None:
"""Change the default maximum navigation timeout.
This method changes the default timeout of 30 seconds for the following
methods:
* :meth:`goto`
* :meth:`goBack`
* :meth:`goForward`
* :meth:`reload`
... | [
"def",
"setDefaultNavigationTimeout",
"(",
"self",
",",
"timeout",
":",
"int",
")",
"->",
"None",
":",
"self",
".",
"_defaultNavigationTimeout",
"=",
"timeout"
] | [
327,
4
] | [
342,
48
] | python | en | ['en', 'fr', 'en'] | True |
Page.querySelector | (self, selector: str) | Get an Element which matches ``selector``.
:arg str selector: A selector to search element.
:return Optional[ElementHandle]: If element which matches the
``selector`` is found, return its
:class:`~pyppeteer.element_handle.ElementHandle`. If not found,
returns ``None`... | Get an Element which matches ``selector``. | async def querySelector(self, selector: str) -> Optional[ElementHandle]:
"""Get an Element which matches ``selector``.
:arg str selector: A selector to search element.
:return Optional[ElementHandle]: If element which matches the
``selector`` is found, return its
:class:... | [
"async",
"def",
"querySelector",
"(",
"self",
",",
"selector",
":",
"str",
")",
"->",
"Optional",
"[",
"ElementHandle",
"]",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"PageError",
"(",
"'no main frame.'",
")",
"return... | [
360,
4
] | [
372,
50
] | python | en | ['en', 'en', 'en'] | True |
Page.evaluateHandle | (self, pageFunction: str, *args: Any
) | Execute function on this page.
Difference between :meth:`~pyppeteer.page.Page.evaluate` and
:meth:`~pyppeteer.page.Page.evaluateHandle` is that
``evaluateHandle`` returns JSHandle object (not value).
:arg str pageFunction: JavaScript function to be executed.
| Execute function on this page. | async def evaluateHandle(self, pageFunction: str, *args: Any
) -> JSHandle:
"""Execute function on this page.
Difference between :meth:`~pyppeteer.page.Page.evaluate` and
:meth:`~pyppeteer.page.Page.evaluateHandle` is that
``evaluateHandle`` returns JSHandle... | [
"async",
"def",
"evaluateHandle",
"(",
"self",
",",
"pageFunction",
":",
"str",
",",
"*",
"args",
":",
"Any",
")",
"->",
"JSHandle",
":",
"if",
"not",
"self",
".",
"mainFrame",
":",
"raise",
"PageError",
"(",
"'no main frame.'",
")",
"context",
"=",
"awa... | [
374,
4
] | [
389,
64
] | python | en | ['en', 'en', 'en'] | True |
Page.queryObjects | (self, prototypeHandle: JSHandle) | Iterate js heap and finds all the objects with the handle.
:arg JSHandle prototypeHandle: JSHandle of prototype object.
| Iterate js heap and finds all the objects with the handle. | async def queryObjects(self, prototypeHandle: JSHandle) -> JSHandle:
"""Iterate js heap and finds all the objects with the handle.
:arg JSHandle prototypeHandle: JSHandle of prototype object.
"""
if not self.mainFrame:
raise PageError('no main frame.')
context = awai... | [
"async",
"def",
"queryObjects",
"(",
"self",
",",
"prototypeHandle",
":",
"JSHandle",
")",
"->",
"JSHandle",
":",
"if",
"not",
"self",
".",
"mainFrame",
":",
"raise",
"PageError",
"(",
"'no main frame.'",
")",
"context",
"=",
"await",
"self",
".",
"mainFrame... | [
391,
4
] | [
401,
58
] | python | en | ['en', 'en', 'en'] | True |
Page.querySelectorEval | (self, selector: str, pageFunction: str,
*args: Any) | Execute function with an element which matches ``selector``.
:arg str selector: A selector to query page for.
:arg str pageFunction: String of JavaScript function to be evaluated on
browser. This function takes an element which
matches the s... | Execute function with an element which matches ``selector``. | async def querySelectorEval(self, selector: str, pageFunction: str,
*args: Any) -> Any:
"""Execute function with an element which matches ``selector``.
:arg str selector: A selector to query page for.
:arg str pageFunction: String of JavaScript function to be eva... | [
"async",
"def",
"querySelectorEval",
"(",
"self",
",",
"selector",
":",
"str",
",",
"pageFunction",
":",
"str",
",",
"*",
"args",
":",
"Any",
")",
"->",
"Any",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"PageError"... | [
403,
4
] | [
418,
75
] | python | en | ['en', 'en', 'en'] | True |
Page.querySelectorAllEval | (self, selector: str, pageFunction: str,
*args: Any) | Execute function with all elements which matches ``selector``.
:arg str selector: A selector to query page for.
:arg str pageFunction: String of JavaScript function to be evaluated on
browser. This function takes Array of the
matched element... | Execute function with all elements which matches ``selector``. | async def querySelectorAllEval(self, selector: str, pageFunction: str,
*args: Any) -> Any:
"""Execute function with all elements which matches ``selector``.
:arg str selector: A selector to query page for.
:arg str pageFunction: String of JavaScript function t... | [
"async",
"def",
"querySelectorAllEval",
"(",
"self",
",",
"selector",
":",
"str",
",",
"pageFunction",
":",
"str",
",",
"*",
"args",
":",
"Any",
")",
"->",
"Any",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"PageErr... | [
420,
4
] | [
433,
78
] | python | en | ['en', 'en', 'en'] | True |
Page.querySelectorAll | (self, selector: str) | Get all element which matches ``selector`` as a list.
:arg str selector: A selector to search element.
:return List[ElementHandle]: List of
:class:`~pyppeteer.element_handle.ElementHandle` which matches the
``selector``. If no element is matched to the ``selector``, return
... | Get all element which matches ``selector`` as a list. | async def querySelectorAll(self, selector: str) -> List[ElementHandle]:
"""Get all element which matches ``selector`` as a list.
:arg str selector: A selector to search element.
:return List[ElementHandle]: List of
:class:`~pyppeteer.element_handle.ElementHandle` which matches the
... | [
"async",
"def",
"querySelectorAll",
"(",
"self",
",",
"selector",
":",
"str",
")",
"->",
"List",
"[",
"ElementHandle",
"]",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"PageError",
"(",
"'no main frame.'",
")",
"return"... | [
435,
4
] | [
447,
53
] | python | en | ['en', 'en', 'en'] | True |
Page.xpath | (self, expression: str) | Evaluate the XPath expression.
If there are no such elements in this page, return an empty list.
:arg str expression: XPath string to be evaluated.
| Evaluate the XPath expression. | async def xpath(self, expression: str) -> List[ElementHandle]:
"""Evaluate the XPath expression.
If there are no such elements in this page, return an empty list.
:arg str expression: XPath string to be evaluated.
"""
frame = self.mainFrame
if not frame:
rai... | [
"async",
"def",
"xpath",
"(",
"self",
",",
"expression",
":",
"str",
")",
"->",
"List",
"[",
"ElementHandle",
"]",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"PageError",
"(",
"'no main frame.'",
")",
"return",
"awai... | [
449,
4
] | [
459,
44
] | python | en | ['en', 'en', 'en'] | True |
Page.cookies | (self, *urls: str) | Get cookies.
If no URLs are specified, this method returns cookies for the current
page URL. If URLs are specified, only cookies for those URLs are
returned.
Returned cookies are list of dictionaries which contain these fields:
* ``name`` (str)
* ``value`` (str)
... | Get cookies. | async def cookies(self, *urls: str) -> dict:
"""Get cookies.
If no URLs are specified, this method returns cookies for the current
page URL. If URLs are specified, only cookies for those URLs are
returned.
Returned cookies are list of dictionaries which contain these fields:
... | [
"async",
"def",
"cookies",
"(",
"self",
",",
"*",
"urls",
":",
"str",
")",
"->",
"dict",
":",
"if",
"not",
"urls",
":",
"urls",
"=",
"(",
"self",
".",
"url",
",",
")",
"resp",
"=",
"await",
"self",
".",
"_client",
".",
"send",
"(",
"'Network.getC... | [
472,
4
] | [
497,
38
] | python | en | ['en', 'nl', 'en'] | False |
Page.deleteCookie | (self, *cookies: dict) | Delete cookie.
``cookies`` should be dictionaries which contain these fields:
* ``name`` (str): **required**
* ``url`` (str)
* ``domain`` (str)
* ``path`` (str)
* ``secure`` (bool)
| Delete cookie. | async def deleteCookie(self, *cookies: dict) -> None:
"""Delete cookie.
``cookies`` should be dictionaries which contain these fields:
* ``name`` (str): **required**
* ``url`` (str)
* ``domain`` (str)
* ``path`` (str)
* ``secure`` (bool)
"""
page... | [
"async",
"def",
"deleteCookie",
"(",
"self",
",",
"*",
"cookies",
":",
"dict",
")",
"->",
"None",
":",
"pageURL",
"=",
"self",
".",
"url",
"for",
"cookie",
"in",
"cookies",
":",
"item",
"=",
"dict",
"(",
"*",
"*",
"cookie",
")",
"if",
"not",
"cooki... | [
499,
4
] | [
515,
66
] | python | en | ['en', 'sr', 'en'] | False |
Page.setCookie | (self, *cookies: dict) | Set cookies.
``cookies`` should be dictionaries which contain these fields:
* ``name`` (str): **required**
* ``value`` (str): **required**
* ``url`` (str)
* ``domain`` (str)
* ``path`` (str)
* ``expires`` (number): Unix time in seconds
* ``httpOnly`` (bo... | Set cookies. | async def setCookie(self, *cookies: dict) -> None:
"""Set cookies.
``cookies`` should be dictionaries which contain these fields:
* ``name`` (str): **required**
* ``value`` (str): **required**
* ``url`` (str)
* ``domain`` (str)
* ``path`` (str)
* ``expir... | [
"async",
"def",
"setCookie",
"(",
"self",
",",
"*",
"cookies",
":",
"dict",
")",
"->",
"None",
":",
"pageURL",
"=",
"self",
".",
"url",
"startsWithHTTP",
"=",
"pageURL",
".",
"startswith",
"(",
"'http'",
")",
"items",
"=",
"[",
"]",
"for",
"cookie",
... | [
517,
4
] | [
550,
14
] | python | en | ['en', 'nl', 'en'] | False |
Page.addScriptTag | (self, options: Dict = None, **kwargs: str
) | Add script tag to this page.
One of ``url``, ``path`` or ``content`` option is necessary.
* ``url`` (string): URL of a script to add.
* ``path`` (string): Path to the local JavaScript file to add.
* ``content`` (string): JavaScript string to add.
* ``type`` (stri... | Add script tag to this page. | async def addScriptTag(self, options: Dict = None, **kwargs: str
) -> ElementHandle:
"""Add script tag to this page.
One of ``url``, ``path`` or ``content`` option is necessary.
* ``url`` (string): URL of a script to add.
* ``path`` (string): Path to t... | [
"async",
"def",
"addScriptTag",
"(",
"self",
",",
"options",
":",
"Dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"str",
")",
"->",
"ElementHandle",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"PageError",
"(",
... | [
552,
4
] | [
570,
48
] | python | en | ['en', 'en', 'en'] | True |
Page.addStyleTag | (self, options: Dict = None, **kwargs: str
) | Add style or link tag to this page.
One of ``url``, ``path`` or ``content`` option is necessary.
* ``url`` (string): URL of the link tag to add.
* ``path`` (string): Path to the local CSS file to add.
* ``content`` (string): CSS string to add.
:return ElementHandle:... | Add style or link tag to this page. | async def addStyleTag(self, options: Dict = None, **kwargs: str
) -> ElementHandle:
"""Add style or link tag to this page.
One of ``url``, ``path`` or ``content`` option is necessary.
* ``url`` (string): URL of the link tag to add.
* ``path`` (string): ... | [
"async",
"def",
"addStyleTag",
"(",
"self",
",",
"options",
":",
"Dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"str",
")",
"->",
"ElementHandle",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"PageError",
"(",
... | [
572,
4
] | [
588,
47
] | python | en | ['en', 'en', 'en'] | True |
Page.injectFile | (self, filePath: str) | [Deprecated] Inject file to this page.
This method is deprecated. Use :meth:`addScriptTag` instead.
| [Deprecated] Inject file to this page. | async def injectFile(self, filePath: str) -> str:
"""[Deprecated] Inject file to this page.
This method is deprecated. Use :meth:`addScriptTag` instead.
"""
frame = self.mainFrame
if not frame:
raise PageError('no main frame.')
return await frame.injectFile(f... | [
"async",
"def",
"injectFile",
"(",
"self",
",",
"filePath",
":",
"str",
")",
"->",
"str",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"PageError",
"(",
"'no main frame.'",
")",
"return",
"await",
"frame",
".",
"inject... | [
590,
4
] | [
598,
47
] | python | en | ['en', 'en', 'en'] | True |
Page.exposeFunction | (self, name: str,
pyppeteerFunction: Callable[..., Any]
) | Add python function to the browser's ``window`` object as ``name``.
Registered function can be called from chrome process.
:arg string name: Name of the function on the window object.
:arg Callable pyppeteerFunction: Function which will be called on
pyt... | Add python function to the browser's ``window`` object as ``name``. | async def exposeFunction(self, name: str,
pyppeteerFunction: Callable[..., Any]
) -> None:
"""Add python function to the browser's ``window`` object as ``name``.
Registered function can be called from chrome process.
:arg string name: N... | [
"async",
"def",
"exposeFunction",
"(",
"self",
",",
"name",
":",
"str",
",",
"pyppeteerFunction",
":",
"Callable",
"[",
"...",
",",
"Any",
"]",
")",
"->",
"None",
":",
"if",
"self",
".",
"_pageBindings",
".",
"get",
"(",
"name",
")",
":",
"raise",
"P... | [
600,
4
] | [
647,
54
] | python | en | ['en', 'en', 'en'] | True |
Page.authenticate | (self, credentials: Dict[str, str]) | Provide credentials for http authentication.
``credentials`` should be ``None`` or dict which has ``username`` and
``password`` field.
| Provide credentials for http authentication. | async def authenticate(self, credentials: Dict[str, str]) -> Any:
"""Provide credentials for http authentication.
``credentials`` should be ``None`` or dict which has ``username`` and
``password`` field.
"""
return await self._networkManager.authenticate(credentials) | [
"async",
"def",
"authenticate",
"(",
"self",
",",
"credentials",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
")",
"->",
"Any",
":",
"return",
"await",
"self",
".",
"_networkManager",
".",
"authenticate",
"(",
"credentials",
")"
] | [
649,
4
] | [
655,
67
] | python | en | ['en', 'en', 'en'] | True |
Page.setExtraHTTPHeaders | (self, headers: Dict[str, str]) | Set extra HTTP headers.
The extra HTTP headers will be sent with every request the page
initiates.
.. note::
``page.setExtraHTTPHeaders`` does not guarantee the order of
headers in the outgoing requests.
:arg Dict headers: A dictionary containing additional htt... | Set extra HTTP headers. | async def setExtraHTTPHeaders(self, headers: Dict[str, str]) -> None:
"""Set extra HTTP headers.
The extra HTTP headers will be sent with every request the page
initiates.
.. note::
``page.setExtraHTTPHeaders`` does not guarantee the order of
headers in the outg... | [
"async",
"def",
"setExtraHTTPHeaders",
"(",
"self",
",",
"headers",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
")",
"->",
"None",
":",
"return",
"await",
"self",
".",
"_networkManager",
".",
"setExtraHTTPHeaders",
"(",
"headers",
")"
] | [
657,
4
] | [
671,
70
] | python | da | ['da', 'sv', 'en'] | False |
Page.setUserAgent | (self, userAgent: str) | Set user agent to use in this page.
:arg str userAgent: Specific user agent to use in this page
| Set user agent to use in this page. | async def setUserAgent(self, userAgent: str) -> None:
"""Set user agent to use in this page.
:arg str userAgent: Specific user agent to use in this page
"""
return await self._networkManager.setUserAgent(userAgent) | [
"async",
"def",
"setUserAgent",
"(",
"self",
",",
"userAgent",
":",
"str",
")",
"->",
"None",
":",
"return",
"await",
"self",
".",
"_networkManager",
".",
"setUserAgent",
"(",
"userAgent",
")"
] | [
673,
4
] | [
678,
65
] | python | en | ['en', 'en', 'en'] | True |
Page.metrics | (self) | Get metrics.
Returns dictionary containing metrics as key/value pairs:
* ``Timestamp`` (number): The timestamp when the metrics sample was
taken.
* ``Documents`` (int): Number of documents in the page.
* ``Frames`` (int): Number of frames in the page.
* ``JSEventListe... | Get metrics. | async def metrics(self) -> Dict[str, Any]:
"""Get metrics.
Returns dictionary containing metrics as key/value pairs:
* ``Timestamp`` (number): The timestamp when the metrics sample was
taken.
* ``Documents`` (int): Number of documents in the page.
* ``Frames`` (int): ... | [
"async",
"def",
"metrics",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"response",
"=",
"await",
"self",
".",
"_client",
".",
"send",
"(",
"'Performance.getMetrics'",
")",
"return",
"self",
".",
"_buildMetricsObject",
"(",
"response",... | [
680,
4
] | [
705,
60
] | python | en | ['en', 'id', 'pt'] | False |
Page.url | (self) | Get URL of this page. | Get URL of this page. | def url(self) -> str:
"""Get URL of this page."""
frame = self.mainFrame
if not frame:
raise PageError('no main frame.')
return frame.url | [
"def",
"url",
"(",
"self",
")",
"->",
"str",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"PageError",
"(",
"'no main frame.'",
")",
"return",
"frame",
".",
"url"
] | [
789,
4
] | [
794,
24
] | python | en | ['en', 'en', 'en'] | True |
Page.content | (self) | Get the full HTML contents of the page.
Returns HTML including the doctype.
| Get the full HTML contents of the page. | async def content(self) -> str:
"""Get the full HTML contents of the page.
Returns HTML including the doctype.
"""
frame = self.mainFrame
if frame is None:
raise PageError('No main frame.')
return await frame.content() | [
"async",
"def",
"content",
"(",
"self",
")",
"->",
"str",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"frame",
"is",
"None",
":",
"raise",
"PageError",
"(",
"'No main frame.'",
")",
"return",
"await",
"frame",
".",
"content",
"(",
")"
] | [
796,
4
] | [
804,
36
] | python | en | ['en', 'en', 'en'] | True |
Page.setContent | (self, html: str) | Set content to this page.
:arg str html: HTML markup to assign to the page.
| Set content to this page. | async def setContent(self, html: str) -> None:
"""Set content to this page.
:arg str html: HTML markup to assign to the page.
"""
frame = self.mainFrame
if frame is None:
raise PageError('No main frame.')
await frame.setContent(html) | [
"async",
"def",
"setContent",
"(",
"self",
",",
"html",
":",
"str",
")",
"->",
"None",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"frame",
"is",
"None",
":",
"raise",
"PageError",
"(",
"'No main frame.'",
")",
"await",
"frame",
".",
"setContent",... | [
806,
4
] | [
814,
36
] | python | en | ['en', 'en', 'en'] | True |
Page.goto | (self, url: str, options: dict = None, **kwargs: Any
) | Go to the ``url``.
:arg string url: URL to navigate page to. The url should include
scheme, e.g. ``https://``.
Available options are:
* ``timeout`` (int): Maximum navigation time in milliseconds, defaults
to 30 seconds, pass ``0`` to disable timeout. The def... | Go to the ``url``. | async def goto(self, url: str, options: dict = None, **kwargs: Any
) -> Optional[Response]:
"""Go to the ``url``.
:arg string url: URL to navigate page to. The url should include
scheme, e.g. ``https://``.
Available options are:
* ``timeout`... | [
"async",
"def",
"goto",
"(",
"self",
",",
"url",
":",
"str",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Optional",
"[",
"Response",
"]",
":",
"options",
"=",
"merge_dict",
"(",
"options",
",",
"kwargs... | [
816,
4
] | [
889,
52
] | python | en | ['en', 'en', 'en'] | True |
Page.reload | (self, options: dict = None, **kwargs: Any
) | Reload this page.
Available options are same as :meth:`goto` method.
| Reload this page. | async def reload(self, options: dict = None, **kwargs: Any
) -> Optional[Response]:
"""Reload this page.
Available options are same as :meth:`goto` method.
"""
options = merge_dict(options, kwargs)
response = (await asyncio.gather(
self.waitForNa... | [
"async",
"def",
"reload",
"(",
"self",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Optional",
"[",
"Response",
"]",
":",
"options",
"=",
"merge_dict",
"(",
"options",
",",
"kwargs",
")",
"response",
"=",... | [
898,
4
] | [
909,
23
] | python | en | ['en', 'en', 'en'] | True |
Page.waitForNavigation | (self, options: dict = None, **kwargs: Any
) | Wait for navigation.
Available options are same as :meth:`goto` method.
This returns :class:`~pyppeteer.network_manager.Response` when the page
navigates to a new URL or reloads. It is useful for when you run code
which will indirectly cause the page to navigate. In case of navigation
... | Wait for navigation. | async def waitForNavigation(self, options: dict = None, **kwargs: Any
) -> Optional[Response]:
"""Wait for navigation.
Available options are same as :meth:`goto` method.
This returns :class:`~pyppeteer.network_manager.Response` when the page
navigates to... | [
"async",
"def",
"waitForNavigation",
"(",
"self",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Optional",
"[",
"Response",
"]",
":",
"# noqa: E501",
"options",
"=",
"merge_dict",
"(",
"options",
",",
"kwargs"... | [
911,
4
] | [
965,
23
] | python | da | ['fr', 'da', 'en'] | False |
Page.waitForRequest | (self, urlOrPredicate: Union[str, Callable[[Request], bool]], # noqa: E501
options: Dict = None, **kwargs: Any) | Wait for request.
:arg urlOrPredicate: A URL or function to wait for.
This method accepts below options:
* ``timeout`` (int|float): Maximum wait time in milliseconds, defaults
to 30 seconds, pass ``0`` to disable the timeout.
Example:
.. code::
firstRe... | Wait for request. | async def waitForRequest(self, urlOrPredicate: Union[str, Callable[[Request], bool]], # noqa: E501
options: Dict = None, **kwargs: Any) -> Request:
"""Wait for request.
:arg urlOrPredicate: A URL or function to wait for.
This method accepts below options:
... | [
"async",
"def",
"waitForRequest",
"(",
"self",
",",
"urlOrPredicate",
":",
"Union",
"[",
"str",
",",
"Callable",
"[",
"[",
"Request",
"]",
",",
"bool",
"]",
"]",
",",
"# noqa: E501",
"options",
":",
"Dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
... | [
967,
4
] | [
1002,
9
] | python | en | ['fr', 'en', 'en'] | True |
Page.waitForResponse | (self, urlOrPredicate: Union[str, Callable[[Response], bool]], # noqa: E501
options: Dict = None, **kwargs: Any) | Wait for response.
:arg urlOrPredicate: A URL or function to wait for.
This method accepts below options:
* ``timeout`` (int|float): Maximum wait time in milliseconds, defaults
to 30 seconds, pass ``0`` to disable the timeout.
Example:
.. code::
firstR... | Wait for response. | async def waitForResponse(self, urlOrPredicate: Union[str, Callable[[Response], bool]], # noqa: E501
options: Dict = None, **kwargs: Any) -> Response:
"""Wait for response.
:arg urlOrPredicate: A URL or function to wait for.
This method accepts below options:
... | [
"async",
"def",
"waitForResponse",
"(",
"self",
",",
"urlOrPredicate",
":",
"Union",
"[",
"str",
",",
"Callable",
"[",
"[",
"Response",
"]",
",",
"bool",
"]",
"]",
",",
"# noqa: E501",
"options",
":",
"Dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
... | [
1004,
4
] | [
1039,
9
] | python | en | ['fr', 'no', 'en'] | False |
Page.goBack | (self, options: dict = None, **kwargs: Any
) | Navigate to the previous page in history.
Available options are same as :meth:`goto` method.
If cannot go back, return ``None``.
| Navigate to the previous page in history. | async def goBack(self, options: dict = None, **kwargs: Any
) -> Optional[Response]:
"""Navigate to the previous page in history.
Available options are same as :meth:`goto` method.
If cannot go back, return ``None``.
"""
options = merge_dict(options, kwargs)... | [
"async",
"def",
"goBack",
"(",
"self",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Optional",
"[",
"Response",
"]",
":",
"options",
"=",
"merge_dict",
"(",
"options",
",",
"kwargs",
")",
"return",
"await... | [
1041,
4
] | [
1050,
42
] | python | en | ['en', 'en', 'en'] | True |
Page.goForward | (self, options: dict = None, **kwargs: Any
) | Navigate to the next page in history.
Available options are same as :meth:`goto` method.
If cannot go forward, return ``None``.
| Navigate to the next page in history. | async def goForward(self, options: dict = None, **kwargs: Any
) -> Optional[Response]:
"""Navigate to the next page in history.
Available options are same as :meth:`goto` method.
If cannot go forward, return ``None``.
"""
options = merge_dict(options, kw... | [
"async",
"def",
"goForward",
"(",
"self",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Optional",
"[",
"Response",
"]",
":",
"options",
"=",
"merge_dict",
"(",
"options",
",",
"kwargs",
")",
"return",
"aw... | [
1052,
4
] | [
1061,
42
] | python | en | ['en', 'en', 'en'] | True |
Page.bringToFront | (self) | Bring page to front (activate tab). | Bring page to front (activate tab). | async def bringToFront(self) -> None:
"""Bring page to front (activate tab)."""
await self._client.send('Page.bringToFront') | [
"async",
"def",
"bringToFront",
"(",
"self",
")",
"->",
"None",
":",
"await",
"self",
".",
"_client",
".",
"send",
"(",
"'Page.bringToFront'",
")"
] | [
1078,
4
] | [
1080,
52
] | python | en | ['en', 'en', 'en'] | True |
Page.emulate | (self, options: dict = None, **kwargs: Any) | Emulate given device metrics and user agent.
This method is a shortcut for calling two methods:
* :meth:`setUserAgent`
* :meth:`setViewport`
``options`` is a dictionary containing these fields:
* ``viewport`` (dict)
* ``width`` (int): page width in pixels.
... | Emulate given device metrics and user agent. | async def emulate(self, options: dict = None, **kwargs: Any) -> None:
"""Emulate given device metrics and user agent.
This method is a shortcut for calling two methods:
* :meth:`setUserAgent`
* :meth:`setViewport`
``options`` is a dictionary containing these fields:
*... | [
"async",
"def",
"emulate",
"(",
"self",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"options",
"=",
"merge_dict",
"(",
"options",
",",
"kwargs",
")",
"# TODO: if options does not have viewport or use... | [
1082,
4
] | [
1111,
61
] | python | en | ['en', 'en', 'en'] | True |
Page.setJavaScriptEnabled | (self, enabled: bool) | Set JavaScript enable/disable. | Set JavaScript enable/disable. | async def setJavaScriptEnabled(self, enabled: bool) -> None:
"""Set JavaScript enable/disable."""
if self._javascriptEnabled == enabled:
return
self._javascriptEnabled = enabled
await self._client.send('Emulation.setScriptExecutionDisabled', {
'value': not enabled... | [
"async",
"def",
"setJavaScriptEnabled",
"(",
"self",
",",
"enabled",
":",
"bool",
")",
"->",
"None",
":",
"if",
"self",
".",
"_javascriptEnabled",
"==",
"enabled",
":",
"return",
"self",
".",
"_javascriptEnabled",
"=",
"enabled",
"await",
"self",
".",
"_clie... | [
1113,
4
] | [
1120,
10
] | python | fr | ['fr', 'fr', 'en'] | True |
Page.setBypassCSP | (self, enabled: bool) | Toggles bypassing page's Content-Security-Policy.
.. note::
CSP bypassing happens at the moment of CSP initialization rather
then evaluation. Usually this means that ``page.setBypassCSP``
should be called before navigating to the domain.
| Toggles bypassing page's Content-Security-Policy. | async def setBypassCSP(self, enabled: bool) -> None:
"""Toggles bypassing page's Content-Security-Policy.
.. note::
CSP bypassing happens at the moment of CSP initialization rather
then evaluation. Usually this means that ``page.setBypassCSP``
should be called before... | [
"async",
"def",
"setBypassCSP",
"(",
"self",
",",
"enabled",
":",
"bool",
")",
"->",
"None",
":",
"await",
"self",
".",
"_client",
".",
"send",
"(",
"'Page.setBypassCSP'",
",",
"{",
"'enabled'",
":",
"enabled",
"}",
")"
] | [
1122,
4
] | [
1130,
74
] | python | en | ['en', 'en', 'en'] | True |
Page.emulateMedia | (self, mediaType: str = None) | Emulate css media type of the page.
:arg str mediaType: Changes the CSS media type of the page. The only
allowed values are ``'screen'``, ``'print'``, and
``None``. Passing ``None`` disables media
emulation.
| Emulate css media type of the page. | async def emulateMedia(self, mediaType: str = None) -> None:
"""Emulate css media type of the page.
:arg str mediaType: Changes the CSS media type of the page. The only
allowed values are ``'screen'``, ``'print'``, and
``None``. Passing ``None`` d... | [
"async",
"def",
"emulateMedia",
"(",
"self",
",",
"mediaType",
":",
"str",
"=",
"None",
")",
"->",
"None",
":",
"if",
"mediaType",
"not",
"in",
"[",
"'screen'",
",",
"'print'",
",",
"None",
",",
"''",
"]",
":",
"raise",
"ValueError",
"(",
"f'Unsupporte... | [
1132,
4
] | [
1144,
10
] | python | en | ['en', 'en', 'en'] | True |
Page.setViewport | (self, viewport: dict) | Set viewport.
Available options are:
* ``width`` (int): page width in pixel.
* ``height`` (int): page height in pixel.
* ``deviceScaleFactor`` (float): Default to 1.0.
* ``isMobile`` (bool): Default to ``False``.
* ``hasTouch`` (bool): Default to ``Fa... | Set viewport. | async def setViewport(self, viewport: dict) -> None:
"""Set viewport.
Available options are:
* ``width`` (int): page width in pixel.
* ``height`` (int): page height in pixel.
* ``deviceScaleFactor`` (float): Default to 1.0.
* ``isMobile`` (bool): Default ... | [
"async",
"def",
"setViewport",
"(",
"self",
",",
"viewport",
":",
"dict",
")",
"->",
"None",
":",
"needsReload",
"=",
"await",
"self",
".",
"_emulationManager",
".",
"emulateViewport",
"(",
"viewport",
")",
"self",
".",
"_viewport",
"=",
"viewport",
"if",
... | [
1146,
4
] | [
1160,
31
] | python | en | ['en', 'id', 'en'] | False |
Page.viewport | (self) | Get viewport as a dictionary or None.
Fields of returned dictionary is same as :meth:`setViewport`.
| Get viewport as a dictionary or None. | def viewport(self) -> Optional[Dict]:
"""Get viewport as a dictionary or None.
Fields of returned dictionary is same as :meth:`setViewport`.
"""
return self._viewport | [
"def",
"viewport",
"(",
"self",
")",
"->",
"Optional",
"[",
"Dict",
"]",
":",
"return",
"self",
".",
"_viewport"
] | [
1163,
4
] | [
1168,
29
] | python | en | ['en', 'en', 'en'] | True |
Page.evaluate | (self, pageFunction: str, *args: Any,
force_expr: bool = False) | Execute js-function or js-expression on browser and get result.
:arg str pageFunction: String of js-function/expression to be executed
on the browser.
:arg bool force_expr: If True, evaluate `pageFunction` as expression.
If False (default), t... | Execute js-function or js-expression on browser and get result. | async def evaluate(self, pageFunction: str, *args: Any,
force_expr: bool = False) -> Any:
"""Execute js-function or js-expression on browser and get result.
:arg str pageFunction: String of js-function/expression to be executed
on the browser.
... | [
"async",
"def",
"evaluate",
"(",
"self",
",",
"pageFunction",
":",
"str",
",",
"*",
"args",
":",
"Any",
",",
"force_expr",
":",
"bool",
"=",
"False",
")",
"->",
"Any",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"frame",
"is",
"None",
":",
"... | [
1170,
4
] | [
1185,
79
] | python | en | ['en', 'en', 'en'] | True |
Page.evaluateOnNewDocument | (self, pageFunction: str, *args: str
) | Add a JavaScript function to the document.
This function would be invoked in one of the following scenarios:
* whenever the page is navigated
* whenever the child frame is attached or navigated. In this case, the
function is invoked in the context of the newly attached frame.
... | Add a JavaScript function to the document. | async def evaluateOnNewDocument(self, pageFunction: str, *args: str
) -> None:
"""Add a JavaScript function to the document.
This function would be invoked in one of the following scenarios:
* whenever the page is navigated
* whenever the child frame... | [
"async",
"def",
"evaluateOnNewDocument",
"(",
"self",
",",
"pageFunction",
":",
"str",
",",
"*",
"args",
":",
"str",
")",
"->",
"None",
":",
"source",
"=",
"helper",
".",
"evaluationString",
"(",
"pageFunction",
",",
"*",
"args",
")",
"await",
"self",
".... | [
1187,
4
] | [
1200,
10
] | python | en | ['en', 'en', 'en'] | True |
Page.setCacheEnabled | (self, enabled: bool = True) | Enable/Disable cache for each request.
By default, caching is enabled.
| Enable/Disable cache for each request. | async def setCacheEnabled(self, enabled: bool = True) -> None:
"""Enable/Disable cache for each request.
By default, caching is enabled.
"""
await self._client.send('Network.setCacheDisabled',
{'cacheDisabled': not enabled}) | [
"async",
"def",
"setCacheEnabled",
"(",
"self",
",",
"enabled",
":",
"bool",
"=",
"True",
")",
"->",
"None",
":",
"await",
"self",
".",
"_client",
".",
"send",
"(",
"'Network.setCacheDisabled'",
",",
"{",
"'cacheDisabled'",
":",
"not",
"enabled",
"}",
")"
... | [
1202,
4
] | [
1208,
63
] | python | en | ['en', 'en', 'en'] | True |
Page.screenshot | (self, options: dict = None, **kwargs: Any
) | Take a screen shot.
The following options are available:
* ``path`` (str): The file path to save the image to. The screenshot
type will be inferred from the file extension.
* ``type`` (str): Specify screenshot type, can be either ``jpeg`` or
``png``. Defaults to ``png``.
... | Take a screen shot. | async def screenshot(self, options: dict = None, **kwargs: Any
) -> Union[bytes, str]:
"""Take a screen shot.
The following options are available:
* ``path`` (str): The file path to save the image to. The screenshot
type will be inferred from the file extensi... | [
"async",
"def",
"screenshot",
"(",
"self",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Union",
"[",
"bytes",
",",
"str",
"]",
":",
"options",
"=",
"merge_dict",
"(",
"options",
",",
"kwargs",
")",
"scr... | [
1210,
4
] | [
1254,
66
] | python | en | ['en', 'ht', 'en'] | True |
Page.pdf | (self, options: dict = None, **kwargs: Any) | Generate a pdf of the page.
Options:
* ``path`` (str): The file path to save the PDF.
* ``scale`` (float): Scale of the webpage rendering, defaults to ``1``.
* ``displayHeaderFooter`` (bool): Display header and footer.
Defaults to ``False``.
* ``headerTemplate`` (str)... | Generate a pdf of the page. | async def pdf(self, options: dict = None, **kwargs: Any) -> bytes:
"""Generate a pdf of the page.
Options:
* ``path`` (str): The file path to save the PDF.
* ``scale`` (float): Scale of the webpage rendering, defaults to ``1``.
* ``displayHeaderFooter`` (bool): Display header a... | [
"async",
"def",
"pdf",
"(",
"self",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"bytes",
":",
"# noqa: E501",
"options",
"=",
"merge_dict",
"(",
"options",
",",
"kwargs",
")",
"scale",
"=",
"options",
"."... | [
1320,
4
] | [
1465,
21
] | python | en | ['en', 'en', 'en'] | True |
Page.plainText | (self) | [Deprecated] Get page content as plain text. | [Deprecated] Get page content as plain text. | async def plainText(self) -> str:
"""[Deprecated] Get page content as plain text."""
logger.warning('`Page.plainText` is deprecated.')
return await self.evaluate('() => document.body.innerText') | [
"async",
"def",
"plainText",
"(",
"self",
")",
"->",
"str",
":",
"logger",
".",
"warning",
"(",
"'`Page.plainText` is deprecated.'",
")",
"return",
"await",
"self",
".",
"evaluate",
"(",
"'() => document.body.innerText'",
")"
] | [
1467,
4
] | [
1470,
67
] | python | en | ['en', 'en', 'en'] | True |
Page.title | (self) | Get page's title. | Get page's title. | async def title(self) -> str:
"""Get page's title."""
frame = self.mainFrame
if not frame:
raise PageError('no main frame.')
return await frame.title() | [
"async",
"def",
"title",
"(",
"self",
")",
"->",
"str",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"PageError",
"(",
"'no main frame.'",
")",
"return",
"await",
"frame",
".",
"title",
"(",
")"
] | [
1472,
4
] | [
1477,
34
] | python | en | ['en', 'en', 'en'] | True |
Page.close | (self, options: Dict = None, **kwargs: Any) | Close this page.
Available options:
* ``runBeforeUnload`` (bool): Defaults to ``False``. Whether to run the
`before unload <https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload>`_
page handlers.
By defaults, :meth:`close` **does not** run beforeunload handlers.... | Close this page. | async def close(self, options: Dict = None, **kwargs: Any) -> None:
"""Close this page.
Available options:
* ``runBeforeUnload`` (bool): Defaults to ``False``. Whether to run the
`before unload <https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload>`_
page handle... | [
"async",
"def",
"close",
"(",
"self",
",",
"options",
":",
"Dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"# noqa: E501",
"options",
"=",
"merge_dict",
"(",
"options",
",",
"kwargs",
")",
"conn",
"=",
"self",
".",
... | [
1479,
4
] | [
1506,
47
] | python | en | ['en', 'en', 'en'] | True |
Page.isClosed | (self) | Indicate that the page has been closed. | Indicate that the page has been closed. | def isClosed(self) -> bool:
"""Indicate that the page has been closed."""
return self._closed | [
"def",
"isClosed",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_closed"
] | [
1508,
4
] | [
1510,
27
] | python | en | ['en', 'en', 'en'] | True |
Page.mouse | (self) | Get :class:`~pyppeteer.input.Mouse` object. | Get :class:`~pyppeteer.input.Mouse` object. | def mouse(self) -> Mouse:
"""Get :class:`~pyppeteer.input.Mouse` object."""
return self._mouse | [
"def",
"mouse",
"(",
"self",
")",
"->",
"Mouse",
":",
"return",
"self",
".",
"_mouse"
] | [
1513,
4
] | [
1515,
26
] | python | nl | ['nl', 'en', 'nl'] | True |
Page.click | (self, selector: str, options: dict = None, **kwargs: Any
) | Click element which matches ``selector``.
This method fetches an element with ``selector``, scrolls it into view
if needed, and then uses :attr:`mouse` to click in the center of the
element. If there's no element matching ``selector``, the method raises
``PageError``.
Available... | Click element which matches ``selector``. | async def click(self, selector: str, options: dict = None, **kwargs: Any
) -> None:
"""Click element which matches ``selector``.
This method fetches an element with ``selector``, scrolls it into view
if needed, and then uses :attr:`mouse` to click in the center of the
... | [
"async",
"def",
"click",
"(",
"self",
",",
"selector",
":",
"str",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"frame",
"is",
"None",
":",
"r... | [
1517,
4
] | [
1547,
54
] | python | en | ['en', 'en', 'en'] | True |
Page.hover | (self, selector: str) | Mouse hover the element which matches ``selector``.
If no element matched the ``selector``, raise ``PageError``.
| Mouse hover the element which matches ``selector``. | async def hover(self, selector: str) -> None:
"""Mouse hover the element which matches ``selector``.
If no element matched the ``selector``, raise ``PageError``.
"""
frame = self.mainFrame
if frame is None:
raise PageError('No main frame.')
await frame.hover(... | [
"async",
"def",
"hover",
"(",
"self",
",",
"selector",
":",
"str",
")",
"->",
"None",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"frame",
"is",
"None",
":",
"raise",
"PageError",
"(",
"'No main frame.'",
")",
"await",
"frame",
".",
"hover",
"("... | [
1549,
4
] | [
1557,
35
] | python | en | ['en', 'en', 'en'] | True |
Page.focus | (self, selector: str) | Focus the element which matches ``selector``.
If no element matched the ``selector``, raise ``PageError``.
| Focus the element which matches ``selector``. | async def focus(self, selector: str) -> None:
"""Focus the element which matches ``selector``.
If no element matched the ``selector``, raise ``PageError``.
"""
frame = self.mainFrame
if frame is None:
raise PageError('No main frame.')
await frame.focus(select... | [
"async",
"def",
"focus",
"(",
"self",
",",
"selector",
":",
"str",
")",
"->",
"None",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"frame",
"is",
"None",
":",
"raise",
"PageError",
"(",
"'No main frame.'",
")",
"await",
"frame",
".",
"focus",
"("... | [
1559,
4
] | [
1567,
35
] | python | en | ['en', 'en', 'en'] | True |
Page.select | (self, selector: str, *values: str) | Select options and return selected values.
If no element matched the ``selector``, raise ``ElementHandleError``.
| Select options and return selected values. | async def select(self, selector: str, *values: str) -> List[str]:
"""Select options and return selected values.
If no element matched the ``selector``, raise ``ElementHandleError``.
"""
frame = self.mainFrame
if not frame:
raise PageError('no main frame.')
re... | [
"async",
"def",
"select",
"(",
"self",
",",
"selector",
":",
"str",
",",
"*",
"values",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"PageError",
"(",
"'no main frame... | [
1569,
4
] | [
1577,
52
] | python | en | ['en', 'en', 'en'] | True |
Page.type | (self, selector: str, text: str, options: dict = None,
**kwargs: Any) | Type ``text`` on the element which matches ``selector``.
If no element matched the ``selector``, raise ``PageError``.
Details see :meth:`pyppeteer.input.Keyboard.type`.
| Type ``text`` on the element which matches ``selector``. | async def type(self, selector: str, text: str, options: dict = None,
**kwargs: Any) -> None:
"""Type ``text`` on the element which matches ``selector``.
If no element matched the ``selector``, raise ``PageError``.
Details see :meth:`pyppeteer.input.Keyboard.type`.
""... | [
"async",
"def",
"type",
"(",
"self",
",",
"selector",
":",
"str",
",",
"text",
":",
"str",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",... | [
1579,
4
] | [
1590,
66
] | python | en | ['en', 'en', 'en'] | True |
Page.waitFor | (self, selectorOrFunctionOrTimeout: Union[str, int, float],
options: dict = None, *args: Any, **kwargs: Any) | Wait for function, timeout, or element which matches on page.
This method behaves differently with respect to the first argument:
* If ``selectorOrFunctionOrTimeout`` is number (int or float), then it
is treated as a timeout in milliseconds and this returns future which
will be don... | Wait for function, timeout, or element which matches on page. | def waitFor(self, selectorOrFunctionOrTimeout: Union[str, int, float],
options: dict = None, *args: Any, **kwargs: Any) -> Awaitable:
"""Wait for function, timeout, or element which matches on page.
This method behaves differently with respect to the first argument:
* If ``sele... | [
"def",
"waitFor",
"(",
"self",
",",
"selectorOrFunctionOrTimeout",
":",
"Union",
"[",
"str",
",",
"int",
",",
"float",
"]",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Awa... | [
1592,
4
] | [
1625,
66
] | python | en | ['en', 'en', 'en'] | True |
Page.waitForSelector | (self, selector: str, options: dict = None,
**kwargs: Any) | Wait until element which matches ``selector`` appears on page.
Wait for the ``selector`` to appear in page. If at the moment of
calling the method the ``selector`` already exists, the method will
return immediately. If the selector doesn't appear after the
``timeout`` milliseconds of wa... | Wait until element which matches ``selector`` appears on page. | def waitForSelector(self, selector: str, options: dict = None,
**kwargs: Any) -> Awaitable:
"""Wait until element which matches ``selector`` appears on page.
Wait for the ``selector`` to appear in page. If at the moment of
calling the method the ``selector`` already exis... | [
"def",
"waitForSelector",
"(",
"self",
",",
"selector",
":",
"str",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Awaitable",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise"... | [
1627,
4
] | [
1654,
65
] | python | en | ['en', 'en', 'en'] | True |
Page.waitForXPath | (self, xpath: str, options: dict = None,
**kwargs: Any) | Wait until element which matches ``xpath`` appears on page.
Wait for the ``xpath`` to appear in page. If the moment of calling the
method the ``xpath`` already exists, the method will return
immediately. If the xpath doesn't appear after ``timeout`` milliseconds
of waiting, the function... | Wait until element which matches ``xpath`` appears on page. | def waitForXPath(self, xpath: str, options: dict = None,
**kwargs: Any) -> Awaitable:
"""Wait until element which matches ``xpath`` appears on page.
Wait for the ``xpath`` to appear in page. If the moment of calling the
method the ``xpath`` already exists, the method will r... | [
"def",
"waitForXPath",
"(",
"self",
",",
"xpath",
":",
"str",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Awaitable",
":",
"frame",
"=",
"self",
".",
"mainFrame",
"if",
"not",
"frame",
":",
"raise",
"P... | [
1656,
4
] | [
1684,
59
] | python | en | ['en', 'en', 'en'] | True |
Page.waitForFunction | (self, pageFunction: str, options: dict = None,
*args: str, **kwargs: Any) | Wait until the function completes and returns a truthy value.
:arg Any args: Arguments to pass to ``pageFunction``.
:return: Return awaitable object which resolves when the
``pageFunction`` returns a truthy value. It resolves to a
:class:`~pyppeteer.execution_context.J... | Wait until the function completes and returns a truthy value. | def waitForFunction(self, pageFunction: str, options: dict = None,
*args: str, **kwargs: Any) -> Awaitable:
"""Wait until the function completes and returns a truthy value.
:arg Any args: Arguments to pass to ``pageFunction``.
:return: Return awaitable object which resol... | [
"def",
"waitForFunction",
"(",
"self",
",",
"pageFunction",
":",
"str",
",",
"options",
":",
"dict",
"=",
"None",
",",
"*",
"args",
":",
"str",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Awaitable",
":",
"frame",
"=",
"self",
".",
"mainFrame",
... | [
1686,
4
] | [
1715,
76
] | python | en | ['en', 'en', 'en'] | True |
ConsoleMessage.type | (self) | Return type of this message. | Return type of this message. | def type(self) -> str:
"""Return type of this message."""
return self._type | [
"def",
"type",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_type"
] | [
1785,
4
] | [
1787,
25
] | python | en | ['en', 'en', 'en'] | True |
ConsoleMessage.text | (self) | Return text representation of this message. | Return text representation of this message. | def text(self) -> str:
"""Return text representation of this message."""
return self._text | [
"def",
"text",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_text"
] | [
1790,
4
] | [
1792,
25
] | python | en | ['en', 'en', 'en'] | True |
ConsoleMessage.args | (self) | Return list of args (JSHandle) of this message. | Return list of args (JSHandle) of this message. | def args(self) -> List[JSHandle]:
"""Return list of args (JSHandle) of this message."""
return self._args | [
"def",
"args",
"(",
"self",
")",
"->",
"List",
"[",
"JSHandle",
"]",
":",
"return",
"self",
".",
"_args"
] | [
1795,
4
] | [
1797,
25
] | python | en | ['en', 'en', 'en'] | True |
MetricsView.get | (self, request) | Show Metrics Details | Show Metrics Details | def get(self, request):
'''Show Metrics Details'''
if request.user.is_superuser or request.user.is_system_auditor:
metrics_to_show = ''
if not request.query_params.get('subsystemonly', "0") == "1":
metrics_to_show += metrics().decode('UTF-8')
if not re... | [
"def",
"get",
"(",
"self",
",",
"request",
")",
":",
"if",
"request",
".",
"user",
".",
"is_superuser",
"or",
"request",
".",
"user",
".",
"is_system_auditor",
":",
"metrics_to_show",
"=",
"''",
"if",
"not",
"request",
".",
"query_params",
".",
"get",
"(... | [
33,
4
] | [
42,
32
] | python | en | ['en', 'fr', 'en'] | True |
Parameterized.get_params_internal | (self, **tags) |
Internal method to be implemented which does not perform caching
|
Internal method to be implemented which does not perform caching
| def get_params_internal(self, **tags):
"""
Internal method to be implemented which does not perform caching
"""
raise NotImplementedError | [
"def",
"get_params_internal",
"(",
"self",
",",
"*",
"*",
"tags",
")",
":",
"raise",
"NotImplementedError"
] | [
25,
4
] | [
29,
33
] | python | en | ['en', 'error', 'th'] | False |
Parameterized._get_params | (self, **tags) |
Get the list of parameters, filtered by the provided tags.
Some common tags include 'regularizable' and 'trainable'
|
Get the list of parameters, filtered by the provided tags.
Some common tags include 'regularizable' and 'trainable'
| def _get_params(self, **tags):
"""
Get the list of parameters, filtered by the provided tags.
Some common tags include 'regularizable' and 'trainable'
"""
tag_tuple = tuple(sorted(list(tags.items()), key=lambda x: x[0]))
if tag_tuple not in self._cached_params:
... | [
"def",
"_get_params",
"(",
"self",
",",
"*",
"*",
"tags",
")",
":",
"tag_tuple",
"=",
"tuple",
"(",
"sorted",
"(",
"list",
"(",
"tags",
".",
"items",
"(",
")",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"0",
"]",
")",
")",
"if",
"tag... | [
31,
4
] | [
39,
45
] | python | en | ['en', 'error', 'th'] | False |
RestProtocolBase.identify | (self) |
Identifies the target product
Curently _communicate has hardcoded data
|
Identifies the target product
Curently _communicate has hardcoded data
| def identify(self):
"""
Identifies the target product
Curently _communicate has hardcoded data
"""
system = self._communicate("System", "/redfish/v1/Systems")
if 'Dell' in str(system['Data']['System'][0]['Manufacturer']):
return system
else:
... | [
"def",
"identify",
"(",
"self",
")",
":",
"system",
"=",
"self",
".",
"_communicate",
"(",
"\"System\"",
",",
"\"/redfish/v1/Systems\"",
")",
"if",
"'Dell'",
"in",
"str",
"(",
"system",
"[",
"'Data'",
"]",
"[",
"'System'",
"]",
"[",
"0",
"]",
"[",
"'Ma... | [
66,
4
] | [
75,
23
] | python | en | ['en', 'ja', 'th'] | False |
MentionData.get_user_ids | (self) |
Returns the user IDs that might have been mentioned by this
content. Note that because this data structure has not parsed
the message and does not know about escaping/code blocks, this
will overestimate the list of user ids.
|
Returns the user IDs that might have been mentioned by this
content. Note that because this data structure has not parsed
the message and does not know about escaping/code blocks, this
will overestimate the list of user ids.
| def get_user_ids(self) -> Set[int]:
"""
Returns the user IDs that might have been mentioned by this
content. Note that because this data structure has not parsed
the message and does not know about escaping/code blocks, this
will overestimate the list of user ids.
"""
... | [
"def",
"get_user_ids",
"(",
"self",
")",
"->",
"Set",
"[",
"int",
"]",
":",
"return",
"set",
"(",
"self",
".",
"user_id_info",
".",
"keys",
"(",
")",
")"
] | [
133,
4
] | [
140,
44
] | python | en | ['en', 'error', 'th'] | False |
get_modified_streams | (
user_ids: List[int], cutoff_date: datetime.datetime
) | Skipping streams where the user's subscription status has changed
when constructing digests is critical to ensure correctness for
streams without shared history, guest users, and long-term idle
users, because it means that every user has the same view of the
history of a given stream whose message histo... | Skipping streams where the user's subscription status has changed
when constructing digests is critical to ensure correctness for
streams without shared history, guest users, and long-term idle
users, because it means that every user has the same view of the
history of a given stream whose message histo... | def get_modified_streams(
user_ids: List[int], cutoff_date: datetime.datetime
) -> Dict[int, Set[int]]:
"""Skipping streams where the user's subscription status has changed
when constructing digests is critical to ensure correctness for
streams without shared history, guest users, and long-term idle
... | [
"def",
"get_modified_streams",
"(",
"user_ids",
":",
"List",
"[",
"int",
"]",
",",
"cutoff_date",
":",
"datetime",
".",
"datetime",
")",
"->",
"Dict",
"[",
"int",
",",
"Set",
"[",
"int",
"]",
"]",
":",
"events",
"=",
"[",
"RealmAuditLog",
".",
"SUBSCRI... | [
399,
0
] | [
438,
17
] | python | en | ['en', 'en', 'en'] | True |
_attr_key | (attr) | Return an appropriate key for an attribute for sorting
Attributes have a namespace that can be either ``None`` or a string. We
can't compare the two because they're different types, so we convert
``None`` to an empty string first.
| Return an appropriate key for an attribute for sorting | def _attr_key(attr):
"""Return an appropriate key for an attribute for sorting
Attributes have a namespace that can be either ``None`` or a string. We
can't compare the two because they're different types, so we convert
``None`` to an empty string first.
"""
return (attr[0][0] or ''), attr[0][... | [
"def",
"_attr_key",
"(",
"attr",
")",
":",
"return",
"(",
"attr",
"[",
"0",
"]",
"[",
"0",
"]",
"or",
"''",
")",
",",
"attr",
"[",
"0",
"]",
"[",
"1",
"]"
] | [
7,
0
] | [
15,
41
] | python | en | ['en', 'en', 'en'] | True |
get_image_dimensions | (file_or_path, close=False) |
Returns the (width, height) of an image, given an open file or a path. Set
'close' to True to close the file at the end if it is initially in an open
state.
|
Returns the (width, height) of an image, given an open file or a path. Set
'close' to True to close the file at the end if it is initially in an open
state.
| def get_image_dimensions(file_or_path, close=False):
"""
Returns the (width, height) of an image, given an open file or a path. Set
'close' to True to close the file at the end if it is initially in an open
state.
"""
from PIL import ImageFile as PillowImageFile
p = PillowImageFile.Parser(... | [
"def",
"get_image_dimensions",
"(",
"file_or_path",
",",
"close",
"=",
"False",
")",
":",
"from",
"PIL",
"import",
"ImageFile",
"as",
"PillowImageFile",
"p",
"=",
"PillowImageFile",
".",
"Parser",
"(",
")",
"if",
"hasattr",
"(",
"file_or_path",
",",
"'read'",
... | [
32,
0
] | [
79,
31
] | python | en | ['en', 'error', 'th'] | False |
get_upload_to | (instance, filename) |
Obtain a valid upload path for an image file.
This needs to be a module-level function so that it can be referenced within migrations,
but simply delegates to the `get_upload_to` method of the instance, so that AbstractImage
subclasses can override it.
|
Obtain a valid upload path for an image file. | def get_upload_to(instance, filename):
"""
Obtain a valid upload path for an image file.
This needs to be a module-level function so that it can be referenced within migrations,
but simply delegates to the `get_upload_to` method of the instance, so that AbstractImage
subclasses can override it.
... | [
"def",
"get_upload_to",
"(",
"instance",
",",
"filename",
")",
":",
"return",
"instance",
".",
"get_upload_to",
"(",
"filename",
")"
] | [
47,
0
] | [
55,
43
] | python | en | ['en', 'error', 'th'] | False |
get_rendition_upload_to | (instance, filename) |
Obtain a valid upload path for an image rendition file.
This needs to be a module-level function so that it can be referenced within migrations,
but simply delegates to the `get_upload_to` method of the instance, so that AbstractRendition
subclasses can override it.
|
Obtain a valid upload path for an image rendition file. | def get_rendition_upload_to(instance, filename):
"""
Obtain a valid upload path for an image rendition file.
This needs to be a module-level function so that it can be referenced within migrations,
but simply delegates to the `get_upload_to` method of the instance, so that AbstractRendition
subclas... | [
"def",
"get_rendition_upload_to",
"(",
"instance",
",",
"filename",
")",
":",
"return",
"instance",
".",
"get_upload_to",
"(",
"filename",
")"
] | [
58,
0
] | [
66,
43
] | python | en | ['en', 'error', 'th'] | False |
AbstractImage.is_stored_locally | (self) |
Returns True if the image is hosted on the local filesystem
|
Returns True if the image is hosted on the local filesystem
| def is_stored_locally(self):
"""
Returns True if the image is hosted on the local filesystem
"""
try:
self.file.path
return True
except NotImplementedError:
return False | [
"def",
"is_stored_locally",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"file",
".",
"path",
"return",
"True",
"except",
"NotImplementedError",
":",
"return",
"False"
] | [
95,
4
] | [
104,
24
] | python | en | ['en', 'error', 'th'] | False |
AbstractImage.get_rendition_model | (cls) | Get the Rendition model for this Image model | Get the Rendition model for this Image model | def get_rendition_model(cls):
""" Get the Rendition model for this Image model """
return cls.renditions.rel.related_model | [
"def",
"get_rendition_model",
"(",
"cls",
")",
":",
"return",
"cls",
".",
"renditions",
".",
"rel",
".",
"related_model"
] | [
278,
4
] | [
280,
47
] | python | en | ['en', 'en', 'en'] | True |
Filter.get_transform | (self, image) |
Returns an ImageTransform with all the transforms in this filter applied.
The ImageTransform is an object with two attributes:
- .size - The size of the final image
- .matrix - An affine transformation matrix that combines any
transform/scale/rotation operations that need ... |
Returns an ImageTransform with all the transforms in this filter applied. | def get_transform(self, image):
"""
Returns an ImageTransform with all the transforms in this filter applied.
The ImageTransform is an object with two attributes:
- .size - The size of the final image
- .matrix - An affine transformation matrix that combines any
tra... | [
"def",
"get_transform",
"(",
"self",
",",
"image",
")",
":",
"transform",
"=",
"ImageTransform",
"(",
"(",
"image",
".",
"width",
",",
"image",
".",
"height",
")",
")",
"for",
"operation",
"in",
"self",
".",
"transform_operations",
":",
"transform",
"=",
... | [
448,
4
] | [
460,
24
] | python | en | ['en', 'error', 'th'] | False |
AbstractRendition.attrs | (self) |
The src, width, height, and alt attributes for an <img> tag, as a HTML
string
|
The src, width, height, and alt attributes for an <img> tag, as a HTML
string
| def attrs(self):
"""
The src, width, height, and alt attributes for an <img> tag, as a HTML
string
"""
return flatatt(self.attrs_dict) | [
"def",
"attrs",
"(",
"self",
")",
":",
"return",
"flatatt",
"(",
"self",
".",
"attrs_dict",
")"
] | [
565,
4
] | [
570,
39
] | python | en | ['en', 'error', 'th'] | False |
AbstractRendition.attrs_dict | (self) |
A dict of the src, width, height, and alt attributes for an <img> tag.
|
A dict of the src, width, height, and alt attributes for an <img> tag.
| def attrs_dict(self):
"""
A dict of the src, width, height, and alt attributes for an <img> tag.
"""
return OrderedDict([
('src', self.url),
('width', self.width),
('height', self.height),
('alt', self.alt),
]) | [
"def",
"attrs_dict",
"(",
"self",
")",
":",
"return",
"OrderedDict",
"(",
"[",
"(",
"'src'",
",",
"self",
".",
"url",
")",
",",
"(",
"'width'",
",",
"self",
".",
"width",
")",
",",
"(",
"'height'",
",",
"self",
".",
"height",
")",
",",
"(",
"'alt... | [
573,
4
] | [
582,
10
] | python | en | ['en', 'error', 'th'] | False |
AbstractRendition.background_position_style | (self) |
Returns a `background-position` rule to be put in the inline style of an element which uses the rendition for its background.
This positions the rendition according to the value of the focal point. This is helpful for when the element does not have
the same aspect ratio as the rendition.
... |
Returns a `background-position` rule to be put in the inline style of an element which uses the rendition for its background. | def background_position_style(self):
"""
Returns a `background-position` rule to be put in the inline style of an element which uses the rendition for its background.
This positions the rendition according to the value of the focal point. This is helpful for when the element does not have
... | [
"def",
"background_position_style",
"(",
"self",
")",
":",
"focal_point",
"=",
"self",
".",
"focal_point",
"if",
"focal_point",
":",
"horz",
"=",
"int",
"(",
"(",
"focal_point",
".",
"x",
"*",
"100",
")",
"//",
"self",
".",
"width",
")",
"vert",
"=",
"... | [
603,
4
] | [
622,
50
] | python | en | ['en', 'error', 'th'] | False |
get_return_data_type | (func_name) | Return a somewhat-helpful data type given a function name | Return a somewhat-helpful data type given a function name | def get_return_data_type(func_name):
"""Return a somewhat-helpful data type given a function name"""
if func_name.startswith('get_'):
if func_name.endswith('_list'):
return 'List'
elif func_name.endswith('_count'):
return 'Integer'
return '' | [
"def",
"get_return_data_type",
"(",
"func_name",
")",
":",
"if",
"func_name",
".",
"startswith",
"(",
"'get_'",
")",
":",
"if",
"func_name",
".",
"endswith",
"(",
"'_list'",
")",
":",
"return",
"'List'",
"elif",
"func_name",
".",
"endswith",
"(",
"'_count'",... | [
382,
0
] | [
389,
13
] | python | en | ['en', 'en', 'en'] | True |
get_readable_field_data_type | (field) | Returns the description for a given field type, if it exists,
Fields' descriptions can contain format strings, which will be interpolated
against the values of field.__dict__ before being output. | Returns the description for a given field type, if it exists,
Fields' descriptions can contain format strings, which will be interpolated
against the values of field.__dict__ before being output. | def get_readable_field_data_type(field):
"""Returns the description for a given field type, if it exists,
Fields' descriptions can contain format strings, which will be interpolated
against the values of field.__dict__ before being output."""
return field.description % field.__dict__ | [
"def",
"get_readable_field_data_type",
"(",
"field",
")",
":",
"return",
"field",
".",
"description",
"%",
"field",
".",
"__dict__"
] | [
392,
0
] | [
397,
45
] | python | en | ['en', 'en', 'en'] | True |
extract_views_from_urlpatterns | (urlpatterns, base='', namespace=None) |
Return a list of views from a list of urlpatterns.
Each object in the returned list is a two-tuple: (view_func, regex)
|
Return a list of views from a list of urlpatterns. | def extract_views_from_urlpatterns(urlpatterns, base='', namespace=None):
"""
Return a list of views from a list of urlpatterns.
Each object in the returned list is a two-tuple: (view_func, regex)
"""
views = []
for p in urlpatterns:
if hasattr(p, 'url_patterns'):
try:
... | [
"def",
"extract_views_from_urlpatterns",
"(",
"urlpatterns",
",",
"base",
"=",
"''",
",",
"namespace",
"=",
"None",
")",
":",
"views",
"=",
"[",
"]",
"for",
"p",
"in",
"urlpatterns",
":",
"if",
"hasattr",
"(",
"p",
",",
"'url_patterns'",
")",
":",
"try",... | [
400,
0
] | [
426,
16
] | python | en | ['en', 'error', 'th'] | False |
simplify_regex | (pattern) | r"""
Clean up urlpattern regexes into something more readable by humans. For
example, turn "^(?P<sport_slug>\w+)/athletes/(?P<athlete_slug>\w+)/$"
into "/<sport_slug>/athletes/<athlete_slug>/".
| r"""
Clean up urlpattern regexes into something more readable by humans. For
example, turn "^(?P<sport_slug>\w+)/athletes/(?P<athlete_slug>\w+)/$"
into "/<sport_slug>/athletes/<athlete_slug>/".
| def simplify_regex(pattern):
r"""
Clean up urlpattern regexes into something more readable by humans. For
example, turn "^(?P<sport_slug>\w+)/athletes/(?P<athlete_slug>\w+)/$"
into "/<sport_slug>/athletes/<athlete_slug>/".
"""
pattern = replace_named_groups(pattern)
pattern = replace_unnamed... | [
"def",
"simplify_regex",
"(",
"pattern",
")",
":",
"pattern",
"=",
"replace_named_groups",
"(",
"pattern",
")",
"pattern",
"=",
"replace_unnamed_groups",
"(",
"pattern",
")",
"# clean up any outstanding regex-y characters.",
"pattern",
"=",
"pattern",
".",
"replace",
... | [
429,
0
] | [
441,
18
] | python | cy | ['en', 'cy', 'hi'] | False |
feed | (request, url, feed_dict=None) | Provided for backwards compatibility. | Provided for backwards compatibility. | def feed(request, url, feed_dict=None):
"""Provided for backwards compatibility."""
if not feed_dict:
raise Http404(_("No feeds are registered."))
slug = url.partition('/')[0]
try:
f = feed_dict[slug]
except KeyError:
raise Http404(_("Slug %r isn't registered.") % slug)
... | [
"def",
"feed",
"(",
"request",
",",
"url",
",",
"feed_dict",
"=",
"None",
")",
":",
"if",
"not",
"feed_dict",
":",
"raise",
"Http404",
"(",
"_",
"(",
"\"No feeds are registered.\"",
")",
")",
"slug",
"=",
"url",
".",
"partition",
"(",
"'/'",
")",
"[",
... | [
6,
0
] | [
21,
28
] | python | en | ['en', 'en', 'en'] | True |
RandomDiscretizedProjections.__init__ | (self, hash_name, projection_count, bin_width, rand_seed=None) |
Creates projection_count random vectors, that are used for projections.
Each random vector will result in one discretized coordinate.
So if you for example decide to use projection_count=3, the bucket
keys will have 3 coordinates and look like '14_4_1' or '-4_18_-1'.
|
Creates projection_count random vectors, that are used for projections.
Each random vector will result in one discretized coordinate. | def __init__(self, hash_name, projection_count, bin_width, rand_seed=None):
"""
Creates projection_count random vectors, that are used for projections.
Each random vector will result in one discretized coordinate.
So if you for example decide to use projection_count=3, the bucket
... | [
"def",
"__init__",
"(",
"self",
",",
"hash_name",
",",
"projection_count",
",",
"bin_width",
",",
"rand_seed",
"=",
"None",
")",
":",
"super",
"(",
"RandomDiscretizedProjections",
",",
"self",
")",
".",
"__init__",
"(",
"hash_name",
")",
"self",
".",
"projec... | [
36,
4
] | [
50,
31
] | python | en | ['en', 'error', 'th'] | False |
RandomDiscretizedProjections.reset | (self, dim) | Resets / Initializes the hash for the specified dimension. | Resets / Initializes the hash for the specified dimension. | def reset(self, dim):
""" Resets / Initializes the hash for the specified dimension. """
if self.dim != dim:
self.dim = dim
self.normals = self.rand.randn(self.projection_count, dim) | [
"def",
"reset",
"(",
"self",
",",
"dim",
")",
":",
"if",
"self",
".",
"dim",
"!=",
"dim",
":",
"self",
".",
"dim",
"=",
"dim",
"self",
".",
"normals",
"=",
"self",
".",
"rand",
".",
"randn",
"(",
"self",
".",
"projection_count",
",",
"dim",
")"
] | [
52,
4
] | [
56,
70
] | python | en | ['en', 'en', 'en'] | True |
RandomDiscretizedProjections.hash_vector | (self, v, querying=False) |
Hashes the vector and returns the binary bucket key as string.
|
Hashes the vector and returns the binary bucket key as string.
| def hash_vector(self, v, querying=False):
"""
Hashes the vector and returns the binary bucket key as string.
"""
if scipy.sparse.issparse(v):
# If vector is sparse, make sure we have the CSR representation
# of the projection matrix
if self.normals_csr... | [
"def",
"hash_vector",
"(",
"self",
",",
"v",
",",
"querying",
"=",
"False",
")",
":",
"if",
"scipy",
".",
"sparse",
".",
"issparse",
"(",
"v",
")",
":",
"# If vector is sparse, make sure we have the CSR representation",
"# of the projection matrix",
"if",
"self",
... | [
58,
4
] | [
77,
60
] | python | en | ['en', 'error', 'th'] | False |
RandomDiscretizedProjections.get_config | (self) |
Returns pickle-serializable configuration struct for storage.
|
Returns pickle-serializable configuration struct for storage.
| def get_config(self):
"""
Returns pickle-serializable configuration struct for storage.
"""
# Fill this dict with config data
return {
'hash_name': self.hash_name,
'dim': self.dim,
'bin_width': self.bin_width,
'projection_count': se... | [
"def",
"get_config",
"(",
"self",
")",
":",
"# Fill this dict with config data",
"return",
"{",
"'hash_name'",
":",
"self",
".",
"hash_name",
",",
"'dim'",
":",
"self",
".",
"dim",
",",
"'bin_width'",
":",
"self",
".",
"bin_width",
",",
"'projection_count'",
"... | [
79,
4
] | [
90,
9
] | python | en | ['en', 'error', 'th'] | False |
RandomDiscretizedProjections.apply_config | (self, config) |
Applies config
|
Applies config
| def apply_config(self, config):
"""
Applies config
"""
self.hash_name = config['hash_name']
self.dim = config['dim']
self.bin_width = config['bin_width']
self.projection_count = config['projection_count']
self.normals = config['normals'] | [
"def",
"apply_config",
"(",
"self",
",",
"config",
")",
":",
"self",
".",
"hash_name",
"=",
"config",
"[",
"'hash_name'",
"]",
"self",
".",
"dim",
"=",
"config",
"[",
"'dim'",
"]",
"self",
".",
"bin_width",
"=",
"config",
"[",
"'bin_width'",
"]",
"self... | [
92,
4
] | [
100,
40
] | python | en | ['en', 'error', 'th'] | False |
SettingModuleProxy.__getitem__ | (self, model_name) | Get a setting instance for a model | Get a setting instance for a model | def __getitem__(self, model_name):
""" Get a setting instance for a model """
# Model names are treated as case-insensitive
return super().__getitem__(model_name.lower()) | [
"def",
"__getitem__",
"(",
"self",
",",
"model_name",
")",
":",
"# Model names are treated as case-insensitive",
"return",
"super",
"(",
")",
".",
"__getitem__",
"(",
"model_name",
".",
"lower",
"(",
")",
")"
] | [
32,
4
] | [
35,
54
] | python | en | ['en', 'en', 'en'] | True |
SettingModuleProxy.__missing__ | (self, model_name) | Get and cache settings that have not been looked up yet | Get and cache settings that have not been looked up yet | def __missing__(self, model_name):
""" Get and cache settings that have not been looked up yet """
self[model_name] = value = self.get_setting(model_name)
return value | [
"def",
"__missing__",
"(",
"self",
",",
"model_name",
")",
":",
"self",
"[",
"model_name",
"]",
"=",
"value",
"=",
"self",
".",
"get_setting",
"(",
"model_name",
")",
"return",
"value"
] | [
37,
4
] | [
40,
20
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.