mirror of https://github.com/pyodide/pyodide.git
DOCS Fix warnings and errors when building docs (#1891)
This commit is contained in:
parent
34e985c81a
commit
710225896f
|
@ -19,7 +19,7 @@ substitutions:
|
|||
error, it will return an empty list instead of raising a `SyntaxError`.
|
||||
{pr}`1819`
|
||||
|
||||
- {{Enhancement}} Added a {ref}`pyodide.http.pyfetch` API which provides a
|
||||
- {{Enhancement}} Added a {any}`pyodide.http.pyfetch` API which provides a
|
||||
convenience wrapper for the Javascript `fetch` API. The API returns a response
|
||||
object with various methods that convert the data into various types while
|
||||
minimizing the number of times the data is copied.
|
||||
|
|
|
@ -36,7 +36,7 @@ JavaScript to Python translations occur:
|
|||
Any time a Python to JavaScript translation occurs, it may create a
|
||||
{any}`PyProxy`. To avoid memory leaks, you must store the {any}`PyProxy` and
|
||||
{any}`destroy <PyProxy.destroy>` it when you are done with it. See
|
||||
{ref}`avoiding-leaks` for more info.
|
||||
{ref}`call-py-from-js` for more info.
|
||||
```
|
||||
|
||||
## Round trip conversions
|
||||
|
@ -219,7 +219,7 @@ following operations are supported:
|
|||
:class: warning
|
||||
|
||||
Make sure to destroy PyProxies when you are done with them to avoid memory leaks.
|
||||
See {ref}`avoiding-leaks`.
|
||||
|
||||
```javascript
|
||||
let foo = pyodide.globals.get('foo');
|
||||
foo();
|
||||
|
@ -333,6 +333,8 @@ will be thrown.
|
|||
|
||||
## Functions
|
||||
|
||||
(call-py-from-js)=
|
||||
|
||||
### Calling Python objects from JavaScript
|
||||
|
||||
If a Python object is callable, the proxy will be callable too. The arguments
|
||||
|
|
|
@ -8,6 +8,7 @@ export { loadPackage, loadedPackages, isPyProxy };
|
|||
* @typedef {import('./pyproxy.gen').PyProxy} PyProxy
|
||||
* @typedef {import('./pyproxy.gen').TypedArray} TypedArray
|
||||
* @typedef {import('emscripten')} Emscripten
|
||||
* @typedef {import('emscripten').Module.FS} FS
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -340,7 +341,7 @@ export function makePublicAPI() {
|
|||
* are available as members of ``FS.filesystems``:
|
||||
* ``IDBFS``, ``NODEFS``, ``PROXYFS``, ``WORKERFS``.
|
||||
*
|
||||
* @type {FS} The Emscripten File System API.
|
||||
* @type {FS}
|
||||
*/
|
||||
const FS = Module.FS;
|
||||
let namespace = {
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
/**
|
||||
* @typedef {import('emscripten').Module} Module
|
||||
*/
|
||||
|
||||
/**
|
||||
* The Emscripten Module.
|
||||
*
|
||||
* @private @type {import('emscripten').Module}
|
||||
* @private
|
||||
* @type {Module}
|
||||
*/
|
||||
export let Module = {};
|
||||
Module.noImageDecoding = true;
|
||||
|
@ -11,9 +16,9 @@ Module.preloadedWasm = {};
|
|||
|
||||
/**
|
||||
*
|
||||
* @param {undefined|(() => string)} stdin
|
||||
* @param {undefined|((text: string) => void)} stdout
|
||||
* @param {undefined|((text: string) => void)} stderr
|
||||
* @param {undefined | function(): string} stdin
|
||||
* @param {undefined | function(string)} stdout
|
||||
* @param {undefined | function(string)} stderr
|
||||
*/
|
||||
export function setStandardStreams(stdin, stdout, stderr) {
|
||||
// For stdout and stderr, emscripten provides convenient wrappers that save us the trouble of converting the bytes into a string
|
||||
|
|
|
@ -166,17 +166,16 @@ function fixRecursionLimit() {
|
|||
* (This can be fixed once `Firefox adopts support for ES6 modules in webworkers
|
||||
* <https://bugzilla.mozilla.org/show_bug.cgi?id=1247687>`_.)
|
||||
*
|
||||
* @param {{ indexURL : string, fullStdLib? : boolean = true, stdin?: () => string, stdout?: (text: string) => void, stderr?: (text: string) => void }} config
|
||||
* @param {string} config.indexURL - The URL from which Pyodide will load
|
||||
* packages
|
||||
* @param {boolean} config.fullStdLib - Load the full Python standard library.
|
||||
* Setting this to false excludes following modules: distutils.
|
||||
* Default: true
|
||||
* @param {undefined | (() => string)} config.stdin - Override the standard input callback. Should ask the user for one line of input.
|
||||
* @param {undefined | function(): string} config.stdin - Override the standard input callback. Should ask the user for one line of input.
|
||||
* Default: undefined
|
||||
* @param {undefined | ((text: string) => void)} config.stdout - Override the standard output callback.
|
||||
* @param {undefined | function(string)} config.stdout - Override the standard output callback.
|
||||
* Default: undefined
|
||||
* @param {undefined | ((text: string) => void)} config.stderr - Override the standard error output callback.
|
||||
* @param {undefined | function(string)} config.stderr - Override the standard error output callback.
|
||||
* Default: undefined
|
||||
* @returns The :ref:`js-api-pyodide` module.
|
||||
* @memberof globalThis
|
||||
|
|
|
@ -13,6 +13,12 @@ from ._core import IN_BROWSER
|
|||
if IN_BROWSER:
|
||||
from js import fetch as _jsfetch, Object
|
||||
|
||||
__all__ = [
|
||||
"open_url",
|
||||
"pyfetch",
|
||||
"FetchResponse",
|
||||
]
|
||||
|
||||
|
||||
def open_url(url: str) -> StringIO:
|
||||
"""Fetches a given URL synchronously.
|
||||
|
@ -156,7 +162,7 @@ async def pyfetch(url, **kwargs) -> FetchResponse:
|
|||
|
||||
Parameters
|
||||
----------
|
||||
url URL to fetch. **kwargs Any keyword arguments are passed along as
|
||||
url URL to fetch. \*\*kwargs Any keyword arguments are passed along as
|
||||
`optional parameters to the fetch API
|
||||
<https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters>`_.
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue