sphinx_gallery.docs_resolv¶
Link resolver objects¶
Functions¶
-
sphinx_gallery.docs_resolv.
embed_code_links
(app, exception)¶ Embed hyperlinks to documentation into example code
-
sphinx_gallery.docs_resolv.
get_data
(url, gallery_dir)¶ Persistent dictionary usage to retrieve the search indexes
-
sphinx_gallery.docs_resolv.
parse_sphinx_docopts
(index)¶ Parse the Sphinx index for documentation options.
Parameters: index (str) – The Sphinx index page Returns: docopts – The documentation options from the page. Return type: dict
Classes¶
-
class
sphinx_gallery.docs_resolv.
BytesIO
([buffer]) → object¶ Create a buffered I/O implementation using an in-memory bytes buffer, ready for reading and writing.
-
close
() → None. Disable all I/O operations.¶
-
closed
¶ True if the file is closed.
-
flush
() → None. Does nothing.¶
-
getvalue
() → bytes.¶ Retrieve the entire contents of the BytesIO object.
-
isatty
() → False.¶ Always returns False since BytesIO objects are not connected to a tty-like device.
-
next
¶
-
read
([size]) → read at most size bytes, returned as a string.¶ If the size argument is negative, read until EOF is reached. Return an empty string at EOF.
-
read1
(size) → read at most size bytes, returned as a string.¶ If the size argument is negative or omitted, read until EOF is reached. Return an empty string at EOF.
-
readable
() → bool. Returns True if the IO object can be read.¶
-
readinto
(b) → int. Read up to len(b) bytes into b.¶ Returns number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read.
-
readline
([size]) → next line from the file, as a string.¶ Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF.
-
readlines
([size]) → list of strings, each a line from the file.¶ Call readline() repeatedly and return a list of the lines so read. The optional size argument, if given, is an approximate bound on the total number of bytes in the lines returned.
-
seek
(pos[, whence]) → int. Change stream position.¶ - Seek to byte offset pos relative to position indicated by whence:
- 0 Start of stream (the default). pos should be >= 0; 1 Current position - pos may be negative; 2 End of stream - pos usually negative.
Returns the new absolute position.
-
seekable
() → bool. Returns True if the IO object can be seeked.¶
-
tell
() → current file position, an integer¶
-
truncate
([size]) → int. Truncate the file to at most size bytes.¶ Size defaults to the current file position, as returned by tell(). The current file position is unchanged. Returns the new size.
-
writable
() → bool. Returns True if the IO object can be written.¶
-
write
(bytes) → int. Write bytes to file.¶ Return the number of bytes written.
-
writelines
(sequence_of_strings) → None. Write strings to the file.¶ Note that newlines are not added. The sequence can be any iterable object producing strings. This is equivalent to calling write() for each string.
-
-
class
sphinx_gallery.docs_resolv.
SphinxDocLinkResolver
(doc_url, gallery_dir, relative=False)¶ Resolve documentation links using searchindex.js generated by Sphinx
Parameters: - doc_url (str) – The base URL of the project website.
- relative (bool) – Return relative links (only useful for links to documentation of this package).
-
resolve
(cobj, this_url)¶ Resolve the link to the documentation, returns None if not found
Parameters: - cobj (dict) – Dict with information about the “code object” for which we are resolving a link. cobj[‘name’] : function or class name (str) cobj[‘module_short’] : shortened module name (str) cobj[‘module’] : module name (str)
- this_url (str) – URL of the current page. Needed to construct relative URLs (only used if relative=True in constructor).
Returns: link – The link (URL) to the documentation.
Return type: str | None
Exceptions¶
HTTPError (url, code, msg, hdrs, fp) |
Raised when HTTP error occurs, but also acts like non-error return |
URLError (reason) |