bootstraparse/apidoc/bootstraparse.modules.prepa...

1554 lines
50 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.preparser.PreParser</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.preparser.PreParser.html" class="internal-link" title="This class"><wbr></wbr>Pre<wbr></wbr>Parser</a></code>
</div>
<div>
<div class="childrenKindTitle">Methods</div>
<ul>
<li class="">
<div class="itemName"><code><a href="#make_replacements" class="internal-link" title="bootstraparse.modules.preparser.PreParser.make_replacements">make<wbr></wbr>_replacements</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#__eq__" class="internal-link" title="bootstraparse.modules.preparser.PreParser.__eq__">__eq__</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#__init__" class="internal-link" title="bootstraparse.modules.preparser.PreParser.__init__">__init__</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#__ne__" class="internal-link" title="bootstraparse.modules.preparser.PreParser.__ne__">__ne__</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#__repr__" class="internal-link" title="bootstraparse.modules.preparser.PreParser.__repr__">__repr__</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#__str__" class="internal-link" title="bootstraparse.modules.preparser.PreParser.__str__">__str__</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#do_imports" class="internal-link" title="bootstraparse.modules.preparser.PreParser.do_imports">do<wbr></wbr>_imports</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#do_replacements" class="internal-link" title="bootstraparse.modules.preparser.PreParser.do_replacements">do<wbr></wbr>_replacements</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#export_with_imports" class="internal-link" title="bootstraparse.modules.preparser.PreParser.export_with_imports">export<wbr></wbr>_with<wbr></wbr>_imports</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#get_alias_from_config" class="internal-link" title="bootstraparse.modules.preparser.PreParser.get_alias_from_config">get<wbr></wbr>_alias<wbr></wbr>_from<wbr></wbr>_config</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#get_all_lines" class="internal-link" title="bootstraparse.modules.preparser.PreParser.get_all_lines">get<wbr></wbr>_all<wbr></wbr>_lines</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#get_element_from_config" class="internal-link" title="bootstraparse.modules.preparser.PreParser.get_element_from_config">get<wbr></wbr>_element<wbr></wbr>_from<wbr></wbr>_config</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#get_image_from_config" class="internal-link" title="bootstraparse.modules.preparser.PreParser.get_image_from_config">get<wbr></wbr>_image<wbr></wbr>_from<wbr></wbr>_config</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#make_import_list" class="internal-link" title="bootstraparse.modules.preparser.PreParser.make_import_list">make<wbr></wbr>_import<wbr></wbr>_list</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#make_temporary_files" class="internal-link" title="bootstraparse.modules.preparser.PreParser.make_temporary_files">make<wbr></wbr>_temporary<wbr></wbr>_files</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#new_temporary_files" class="internal-link" title="bootstraparse.modules.preparser.PreParser.new_temporary_files">new<wbr></wbr>_temporary<wbr></wbr>_files</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#parse_import_list" class="internal-link" title="bootstraparse.modules.preparser.PreParser.parse_import_list">parse<wbr></wbr>_import<wbr></wbr>_list</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#parse_shortcuts_and_images" class="internal-link" title="bootstraparse.modules.preparser.PreParser.parse_shortcuts_and_images">parse<wbr></wbr>_shortcuts<wbr></wbr>_and<wbr></wbr>_images</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#readlines" class="internal-link" title="bootstraparse.modules.preparser.PreParser.readlines">readlines</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#rich_tree" class="internal-link" title="bootstraparse.modules.preparser.PreParser.rich_tree">rich<wbr></wbr>_tree</a></code>
</div>
</li>
</ul>
<div class="childrenKindTitle">Attributes</div>
<ul>
<li class="">
<div class="itemName"><code><a href="#base_path" class="internal-link" title="bootstraparse.modules.preparser.PreParser.base_path">base<wbr></wbr>_path</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#current_origin_for_read" class="internal-link" title="bootstraparse.modules.preparser.PreParser.current_origin_for_read">current<wbr></wbr>_origin<wbr></wbr>_for<wbr></wbr>_read</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#file_with_all_imports" class="internal-link" title="bootstraparse.modules.preparser.PreParser.file_with_all_imports">file<wbr></wbr>_with<wbr></wbr>_all<wbr></wbr>_imports</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#file_with_all_replacements" class="internal-link" title="bootstraparse.modules.preparser.PreParser.file_with_all_replacements">file<wbr></wbr>_with<wbr></wbr>_all<wbr></wbr>_replacements</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#global_dict_of_imports" class="internal-link" title="bootstraparse.modules.preparser.PreParser.global_dict_of_imports">global<wbr></wbr>_dict<wbr></wbr>_of<wbr></wbr>_imports</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#imports_done" class="internal-link" title="bootstraparse.modules.preparser.PreParser.imports_done">imports<wbr></wbr>_done</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#is_global_dict_of_imports_initialized" class="internal-link" title="bootstraparse.modules.preparser.PreParser.is_global_dict_of_imports_initialized">is<wbr></wbr>_global<wbr></wbr>_dict<wbr></wbr>_of<wbr></wbr>_imports<wbr></wbr>_initialized</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#list_of_paths" class="internal-link" title="bootstraparse.modules.preparser.PreParser.list_of_paths">list<wbr></wbr>_of<wbr></wbr>_paths</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#local_dict_of_imports" class="internal-link" title="bootstraparse.modules.preparser.PreParser.local_dict_of_imports">local<wbr></wbr>_dict<wbr></wbr>_of<wbr></wbr>_imports</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#name" class="internal-link" title="bootstraparse.modules.preparser.PreParser.name">name</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#path" class="internal-link" title="bootstraparse.modules.preparser.PreParser.path">path</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#relative_path_resolver" class="internal-link" title="bootstraparse.modules.preparser.PreParser.relative_path_resolver">relative<wbr></wbr>_path<wbr></wbr>_resolver</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#replacements_done" class="internal-link" title="bootstraparse.modules.preparser.PreParser.replacements_done">replacements<wbr></wbr>_done</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#saved_import_list" class="internal-link" title="bootstraparse.modules.preparser.PreParser.saved_import_list">saved<wbr></wbr>_import<wbr></wbr>_list</a></code>
</div>
</li><li class="">
<div class="itemName"><code><a href="#tree_view" class="internal-link" title="bootstraparse.modules.preparser.PreParser.tree_view">tree<wbr></wbr>_view</a></code>
</div>
</li><li class="private">
<div class="itemName"><code><a href="#_env" class="internal-link" title="bootstraparse.modules.preparser.PreParser._env">_env</a></code>
</div>
</li>
</ul>
</div>
</div><div>
<div class="thingTitle">
<span>Module</span>
<code><a href="bootstraparse.modules.preparser.html" class="internal-link" title="The parent of this class">preparser</a></code>
</div>
<div>
<div class="childrenKindTitle">Classes</div>
<ul>
<li class=" thisobject">
<div class="itemName"><code><a href="bootstraparse.modules.preparser.PreParser.html" class="internal-link" title="bootstraparse.modules.preparser.PreParser"><wbr></wbr>Pre<wbr></wbr>Parser</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.preparser.html" class="internal-link" title="bootstraparse.modules.preparser">preparser</a></code><wbr></wbr>.<code><a href="bootstraparse.modules.preparser.PreParser.html" class="internal-link" title="bootstraparse.modules.preparser.PreParser">PreParser</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">PreParser</span>:</code></p>
<p><a href="classIndex.html#bootstraparse.modules.preparser.PreParser">View In Hierarchy</a></p>
</div>
<div class="moduleDocstring">
<div><p>Takes a path and environment, executes all pre-parsing methods on the specified file.</p>
</div>
</div>
<div id="splitTables">
<table class="children sortable" id="id59">
<tr class="staticmethod">
<td>Static Method</td>
<td><code><a href="#make_replacements" class="internal-link" title="bootstraparse.modules.preparser.PreParser.make_replacements">make<wbr></wbr>_replacements</a></code></td>
<td>Tries to format the message or give an error message and return the original message :param message: the message to format :type message: str :param var_list: the list of variables to replace in the message :type var_list: str :keyword var_dict: the dictionary of variables to replace in the message :type var_dict: dict[str, str]...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#__eq__" class="internal-link" title="bootstraparse.modules.preparser.PreParser.__eq__">__eq__</a></code></td>
<td>Checks if the PreParser object is equal to another PreParser object. :return: True if the PreParser objects are equal, False otherwise :param other: the other PreParser object</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#__init__" class="internal-link" title="bootstraparse.modules.preparser.PreParser.__init__">__init__</a></code></td>
<td>Initializes the PreParser object. Takes the following parameters: :param file_path: the path of the file to be parsed :param _env: the environment object :param list_of_paths: the list of files that have been imported in this branch of the import tree :param dict_of_imports: Dictionary of all imports made to avoid duplicate file opening / pre-parsing :type file_path: str :type _env: environment...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#__ne__" class="internal-link" title="bootstraparse.modules.preparser.PreParser.__ne__">__ne__</a></code></td>
<td>Checks if the PreParser object is not equal to another PreParser object. :param other: the other PreParser object :type other: PreParser :return: True if the PreParser objects are not equal, False otherwise...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#__repr__" class="internal-link" title="bootstraparse.modules.preparser.PreParser.__repr__">__repr__</a></code></td>
<td>Returns a string representation of the PreParser object.</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#__str__" class="internal-link" title="bootstraparse.modules.preparser.PreParser.__str__">__str__</a></code></td>
<td>Returns a string representation of the PreParser object.</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#do_imports" class="internal-link" title="bootstraparse.modules.preparser.PreParser.do_imports">do<wbr></wbr>_imports</a></code></td>
<td>Execute all actions needed to do the imports and setup for the next step :return: The file descriptor of the file with all imports :rtype: StringIO</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#do_replacements" class="internal-link" title="bootstraparse.modules.preparser.PreParser.do_replacements">do<wbr></wbr>_replacements</a></code></td>
<td>Execute all actions needed to do the replacements. :return: The file descriptor of the file with all replacements :rtype: StringIO</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#export_with_imports" class="internal-link" title="bootstraparse.modules.preparser.PreParser.export_with_imports">export<wbr></wbr>_with<wbr></wbr>_imports</a></code></td>
<td>Return the file object with all file imports done :return: a filelike object with all file imports done :rtype: StringIO</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#get_alias_from_config" class="internal-link" title="bootstraparse.modules.preparser.PreParser.get_alias_from_config">get<wbr></wbr>_alias<wbr></wbr>_from<wbr></wbr>_config</a></code></td>
<td>Returns the alias from the config and makes the replacements with the options provided :param shortcut: id of the shortcut to fetch :type shortcut: str :param optionals: optional parameters along with alias :type optionals: syntax...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#get_all_lines" class="internal-link" title="bootstraparse.modules.preparser.PreParser.get_all_lines">get<wbr></wbr>_all<wbr></wbr>_lines</a></code></td>
<td>Get the lines from the file on the step you are in :return: A list of lines :rtype: list[str]</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#get_element_from_config" class="internal-link" title="bootstraparse.modules.preparser.PreParser.get_element_from_config">get<wbr></wbr>_element<wbr></wbr>_from<wbr></wbr>_config</a></code></td>
<td>Fetches an element from the config (a nested dictionary) going through the list of keys Raises an error if the element is not found :param list_keys: the list of keys to go through the config :type list_keys: str...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#get_image_from_config" class="internal-link" title="bootstraparse.modules.preparser.PreParser.get_image_from_config">get<wbr></wbr>_image<wbr></wbr>_from<wbr></wbr>_config</a></code></td>
<td>Returns the image from the config and makes the replacements with the options provided :param shortcut: id of the image to fetch :type shortcut: str :param optionals: optional parameters along with image :type optionals: syntax...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#make_import_list" class="internal-link" title="bootstraparse.modules.preparser.PreParser.make_import_list">make<wbr></wbr>_import<wbr></wbr>_list</a></code></td>
<td>Creates a list of all files to be imported. Makes sure that the files are not already imported through a previous import statement. Recursively build a list of PreParser object for each file to be imported...</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#make_temporary_files" class="internal-link" title="bootstraparse.modules.preparser.PreParser.make_temporary_files">make<wbr></wbr>_temporary<wbr></wbr>_files</a></code></td>
<td>Creates temporary files for the import list and the replacement.</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#new_temporary_files" class="internal-link" title="bootstraparse.modules.preparser.PreParser.new_temporary_files">new<wbr></wbr>_temporary<wbr></wbr>_files</a></code></td>
<td>Make new temporary files, if the old one are not referenced, the garbage collector will delete them.</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#parse_import_list" class="internal-link" title="bootstraparse.modules.preparser.PreParser.parse_import_list">parse<wbr></wbr>_import<wbr></wbr>_list</a></code></td>
<td>Parses the import list of the file. :return: a list of files to be imported, and the line number of the import statement :rtype: list[(str, int)]</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#parse_shortcuts_and_images" class="internal-link" title="bootstraparse.modules.preparser.PreParser.parse_shortcuts_and_images">parse<wbr></wbr>_shortcuts<wbr></wbr>_and<wbr></wbr>_images</a></code></td>
<td>Parses through the output files from export_with_imports and replaces shortcuts and images calls with appropriate html :return: The file descriptor of the file with all replacements :rtype: StringIO</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#readlines" class="internal-link" title="bootstraparse.modules.preparser.PreParser.readlines">readlines</a></code></td>
<td>Reads the original file and returns a list of lines. :return: a list of lines :rtype: list[str]</td>
</tr><tr class="method">
<td>Method</td>
<td><code><a href="#rich_tree" class="internal-link" title="bootstraparse.modules.preparser.PreParser.rich_tree">rich<wbr></wbr>_tree</a></code></td>
<td>Returns a rich representation of the PreParser object. :param prefix: the prefix to add to the representation :type prefix: str :param suffix: the suffix to add to the representation :type suffix: str :param force: if True, the representation is always computed, even if it has already been done :type force: bool :param strip_prefix: the prefix to remove from the path :type strip_prefix: str :return: a rich representation of the PreParser object...</td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#base_path" class="internal-link" title="bootstraparse.modules.preparser.PreParser.base_path">base<wbr></wbr>_path</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#current_origin_for_read" class="internal-link" title="bootstraparse.modules.preparser.PreParser.current_origin_for_read">current<wbr></wbr>_origin<wbr></wbr>_for<wbr></wbr>_read</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#file_with_all_imports" class="internal-link" title="bootstraparse.modules.preparser.PreParser.file_with_all_imports">file<wbr></wbr>_with<wbr></wbr>_all<wbr></wbr>_imports</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#file_with_all_replacements" class="internal-link" title="bootstraparse.modules.preparser.PreParser.file_with_all_replacements">file<wbr></wbr>_with<wbr></wbr>_all<wbr></wbr>_replacements</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#global_dict_of_imports" class="internal-link" title="bootstraparse.modules.preparser.PreParser.global_dict_of_imports">global<wbr></wbr>_dict<wbr></wbr>_of<wbr></wbr>_imports</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#imports_done" class="internal-link" title="bootstraparse.modules.preparser.PreParser.imports_done">imports<wbr></wbr>_done</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#is_global_dict_of_imports_initialized" class="internal-link" title="bootstraparse.modules.preparser.PreParser.is_global_dict_of_imports_initialized">is<wbr></wbr>_global<wbr></wbr>_dict<wbr></wbr>_of<wbr></wbr>_imports<wbr></wbr>_initialized</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#list_of_paths" class="internal-link" title="bootstraparse.modules.preparser.PreParser.list_of_paths">list<wbr></wbr>_of<wbr></wbr>_paths</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#local_dict_of_imports" class="internal-link" title="bootstraparse.modules.preparser.PreParser.local_dict_of_imports">local<wbr></wbr>_dict<wbr></wbr>_of<wbr></wbr>_imports</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.preparser.PreParser.name">name</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#path" class="internal-link" title="bootstraparse.modules.preparser.PreParser.path">path</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#relative_path_resolver" class="internal-link" title="bootstraparse.modules.preparser.PreParser.relative_path_resolver">relative<wbr></wbr>_path<wbr></wbr>_resolver</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#replacements_done" class="internal-link" title="bootstraparse.modules.preparser.PreParser.replacements_done">replacements<wbr></wbr>_done</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable">
<td>Instance Variable</td>
<td><code><a href="#saved_import_list" class="internal-link" title="bootstraparse.modules.preparser.PreParser.saved_import_list">saved<wbr></wbr>_import<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="#tree_view" class="internal-link" title="bootstraparse.modules.preparser.PreParser.tree_view">tree<wbr></wbr>_view</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="instancevariable private">
<td>Instance Variable</td>
<td><code><a href="#_env" class="internal-link" title="bootstraparse.modules.preparser.PreParser._env">_env</a></code></td>
<td><span class="undocumented">Undocumented</span></td>
</tr>
</table>
</div>
<div id="childList">
<div class="basestaticmethod">
<a name="bootstraparse.modules.preparser.PreParser.make_replacements">
</a>
<a name="make_replacements">
</a>
<div class="functionHeader">
@staticmethod<br />
<span class="py-keyword">def</span> <span class="py-defname">make_replacements</span>(message, *var_list, **var_dict):
</div>
<div class="docstring functionBody">
<div><p>Tries to format the message or give an error message and return the original message :param message: the message to format :type message: str :param var_list: the list of variables to replace in the message :type var_list: str :keyword var_dict: the dictionary of variables to replace in the message :type var_dict: dict[str, str]</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.__eq__">
</a>
<a name="__eq__">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">__eq__</span>(self, other):
</div>
<div class="docstring functionBody">
<div><p>Checks if the PreParser object is equal to another PreParser object. :return: True if the PreParser objects are equal, False otherwise :param other: the other PreParser object</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.__init__">
</a>
<a name="__init__">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">__init__</span>(self, file_path, _env, list_of_paths=None, dict_of_imports=None):
</div>
<div class="docstring functionBody">
<div><p>Initializes the PreParser object. Takes the following parameters: :param file_path: the path of the file to be parsed :param _env: the environment object :param list_of_paths: the list of files that have been imported in this branch of the import tree :param dict_of_imports: Dictionary of all imports made to avoid duplicate file opening / pre-parsing :type file_path: str :type _env: environment.Environment :type list_of_paths: list[str] :type dict_of_imports: dict[str, PreParser]</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.__ne__">
</a>
<a name="__ne__">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">__ne__</span>(self, other):
</div>
<div class="docstring functionBody">
<div><p>Checks if the PreParser object is not equal to another PreParser object. :param other: the other PreParser object :type other: PreParser :return: True if the PreParser objects are not equal, False otherwise</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.__repr__">
</a>
<a name="__repr__">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">__repr__</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Returns a string representation of the PreParser object.</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.__str__">
</a>
<a name="__str__">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">__str__</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Returns a string representation of the PreParser object.</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.do_imports">
</a>
<a name="do_imports">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">do_imports</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Execute all actions needed to do the imports and setup for the next step :return: The file descriptor of the file with all imports :rtype: StringIO</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.do_replacements">
</a>
<a name="do_replacements">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">do_replacements</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Execute all actions needed to do the replacements. :return: The file descriptor of the file with all replacements :rtype: StringIO</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.export_with_imports">
</a>
<a name="export_with_imports">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">export_with_imports</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Return the file object with all file imports done :return: a filelike object with all file imports done :rtype: StringIO</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.get_alias_from_config">
</a>
<a name="get_alias_from_config">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">get_alias_from_config</span>(self, shortcut, optionals):
</div>
<div class="docstring functionBody">
<div><p>Returns the alias from the config and makes the replacements with the options provided :param shortcut: id of the shortcut to fetch :type shortcut: str :param optionals: optional parameters along with alias :type optionals: syntax.Optional :return: the html to insert as a string :rtype: str</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.get_all_lines">
</a>
<a name="get_all_lines">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">get_all_lines</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Get the lines from the file on the step you are in :return: A list of lines :rtype: list[str]</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.get_element_from_config">
</a>
<a name="get_element_from_config">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">get_element_from_config</span>(self, *list_keys):
</div>
<div class="docstring functionBody">
<div><p>Fetches an element from the config (a nested dictionary) going through the list of keys Raises an error if the element is not found :param list_keys: the list of keys to go through the config :type list_keys: str</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.get_image_from_config">
</a>
<a name="get_image_from_config">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">get_image_from_config</span>(self, shortcut, optionals):
</div>
<div class="docstring functionBody">
<div><p>Returns the image from the config and makes the replacements with the options provided :param shortcut: id of the image to fetch :type shortcut: str :param optionals: optional parameters along with image :type optionals: syntax.Optional :return: the html to insert as a string</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.make_import_list">
</a>
<a name="make_import_list">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">make_import_list</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Creates a list of all files to be imported. Makes sure that the files are not already imported through a previous import statement. Recursively build a list of PreParser object for each file to be imported. :return: the dictionary of all files to be imported (key: file name, value: PreParser object) :rtype: dict[str, PreParser]</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.make_temporary_files">
</a>
<a name="make_temporary_files">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">make_temporary_files</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Creates temporary files for the import list and the replacement.</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.new_temporary_files">
</a>
<a name="new_temporary_files">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">new_temporary_files</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Make new temporary files, if the old one are not referenced, the garbage collector will delete them.</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.parse_import_list">
</a>
<a name="parse_import_list">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">parse_import_list</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Parses the import list of the file. :return: a list of files to be imported, and the line number of the import statement :rtype: list[(str, int)]</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.parse_shortcuts_and_images">
</a>
<a name="parse_shortcuts_and_images">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">parse_shortcuts_and_images</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Parses through the output files from export_with_imports and replaces shortcuts and images calls with appropriate html :return: The file descriptor of the file with all replacements :rtype: StringIO</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.readlines">
</a>
<a name="readlines">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">readlines</span>(self):
</div>
<div class="docstring functionBody">
<div><p>Reads the original file and returns a list of lines. :return: a list of lines :rtype: list[str]</p>
</div>
</div>
</div><div class="basemethod">
<a name="bootstraparse.modules.preparser.PreParser.rich_tree">
</a>
<a name="rich_tree">
</a>
<div class="functionHeader">
<span class="py-keyword">def</span> <span class="py-defname">rich_tree</span>(self, prefix=<span class="rst-variable-quote">'</span><span class="rst-variable-string"></span><span class="rst-variable-quote">'</span>, suffix=<span class="rst-variable-quote">'</span><span class="rst-variable-string"></span><span class="rst-variable-quote">'</span>, force=True, strip_prefix=<span class="rst-variable-quote">'</span><span class="rst-variable-string"></span><span class="rst-variable-quote">'</span>):
</div>
<div class="docstring functionBody">
<div><p>Returns a rich representation of the PreParser object. :param prefix: the prefix to add to the representation :type prefix: str :param suffix: the suffix to add to the representation :type suffix: str :param force: if True, the representation is always computed, even if it has already been done :type force: bool :param strip_prefix: the prefix to remove from the path :type strip_prefix: str :return: a rich representation of the PreParser object</p>
</div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.base_path">
</a>
<a name="base_path">
</a>
<div class="functionHeader">
<span class="py-defname">base_path</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.current_origin_for_read">
</a>
<a name="current_origin_for_read">
</a>
<div class="functionHeader">
<span class="py-defname">current_origin_for_read</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.file_with_all_imports">
</a>
<a name="file_with_all_imports">
</a>
<div class="functionHeader">
<span class="py-defname">file_with_all_imports</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.file_with_all_replacements">
</a>
<a name="file_with_all_replacements">
</a>
<div class="functionHeader">
<span class="py-defname">file_with_all_replacements</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.global_dict_of_imports">
</a>
<a name="global_dict_of_imports">
</a>
<div class="functionHeader">
<span class="py-defname">global_dict_of_imports</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.imports_done">
</a>
<a name="imports_done">
</a>
<div class="functionHeader">
<span class="py-defname">imports_done</span>: <code>bool</code> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.is_global_dict_of_imports_initialized">
</a>
<a name="is_global_dict_of_imports_initialized">
</a>
<div class="functionHeader">
<span class="py-defname">is_global_dict_of_imports_initialized</span>: <code>bool</code> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.list_of_paths">
</a>
<a name="list_of_paths">
</a>
<div class="functionHeader">
<span class="py-defname">list_of_paths</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.local_dict_of_imports">
</a>
<a name="local_dict_of_imports">
</a>
<div class="functionHeader">
<span class="py-defname">local_dict_of_imports</span>: <code>dict</code> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.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.preparser.PreParser.path">
</a>
<a name="path">
</a>
<div class="functionHeader">
<span class="py-defname">path</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.relative_path_resolver">
</a>
<a name="relative_path_resolver">
</a>
<div class="functionHeader">
<span class="py-defname">relative_path_resolver</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.replacements_done">
</a>
<a name="replacements_done">
</a>
<div class="functionHeader">
<span class="py-defname">replacements_done</span>: <code>bool</code> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.saved_import_list">
</a>
<a name="saved_import_list">
</a>
<div class="functionHeader">
<span class="py-defname">saved_import_list</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable">
<a name="bootstraparse.modules.preparser.PreParser.tree_view">
</a>
<a name="tree_view">
</a>
<div class="functionHeader">
<span class="py-defname">tree_view</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</p></div>
</div>
</div><div class="baseinstancevariable private">
<a name="bootstraparse.modules.preparser.PreParser._env">
</a>
<a name="_env">
</a>
<div class="functionHeader">
<span class="py-defname">_env</span> =
</div>
<div class="functionBody">
<div><p class="undocumented">Undocumented</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 19:40:50.
</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>