bootstraparse/apidoc/bootstraparse.modules.conte...

1152 lines
36 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html>
<head>
<title>bootstraparse.modules.context_mngr.ContextManager</title>
<meta name="generator" content="pydoctor 22.5.1">
</meta>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1" />
<link rel="stylesheet" type="text/css" href="bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="apidocs.css" />
<link rel="stylesheet" type="text/css" href="extra.css" />
</head>
<body>
<nav class="navbar navbar-default mainnavbar">
<div class="container-fluid">
<div class="navbar-header">
<div class="navlinks">
<span class="navbar-brand">
bootstraparse <a href="index.html">API Documentation</a>
</span>
<a href="moduleIndex.html">
Modules
</a>
<a href="classIndex.html">
Classes
</a>
<a href="nameIndex.html">
Names
</a>
<div id="search-box-container">
<div class="input-group">
<input id="search-box" type="search" name="search-query" placeholder="Search..." aria-label="Search" minlength="2" class="form-control" autocomplete="off" />
<span class="input-group-btn">
<a style="display: none;" class="btn btn-default" id="search-clear-button" title="Clear" onclick="clearSearch()"><img src="fonts/x-circle.svg" alt="Clear" /></a>
<a class="btn btn-default" id="search-help-button" title="Help" onclick="toggleSearchHelpText()"><img src="fonts/info.svg" alt="Help" /></a>
</span>
</div>
</div>
</div>
<div id="search-results-container" style="display: none;">
<div id="search-buttons">
<span class="label label-default" id="search-docstrings-button">
<label class="checkbox-inline">
<input type="checkbox" id="toggle-search-in-docstrings-checkbox" value="false" onclick="toggleSearchInDocstrings()">
search in docstrings
</input>
</label>
</span>
</div>
<noscript>
<h1>Cannot search: JavaScript is not supported/enabled in your browser.</h1>
</noscript>
<div class="hint" id="search-help-box">
<p class="rst-last">
Search bar offers the following options:
<ul>
<li>
<strong>Term presence.</strong> The below example searches for documents that
must contain “foo”, might contain “bar” and must not contain “baz”: <code>+foo bar -baz</code>
</li>
<li>
<strong>Wildcards.</strong> The below example searches for documents with words beginning with “foo”: <code>foo*</code>
</li>
<li>
<strong>Search in specific fields.</strong> The following search matches all objects
in "twisted.mail" that matches “search”: <code>+qname:twisted.mail.* +search</code>
<p>
Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'.
Last two fields are only applicable if "search in docstrings" is enabled.
</p>
</li>
<li>
<strong>Fuzzy matches.</strong> The following search matches all documents
that have a word within 1 edit distance of “foo”: <code>foo~1</code>
</li>
</ul>
</p>
</div>
<div id="search-status"> </div>
<div class="warning" id="search-warn-box" style="display: none;">
<p class="rst-last"><span id="search-warn"></span></p>
</div>
<table id="search-results">
<!-- Filled dynamically by JS -->
</table>
<div style="margin-top: 8px;">
<p>Results provided by <a href="https://lunrjs.com">Lunr.js</a></p>
</div>
</div>
</div>
</div>
</nav>
<div class="container-fluid">
<!-- Side navigation -->
<div class="sidebarcontainer" style="display: none;">
<div class="sidebar"><nav class="sidebar">
<div>
<div class="thingTitle">
<span>Class</span>
<code class="thisobject"><a href="bootstraparse.modules.context_mngr.ContextManager.html" class="internal-link" title="This class"><wbr></wbr>Context<wbr></wbr>Manager</a></code>
</div>
<div>
<div class="childrenKindTitle">Methods</div>
<ul>
<li class="">
<div class="itemName"><code><a href="#__call__" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.__call__">__call__</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#__init__" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.__init__">__init__</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#__iter__" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.__iter__">__iter__</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#encapsulate" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.encapsulate">encapsulate</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#finalize_pile" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.finalize_pile">finalize<wbr></wbr>_pile</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#get_last_container_in_pile" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.get_last_container_in_pile">get<wbr></wbr>_last<wbr></wbr>_container<wbr></wbr>_in<wbr></wbr>_pile</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#lookahead" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.lookahead">lookahead</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#print_all" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.print_all">print<wbr></wbr>_all</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#recontext" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.recontext">recontext</a></code>
</div>
</li><li class="private">
<div class="itemName"><code><a href="#_add_matched" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager._add_matched">_add<wbr></wbr>_matched</a></code>
</div>
</li><li class="private">
<div class="itemName"><code><a href="#_get_matched" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager._get_matched">_get<wbr></wbr>_matched</a></code>
</div>
</li>
</ul>
<div class="childrenKindTitle">Attributes</div>
<ul>
<li class="">
<div class="itemName"><code><a href="#contextualised" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.contextualised">contextualised</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#dict_lookahead" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.dict_lookahead">dict<wbr></wbr>_lookahead</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#ident" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.ident">ident</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#matched_elements" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.matched_elements">matched<wbr></wbr>_elements</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#name" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.name">name</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#output" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.output">output</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#parsed_list" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.parsed_list">parsed<wbr></wbr>_list</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#pile" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.pile">pile</a></code>
</div>
</li>
</ul>
</div>
</div><div>
<div class="thingTitle">
<span>Module</span>
<code><a href="bootstraparse.modules.context_mngr.html" class="internal-link" title="The parent of this class">context<wbr></wbr>_mngr</a></code>
</div>
<div>
<div class="childrenKindTitle">Classes</div>
<ul>
<li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.BaseContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.BaseContainer"><wbr></wbr>Base<wbr></wbr>Container</a></code>
</div>
</li><li class=" thisobject">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.ContextManager.html" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager"><wbr></wbr>Context<wbr></wbr>Manager</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.DisplayContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.DisplayContainer"><wbr></wbr>Display<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.EtCustomSpanContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.EtCustomSpanContainer"><wbr></wbr>Et<wbr></wbr>Custom<wbr></wbr>Span<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.EtEmContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.EtEmContainer"><wbr></wbr>Et<wbr></wbr>Em<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.EtOlistContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.EtOlistContainer"><wbr></wbr>Et<wbr></wbr>Olist<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.EtStrikethroughContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.EtStrikethroughContainer"><wbr></wbr>Et<wbr></wbr>Strikethrough<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.EtStrongContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.EtStrongContainer"><wbr></wbr>Et<wbr></wbr>Strong<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.EtUlistContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.EtUlistContainer"><wbr></wbr>Et<wbr></wbr>Ulist<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.EtUnderlineContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.EtUnderlineContainer"><wbr></wbr>Et<wbr></wbr>Underline<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.HeaderContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.HeaderContainer"><wbr></wbr>Header<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.HyperLinkContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.HyperLinkContainer"><wbr></wbr>Hyper<wbr></wbr>Link<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.LinebreakContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.LinebreakContainer"><wbr></wbr>Linebreak<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.ReContextContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.ReContextContainer"><wbr></wbr>Re<wbr></wbr>Context<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.SeContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.SeContainer"><wbr></wbr>Se<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.TableCellContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.TableCellContainer"><wbr></wbr>Table<wbr></wbr>Cell<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.TableRowContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.TableRowContainer"><wbr></wbr>Table<wbr></wbr>Row<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.TableSeparatorContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.TableSeparatorContainer"><wbr></wbr>Table<wbr></wbr>Separator<wbr></wbr>Container</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.TextContainer.html" class="internal-link" title="bootstraparse.modules.context_mngr.TextContainer"><wbr></wbr>Text<wbr></wbr>Container</a></code>
</div>
</li>
</ul>
<div class="childrenKindTitle">Variables</div>
<ul>
<li class="private">
<div class="itemName"><code><a href="bootstraparse.modules.context_mngr.html#_to_container" class="internal-link" title="bootstraparse.modules.context_mngr._to_container">_to<wbr></wbr>_container</a></code>
</div>
</li>
</ul>
</div>
</div>
</nav>
</div>
<div id="collapseSideBar">
<a class="btn btn-link" onclick="toggleSideBarCollapse()" title="Toggle Sidebar Collapse">
</a>
</div>
<script src="sidebartoggle.js" type="text/javascript"></script>
</div>
<div id="main" class="">
<div class="page-header">
<h1 class="class"><code><code><a href="index.html" class="internal-link">bootstraparse</a></code><wbr></wbr>.<code><a href="bootstraparse.modules.html" class="internal-link" title="bootstraparse.modules">modules</a></code><wbr></wbr>.<code><a href="bootstraparse.modules.context_mngr.html" class="internal-link" title="bootstraparse.modules.context_mngr">context_mngr</a></code><wbr></wbr>.<code><a href="bootstraparse.modules.context_mngr.ContextManager.html" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager">ContextManager</a></code></code></h1>
<div id="showPrivate">
<button class="btn btn-link" onclick="togglePrivate()">Toggle Private API</button>
</div>
</div>
<div class="categoryHeader">
class documentation
</div>
<div class="extrasDocstring">
<p><code><span class="py-keyword">class</span> <span class="py-defname">ContextManager</span>:</code></p>
<p><a href="classIndex.html#bootstraparse.modules.context_mngr.ContextManager">View In Hierarchy</a></p>
</div>
<div class="moduleDocstring">
<div><p>Class in charge of piling all the parsed elements and then encapsulating them inside one another.</p>
</div>
</div>
<div id="splitTables">
<table class="children sortable" id="id43">
<tr class="method">
<td>Method</td>
<td><code><a href="#__call__" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.__call__">__call__</a></code></td>
<td>Interprets the list of tokens provided and deduces context, encapsulating them to their closest neighbour and containing all tokens inbetween. :rtype: list[BaseContainer] :return: Returns the pile entirely processed as a list of containers...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#__init__" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.__init__">__init__</a></code></td>
<td>Takes a list of parsed tokens. :type parsed_list : list[syntax.SemanticType] :param parsed_list: List of parsed tokens output by our parser. :type name: str :param name: Name of the file being parsed. ...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#__iter__" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.__iter__">__iter__</a></code></td>
<td>Iterator over the pile. :ytype: BaseContainer</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#encapsulate" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.encapsulate">encapsulate</a></code></td>
<td>Method to encapsulate a number of tokens together as a final container object and replace all elements in the pile with None, except the first one which becomes the container. :type start : int :param start: Index of the pile where the encapsulation must begin...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#finalize_pile" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.finalize_pile">finalize<wbr></wbr>_pile</a></code></td>
<td>Function for cleaning up of the pile after full contextualisation. Removes Nones and checks for any errors or illogical containers. :return: list[BaseContainer]</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#get_last_container_in_pile" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.get_last_container_in_pile">get<wbr></wbr>_last<wbr></wbr>_container<wbr></wbr>_in<wbr></wbr>_pile</a></code></td>
<td>Returns the last element in the pile if it is a Container, raises an error otherwise. :type index : int :param index: Index of the element to check. :return: Last element in the pile if it is a Container, raises an error otherwise...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#lookahead" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.lookahead">lookahead</a></code></td>
<td>Iterates the pile beginning from index and looks for all tokens matching labels with token. :type token : syntax.BaseContainer :param token: Token to look for. :type index : int :param index: Index of the token in the pile...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#print_all" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.print_all">print<wbr></wbr>_all</a></code></td>
<td>Prints the pile.</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#recontext" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.recontext">recontext</a></code></td>
<td>Function to recontextualise the content of a token. :param token: Token to recontextualise. :type token: syntax.SemanticType :return: Token to recontextualise. :rtype: syntax.SemanticType</td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#contextualised" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.contextualised">contextualised</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#dict_lookahead" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.dict_lookahead">dict<wbr></wbr>_lookahead</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#ident" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.ident">ident</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#matched_elements" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.matched_elements">matched<wbr></wbr>_elements</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#name" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.name">name</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#output" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.output">output</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#parsed_list" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.parsed_list">parsed<wbr></wbr>_list</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#pile" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager.pile">pile</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="method private">
<td>Method</td>
<td><code><a href="#_add_matched" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager._add_matched">_add<wbr></wbr>_matched</a></code></td>
<td>Method to add a matched element to the dictionary of matched elements. :type label : str :param label: Label of the matched element. :type index: int :param index: Index of the matched element in the pile.</td>
</tr><tr class="method private">
<td>Method</td>
<td><code><a href="#_get_matched" class="internal-link" title="bootstraparse.modules.context_mngr.ContextManager._get_matched">_get<wbr></wbr>_matched</a></code></td>
<td>Method to get the index of the last matched element of a given label. :type label: str :param label: Label of the matched element. :rtype: int :return: Index of the last matched element</td>
</tr>
</table>
</div>
<div id="childList">
<div class="basemethod">
<a name="bootstraparse.modules.context_mngr.ContextManager.__call__">
</a>
<a name="__call__">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">__call__</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Interprets the list of tokens provided and deduces context, encapsulating them to their closest neighbour and containing all tokens inbetween. :rtype: list[BaseContainer] :return: Returns the pile entirely processed as a list of containers. :raises: MismatchedContainerError if a container is not matched to its corresponding token.</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.context_mngr.ContextManager.__init__">
</a>
<a name="__init__">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">__init__</span>(self, parsed_list, name=None, ident=0):
</div>
<div class="docstring functionBody">
<div><p>Takes a list of parsed tokens. :type parsed_list : list[syntax.SemanticType] :param parsed_list: List of parsed tokens output by our parser. :type name: str :param name: Name of the file being parsed. :type ident: int :param ident: Number of spaces to indent the output.</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.context_mngr.ContextManager.__iter__">
</a>
<a name="__iter__">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">__iter__</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Iterator over the pile. :ytype: BaseContainer</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.context_mngr.ContextManager.encapsulate">
</a>
<a name="encapsulate">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">encapsulate</span>(self, start, end):
</div>
<div class="docstring functionBody">
<div><p>Method to encapsulate a number of tokens together as a final container object and replace all elements in the pile with None, except the first one which becomes the container. :type start : int :param start: Index of the pile where the encapsulation must begin. :type end: int :param end: Index of the pile where the encapsulation must end. :rtype: list[(BaseContainer|None)] :return: List of containers and None objects.</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.context_mngr.ContextManager.finalize_pile">
</a>
<a name="finalize_pile">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">finalize_pile</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Function for cleaning up of the pile after full contextualisation. Removes Nones and checks for any errors or illogical containers. :return: list[BaseContainer]</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.context_mngr.ContextManager.get_last_container_in_pile">
</a>
<a name="get_last_container_in_pile">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">get_last_container_in_pile</span>(self, index):
</div>
<div class="docstring functionBody">
<div><p>Returns the last element in the pile if it is a Container, raises an error otherwise. :type index : int :param index: Index of the element to check. :return: Last element in the pile if it is a Container, raises an error otherwise. :rtype: BaseContainer :raise: error_mngr.LonelyOptionalError when an element is found in the pile that is not encapsulated in a container.</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.context_mngr.ContextManager.lookahead">
</a>
<a name="lookahead">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">lookahead</span>(self, token, index):
</div>
<div class="docstring functionBody">
<div><p>Iterates the pile beginning from index and looks for all tokens matching labels with token. :type token : syntax.BaseContainer :param token: Token to look for. :type index : int :param index: Index of the token in the pile. :return: (number of tokens matched, number of linebreaks) :rtype: (int, int)</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.context_mngr.ContextManager.print_all">
</a>
<a name="print_all">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">print_all</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Prints the pile.</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.context_mngr.ContextManager.recontext">
</a>
<a name="recontext">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">recontext</span>(self, token):
</div>
<div class="docstring functionBody">
<div><p>Function to recontextualise the content of a token. :param token: Token to recontextualise. :type token: syntax.SemanticType :return: Token to recontextualise. :rtype: syntax.SemanticType</p>
</div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.context_mngr.ContextManager.contextualised">
</a>
<a name="contextualised">
</a>
<div class="functionHeader">
<span class="py-defname">contextualised</span>: <code>bool</code> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.context_mngr.ContextManager.dict_lookahead">
</a>
<a name="dict_lookahead">
</a>
<div class="functionHeader">
<span class="py-defname">dict_lookahead</span>: <code>dict</code> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.context_mngr.ContextManager.ident">
</a>
<a name="ident">
</a>
<div class="functionHeader">
<span class="py-defname">ident</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.context_mngr.ContextManager.matched_elements">
</a>
<a name="matched_elements">
</a>
<div class="functionHeader">
<span class="py-defname">matched_elements</span>: <code>dict</code> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.context_mngr.ContextManager.name">
</a>
<a name="name">
</a>
<div class="functionHeader">
<span class="py-defname">name</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.context_mngr.ContextManager.output">
</a>
<a name="output">
</a>
<div class="functionHeader">
<span class="py-defname">output</span>: <code>list</code> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.context_mngr.ContextManager.parsed_list">
</a>
<a name="parsed_list">
</a>
<div class="functionHeader">
<span class="py-defname">parsed_list</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.context_mngr.ContextManager.pile">
</a>
<a name="pile">
</a>
<div class="functionHeader">
<span class="py-defname">pile</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="basemethod private">
<a name="bootstraparse.modules.context_mngr.ContextManager._add_matched">
</a>
<a name="_add_matched">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">_add_matched</span>(self, label, index):
</div>
<div class="docstring functionBody">
<div><p>Method to add a matched element to the dictionary of matched elements. :type label : str :param label: Label of the matched element. :type index: int :param index: Index of the matched element in the pile.</p>
</div>
</div>
</div><div class="basemethod private">
<a name="bootstraparse.modules.context_mngr.ContextManager._get_matched">
</a>
<a name="_get_matched">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">_get_matched</span>(self, label):
</div>
<div class="docstring functionBody">
<div><p>Method to get the index of the last matched element of a given label. :type label: str :param label: Label of the matched element. :rtype: int :return: Index of the last matched element</p>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="navbar navbar-default">
<div class="container">
<a href="index.html">API Documentation</a> for bootstraparse,
generated by <a href="https://github.com/twisted/pydoctor/">pydoctor</a>
22.5.1 at 2022-06-15 22:32:36.
</div>
<!-- Search related scripts needs to be loaded at the end of HTML
parsing not to introduce overhead and display HTML data asap -->
<script src="ajax.js" type="text/javascript"></script>
<script src="searchlib.js" type="text/javascript"></script>
<script src="search.js" type="text/javascript"></script>
</footer>
<script src="pydoctor.js" type="text/javascript"></script>
</body>
</html>