evennia/docs/versions/1.0-dev/api/evennia.utils.html
2020-06-13 00:15:39 +02:00

9597 lines
No EOL
670 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>evennia.utils package &#8212; Evennia 1.0-dev documentation</title>
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-evennia.utils">
<span id="evennia-utils-package"></span><h1>evennia.utils package<a class="headerlink" href="#module-evennia.utils" title="Permalink to this headline"></a></h1>
<p>This sub-package holds the miscelaneous utilities used by other
modules in Evennia. It also holds the idmapper in-memory caching
functionality.</p>
<div class="section" id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="evennia.utils.idmapper.html">evennia.utils.idmapper package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.idmapper.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.idmapper.html#module-evennia.utils.idmapper.manager">evennia.utils.idmapper.manager module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.idmapper.html#module-evennia.utils.idmapper.models">evennia.utils.idmapper.models module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.idmapper.html#module-evennia.utils.idmapper.tests">evennia.utils.idmapper.tests module</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="evennia.utils.tests.html">evennia.utils.tests package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#subpackages">Subpackages</a><ul>
<li class="toctree-l3"><a class="reference internal" href="evennia.utils.tests.data.html">evennia.utils.tests.data package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="evennia.utils.tests.data.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="evennia.utils.tests.data.html#module-evennia.utils.tests.data.evform_example">evennia.utils.tests.data.evform_example module</a></li>
<li class="toctree-l4"><a class="reference internal" href="evennia.utils.tests.data.html#module-evennia.utils.tests.data.prototypes_example">evennia.utils.tests.data.prototypes_example module</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#module-evennia.utils.tests.test_ansi">evennia.utils.tests.test_ansi module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#module-evennia.utils.tests.test_batchprocessors">evennia.utils.tests.test_batchprocessors module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#module-evennia.utils.tests.test_create_functions">evennia.utils.tests.test_create_functions module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#module-evennia.utils.tests.test_eveditor">evennia.utils.tests.test_eveditor module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#module-evennia.utils.tests.test_evform">evennia.utils.tests.test_evform module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#module-evennia.utils.tests.test_evmenu">evennia.utils.tests.test_evmenu module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#module-evennia.utils.tests.test_gametime">evennia.utils.tests.test_gametime module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#module-evennia.utils.tests.test_tagparsing">evennia.utils.tests.test_tagparsing module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#module-evennia.utils.tests.test_text2html">evennia.utils.tests.test_text2html module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#module-evennia.utils.tests.test_utils">evennia.utils.tests.test_utils module</a></li>
<li class="toctree-l2"><a class="reference internal" href="evennia.utils.tests.html#module-evennia.utils.tests.test_validatorfuncs">evennia.utils.tests.test_validatorfuncs module</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-evennia.utils.ansi">
<span id="evennia-utils-ansi-module"></span><h2>evennia.utils.ansi module<a class="headerlink" href="#module-evennia.utils.ansi" title="Permalink to this headline"></a></h2>
<p>ANSI - Gives colour to text.</p>
<p>Use the codes defined in ANSIPARSER in your text
to apply colour to text according to the ANSI standard.</p>
<p class="rubric">Examples</p>
<p>This is <a href="#id1"><span class="problematic" id="id2">|</span></a>rRed text|n and this is normal again.</p>
<p>Mostly you should not need to call parse_ansi() explicitly;
it is run by Evennia just before returning data to/from the
user. Depreciated example forms are available by extending
the ansi mapping.</p>
<dl class="class">
<dt id="evennia.utils.ansi.ANSIMeta">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.ansi.</code><code class="sig-name descname">ANSIMeta</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIMeta"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIMeta" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code></p>
<p>Many functions on ANSIString are just light wrappers around the string
base class. We apply them here, as part of the classes construction.</p>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIMeta.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIMeta.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIMeta.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.ansi.ANSIParser">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.ansi.</code><code class="sig-name descname">ANSIParser</code><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIParser"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIParser" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>A class that parses ANSI markup
to ANSI command sequences</p>
<p>We also allow to escape colour codes
by prepending with a for xterm256,
an extra | for Merc-style codes</p>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.ansi_escapes">
<code class="sig-name descname">ansi_escapes</code><em class="property"> = re.compile('({{|\\\\|\\|\\|)', re.DOTALL)</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.ansi_escapes" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.ansi_map">
<code class="sig-name descname">ansi_map</code><em class="property"> = [('|n', '\x1b[0m'), ('|/', '\r\n'), ('|-', '\t'), ('|_', ' '), ('|*', '\x1b[7m'), ('|^', '\x1b[5m'), ('|u', '\x1b[4m'), ('|r', '\x1b[1m\x1b[31m'), ('|g', '\x1b[1m\x1b[32m'), ('|y', '\x1b[1m\x1b[33m'), ('|b', '\x1b[1m\x1b[34m'), ('|m', '\x1b[1m\x1b[35m'), ('|c', '\x1b[1m\x1b[36m'), ('|w', '\x1b[1m\x1b[37m'), ('|x', '\x1b[1m\x1b[30m'), ('|R', '\x1b[22m\x1b[31m'), ('|G', '\x1b[22m\x1b[32m'), ('|Y', '\x1b[22m\x1b[33m'), ('|B', '\x1b[22m\x1b[34m'), ('|M', '\x1b[22m\x1b[35m'), ('|C', '\x1b[22m\x1b[36m'), ('|W', '\x1b[22m\x1b[37m'), ('|X', '\x1b[22m\x1b[30m'), ('|h', '\x1b[1m'), ('|H', '\x1b[22m'), ('|!R', '\x1b[31m'), ('|!G', '\x1b[32m'), ('|!Y', '\x1b[33m'), ('|!B', '\x1b[34m'), ('|!M', '\x1b[35m'), ('|!C', '\x1b[36m'), ('|!W', '\x1b[37m'), ('|!X', '\x1b[30m'), ('|[R', '\x1b[41m'), ('|[G', '\x1b[42m'), ('|[Y', '\x1b[43m'), ('|[B', '\x1b[44m'), ('|[M', '\x1b[45m'), ('|[C', '\x1b[46m'), ('|[W', '\x1b[47m'), ('|[X', '\x1b[40m')]</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.ansi_map" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.ansi_map_dict">
<code class="sig-name descname">ansi_map_dict</code><em class="property"> = {'|!B': '\x1b[34m', '|!C': '\x1b[36m', '|!G': '\x1b[32m', '|!M': '\x1b[35m', '|!R': '\x1b[31m', '|!W': '\x1b[37m', '|!X': '\x1b[30m', '|!Y': '\x1b[33m', '|*': '\x1b[7m', '|-': '\t', '|/': '\r\n', '|B': '\x1b[22m\x1b[34m', '|C': '\x1b[22m\x1b[36m', '|G': '\x1b[22m\x1b[32m', '|H': '\x1b[22m', '|M': '\x1b[22m\x1b[35m', '|R': '\x1b[22m\x1b[31m', '|W': '\x1b[22m\x1b[37m', '|X': '\x1b[22m\x1b[30m', '|Y': '\x1b[22m\x1b[33m', '|[B': '\x1b[44m', '|[C': '\x1b[46m', '|[G': '\x1b[42m', '|[M': '\x1b[45m', '|[R': '\x1b[41m', '|[W': '\x1b[47m', '|[X': '\x1b[40m', '|[Y': '\x1b[43m', '|^': '\x1b[5m', '|_': ' ', '|b': '\x1b[1m\x1b[34m', '|c': '\x1b[1m\x1b[36m', '|g': '\x1b[1m\x1b[32m', '|h': '\x1b[1m', '|m': '\x1b[1m\x1b[35m', '|n': '\x1b[0m', '|r': '\x1b[1m\x1b[31m', '|u': '\x1b[4m', '|w': '\x1b[1m\x1b[37m', '|x': '\x1b[1m\x1b[30m', '|y': '\x1b[1m\x1b[33m'}</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.ansi_map_dict" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.ansi_re">
<code class="sig-name descname">ansi_re</code><em class="property"> = '\\033\\[[0-9;]+m'</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.ansi_re" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.ansi_regex">
<code class="sig-name descname">ansi_regex</code><em class="property"> = re.compile('\\033\\[[0-9;]+m')</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.ansi_regex" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.ansi_sub">
<code class="sig-name descname">ansi_sub</code><em class="property"> = re.compile('\\|n|\\|/|\\|\\-|\\|_|\\|\\*|\\|\\^|\\|u|\\|r|\\|g|\\|y|\\|b|\\|m|\\|c|\\|w|\\|x|\\|R|\\|G|\\|Y|\\|B|\\|M|\\|C|\\|W|\\|X|\\|h|\\|H|\\|!R|\\|!G|\\|!Y|\\|!B|\\|!M|\\|!C|\\|!W|\\|!X|\\|\\[R|\\|\\[G|\\|\, re.DOTALL)</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.ansi_sub" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.ansi_xterm256_bright_bg_map">
<code class="sig-name descname">ansi_xterm256_bright_bg_map</code><em class="property"> = [('|[r', '|[500'), ('|[g', '|[050'), ('|[y', '|[550'), ('|[b', '|[005'), ('|[m', '|[505'), ('|[c', '|[055'), ('|[w', '|[555'), ('|[x', '|[222')]</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.ansi_xterm256_bright_bg_map" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.ansi_xterm256_bright_bg_map_dict">
<code class="sig-name descname">ansi_xterm256_bright_bg_map_dict</code><em class="property"> = {'|[b': '|[005', '|[c': '|[055', '|[g': '|[050', '|[m': '|[505', '|[r': '|[500', '|[w': '|[555', '|[x': '|[222', '|[y': '|[550'}</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.ansi_xterm256_bright_bg_map_dict" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.brightbg_sub">
<code class="sig-name descname">brightbg_sub</code><em class="property"> = re.compile('(?&lt;!\\|)\\|\\[r|(?&lt;!\\|)\\|\\[g|(?&lt;!\\|)\\|\\[y|(?&lt;!\\|)\\|\\[b|(?&lt;!\\|)\\|\\[m|(?&lt;!\\|)\\|\\[c|(?&lt;!\\|)\\|\\[w|(?&lt;!\\|)\\|\\[x', re.DOTALL)</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.brightbg_sub" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.mxp_re">
<code class="sig-name descname">mxp_re</code><em class="property"> = '\\|lc(.*?)\\|lt(.*?)\\|le'</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.mxp_re" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.mxp_sub">
<code class="sig-name descname">mxp_sub</code><em class="property"> = re.compile('\\|lc(.*?)\\|lt(.*?)\\|le', re.DOTALL)</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.mxp_sub" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIParser.parse_ansi">
<code class="sig-name descname">parse_ansi</code><span class="sig-paren">(</span><em class="sig-param">string</em>, <em class="sig-param">strip_ansi=False</em>, <em class="sig-param">xterm256=False</em>, <em class="sig-param">mxp=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIParser.parse_ansi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.parse_ansi" title="Permalink to this definition"></a></dt>
<dd><p>Parses a string, subbing color codes according to the stored
mapping.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> (<em>str</em>) The string to parse.</p></li>
<li><p><strong>strip_ansi</strong> (<em>boolean</em><em>, </em><em>optional</em>) Strip all found ansi markup.</p></li>
<li><p><strong>xterm256</strong> (<em>boolean</em><em>, </em><em>optional</em>) If actually using xterm256 or if
these values should be converted to 16-color ANSI.</p></li>
<li><p><strong>mxp</strong> (<em>boolean</em><em>, </em><em>optional</em>) Parse MXP commands in string.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The parsed string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>string (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIParser.strip_mxp">
<code class="sig-name descname">strip_mxp</code><span class="sig-paren">(</span><em class="sig-param">string</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIParser.strip_mxp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.strip_mxp" title="Permalink to this definition"></a></dt>
<dd><p>Strips all MXP codes from a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>string</strong> (<em>str</em>) The string to strip.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The processed string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>string (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIParser.strip_raw_codes">
<code class="sig-name descname">strip_raw_codes</code><span class="sig-paren">(</span><em class="sig-param">string</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIParser.strip_raw_codes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.strip_raw_codes" title="Permalink to this definition"></a></dt>
<dd><p>Strips raw ANSI codes from a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>string</strong> (<em>str</em>) The string to strip.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The processed string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>string (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIParser.sub_ansi">
<code class="sig-name descname">sub_ansi</code><span class="sig-paren">(</span><em class="sig-param">ansimatch</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIParser.sub_ansi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.sub_ansi" title="Permalink to this definition"></a></dt>
<dd><p>Replacer used by <cite>re.sub</cite> to replace ANSI
markers with correct ANSI sequences</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ansimatch</strong> (<em>re.matchobject</em>) The match.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The processed match string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>processed (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIParser.sub_brightbg">
<code class="sig-name descname">sub_brightbg</code><span class="sig-paren">(</span><em class="sig-param">ansimatch</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIParser.sub_brightbg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.sub_brightbg" title="Permalink to this definition"></a></dt>
<dd><p>Replacer used by <cite>re.sub</cite> to replace ANSI
bright background markers with Xterm256 replacement</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ansimatch</strong> (<em>re.matchobject</em>) The match.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The processed match string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>processed (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIParser.sub_xterm256">
<code class="sig-name descname">sub_xterm256</code><span class="sig-paren">(</span><em class="sig-param">rgbmatch</em>, <em class="sig-param">use_xterm256=False</em>, <em class="sig-param">color_type='fg'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIParser.sub_xterm256"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.sub_xterm256" title="Permalink to this definition"></a></dt>
<dd><p>This is a replacer method called by <cite>re.sub</cite> with the matched
tag. It must return the correct ansi sequence.</p>
<p>It checks <cite>self.do_xterm256</cite> to determine if conversion
to standard ANSI should be done or not.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>rgbmatch</strong> (<em>re.matchobject</em>) The match.</p></li>
<li><p><strong>use_xterm256</strong> (<em>bool</em><em>, </em><em>optional</em>) Dont convert 256-colors to 16.</p></li>
<li><p><strong>color_type</strong> (<em>str</em>) One of fg, bg, gfg, gbg.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The processed match string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>processed (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.xterm256_bg">
<code class="sig-name descname">xterm256_bg</code><em class="property"> = ['\\|\\[([0-5])([0-5])([0-5])']</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.xterm256_bg" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.xterm256_bg_sub">
<code class="sig-name descname">xterm256_bg_sub</code><em class="property"> = re.compile('\\|\\[([0-5])([0-5])([0-5])', re.DOTALL)</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.xterm256_bg_sub" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.xterm256_fg">
<code class="sig-name descname">xterm256_fg</code><em class="property"> = ['\\|([0-5])([0-5])([0-5])']</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.xterm256_fg" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.xterm256_fg_sub">
<code class="sig-name descname">xterm256_fg_sub</code><em class="property"> = re.compile('\\|([0-5])([0-5])([0-5])', re.DOTALL)</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.xterm256_fg_sub" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.xterm256_gbg">
<code class="sig-name descname">xterm256_gbg</code><em class="property"> = ['\\|\\[=([a-z])']</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.xterm256_gbg" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.xterm256_gbg_sub">
<code class="sig-name descname">xterm256_gbg_sub</code><em class="property"> = re.compile('\\|\\[=([a-z])', re.DOTALL)</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.xterm256_gbg_sub" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.xterm256_gfg">
<code class="sig-name descname">xterm256_gfg</code><em class="property"> = ['\\|=([a-z])']</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.xterm256_gfg" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIParser.xterm256_gfg_sub">
<code class="sig-name descname">xterm256_gfg_sub</code><em class="property"> = re.compile('\\|=([a-z])', re.DOTALL)</em><a class="headerlink" href="#evennia.utils.ansi.ANSIParser.xterm256_gfg_sub" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.ansi.ANSIString">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.ansi.</code><code class="sig-name descname">ANSIString</code><span class="sig-paren">(</span><em class="sig-param">*_</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
<p>Unicode-like object that is aware of ANSI codes.</p>
<p>This class can be used nearly identically to strings, in that it will
report string length, handle slices, etc, much like a string object
would. The methods should be used identically as string methods are.</p>
<p>There is at least one exception to this (and there may be more, though
they have not come up yet). When using .join() or u.join() on an
ANSIString, color information will get lost. You must use
ANSIString().join() to preserve color information.</p>
<p>This implementation isnt perfectly clean, as it doesnt really have an
understanding of what the codes mean in order to eliminate
redundant characters though cleaning up the strings might end up being
inefficient and slow without some C code when dealing with larger values.
Such enhancements could be made as an enhancement to ANSI_PARSER
if needed, however.</p>
<p>If one is going to use ANSIString, one should generally avoid converting
away from it until one is about to send information on the wire. This is
because escape sequences in the string may otherwise already be decoded,
and taken literally the second time around.</p>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*_</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.__init__" title="Permalink to this definition"></a></dt>
<dd><p>When the ANSIString is first initialized, a few internal variables
have to be set.</p>
<p>The first is the parser. It is possible to replace Evennias standard
ANSI parser with one of your own syntax if you wish, so long as it
implements the same interface.</p>
<p>The second is the _raw_string. This is the original “dumb” string
with ansi escapes that ANSIString represents.</p>
<p>The third thing to set is the _clean_string. This is a string that is
devoid of all ANSI Escapes.</p>
<p>Finally, _code_indexes and _char_indexes are defined. These are lookup
tables for which characters in the raw string are related to ANSI
escapes, and which are for the readable text.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString._adder">
<em class="property">classmethod </em><code class="sig-name descname">_adder</code><span class="sig-paren">(</span><em class="sig-param">first</em>, <em class="sig-param">second</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString._adder"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString._adder" title="Permalink to this definition"></a></dt>
<dd><p>Joins two ANSIStrings, preserving calculated info.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString._filler">
<code class="sig-name descname">_filler</code><span class="sig-paren">(</span><em class="sig-param">char</em>, <em class="sig-param">amount</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString._filler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString._filler" title="Permalink to this definition"></a></dt>
<dd><p>Generate a line of characters in a more efficient way than just adding
ANSIStrings.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString._get_indexes">
<code class="sig-name descname">_get_indexes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString._get_indexes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString._get_indexes" title="Permalink to this definition"></a></dt>
<dd><p>Two tables need to be made, one which contains the indexes of all
readable characters, and one which contains the indexes of all ANSI
escapes. Its important to remember that ANSI escapes require more
that one character at a time, though no readable character needs more
than one character, since the string base class abstracts that away
from us. However, several readable characters can be placed in a row.</p>
<p>We must use regexes here to figure out where all the escape sequences
are hiding in the string. Then we use the ranges of their starts and
ends to create a final, comprehensive list of all indexes which are
dedicated to code, and all dedicated to text.</p>
<p>Its possible that only one of these tables is actually needed, the
other assumed to be what isnt in the first.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString._get_interleving">
<code class="sig-name descname">_get_interleving</code><span class="sig-paren">(</span><em class="sig-param">index</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString._get_interleving"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString._get_interleving" title="Permalink to this definition"></a></dt>
<dd><p>Get the code characters from the given slice end to the next
character.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString._shifter">
<em class="property">static </em><code class="sig-name descname">_shifter</code><span class="sig-paren">(</span><em class="sig-param">iterable</em>, <em class="sig-param">offset</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString._shifter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString._shifter" title="Permalink to this definition"></a></dt>
<dd><p>Takes a list of integers, and produces a new one incrementing all
by a number.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString._slice">
<code class="sig-name descname">_slice</code><span class="sig-paren">(</span><em class="sig-param">slc</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString._slice"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString._slice" title="Permalink to this definition"></a></dt>
<dd><p>This function takes a slice() object.</p>
<p>Slices have to be handled specially. Not only are they able to specify
a start and end with [x:y], but many forget that they can also specify
an interval with [x:y:z]. As a result, not only do we have to track
the ANSI Escapes that have played before the start of the slice, we
must also replay any in these intervals, should they exist.</p>
<p>Thankfully, slicing the _char_indexes table gives us the actual
indexes that need slicing in the raw string. We can check between
those indexes to figure out what escape characters need to be
replayed.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.capitalize">
<code class="sig-name descname">capitalize</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.capitalize" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.center">
<code class="sig-name descname">center</code><span class="sig-paren">(</span><em class="sig-param">width</em>, <em class="sig-param">fillchar</em>, <em class="sig-param">_difference</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.center"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.center" title="Permalink to this definition"></a></dt>
<dd><p>Center some text with some spaces padding both sides.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>width</strong> (<em>int</em>) The target width of the output string.</p></li>
<li><p><strong>fillchar</strong> (<em>str</em>) A single character string to pad the output string
with.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A string padded on both ends with fillchar.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>result (<a class="reference internal" href="#evennia.utils.ansi.ANSIString" title="evennia.utils.ansi.ANSIString">ANSIString</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.clean">
<code class="sig-name descname">clean</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.clean"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.clean" title="Permalink to this definition"></a></dt>
<dd><p>Return a string object <em>without</em> the ANSI escapes.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A unicode object with no ANSI escapes.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>clean_string (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.count">
<code class="sig-name descname">count</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.count" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.decode">
<code class="sig-name descname">decode</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.decode" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.encode">
<code class="sig-name descname">encode</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.encode" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.endswith">
<code class="sig-name descname">endswith</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.endswith" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.expandtabs">
<code class="sig-name descname">expandtabs</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.expandtabs" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.find">
<code class="sig-name descname">find</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.find" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.format">
<code class="sig-name descname">format</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.format" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.index">
<code class="sig-name descname">index</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.index" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.isalnum">
<code class="sig-name descname">isalnum</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.isalnum" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.isalpha">
<code class="sig-name descname">isalpha</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.isalpha" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.isdigit">
<code class="sig-name descname">isdigit</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.isdigit" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.islower">
<code class="sig-name descname">islower</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.islower" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.isspace">
<code class="sig-name descname">isspace</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.isspace" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.istitle">
<code class="sig-name descname">istitle</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.istitle" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.isupper">
<code class="sig-name descname">isupper</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.isupper" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.join">
<code class="sig-name descname">join</code><span class="sig-paren">(</span><em class="sig-param">iterable</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.join"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.join" title="Permalink to this definition"></a></dt>
<dd><p>Joins together strings in an iterable, using this string between each
one.</p>
<dl class="simple">
<dt>NOTE: This should always be used for joining strings when ANSIStrings</dt><dd><p>are involved. Otherwise color information will be discarded by
python, due to details in the C implementation of strings.</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>iterable</strong> (<em>list of strings</em>) A list of strings to join together</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl>
<dt>A single string with all of the iterables</dt><dd><p>contents concatenated, with this string between each. For
example:</p>
<blockquote>
<div><p>ANSIString(, ).join([up, right, left, down])</p>
</div></blockquote>
<dl class="simple">
<dt>…Would return:</dt><dd><p>ANSIString(up, right, left, down)</p>
</dd>
</dl>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>result (<a class="reference internal" href="#evennia.utils.ansi.ANSIString" title="evennia.utils.ansi.ANSIString">ANSIString</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.ljust">
<code class="sig-name descname">ljust</code><span class="sig-paren">(</span><em class="sig-param">width</em>, <em class="sig-param">fillchar</em>, <em class="sig-param">_difference</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.ljust"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.ljust" title="Permalink to this definition"></a></dt>
<dd><p>Left justify some text.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>width</strong> (<em>int</em>) The target width of the output string.</p></li>
<li><p><strong>fillchar</strong> (<em>str</em>) A single character string to pad the output string
with.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A string padded on the right with fillchar.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>result (<a class="reference internal" href="#evennia.utils.ansi.ANSIString" title="evennia.utils.ansi.ANSIString">ANSIString</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.lower">
<code class="sig-name descname">lower</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.lower" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.lstrip">
<code class="sig-name descname">lstrip</code><span class="sig-paren">(</span><em class="sig-param">chars=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.lstrip"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.lstrip" title="Permalink to this definition"></a></dt>
<dd><p>Strip from the left, taking ANSI markers into account.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>chars</strong> (<em>str</em><em>, </em><em>optional</em>) A string containing individual characters
to strip off of the left end of the string. By default, any
blank spaces are trimmed.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A new ANSIString with the left end trimmed of</dt><dd><p>the relevant characters.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>result (<a class="reference internal" href="#evennia.utils.ansi.ANSIString" title="evennia.utils.ansi.ANSIString">ANSIString</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.partition">
<code class="sig-name descname">partition</code><span class="sig-paren">(</span><em class="sig-param">sep</em>, <em class="sig-param">reverse=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.partition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.partition" title="Permalink to this definition"></a></dt>
<dd><p>Splits once into three sections (with the separator being the middle section)</p>
<p>We use the same techniques we used in split() to make sure each are
colored.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sep</strong> (<em>str</em>) The separator to split the string on.</p></li>
<li><p><strong>reverse</strong> (<em>boolean</em>) Whether to split the string on the last
occurrence of the separator rather than the first.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>prefix (ANSIString): The part of the string before the</dt><dd><p>separator</p>
</dd>
</dl>
<p>sep (ANSIString): The separator itself
postfix (ANSIString): The part of the string after the</p>
<blockquote>
<div><p>separator.</p>
</div></blockquote>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>result (tuple)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.raw">
<code class="sig-name descname">raw</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.raw"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.raw" title="Permalink to this definition"></a></dt>
<dd><p>Return a string object with the ANSI escapes.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A unicode object <em>with</em> the raw ANSI escape sequences.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>raw (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.ansi.ANSIString.re_format">
<code class="sig-name descname">re_format</code><em class="property"> = re.compile('(?i)(?P&lt;just&gt;(?P&lt;fill&gt;.)?(?P&lt;align&gt;\\&lt;|\\&gt;|\\=|\\^))?(?P&lt;sign&gt;\\+|\\-| )?(?P&lt;alt&gt;\\#)?(?P&lt;zero&gt;0)?(?P&lt;width&gt;\\d+)?(?P&lt;grouping&gt;\\_|\\,)?(?:\\.(?P&lt;precision&gt;\\d+))?(?P&lt;type&gt;b|c|d|e|E|f|F|g|G|n|o|s|x|X, re.IGNORECASE)</em><a class="headerlink" href="#evennia.utils.ansi.ANSIString.re_format" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.replace">
<code class="sig-name descname">replace</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.replace" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.rfind">
<code class="sig-name descname">rfind</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.rfind" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.rindex">
<code class="sig-name descname">rindex</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.rindex" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.rjust">
<code class="sig-name descname">rjust</code><span class="sig-paren">(</span><em class="sig-param">width</em>, <em class="sig-param">fillchar</em>, <em class="sig-param">_difference</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.rjust"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.rjust" title="Permalink to this definition"></a></dt>
<dd><p>Right justify some text.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>width</strong> (<em>int</em>) The target width of the output string.</p></li>
<li><p><strong>fillchar</strong> (<em>str</em>) A single character string to pad the output string
with.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A string padded on the left with fillchar.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>result (<a class="reference internal" href="#evennia.utils.ansi.ANSIString" title="evennia.utils.ansi.ANSIString">ANSIString</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.rsplit">
<code class="sig-name descname">rsplit</code><span class="sig-paren">(</span><em class="sig-param">by=None</em>, <em class="sig-param">maxsplit=-1</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.rsplit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.rsplit" title="Permalink to this definition"></a></dt>
<dd><p>Like split, but starts from the end of the string rather than the
beginning.</p>
<p>Stolen from PyPys pure Python string implementation, tweaked for
ANSIString.</p>
<p>PyPy is distributed under the MIT licence.
<a class="reference external" href="http://opensource.org/licenses/MIT">http://opensource.org/licenses/MIT</a></p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>by</strong> (<em>str</em>) A string to search for which will be used to split
the string. For instance, , for Hello,world would
result in [Hello, world]</p></li>
<li><p><strong>maxsplit</strong> (<em>int</em>) The maximum number of times to split the string.
For example, a maxsplit of 2 with a by of , on the string
Hello,world,test,string would result in
[Hello,world, test, string]</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A list of ANSIStrings derived from</dt><dd><p>this string.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>result (list of ANSIStrings)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.rstrip">
<code class="sig-name descname">rstrip</code><span class="sig-paren">(</span><em class="sig-param">chars=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.rstrip"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.rstrip" title="Permalink to this definition"></a></dt>
<dd><p>Strip from the right, taking ANSI markers into account.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>chars</strong> (<em>str</em><em>, </em><em>optional</em>) A string containing individual characters
to strip off of the right end of the string. By default, any
blank spaces are trimmed.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A new ANSIString with the right end trimmed of</dt><dd><p>the relevant characters.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>result (<a class="reference internal" href="#evennia.utils.ansi.ANSIString" title="evennia.utils.ansi.ANSIString">ANSIString</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.split">
<code class="sig-name descname">split</code><span class="sig-paren">(</span><em class="sig-param">by=None</em>, <em class="sig-param">maxsplit=-1</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.split"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.split" title="Permalink to this definition"></a></dt>
<dd><p>Splits a string based on a separator.</p>
<p>Stolen from PyPys pure Python string implementation, tweaked for
ANSIString.</p>
<p>PyPy is distributed under the MIT licence.
<a class="reference external" href="http://opensource.org/licenses/MIT">http://opensource.org/licenses/MIT</a></p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>by</strong> (<em>str</em>) A string to search for which will be used to split
the string. For instance, , for Hello,world would
result in [Hello, world]</p></li>
<li><p><strong>maxsplit</strong> (<em>int</em>) The maximum number of times to split the string.
For example, a maxsplit of 2 with a by of , on the string
Hello,world,test,string would result in
[Hello, world, test,string]</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A list of ANSIStrings derived from</dt><dd><p>this string.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>result (list of ANSIStrings)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.startswith">
<code class="sig-name descname">startswith</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.startswith" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.strip">
<code class="sig-name descname">strip</code><span class="sig-paren">(</span><em class="sig-param">chars=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#ANSIString.strip"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.ANSIString.strip" title="Permalink to this definition"></a></dt>
<dd><p>Strip from both ends, taking ANSI markers into account.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>chars</strong> (<em>str</em><em>, </em><em>optional</em>) A string containing individual characters
to strip off of both ends of the string. By default, any blank
spaces are trimmed.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A new ANSIString with the ends trimmed of the</dt><dd><p>relevant characters.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>result (<a class="reference internal" href="#evennia.utils.ansi.ANSIString" title="evennia.utils.ansi.ANSIString">ANSIString</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.swapcase">
<code class="sig-name descname">swapcase</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.swapcase" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.translate">
<code class="sig-name descname">translate</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.translate" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.ansi.ANSIString.upper">
<code class="sig-name descname">upper</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.ansi.ANSIString.upper" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.ansi._on_raw">
<code class="sig-prename descclassname">evennia.utils.ansi.</code><code class="sig-name descname">_on_raw</code><span class="sig-paren">(</span><em class="sig-param">func_name</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#_on_raw"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi._on_raw" title="Permalink to this definition"></a></dt>
<dd><p>Like query_super, but makes the operation run on the raw string.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.ansi._query_super">
<code class="sig-prename descclassname">evennia.utils.ansi.</code><code class="sig-name descname">_query_super</code><span class="sig-paren">(</span><em class="sig-param">func_name</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#_query_super"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi._query_super" title="Permalink to this definition"></a></dt>
<dd><p>Have the string class handle this with the cleaned string instead
of ANSIString.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.ansi._spacing_preflight">
<code class="sig-prename descclassname">evennia.utils.ansi.</code><code class="sig-name descname">_spacing_preflight</code><span class="sig-paren">(</span><em class="sig-param">func</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#_spacing_preflight"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi._spacing_preflight" title="Permalink to this definition"></a></dt>
<dd><p>This wrapper function is used to do some preflight checks on
functions used for padding ANSIStrings.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.ansi._transform">
<code class="sig-prename descclassname">evennia.utils.ansi.</code><code class="sig-name descname">_transform</code><span class="sig-paren">(</span><em class="sig-param">func_name</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#_transform"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi._transform" title="Permalink to this definition"></a></dt>
<dd><p>Some string functions, like those manipulating capital letters,
return a string the same length as the original. This function
allows us to do the same, replacing all the non-coded characters
with the resulting string.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.ansi.parse_ansi">
<code class="sig-prename descclassname">evennia.utils.ansi.</code><code class="sig-name descname">parse_ansi</code><span class="sig-paren">(</span><em class="sig-param">string</em>, <em class="sig-param">strip_ansi=False</em>, <em class="sig-param">parser=&lt;evennia.utils.ansi.ANSIParser object&gt;</em>, <em class="sig-param">xterm256=False</em>, <em class="sig-param">mxp=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#parse_ansi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.parse_ansi" title="Permalink to this definition"></a></dt>
<dd><p>Parses a string, subbing color codes as needed.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> (<em>str</em>) The string to parse.</p></li>
<li><p><strong>strip_ansi</strong> (<em>bool</em><em>, </em><em>optional</em>) Strip all ANSI sequences.</p></li>
<li><p><strong>parser</strong> (<em>ansi.AnsiParser</em><em>, </em><em>optional</em>) A parser instance to use.</p></li>
<li><p><strong>xterm256</strong> (<em>bool</em><em>, </em><em>optional</em>) Support xterm256 or not.</p></li>
<li><p><strong>mxp</strong> (<em>bool</em><em>, </em><em>optional</em>) Support MXP markup or not.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The parsed string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>string (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.ansi.raw">
<code class="sig-prename descclassname">evennia.utils.ansi.</code><code class="sig-name descname">raw</code><span class="sig-paren">(</span><em class="sig-param">string</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#raw"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.raw" title="Permalink to this definition"></a></dt>
<dd><p>Escapes a string into a form which wont be colorized by the ansi
parser.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The raw, escaped string.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>string (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.ansi.strip_ansi">
<code class="sig-prename descclassname">evennia.utils.ansi.</code><code class="sig-name descname">strip_ansi</code><span class="sig-paren">(</span><em class="sig-param">string</em>, <em class="sig-param">parser=&lt;evennia.utils.ansi.ANSIParser object&gt;</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#strip_ansi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.strip_ansi" title="Permalink to this definition"></a></dt>
<dd><p>Strip all ansi from the string. This handles the Evennia-specific
markup.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> (<em>str</em>) The string to strip.</p></li>
<li><p><strong>parser</strong> (<em>ansi.AnsiParser</em><em>, </em><em>optional</em>) The parser to use.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The stripped string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>string (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.ansi.strip_raw_ansi">
<code class="sig-prename descclassname">evennia.utils.ansi.</code><code class="sig-name descname">strip_raw_ansi</code><span class="sig-paren">(</span><em class="sig-param">string</em>, <em class="sig-param">parser=&lt;evennia.utils.ansi.ANSIParser object&gt;</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/ansi.html#strip_raw_ansi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.ansi.strip_raw_ansi" title="Permalink to this definition"></a></dt>
<dd><p>Remove raw ansi codes from string. This assumes pure
ANSI-bytecodes in the string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> (<em>str</em>) The string to parse.</p></li>
<li><p><strong>parser</strong> (<em>bool</em><em>, </em><em>optional</em>) The parser to use.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>the stripped string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>string (str)</p>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.batchprocessors">
<span id="evennia-utils-batchprocessors-module"></span><h2>evennia.utils.batchprocessors module<a class="headerlink" href="#module-evennia.utils.batchprocessors" title="Permalink to this headline"></a></h2>
<p>This module contains the core methods for the Batch-command- and
Batch-code-processors respectively. In short, these are two different
ways to build a game world using a normal text-editor without having
to do so on the fly in-game. They also serve as an automatic backup
so you can quickly recreate a world also after a server reset. The
functions in this module is meant to form the backbone of a system
called and accessed through game commands.</p>
<p>The Batch-command processor is the simplest. It simply runs a list of
in-game commands in sequence by reading them from a text file. The
advantage of this is that the builder only need to remember the normal
in-game commands. They are also executing with full permission checks
etc, making it relatively safe for builders to use. The drawback is
that in-game there is really a builder-character walking around
building things, and it can be important to create rooms and objects
in the right order, so the character can move between them. Also
objects that affects players (such as mobs, dark rooms etc) will
affect the building character too, requiring extra care to turn
off/on.</p>
<p>The Batch-code processor is a more advanced system that accepts full
Python code, executing in chunks. The advantage of this is much more
power; practically anything imaginable can be coded and handled using
the batch-code processor. There is no in-game character that moves and
that can be affected by what is being built - the database is
populated on the fly. The drawback is safety and entry threshold - the
code is executed as would any server code, without mud-specific
permission-checks, and you have full access to modifying objects
etc. You also need to know Python and Evennias API. Hence its
recommended that the batch-code processor is limited only to
superusers or highly trusted staff.</p>
<p>Batch-command processor file syntax</p>
<p>The batch-command processor accepts batchcommand files e.g
<cite>batch.ev</cite>, containing a sequence of valid Evennia commands in a
simple format. The engine runs each command in sequence, as if they
had been run at the game prompt.</p>
<p>Each Evennia command must be delimited by a line comment to mark its
end.</p>
<p><a href="#id3"><span class="problematic" id="id4">``</span></a>`
#INSERT path.batchcmdfile - this as the first entry on a line will</p>
<blockquote>
<div><p>import and run a batch.ev file in this position, as if it was
written in this file.</p>
</div></blockquote>
<p><a href="#id5"><span class="problematic" id="id6">``</span></a><a href="#id7"><span class="problematic" id="id8">`</span></a></p>
<p>This way entire game worlds can be created and planned offline; it is
especially useful in order to create long room descriptions where a
real offline text editor is often much better than any online text
editor or prompt.</p>
<div class="section" id="example-of-batch-ev-file">
<h3>Example of batch.ev file:<a class="headerlink" href="#example-of-batch-ev-file" title="Permalink to this headline"></a></h3>
<p><a href="#id9"><span class="problematic" id="id10">``</span></a>`
# batch file
# all lines starting with # are comments; they also indicate
# that a command definition is over.</p>
<p>&#64;create box</p>
<p># this comment ends the &#64;create command.</p>
<p>&#64;set box/desc = A large box.</p>
<p>Inside are some scattered piles of clothing.</p>
<p>It seems the bottom of the box is a bit loose.</p>
<p># Again, this comment indicates the &#64;set command is over. Note how
# the description could be freely added. Excess whitespace on a line
# is ignored. An empty line in the command definition is parsed as a</p>
<p># (so two empty lines becomes a new paragraph).</p>
<p>&#64;teleport #221</p>
<p># (Assuming #221 is a warehouse or something.)
# (remember, this comment ends the &#64;teleport command! Donf forget it)</p>
<p># Example of importing another file at this point.
#IMPORT examples.batch</p>
<p>&#64;drop box</p>
<p># Done, the box is in the warehouse! (this last comment is not necessary to
# close the &#64;drop command since its the end of the file)
<a href="#id11"><span class="problematic" id="id12">``</span></a><a href="#id13"><span class="problematic" id="id14">`</span></a></p>
<hr class="docutils" />
<p>An example batch file is <cite>contrib/examples/batch_example.ev</cite>.</p>
<hr class="docutils" />
<p>Batch-code processor file syntax</p>
<p>The Batch-code processor accepts full python modules (e.g. <cite>batch.py</cite>)
that looks identical to normal Python files. The difference from
importing and running any Python module is that the batch-code module
is loaded as a file and executed directly, so changes to the file will
apply immediately without a server &#64;reload.</p>
<p>Optionally, one can add some special commented tokens to split the
execution of the code for the benefit of the batchprocessors
interactive- and debug-modes. This allows to conveniently step through
the code and re-run sections of it easily during development.</p>
<p>Code blocks are marked by commented tokens alone on a line:</p>
<dl class="simple">
<dt>#HEADER - This denotes code that should be pasted at the top of all</dt><dd><p>other code. Multiple HEADER statements - regardless of where
it exists in the file - is the same as one big block.
Observe that changes to variables made in one block is not
preserved between blocks!</p>
</dd>
<dt>#CODE - This designates a code block that will be executed like a</dt><dd><p>stand-alone piece of code together with any HEADER(s)
defined. It is mainly used as a way to mark stop points for
the interactive mode of the batchprocessor. If no CODE block
is defined in the module, the entire module (including HEADERS)
is assumed to be a CODE block.</p>
</dd>
<dt>#INSERT path.filename - This imports another batch_code.py file and</dt><dd><p>runs it in the given position. The inserted file will retain
its own HEADERs which will not be mixed with the headers of
this file.</p>
</dd>
</dl>
<p>Importing works as normal. The following variables are automatically
made available in the script namespace.</p>
<ul class="simple">
<li><p><cite>caller</cite> - The object executing the batchscript</p></li>
<li><dl class="simple">
<dt><cite>DEBUG</cite> - This is a boolean marking if the batchprocessor is running</dt><dd><p>in debug mode. It can be checked to e.g. delete created objects
when running a CODE block multiple times during testing.
(avoids creating a slew of same-named db objects)</p>
</dd>
</dl>
</li>
</ul>
</div>
<div class="section" id="example-batch-py-file">
<h3>Example batch.py file<a class="headerlink" href="#example-batch-py-file" title="Permalink to this headline"></a></h3>
<p><a href="#id15"><span class="problematic" id="id16">``</span></a>`
#HEADER</p>
<p>from django.conf import settings
from evennia.utils import create
from types import basetypes</p>
<p>GOLD = 10</p>
<p>#CODE</p>
<p>obj = create.create_object(basetypes.Object)
obj2 = create.create_object(basetypes.Object)
obj.location = caller.location
obj.db.gold = GOLD
caller.msg(“The object was created!”)</p>
<dl class="simple">
<dt>if DEBUG:</dt><dd><p>obj.delete()
obj2.delete()</p>
</dd>
</dl>
<p>#INSERT another_batch_file</p>
<p>#CODE</p>
<p>script = create.create_script()
<a href="#id17"><span class="problematic" id="id18">``</span></a><a href="#id19"><span class="problematic" id="id20">`</span></a></p>
<dl class="class">
<dt id="evennia.utils.batchprocessors.BatchCodeProcessor">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.batchprocessors.</code><code class="sig-name descname">BatchCodeProcessor</code><a class="reference internal" href="../_modules/evennia/utils/batchprocessors.html#BatchCodeProcessor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.batchprocessors.BatchCodeProcessor" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This implements a batch-code processor</p>
<dl class="method">
<dt id="evennia.utils.batchprocessors.BatchCodeProcessor.code_exec">
<code class="sig-name descname">code_exec</code><span class="sig-paren">(</span><em class="sig-param">code</em>, <em class="sig-param">extra_environ=None</em>, <em class="sig-param">debug=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/batchprocessors.html#BatchCodeProcessor.code_exec"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.batchprocessors.BatchCodeProcessor.code_exec" title="Permalink to this definition"></a></dt>
<dd><p>Execute a single code block, including imports and appending
global vars.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>code</strong> (<em>str</em>) Code to run.</p></li>
<li><p><strong>extra_environ</strong> (<em>dict</em>) Environment variables to run with code.</p></li>
<li><p><strong>debug</strong> (<em>bool</em><em>, </em><em>optional</em>) Set the DEBUG variable in the execution
namespace.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>An error code or None (ok).</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>err (str or None)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.batchprocessors.BatchCodeProcessor.parse_file">
<code class="sig-name descname">parse_file</code><span class="sig-paren">(</span><em class="sig-param">pythonpath</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/batchprocessors.html#BatchCodeProcessor.parse_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.batchprocessors.BatchCodeProcessor.parse_file" title="Permalink to this definition"></a></dt>
<dd><p>This parses the lines of a batchfile according to the following
rules:</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>pythonpath</strong> (<em>str</em>) The dot-python path to the file.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A list of all #CODE blocks, each with</dt><dd><p>prepended #HEADER data. If no #CODE blocks were found,
this will be a list of one element.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>codeblocks (list)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<ol class="arabic simple">
<li><dl class="simple">
<dt>Code before a #CODE/HEADER block are considered part of</dt><dd><p>the first code/header block or is the ONLY block if no
#CODE/HEADER blocks are defined.</p>
</dd>
</dl>
</li>
<li><p>Lines starting with #HEADER starts a header block (ends other blocks)</p></li>
<li><p>Lines starting with #CODE begins a code block (ends other blocks)</p></li>
<li><p>Lines starting with #INSERT are on form #INSERT filename. Code from
this file are processed with their headers <em>separately</em> before
being inserted at the point of the #INSERT.</p></li>
<li><p>Code after the last block is considered part of the last header/code
block</p></li>
</ol>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.batchprocessors.BatchCommandProcessor">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.batchprocessors.</code><code class="sig-name descname">BatchCommandProcessor</code><a class="reference internal" href="../_modules/evennia/utils/batchprocessors.html#BatchCommandProcessor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.batchprocessors.BatchCommandProcessor" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This class implements a batch-command processor.</p>
<dl class="method">
<dt id="evennia.utils.batchprocessors.BatchCommandProcessor.parse_file">
<code class="sig-name descname">parse_file</code><span class="sig-paren">(</span><em class="sig-param">pythonpath</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/batchprocessors.html#BatchCommandProcessor.parse_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.batchprocessors.BatchCommandProcessor.parse_file" title="Permalink to this definition"></a></dt>
<dd><p>This parses the lines of a batchfile according to the following
rules:</p>
<blockquote>
<div><ol class="arabic simple">
<li><dl class="simple">
<dt># at the beginning of a line marks the end of the command before</dt><dd><p>it. It is also a comment and any number of # can exist on
subsequent lines (but not inside comments).</p>
</dd>
</dl>
</li>
<li><p>#INSERT at the beginning of a line imports another
batch-cmd file file and pastes it into the batch file as if
it was written there.</p></li>
<li><p>Commands are placed alone at the beginning of a line and their
arguments are considered to be everything following (on any
number of lines) until the next comment line beginning with #.</p></li>
<li><p>Newlines are ignored in command definitions</p></li>
<li><p>A completely empty line in a command line definition is condered
a newline (so two empty lines is a paragraph).</p></li>
<li><p>Excess spaces and indents inside arguments are stripped.</p></li>
</ol>
</div></blockquote>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.batchprocessors.read_batchfile">
<code class="sig-prename descclassname">evennia.utils.batchprocessors.</code><code class="sig-name descname">read_batchfile</code><span class="sig-paren">(</span><em class="sig-param">pythonpath</em>, <em class="sig-param">file_ending='.py'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/batchprocessors.html#read_batchfile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.batchprocessors.read_batchfile" title="Permalink to this definition"></a></dt>
<dd><p>This reads the contents of a batch-file. Filename is considered
to be a python path to a batch file relative the directory
specified in <cite>settings.py</cite>.</p>
<p>file_ending specify which batchfile ending should be assumed (.ev
or .py). The ending should not be included in the python path.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pythonpath</strong> (<em>str</em>) A dot-python path to a file.</p></li>
<li><p><strong>file_ending</strong> (<em>str</em>) The file ending of this file (.ev or .py)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The text content of the batch file.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>IOError</strong> If problems reading file.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.batchprocessors.tb_filename">
<code class="sig-prename descclassname">evennia.utils.batchprocessors.</code><code class="sig-name descname">tb_filename</code><span class="sig-paren">(</span><em class="sig-param">tb</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/batchprocessors.html#tb_filename"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.batchprocessors.tb_filename" title="Permalink to this definition"></a></dt>
<dd><p>Helper to get filename from traceback</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.batchprocessors.tb_iter">
<code class="sig-prename descclassname">evennia.utils.batchprocessors.</code><code class="sig-name descname">tb_iter</code><span class="sig-paren">(</span><em class="sig-param">tb</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/batchprocessors.html#tb_iter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.batchprocessors.tb_iter" title="Permalink to this definition"></a></dt>
<dd><p>Traceback iterator.</p>
</dd></dl>
</div>
</div>
<div class="section" id="module-evennia.utils.containers">
<span id="evennia-utils-containers-module"></span><h2>evennia.utils.containers module<a class="headerlink" href="#module-evennia.utils.containers" title="Permalink to this headline"></a></h2>
<p>Containers</p>
<p>Containers are storage classes usually initialized from a setting. They
represent Singletons and acts as a convenient place to find resources (
available as properties on the singleton)</p>
<p>evennia.GLOBAL_SCRIPTS
evennia.OPTION_CLASSES</p>
<dl class="class">
<dt id="evennia.utils.containers.Container">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.containers.</code><code class="sig-name descname">Container</code><a class="reference internal" href="../_modules/evennia/utils/containers.html#Container"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.Container" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Base container class. A container is simply a storage object whose
properties can be acquired as a property on it. This is generally
considered a read-only affair.</p>
<p>The container is initialized by a list of modules containing callables.</p>
<dl class="method">
<dt id="evennia.utils.containers.Container.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/containers.html#Container.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.Container.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Read data from module.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.containers.Container.all">
<code class="sig-name descname">all</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/containers.html#Container.all"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.Container.all" title="Permalink to this definition"></a></dt>
<dd><p>Get all stored data</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>All global script objects stored on the container.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>scripts (list)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.containers.Container.get">
<code class="sig-name descname">get</code><span class="sig-paren">(</span><em class="sig-param">key</em>, <em class="sig-param">default=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/containers.html#Container.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.Container.get" title="Permalink to this definition"></a></dt>
<dd><p>Retrive data by key (in case of not knowing it beforehand).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> (<em>str</em>) The name of the script.</p></li>
<li><p><strong>default</strong> (<em>any</em><em>, </em><em>optional</em>) Value to return if key is not found.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The data loaded on this container.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.containers.Container.load_data">
<code class="sig-name descname">load_data</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/containers.html#Container.load_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.Container.load_data" title="Permalink to this definition"></a></dt>
<dd><p>Delayed import to avoid eventual circular imports from inside
the storage modules.</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.containers.Container.storage_modules">
<code class="sig-name descname">storage_modules</code><em class="property"> = []</em><a class="headerlink" href="#evennia.utils.containers.Container.storage_modules" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.containers.GlobalScriptContainer">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.containers.</code><code class="sig-name descname">GlobalScriptContainer</code><a class="reference internal" href="../_modules/evennia/utils/containers.html#GlobalScriptContainer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.GlobalScriptContainer" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.containers.Container" title="evennia.utils.containers.Container"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.containers.Container</span></code></a></p>
<p>Simple Handler object loaded by the Evennia API to contain and manage a
games Global Scripts. This will list global Scripts created on their own
but will also auto-(re)create scripts defined in <cite>settings.GLOBAL_SCRIPTS</cite>.</p>
<p class="rubric">Example</p>
<p>import evennia
evennia.GLOBAL_SCRIPTS.scriptname</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This does not use much of the BaseContainer since its not loading
callables from settings but a custom dict of tuples.</p>
</div>
<dl class="method">
<dt id="evennia.utils.containers.GlobalScriptContainer.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/containers.html#GlobalScriptContainer.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.GlobalScriptContainer.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Note: We must delay loading of typeclasses since this module may get
initialized before Scripts are actually initialized.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.containers.GlobalScriptContainer._get_scripts">
<code class="sig-name descname">_get_scripts</code><span class="sig-paren">(</span><em class="sig-param">key=None</em>, <em class="sig-param">default=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/containers.html#GlobalScriptContainer._get_scripts"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.GlobalScriptContainer._get_scripts" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.containers.GlobalScriptContainer._load_script">
<code class="sig-name descname">_load_script</code><span class="sig-paren">(</span><em class="sig-param">key</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/containers.html#GlobalScriptContainer._load_script"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.GlobalScriptContainer._load_script" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.containers.GlobalScriptContainer.all">
<code class="sig-name descname">all</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/containers.html#GlobalScriptContainer.all"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.GlobalScriptContainer.all" title="Permalink to this definition"></a></dt>
<dd><p>Get all global scripts. Note that this will not auto-start
scripts defined in settings.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>All global script objects stored on the container.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>scripts (list)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.containers.GlobalScriptContainer.get">
<code class="sig-name descname">get</code><span class="sig-paren">(</span><em class="sig-param">key</em>, <em class="sig-param">default=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/containers.html#GlobalScriptContainer.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.GlobalScriptContainer.get" title="Permalink to this definition"></a></dt>
<dd><p>Retrive data by key (in case of not knowing it beforehand). Any
scripts that are in settings.GLOBAL_SCRIPTS that are not found
will be recreated on-demand.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> (<em>str</em>) The name of the script.</p></li>
<li><p><strong>default</strong> (<em>any</em><em>, </em><em>optional</em>) Value to return if key is not found
at all on this container (i.e it cannot be loaded at all).</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The data loaded on this container.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.containers.GlobalScriptContainer.load_data">
<code class="sig-name descname">load_data</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/containers.html#GlobalScriptContainer.load_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.GlobalScriptContainer.load_data" title="Permalink to this definition"></a></dt>
<dd><p>This delayed import avoids trying to load Scripts before they are
initialized.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.containers.GlobalScriptContainer.start">
<code class="sig-name descname">start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/containers.html#GlobalScriptContainer.start"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.GlobalScriptContainer.start" title="Permalink to this definition"></a></dt>
<dd><p>Called last in evennia.__init__ to initialize the container late
(after script typeclasses have finished loading).</p>
<p>We include all global scripts in the handler and
make sure to auto-load time-based scripts.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.containers.OptionContainer">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.containers.</code><code class="sig-name descname">OptionContainer</code><a class="reference internal" href="../_modules/evennia/utils/containers.html#OptionContainer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.containers.OptionContainer" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.containers.Container" title="evennia.utils.containers.Container"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.containers.Container</span></code></a></p>
<p>Loads and stores the final list of OPTION CLASSES.</p>
<p>Can access these as properties or dictionary-contents.</p>
<dl class="attribute">
<dt id="evennia.utils.containers.OptionContainer.storage_modules">
<code class="sig-name descname">storage_modules</code><em class="property"> = ['evennia.utils.optionclasses']</em><a class="headerlink" href="#evennia.utils.containers.OptionContainer.storage_modules" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.create">
<span id="evennia-utils-create-module"></span><h2>evennia.utils.create module<a class="headerlink" href="#module-evennia.utils.create" title="Permalink to this headline"></a></h2>
<p>This module gathers all the essential database-creation
functions for the game engines various object types.</p>
<p>Only objects created stand-alone are in here, e.g. object Attributes
are always created directly through their respective objects.</p>
<p>Each creation_* function also has an alias named for the entity being
created, such as create_object() and object(). This is for
consistency with the utils.search module and allows you to do the
shorter “create.object()”.</p>
<p>The respective object managers hold more methods for manipulating and
searching objects already existing in the database.</p>
<dl class="simple">
<dt>Models covered:</dt><dd><p>Objects
Scripts
Help
Message
Channel
Accounts</p>
</dd>
</dl>
<dl class="function">
<dt id="evennia.utils.create.create_object">
<code class="sig-prename descclassname">evennia.utils.create.</code><code class="sig-name descname">create_object</code><span class="sig-paren">(</span><em class="sig-param">typeclass=None</em>, <em class="sig-param">key=None</em>, <em class="sig-param">location=None</em>, <em class="sig-param">home=None</em>, <em class="sig-param">permissions=None</em>, <em class="sig-param">locks=None</em>, <em class="sig-param">aliases=None</em>, <em class="sig-param">tags=None</em>, <em class="sig-param">destination=None</em>, <em class="sig-param">report_to=None</em>, <em class="sig-param">nohome=False</em>, <em class="sig-param">attributes=None</em>, <em class="sig-param">nattributes=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/create.html#create_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.create.create_object" title="Permalink to this definition"></a></dt>
<dd><p>Create a new in-game object.</p>
<dl>
<dt>Kwargs:</dt><dd><p>typeclass (class or str): Class or python path to a typeclass.
key (str): Name of the new object. If not set, a name of</p>
<blockquote>
<div><p>#dbref will be set.</p>
</div></blockquote>
<dl class="simple">
<dt>home (Object or str): Obj or #dbref to use as the objects</dt><dd><p>home location.</p>
</dd>
</dl>
<p>permissions (list): A list of permission strings or tuples (permstring, category).
locks (str): one or more lockstrings, separated by semicolons.
aliases (list): A list of alternative keys or tuples (aliasstring, category).
tags (list): List of tag keys or tuples (tagkey, category) or (tagkey, category, data).
destination (Object or str): Obj or #dbref to use as an Exits</p>
<blockquote>
<div><p>target.</p>
</div></blockquote>
<p>report_to (Object): The object to return error messages to.
nohome (bool): This allows the creation of objects without a</p>
<blockquote>
<div><p>default home location; only used when creating the default
location itself or during unittests.</p>
</div></blockquote>
<dl class="simple">
<dt>attributes (list): Tuples on the form (key, value) or (key, value, category),</dt><dd><dl class="simple">
<dt>(key, value, lockstring) or (key, value, lockstring, default_access).</dt><dd><p>to set as Attributes on the new object.</p>
</dd>
</dl>
</dd>
<dt>nattributes (list): Non-persistent tuples on the form (key, value). Note that</dt><dd><p>adding this rarely makes sense since this data will not survive a reload.</p>
</dd>
</dl>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A newly created object of the given typeclass.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>object (Object)</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><a class="reference internal" href="evennia.objects.html#evennia.objects.models.ObjectDB.DoesNotExist" title="evennia.objects.models.ObjectDB.DoesNotExist"><strong>ObjectDB.DoesNotExist</strong></a> If trying to create an Object with
<cite>location</cite> or <cite>home</cite> that cant be found.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.create.create_script">
<code class="sig-prename descclassname">evennia.utils.create.</code><code class="sig-name descname">create_script</code><span class="sig-paren">(</span><em class="sig-param">typeclass=None</em>, <em class="sig-param">key=None</em>, <em class="sig-param">obj=None</em>, <em class="sig-param">account=None</em>, <em class="sig-param">locks=None</em>, <em class="sig-param">interval=None</em>, <em class="sig-param">start_delay=None</em>, <em class="sig-param">repeats=None</em>, <em class="sig-param">persistent=None</em>, <em class="sig-param">autostart=True</em>, <em class="sig-param">report_to=None</em>, <em class="sig-param">desc=None</em>, <em class="sig-param">tags=None</em>, <em class="sig-param">attributes=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/create.html#create_script"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.create.create_script" title="Permalink to this definition"></a></dt>
<dd><p>Create a new script. All scripts are a combination of a database
object that communicates with the database, and an typeclass that
decorates the database object into being different types of
scripts. Its behaviour is similar to the game objects except
scripts has a time component and are more limited in scope.</p>
<dl>
<dt>Kwargs:</dt><dd><p>typeclass (class or str): Class or python path to a typeclass.
key (str): Name of the new object. If not set, a name of</p>
<blockquote>
<div><p>#dbref will be set.</p>
</div></blockquote>
<dl class="simple">
<dt>obj (Object): The entity on which this Script sits. If this</dt><dd><p>is <cite>None</cite>, we are creating a “global” script.</p>
</dd>
<dt>account (Account): The account on which this Script sits. It is</dt><dd><p>exclusiv to <cite>obj</cite>.</p>
</dd>
</dl>
<p>locks (str): one or more lockstrings, separated by semicolons.
interval (int): The triggering interval for this Script, in</p>
<blockquote>
<div><p>seconds. If unset, the Script will not have a timing
component.</p>
</div></blockquote>
<dl class="simple">
<dt>start_delay (bool): If <cite>True</cite>, will wait <cite>interval</cite> seconds</dt><dd><p>before triggering the first time.</p>
</dd>
<dt>repeats (int): The number of times to trigger before stopping.</dt><dd><p>If unset, will repeat indefinitely.</p>
</dd>
<dt>persistent (bool): If this Script survives a server shutdown</dt><dd><p>or not (all Scripts will survive a reload).</p>
</dd>
<dt>autostart (bool): If this Script will start immediately when</dt><dd><p>created or if the <cite>start</cite> method must be called explicitly.</p>
</dd>
</dl>
<p>report_to (Object): The object to return error messages to.
desc (str): Optional description of script
tags (list): List of tags or tuples (tag, category).
attributes (list): List if tuples (key, value) or (key, value, category)</p>
<blockquote>
<div><p>(key, value, lockstring) or (key, value, lockstring, default_access).</p>
</div></blockquote>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>An instance of the script created</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>script (obj)</p>
</dd>
</dl>
<p>See evennia.scripts.manager for methods to manipulate existing
scripts in the database.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.create.create_help_entry">
<code class="sig-prename descclassname">evennia.utils.create.</code><code class="sig-name descname">create_help_entry</code><span class="sig-paren">(</span><em class="sig-param">key</em>, <em class="sig-param">entrytext</em>, <em class="sig-param">category='General'</em>, <em class="sig-param">locks=None</em>, <em class="sig-param">aliases=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/create.html#create_help_entry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.create.create_help_entry" title="Permalink to this definition"></a></dt>
<dd><p>Create a static help entry in the help database. Note that Command
help entries are dynamic and directly taken from the __doc__
entries of the command. The database-stored help entries are
intended for more general help on the game, more extensive info,
in-game setting information and so on.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> (<em>str</em>) The name of the help entry.</p></li>
<li><p><strong>entrytext</strong> (<em>str</em>) The body of te help entry</p></li>
<li><p><strong>category</strong> (<em>str</em><em>, </em><em>optional</em>) The help category of the entry.</p></li>
<li><p><strong>locks</strong> (<em>str</em><em>, </em><em>optional</em>) A lockstring to restrict access.</p></li>
<li><p><strong>aliases</strong> (<em>list of str</em>) List of alternative (likely shorter) keynames.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A newly created help entry.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>help (<a class="reference internal" href="evennia.help.html#evennia.help.models.HelpEntry" title="evennia.help.models.HelpEntry">HelpEntry</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.create.create_message">
<code class="sig-prename descclassname">evennia.utils.create.</code><code class="sig-name descname">create_message</code><span class="sig-paren">(</span><em class="sig-param">senderobj</em>, <em class="sig-param">message</em>, <em class="sig-param">channels=None</em>, <em class="sig-param">receivers=None</em>, <em class="sig-param">locks=None</em>, <em class="sig-param">header=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/create.html#create_message"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.create.create_message" title="Permalink to this definition"></a></dt>
<dd><p>Create a new communication Msg. Msgs represent a unit of
database-persistent communication between entites.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>senderobj</strong> (<em>Object</em><em> or </em><em>Account</em>) The entity sending the Msg.</p></li>
<li><p><strong>message</strong> (<em>str</em>) Text with the message. Eventual headers, titles
etc should all be included in this text string. Formatting
will be retained.</p></li>
<li><p><strong>channels</strong> (<em>Channel</em><em>, </em><em>key</em><em> or </em><em>list</em>) A channel or a list of channels to
send to. The channels may be actual channel objects or their
unique key strings.</p></li>
<li><p><strong>receivers</strong> (<em>Object</em><em>, </em><em>Account</em><em>, </em><em>str</em><em> or </em><em>list</em>) An Account/Object to send
to, or a list of them. May be Account objects or accountnames.</p></li>
<li><p><strong>locks</strong> (<em>str</em>) Lock definition string.</p></li>
<li><p><strong>header</strong> (<em>str</em>) Mime-type or other optional information for the message</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>The Comm system is created very open-ended, so its fully possible
to let a message both go to several channels and to several
receivers at the same time, its up to the command definitions to
limit this as desired.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.create.create_channel">
<code class="sig-prename descclassname">evennia.utils.create.</code><code class="sig-name descname">create_channel</code><span class="sig-paren">(</span><em class="sig-param">key</em>, <em class="sig-param">aliases=None</em>, <em class="sig-param">desc=None</em>, <em class="sig-param">locks=None</em>, <em class="sig-param">keep_log=True</em>, <em class="sig-param">typeclass=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/create.html#create_channel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.create.create_channel" title="Permalink to this definition"></a></dt>
<dd><p>Create A communication Channel. A Channel serves as a central hub
for distributing Msgs to groups of people without specifying the
receivers explicitly. Instead accounts may connect to the channel
and follow the flow of messages. By default the channel allows
access to all old messages, but this can be turned off with the
keep_log switch.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>key</strong> (<em>str</em>) This must be unique.</p>
</dd>
</dl>
<dl>
<dt>Kwargs:</dt><dd><p>aliases (list of str): List of alternative (likely shorter) keynames.
desc (str): A description of the channel, for use in listings.
locks (str): Lockstring.
keep_log (bool): Log channel throughput.
typeclass (str or class): The typeclass of the Channel (not</p>
<blockquote>
<div><p>often used).</p>
</div></blockquote>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A newly created channel.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>channel (Channel)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.create.create_account">
<code class="sig-prename descclassname">evennia.utils.create.</code><code class="sig-name descname">create_account</code><span class="sig-paren">(</span><em class="sig-param">key</em>, <em class="sig-param">email</em>, <em class="sig-param">password</em>, <em class="sig-param">typeclass=None</em>, <em class="sig-param">is_superuser=False</em>, <em class="sig-param">locks=None</em>, <em class="sig-param">permissions=None</em>, <em class="sig-param">tags=None</em>, <em class="sig-param">attributes=None</em>, <em class="sig-param">report_to=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/create.html#create_account"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.create.create_account" title="Permalink to this definition"></a></dt>
<dd><p>This creates a new account.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> (<em>str</em>) The accounts name. This should be unique.</p></li>
<li><p><strong>email</strong> (<em>str</em><em> or </em><em>None</em>) Email on valid <a class="reference external" href="mailto:addr&#37;&#52;&#48;addr&#46;domain">addr<span>&#64;</span>addr<span>&#46;</span>domain</a> form. If
the empty string, will be set to None.</p></li>
<li><p><strong>password</strong> (<em>str</em>) Password in cleartext.</p></li>
</ul>
</dd>
</dl>
<dl>
<dt>Kwargs:</dt><dd><p>typeclass (str): The typeclass to use for the account.
is_superuser (bool): Wether or not this account is to be a superuser
locks (str): Lockstring.
permission (list): List of permission strings.
tags (list): List of Tags on form <cite>(key, category[, data])</cite>
attributes (list): List of Attributes on form</p>
<blockquote>
<div><p><cite>(key, value [, category, [,lockstring [, default_pass]]])</cite></p>
</div></blockquote>
<dl class="simple">
<dt>report_to (Object): An object with a msg() method to report</dt><dd><p>errors to. If not given, errors will be logged.</p>
</dd>
</dl>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The newly created Account.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Account</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>ValueError</strong> If <cite>key</cite> already exists in database.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Usually only the server admin should need to be superuser, all
other access levels can be handled with more fine-grained
permissions or groups. A superuser bypasses all lock checking
operations and is thus not suitable for play-testing the game.</p>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.dbserialize">
<span id="evennia-utils-dbserialize-module"></span><h2>evennia.utils.dbserialize module<a class="headerlink" href="#module-evennia.utils.dbserialize" title="Permalink to this headline"></a></h2>
<p>This module handles serialization of arbitrary python structural data,
intended primarily to be stored in the database. It also supports
storing Django model instances (which plain pickle cannot do).</p>
<p>This serialization is used internally by the server, notably for
storing data in Attributes and for piping data to process pools.</p>
<p>The purpose of dbserialize is to handle all forms of data. For
well-structured non-arbitrary exchange, such as communicating with a
rich web client, a simpler JSON serialization makes more sense.</p>
<p>This module also implements the <cite>SaverList</cite>, <cite>SaverDict</cite> and <cite>SaverSet</cite>
classes. These are iterables that track their position in a nested
structure and makes sure to send updates up to their root. This is
used by Attributes - without it, one would not be able to update mutables
in-situ, e.g <cite>obj.db.mynestedlist[3][5] = 3</cite> would never be saved and
be out of sync with the database.</p>
<dl class="function">
<dt id="evennia.utils.dbserialize.to_pickle">
<code class="sig-prename descclassname">evennia.utils.dbserialize.</code><code class="sig-name descname">to_pickle</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/dbserialize.html#to_pickle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.dbserialize.to_pickle" title="Permalink to this definition"></a></dt>
<dd><p>This prepares data on arbitrary form to be pickled. It handles any
nested structure and returns data on a form that is safe to pickle
(including having converted any database models to their internal
representation). We also convert any Saver*-type objects back to
their normal representations, they are not pickle-safe.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> (<em>any</em>) Data to pickle.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Pickled data.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>data (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.dbserialize.from_pickle">
<code class="sig-prename descclassname">evennia.utils.dbserialize.</code><code class="sig-name descname">from_pickle</code><span class="sig-paren">(</span><em class="sig-param">data</em>, <em class="sig-param">db_obj=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/dbserialize.html#from_pickle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.dbserialize.from_pickle" title="Permalink to this definition"></a></dt>
<dd><p>This should be fed a just de-pickled data object. It will be converted back
to a form that may contain database objects again. Note that if a database
object was removed (or changed in-place) in the database, None will be
returned.</p>
<dl>
<dt><a href="#id219"><span class="problematic" id="id220">Args_</span></a></dt><dd><p>data (any): Pickled data to unpickle.
db_obj (Atribute, any): This is the model instance (normally</p>
<blockquote>
<div><p>an Attribute) that _Saver*-type iterables (_SaverList etc)
will save to when they update. It must have a value property
that saves assigned data to the database. Skip if not
serializing onto a given object. If db_obj is given, this
function will convert lists, dicts and sets to their
_SaverList, _SaverDict and _SaverSet counterparts.</p>
</div></blockquote>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Unpickled data.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>data (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.dbserialize.do_pickle">
<code class="sig-prename descclassname">evennia.utils.dbserialize.</code><code class="sig-name descname">do_pickle</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/dbserialize.html#do_pickle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.dbserialize.do_pickle" title="Permalink to this definition"></a></dt>
<dd><p>Perform pickle to string</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.dbserialize.do_unpickle">
<code class="sig-prename descclassname">evennia.utils.dbserialize.</code><code class="sig-name descname">do_unpickle</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/dbserialize.html#do_unpickle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.dbserialize.do_unpickle" title="Permalink to this definition"></a></dt>
<dd><p>Retrieve pickle from pickled string</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.dbserialize.dbserialize">
<code class="sig-prename descclassname">evennia.utils.dbserialize.</code><code class="sig-name descname">dbserialize</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/dbserialize.html#dbserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.dbserialize.dbserialize" title="Permalink to this definition"></a></dt>
<dd><p>Serialize to pickled form in one step</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.dbserialize.dbunserialize">
<code class="sig-prename descclassname">evennia.utils.dbserialize.</code><code class="sig-name descname">dbunserialize</code><span class="sig-paren">(</span><em class="sig-param">data</em>, <em class="sig-param">db_obj=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/dbserialize.html#dbunserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.dbserialize.dbunserialize" title="Permalink to this definition"></a></dt>
<dd><p>Un-serialize in one step. See from_pickle for help db_obj.</p>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.eveditor">
<span id="evennia-utils-eveditor-module"></span><h2>evennia.utils.eveditor module<a class="headerlink" href="#module-evennia.utils.eveditor" title="Permalink to this headline"></a></h2>
<p>EvEditor (Evennia Line Editor)</p>
<p>This implements an advanced line editor for editing longer texts
in-game. The editor mimics the command mechanisms of the “VI” editor
(a famous line-by-line editor) as far as reasonable.</p>
<p>Features of the editor:</p>
<blockquote>
<div><ul class="simple">
<li><p>undo/redo.</p></li>
<li><p>edit/replace on any line of the buffer.</p></li>
<li><p>search&amp;replace text anywhere in buffer.</p></li>
<li><p>formatting of buffer, or selection, to certain width + indentations.</p></li>
<li><p>allow to echo the input or not, depending on your client.</p></li>
</ul>
</div></blockquote>
<p>To use the editor, just import EvEditor from this module
and initialize it:</p>
<blockquote>
<div><blockquote>
<div><p>from evennia.utils.eveditor import EvEditor</p>
<p>EvEditor(caller, loadfunc=None, savefunc=None, quitfunc=None, key=””, persistent=True)</p>
</div></blockquote>
<ul class="simple">
<li><p>caller is the user of the editor, the one to see all feedback.</p></li>
<li><p>loadfunc(caller) is called when the editor is first launched; the
return from this function is loaded as the starting buffer in the
editor.</p></li>
<li><p>safefunc(caller, buffer) is called with the current buffer when
saving in the editor. The function should return True/False depending
on if the saving was successful or not.</p></li>
<li><p>quitfunc(caller) is called when the editor exits. If this is given,
no automatic quit messages will be given.</p></li>
<li><p>key is an optional identifier for the editing session, to be
displayed in the editor.</p></li>
<li><p>persistent means the editor state will be saved to the database making it
survive a server reload. Note that using this mode, the load- save-
and quit-funcs must all be possible to pickle - notable unusable
callables are class methods and functions defined inside other
functions. With persistent=False, no such restriction exists.</p></li>
<li><p>code set to True activates features on the EvEditor to enter Python code.</p></li>
</ul>
</div></blockquote>
<p>In addition, the EvEditor can be used to enter Python source code,
and offers basic handling of indentation.</p>
<dl class="class">
<dt id="evennia.utils.eveditor.CmdEditorBase">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.eveditor.</code><code class="sig-name descname">CmdEditorBase</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#CmdEditorBase"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.command.Command</span></code></a></p>
<p>Base parent for editor commands</p>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorBase._keyaliases">
<code class="sig-name descname">_keyaliases</code><em class="property"> = ('command',)</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase._keyaliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorBase._matchset">
<code class="sig-name descname">_matchset</code><em class="property"> = {'command'}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase._matchset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorBase.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = []</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorBase.editor">
<code class="sig-name descname">editor</code><em class="property"> = None</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase.editor" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorBase.help_category">
<code class="sig-name descname">help_category</code><em class="property"> = 'general'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase.help_category" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorBase.help_entry">
<code class="sig-name descname">help_entry</code><em class="property"> = 'LineEditor'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase.help_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorBase.key">
<code class="sig-name descname">key</code><em class="property"> = 'command'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorBase.lock_storage">
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all()'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase.lock_storage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorBase.locks">
<code class="sig-name descname">locks</code><em class="property"> = 'cmd:all()'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase.locks" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.CmdEditorBase.parse">
<code class="sig-name descname">parse</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#CmdEditorBase.parse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase.parse" title="Permalink to this definition"></a></dt>
<dd><p>Handles pre-parsing</p>
<dl>
<dt>Editor commands are on the form</dt><dd><p>:cmd [li] [w] [txt]</p>
</dd>
<dt>Where all arguments are optional.</dt><dd><dl class="simple">
<dt>li - line number (int), starting from 1. This could also</dt><dd><p>be a range given as &lt;l&gt;:&lt;l&gt;.</p>
</dd>
</dl>
<p>w - word(s) (string), could be encased in quotes.
txt - extra text (string), could be encased in quotes.</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorBase.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '', 'category': 'general', 'key': 'command', 'tags': '', 'text': '\n Base parent for editor commands\n '}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorBase.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.eveditor.CmdEditorGroup">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.eveditor.</code><code class="sig-name descname">CmdEditorGroup</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#CmdEditorGroup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.eveditor.CmdEditorBase" title="evennia.utils.eveditor.CmdEditorBase"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.eveditor.CmdEditorBase</span></code></a></p>
<p>Commands for the editor</p>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup._keyaliases">
<code class="sig-name descname">_keyaliases</code><em class="property"> = (':q', ':i', ':h', ':I', ':s', '::', ':dd', ':dw', ':j', ':::', ':DD', ':S', ':UU', ':r', ':x', ':p', ':=', ':fi', ':', ':A', ':u', ':&lt;', ':editor_command_group', ':uu', ':&gt;', ':q!', ':wq', ':echo', ':y', ':fd', ':!', ':f', ':w')</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup._keyaliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup._matchset">
<code class="sig-name descname">_matchset</code><em class="property"> = {':', ':!', '::', ':::', ':&lt;', ':=', ':&gt;', ':A', ':DD', ':I', ':S', ':UU', ':dd', ':dw', ':echo', ':editor_command_group', ':f', ':fd', ':fi', ':h', ':i', ':j', ':p', ':q', ':q!', ':r', ':s', ':u', ':uu', ':w', ':wq', ':x', ':y'}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup._matchset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = [':q', ':i', ':h', ':I', ':s', '::', ':dd', ':dw', ':j', ':::', ':DD', ':S', ':UU', ':r', ':x', ':p', ':=', ':fi', ':', ':A', ':u', ':&lt;', ':uu', ':&gt;', ':q!', ':wq', ':echo', ':y', ':fd', ':!', ':f', ':w']</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup.arg_regex">
<code class="sig-name descname">arg_regex</code><em class="property"> = re.compile('\\s.*?|$', re.IGNORECASE)</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.arg_regex" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.CmdEditorGroup.func">
<code class="sig-name descname">func</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#CmdEditorGroup.func"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.func" title="Permalink to this definition"></a></dt>
<dd><p>This command handles all the in-editor :-style commands. Since
each command is small and very limited, this makes for a more
efficient presentation.</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup.help_category">
<code class="sig-name descname">help_category</code><em class="property"> = 'general'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.help_category" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup.key">
<code class="sig-name descname">key</code><em class="property"> = ':editor_command_group'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup.lock_storage">
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all()'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.lock_storage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': ':q :i :h :I :s :: :dd :dw :j ::: :DD :S :UU :r :x :p := :fi : :A :u :&lt; :uu :&gt; :q! :wq :echo :y :fd :! :f :w', 'category': 'general', 'key': ':editor_command_group', 'tags': '', 'text': '\n Commands for the editor\n '}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.eveditor.CmdLineInput">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.eveditor.</code><code class="sig-name descname">CmdLineInput</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#CmdLineInput"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.CmdLineInput" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.eveditor.CmdEditorBase" title="evennia.utils.eveditor.CmdEditorBase"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.eveditor.CmdEditorBase</span></code></a></p>
<p>No command match - Inputs line of text into buffer.</p>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdLineInput._keyaliases">
<code class="sig-name descname">_keyaliases</code><em class="property"> = ('__noinput_command', '__nomatch_command')</em><a class="headerlink" href="#evennia.utils.eveditor.CmdLineInput._keyaliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdLineInput._matchset">
<code class="sig-name descname">_matchset</code><em class="property"> = {'__noinput_command', '__nomatch_command'}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdLineInput._matchset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdLineInput.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['__noinput_command']</em><a class="headerlink" href="#evennia.utils.eveditor.CmdLineInput.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.CmdLineInput.func">
<code class="sig-name descname">func</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#CmdLineInput.func"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.CmdLineInput.func" title="Permalink to this definition"></a></dt>
<dd><p>Adds the line without any formatting changes.</p>
<p>If the editor handles code, it might add automatic
indentation.</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdLineInput.help_category">
<code class="sig-name descname">help_category</code><em class="property"> = 'general'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdLineInput.help_category" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdLineInput.key">
<code class="sig-name descname">key</code><em class="property"> = '__nomatch_command'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdLineInput.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdLineInput.lock_storage">
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all()'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdLineInput.lock_storage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdLineInput.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '__noinput_command', 'category': 'general', 'key': '__nomatch_command', 'tags': '', 'text': '\n No command match - Inputs line of text into buffer.\n '}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdLineInput.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.eveditor.CmdSaveYesNo">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.eveditor.</code><code class="sig-name descname">CmdSaveYesNo</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#CmdSaveYesNo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.CmdSaveYesNo" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.command.Command</span></code></a></p>
<p>Save the editor state on quit. This catches
nomatches (defaults to Yes), and avoid saves only if
command was given specifically as “no” or “n”.</p>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdSaveYesNo._keyaliases">
<code class="sig-name descname">_keyaliases</code><em class="property"> = ('__noinput_command', '__nomatch_command')</em><a class="headerlink" href="#evennia.utils.eveditor.CmdSaveYesNo._keyaliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdSaveYesNo._matchset">
<code class="sig-name descname">_matchset</code><em class="property"> = {'__noinput_command', '__nomatch_command'}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdSaveYesNo._matchset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdSaveYesNo.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['__noinput_command']</em><a class="headerlink" href="#evennia.utils.eveditor.CmdSaveYesNo.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.CmdSaveYesNo.func">
<code class="sig-name descname">func</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#CmdSaveYesNo.func"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.CmdSaveYesNo.func" title="Permalink to this definition"></a></dt>
<dd><p>Implement the yes/no choice.</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdSaveYesNo.help_category">
<code class="sig-name descname">help_category</code><em class="property"> = 'general'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdSaveYesNo.help_category" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdSaveYesNo.help_cateogory">
<code class="sig-name descname">help_cateogory</code><em class="property"> = 'LineEditor'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdSaveYesNo.help_cateogory" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdSaveYesNo.key">
<code class="sig-name descname">key</code><em class="property"> = '__nomatch_command'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdSaveYesNo.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdSaveYesNo.lock_storage">
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all()'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdSaveYesNo.lock_storage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdSaveYesNo.locks">
<code class="sig-name descname">locks</code><em class="property"> = 'cmd:all()'</em><a class="headerlink" href="#evennia.utils.eveditor.CmdSaveYesNo.locks" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.CmdSaveYesNo.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '__noinput_command', 'category': 'general', 'key': '__nomatch_command', 'tags': '', 'text': '\n Save the editor state on quit. This catches\n nomatches (defaults to Yes), and avoid saves only if\n command was given specifically as &quot;no&quot; or &quot;n&quot;.\n '}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdSaveYesNo.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.eveditor.EvEditor">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.eveditor.</code><code class="sig-name descname">EvEditor</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">loadfunc=None</em>, <em class="sig-param">savefunc=None</em>, <em class="sig-param">quitfunc=None</em>, <em class="sig-param">key=''</em>, <em class="sig-param">persistent=False</em>, <em class="sig-param">codefunc=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This defines a line editor object. It creates all relevant commands
and tracks the current state of the buffer. It also cleans up after
itself.</p>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">loadfunc=None</em>, <em class="sig-param">savefunc=None</em>, <em class="sig-param">quitfunc=None</em>, <em class="sig-param">key=''</em>, <em class="sig-param">persistent=False</em>, <em class="sig-param">codefunc=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Launches a full in-game line editor, mimicking the functionality of VIM.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>caller</strong> (<em>Object</em>) Who is using the editor.</p></li>
<li><p><strong>loadfunc</strong> (<em>callable</em><em>, </em><em>optional</em>) This will be called as
<cite>loadfunc(caller)</cite> when the editor is first started. Its
return will be used as the editors starting buffer.</p></li>
<li><p><strong>savefunc</strong> (<em>callable</em><em>, </em><em>optional</em>) This will be called as
<cite>savefunc(caller, buffer)</cite> when the save-command is given and
is used to actually determine where/how result is saved.
It should return <cite>True</cite> if save was successful and also
handle any feedback to the user.</p></li>
<li><p><strong>quitfunc</strong> (<em>callable</em><em>, </em><em>optional</em>) This will optionally be
called as <cite>quitfunc(caller)</cite> when the editor is
exited. If defined, it should handle all wanted feedback
to the user.</p></li>
<li><p><strong>quitfunc_args</strong> (<em>tuple</em><em>, </em><em>optional</em>) Optional tuple of arguments to
supply to <cite>quitfunc</cite>.</p></li>
<li><p><strong>key</strong> (<em>str</em><em>, </em><em>optional</em>) An optional key for naming this
session and make it unique from other editing sessions.</p></li>
<li><p><strong>persistent</strong> (<em>bool</em><em>, </em><em>optional</em>) Make the editor survive a reboot. Note
that if this is set, all callables must be possible to pickle</p></li>
<li><p><strong>codefunc</strong> (<em>bool</em><em>, </em><em>optional</em>) If given, will run the editor in code mode.
This will be called as <cite>codefunc(caller, buf)</cite>.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>In persistent mode, all the input callables (savefunc etc)
must be possible to be <em>pickled</em>, this excludes e.g.
callables that are class methods or functions defined
dynamically or as part of another function. In
non-persistent mode no such restrictions exist.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.decrease_indent">
<code class="sig-name descname">decrease_indent</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.decrease_indent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.decrease_indent" title="Permalink to this definition"></a></dt>
<dd><p>Decrease automatic indentation by 1 level.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.deduce_indent">
<code class="sig-name descname">deduce_indent</code><span class="sig-paren">(</span><em class="sig-param">line</em>, <em class="sig-param">buffer</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.deduce_indent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.deduce_indent" title="Permalink to this definition"></a></dt>
<dd><p>Try to deduce the level of indentation of the given line.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.display_buffer">
<code class="sig-name descname">display_buffer</code><span class="sig-paren">(</span><em class="sig-param">buf=None</em>, <em class="sig-param">offset=0</em>, <em class="sig-param">linenums=True</em>, <em class="sig-param">options={'raw': False}</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.display_buffer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.display_buffer" title="Permalink to this definition"></a></dt>
<dd><p>This displays the line editor buffer, or selected parts of it.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>buf</strong> (<em>str</em><em>, </em><em>optional</em>) The buffer or part of buffer to display.</p></li>
<li><p><strong>offset</strong> (<em>int</em><em>, </em><em>optional</em>) If <cite>buf</cite> is set and is not the full buffer,
<cite>offset</cite> should define the actual starting line number, to
get the linenum display right.</p></li>
<li><p><strong>linenums</strong> (<em>bool</em><em>, </em><em>optional</em>) Show line numbers in buffer.</p></li>
<li><p><strong>options</strong> raw (bool, optional): Tell protocol to not parse
formatting information.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.display_help">
<code class="sig-name descname">display_help</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.display_help"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.display_help" title="Permalink to this definition"></a></dt>
<dd><p>Shows the help entry for the editor.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.get_buffer">
<code class="sig-name descname">get_buffer</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.get_buffer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.get_buffer" title="Permalink to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The current buffer.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>buffer (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.increase_indent">
<code class="sig-name descname">increase_indent</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.increase_indent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.increase_indent" title="Permalink to this definition"></a></dt>
<dd><p>Increase automatic indentation by 1 level.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.load_buffer">
<code class="sig-name descname">load_buffer</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.load_buffer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.load_buffer" title="Permalink to this definition"></a></dt>
<dd><p>Load the buffer using the load function hook.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.quit">
<code class="sig-name descname">quit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.quit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.quit" title="Permalink to this definition"></a></dt>
<dd><p>Cleanly exit the editor.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.save_buffer">
<code class="sig-name descname">save_buffer</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.save_buffer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.save_buffer" title="Permalink to this definition"></a></dt>
<dd><p>Saves the content of the buffer.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.swap_autoindent">
<code class="sig-name descname">swap_autoindent</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.swap_autoindent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.swap_autoindent" title="Permalink to this definition"></a></dt>
<dd><p>Swap automatic indentation on or off.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.update_buffer">
<code class="sig-name descname">update_buffer</code><span class="sig-paren">(</span><em class="sig-param">buf</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.update_buffer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.update_buffer" title="Permalink to this definition"></a></dt>
<dd><p>This should be called when the buffer has been changed
somehow. It will handle unsaved flag and undo updating.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>buf</strong> (<em>str</em>) The text to update the buffer with.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditor.update_undo">
<code class="sig-name descname">update_undo</code><span class="sig-paren">(</span><em class="sig-param">step=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditor.update_undo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditor.update_undo" title="Permalink to this definition"></a></dt>
<dd><p>This updates the undo position.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>step</strong> (<em>int</em><em>, </em><em>optional</em>) The amount of steps
to progress the undo position to. This
may be a negative value for undo and
a positive value for redo.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.eveditor.EvEditorCmdSet">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.eveditor.</code><code class="sig-name descname">EvEditorCmdSet</code><span class="sig-paren">(</span><em class="sig-param">cmdsetobj=None</em>, <em class="sig-param">key=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditorCmdSet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditorCmdSet" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.cmdset.CmdSet" title="evennia.commands.cmdset.CmdSet"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.cmdset.CmdSet</span></code></a></p>
<p>CmdSet for the editor commands</p>
<dl class="method">
<dt id="evennia.utils.eveditor.EvEditorCmdSet.at_cmdset_creation">
<code class="sig-name descname">at_cmdset_creation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#EvEditorCmdSet.at_cmdset_creation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.EvEditorCmdSet.at_cmdset_creation" title="Permalink to this definition"></a></dt>
<dd><p>Hook method - this should be overloaded in the inheriting
class, and should take care of populating the cmdset by use of
self.add().</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.EvEditorCmdSet.key">
<code class="sig-name descname">key</code><em class="property"> = 'editorcmdset'</em><a class="headerlink" href="#evennia.utils.eveditor.EvEditorCmdSet.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.EvEditorCmdSet.mergetype">
<code class="sig-name descname">mergetype</code><em class="property"> = 'Replace'</em><a class="headerlink" href="#evennia.utils.eveditor.EvEditorCmdSet.mergetype" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.EvEditorCmdSet.path">
<code class="sig-name descname">path</code><em class="property"> = 'evennia.utils.eveditor.EvEditorCmdSet'</em><a class="headerlink" href="#evennia.utils.eveditor.EvEditorCmdSet.path" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.eveditor.SaveYesNoCmdSet">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.eveditor.</code><code class="sig-name descname">SaveYesNoCmdSet</code><span class="sig-paren">(</span><em class="sig-param">cmdsetobj=None</em>, <em class="sig-param">key=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#SaveYesNoCmdSet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.SaveYesNoCmdSet" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.cmdset.CmdSet" title="evennia.commands.cmdset.CmdSet"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.cmdset.CmdSet</span></code></a></p>
<p>Stores the yesno question</p>
<dl class="method">
<dt id="evennia.utils.eveditor.SaveYesNoCmdSet.at_cmdset_creation">
<code class="sig-name descname">at_cmdset_creation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#SaveYesNoCmdSet.at_cmdset_creation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor.SaveYesNoCmdSet.at_cmdset_creation" title="Permalink to this definition"></a></dt>
<dd><p>at cmdset creation</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.SaveYesNoCmdSet.key">
<code class="sig-name descname">key</code><em class="property"> = 'quitsave_yesno'</em><a class="headerlink" href="#evennia.utils.eveditor.SaveYesNoCmdSet.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.SaveYesNoCmdSet.mergetype">
<code class="sig-name descname">mergetype</code><em class="property"> = 'Replace'</em><a class="headerlink" href="#evennia.utils.eveditor.SaveYesNoCmdSet.mergetype" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.SaveYesNoCmdSet.path">
<code class="sig-name descname">path</code><em class="property"> = 'evennia.utils.eveditor.SaveYesNoCmdSet'</em><a class="headerlink" href="#evennia.utils.eveditor.SaveYesNoCmdSet.path" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.eveditor.SaveYesNoCmdSet.priority">
<code class="sig-name descname">priority</code><em class="property"> = 1</em><a class="headerlink" href="#evennia.utils.eveditor.SaveYesNoCmdSet.priority" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.eveditor._load_editor">
<code class="sig-prename descclassname">evennia.utils.eveditor.</code><code class="sig-name descname">_load_editor</code><span class="sig-paren">(</span><em class="sig-param">caller</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/eveditor.html#_load_editor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.eveditor._load_editor" title="Permalink to this definition"></a></dt>
<dd><p>Load persistent editor from storage.</p>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.evform">
<span id="evennia-utils-evform-module"></span><h2>evennia.utils.evform module<a class="headerlink" href="#module-evennia.utils.evform" title="Permalink to this headline"></a></h2>
<p>EvForm - a way to create advanced ASCII forms</p>
<p>This is intended for creating advanced ASCII game forms, such as a
large pretty character sheet or info document.</p>
<p>The system works on the basis of a readin template that is given in a
separate Python file imported into the handler. This file contains
some optional settings and a string mapping out the form. The template
has markers in it to denounce fields to fill. The markers map the
absolute size of the field and will be filled with an <cite>evtable.EvCell</cite>
object when displaying the form.</p>
<p>Example of input file <cite>testform.py</cite>:</p>
<p><a href="#id21"><span class="problematic" id="id22">``</span></a><a href="#id23"><span class="problematic" id="id24">`</span></a>python
FORMCHAR = “x”
TABLECHAR = “c”</p>
<p>FORM =
.————————————————.
| |
| Name: xxxxx1xxxxx Player: xxxxxxx2xxxxxxx |
| xxxxxxxxxxx |
| |</p>
<blockquote>
<div><p>&gt;———————————————-&lt;</p>
</div></blockquote>
<div class="line-block">
<div class="line-block">
<div class="line"><a href="#id25"><span class="problematic" id="id26">|</span></a></div>
</div>
<div class="line">Desc: xxxxxxxxxxx STR: x4x DEX: x5x |</div>
<div class="line-block">
<div class="line">xxxxx3xxxxx INT: x6x STA: x7x |</div>
<div class="line">xxxxxxxxxxx LUC: x8x MAG: x9x |</div>
<div class="line-block">
<div class="line-block">
<div class="line">|
&gt;———————————————-&lt;</div>
</div>
<div class="line">| |</div>
</div>
</div>
<div class="line">cccccccc | ccccccccccccccccccccccccccccccccccc |</div>
<div class="line">cccccccc | ccccccccccccccccccccccccccccccccccc |</div>
<div class="line">cccAcccc | ccccccccccccccccccccccccccccccccccc |</div>
<div class="line">cccccccc | ccccccccccccccccccccccccccccccccccc |</div>
<div class="line">cccccccc | cccccccccccccccccBccccccccccccccccc |</div>
<div class="line-block">
<div class="line">| |</div>
</div>
</div>
<p><a href="#id27"><span class="problematic" id="id28">``</span></a><a href="#id29"><span class="problematic" id="id30">`</span></a></p>
<p>The first line of the <cite>FORM</cite> string is ignored. The forms and table
markers must mark out complete, unbroken rectangles, each containing
one embedded single-character identifier (so the smallest element
possible is a 3-character wide form). The identifier can be any
character except for the <cite>FORM_CHAR</cite> and <cite>TABLE_CHAR</cite> and some of the
common ASCII-art elements, like space, <cite>_</cite> <cite>|</cite> <cite>*</cite> etc (see
<cite>INVALID_FORMCHARS</cite> in this module). Form Rectangles can have any size,
but must be separated from each other by at least one other
characters width.</p>
<p>Use as follows:</p>
<dl>
<dt><a href="#id31"><span class="problematic" id="id32">``</span></a><a href="#id33"><span class="problematic" id="id34">`</span></a>python</dt><dd><p>from evennia import EvForm, EvTable</p>
<p># create a new form from the template
form = EvForm(“path/to/testform.py”)</p>
<dl class="simple">
<dt>(MudForm can also take a dictionary holding</dt><dd><p>the required keys FORMCHAR, TABLECHAR and FORM)</p>
</dd>
</dl>
<p># add data to each tagged form cell
form.map(cells={1: “Tom the Bouncer”,</p>
<blockquote>
<div><p>2: “Griatch”,
3: “A sturdy fellow”,
4: 12,
5: 10,
6: 5,
7: 18,
8: 10,
9: 3})</p>
</div></blockquote>
<p># create the EvTables
tableA = EvTable(“HP”,”MV”,”MP”,</p>
<blockquote>
<div><p>table=[[“**”], [“<strong>*</strong>”], [“<a href="#id35"><span class="problematic" id="id36">**</span></a><a href="#id37"><span class="problematic" id="id38">*</span></a>”]],
border=”incols”)</p>
</div></blockquote>
<dl>
<dt>tableB = EvTable(“Skill”, “Value”, “Exp”,</dt><dd><dl class="simple">
<dt>table=[[“Shooting”, “Herbalism”, “Smithing”],</dt><dd><p>[12,14,9],[“550/1200”, “990/1400”, “205/900”]],</p>
</dd>
</dl>
<p>border=”incols”)</p>
</dd>
</dl>
<p># add the tables to the proper ids in the form
form.map(tables={“A”: tableA,</p>
<blockquote>
<div><p>“B”: tableB})</p>
</div></blockquote>
<p>print(form)</p>
</dd>
</dl>
<p><a href="#id39"><span class="problematic" id="id40">``</span></a><a href="#id41"><span class="problematic" id="id42">`</span></a></p>
<p>This produces the following result:</p>
<p><a href="#id43"><span class="problematic" id="id44">``</span></a>`
.————————————————.
| |
| Name: Tom the Player: Griatch |
| Bouncer |
| |</p>
<blockquote>
<div><p>&gt;———————————————-&lt;</p>
</div></blockquote>
<div class="line-block">
<div class="line-block">
<div class="line"><a href="#id45"><span class="problematic" id="id46">|</span></a></div>
</div>
<div class="line">Desc: A sturdy STR: 12 DEX: 10 |</div>
<div class="line-block">
<div class="line">fellow INT: 5 STA: 18 |</div>
<div class="line-block">
<div class="line-block">
<div class="line">LUC: 10 MAG: 3 |</div>
<div class="line-block">
<div class="line">|
&gt;———————————————-&lt;</div>
</div>
</div>
<div class="line">| |</div>
</div>
</div>
<div class="line">HP|MV|MP | Skill <a href="#id47"><span class="problematic" id="id48">|</span></a>Value <a href="#id49"><span class="problematic" id="id50">|</span></a>Exp |</div>
<div class="line">~~+~~+~~ | ~~~~~~~~~~~+~~~~~~~~~~~+~~~~~~~~~~~ |</div>
<div class="line"><strong>|**|</strong> | Shooting <a href="#id51"><span class="problematic" id="id52">|</span></a>12 <a href="#id53"><span class="problematic" id="id54">|</span></a>550/1200 |</div>
<div class="line-block">
<div class="line"><a href="#id55"><span class="problematic" id="id56">|</span></a><a href="#id57"><span class="problematic" id="id58">**</span></a><a href="#id59"><span class="problematic" id="id60">|</span></a>* | Herbalism <a href="#id61"><span class="problematic" id="id62">|</span></a>14 <a href="#id63"><span class="problematic" id="id64">|</span></a>990/1400 |</div>
<div class="line"><a href="#id65"><span class="problematic" id="id66">|</span></a>* | | Smithing <a href="#id67"><span class="problematic" id="id68">|</span></a>9 <a href="#id69"><span class="problematic" id="id70">|</span></a>205/900 |</div>
<div class="line-block">
<div class="line">| |
————————————————</div>
</div>
</div>
</div>
<p><a href="#id71"><span class="problematic" id="id72">``</span></a><a href="#id73"><span class="problematic" id="id74">`</span></a></p>
<p>The marked forms have been replaced with EvCells of text and with
EvTables. The form can be updated by simply re-applying <cite>form.map()</cite>
with the updated data.</p>
<p>When working with the template ASCII file, you can use <cite>form.reload()</cite>
to re-read the template and re-apply all existing mappings.</p>
<p>Each component is restrained to the width and height specified by the
template, so it will resize to fit (or crop text if the area is too
small for it). If you try to fit a table into an area it cannot fit
into (when including its borders and at least one line of text), the
form will raise an error.</p>
<dl class="class">
<dt id="evennia.utils.evform.EvForm">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evform.</code><code class="sig-name descname">EvForm</code><span class="sig-paren">(</span><em class="sig-param">filename=None</em>, <em class="sig-param">cells=None</em>, <em class="sig-param">tables=None</em>, <em class="sig-param">form=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evform.html#EvForm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evform.EvForm" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This object is instantiated with a text file and parses
it for rectangular form fields. It can then be fed a
mapping so as to populate the fields with fixed-width
EvCell or Tables.</p>
<dl class="method">
<dt id="evennia.utils.evform.EvForm.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">filename=None</em>, <em class="sig-param">cells=None</em>, <em class="sig-param">tables=None</em>, <em class="sig-param">form=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evform.html#EvForm.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evform.EvForm.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Initiate the form</p>
<dl>
<dt>Kwargs:</dt><dd><p>filename (str): Path to template file.
cells (dict): A dictionary mapping of {id:text}
tables (dict): A dictionary mapping of {id:EvTable}.
form (dict): A dictionary of {“FORMCHAR”:char,</p>
<blockquote>
<div><blockquote>
<div><p>“TABLECHAR”:char,
“FORM”:templatestring}</p>
</div></blockquote>
<p>if this is given, filename is not read.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Other kwargs are fed as options to the EvCells and EvTables
(see <cite>evtable.EvCell</cite> and <cite>evtable.EvTable</cite> for more info).</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evform.EvForm._parse_rectangles">
<code class="sig-name descname">_parse_rectangles</code><span class="sig-paren">(</span><em class="sig-param">cellchar</em>, <em class="sig-param">tablechar</em>, <em class="sig-param">form</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evform.html#EvForm._parse_rectangles"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evform.EvForm._parse_rectangles" title="Permalink to this definition"></a></dt>
<dd><p>Parse a form for rectangular formfields identified by formchar
enclosing an identifier.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evform.EvForm._populate_form">
<code class="sig-name descname">_populate_form</code><span class="sig-paren">(</span><em class="sig-param">raw_form</em>, <em class="sig-param">mapping</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evform.html#EvForm._populate_form"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evform.EvForm._populate_form" title="Permalink to this definition"></a></dt>
<dd><p>Insert cell contents into form at given locations</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evform.EvForm.map">
<code class="sig-name descname">map</code><span class="sig-paren">(</span><em class="sig-param">cells=None</em>, <em class="sig-param">tables=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evform.html#EvForm.map"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evform.EvForm.map" title="Permalink to this definition"></a></dt>
<dd><p>Add mapping for form.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>cells</strong> (<em>dict</em>) A dictionary of {identifier:celltext}</p></li>
<li><p><strong>tables</strong> (<em>dict</em>) A dictionary of {identifier:table}</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>kwargs will be forwarded to tables/cells. See
<cite>evtable.EvCell</cite> and <cite>evtable.EvTable</cite> for info.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evform.EvForm.reload">
<code class="sig-name descname">reload</code><span class="sig-paren">(</span><em class="sig-param">filename=None</em>, <em class="sig-param">form=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evform.html#EvForm.reload"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evform.EvForm.reload" title="Permalink to this definition"></a></dt>
<dd><p>Creates the form from a stored file name.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>filename</strong> (<em>str</em>) The file to read from.</p></li>
<li><p><strong>form</strong> (<em>dict</em>) A mapping for the form.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Kwargs are passed through to Cel creation.</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evform._test">
<code class="sig-prename descclassname">evennia.utils.evform.</code><code class="sig-name descname">_test</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evform.html#_test"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evform._test" title="Permalink to this definition"></a></dt>
<dd><p>test evform. This is used by the unittest system.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evform._to_ansi">
<code class="sig-prename descclassname">evennia.utils.evform.</code><code class="sig-name descname">_to_ansi</code><span class="sig-paren">(</span><em class="sig-param">obj</em>, <em class="sig-param">regexable=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evform.html#_to_ansi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evform._to_ansi" title="Permalink to this definition"></a></dt>
<dd><p>convert to ANSIString</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evform._to_rect">
<code class="sig-prename descclassname">evennia.utils.evform.</code><code class="sig-name descname">_to_rect</code><span class="sig-paren">(</span><em class="sig-param">lines</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evform.html#_to_rect"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evform._to_rect" title="Permalink to this definition"></a></dt>
<dd><p>Forces all lines to be as long as the longest</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>lines</strong> (<em>list</em>) list of <a href="#id75"><span class="problematic" id="id76">`</span></a>ANSIString`s</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>list of <a href="#id77"><span class="problematic" id="id78">`</span></a>ANSIString`s of
same length as the longest input line</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(list)</p>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.evmenu">
<span id="evennia-utils-evmenu-module"></span><h2>evennia.utils.evmenu module<a class="headerlink" href="#module-evennia.utils.evmenu" title="Permalink to this headline"></a></h2>
<p>EvMenu</p>
<p>This implements a full menu system for Evennia.</p>
<p>To start the menu, just import the EvMenu class from this module.
Example usage:</p>
<p><a href="#id79"><span class="problematic" id="id80">``</span></a><a href="#id81"><span class="problematic" id="id82">`</span></a>python</p>
<blockquote>
<div><p>from evennia.utils.evmenu import EvMenu</p>
<dl class="simple">
<dt>EvMenu(caller, menu_module_path,</dt><dd><p>startnode=”node1”,
cmdset_mergetype=”Replace”, cmdset_priority=1,
auto_quit=True, cmd_on_exit=”look”, persistent=True)</p>
</dd>
</dl>
</div></blockquote>
<p><a href="#id83"><span class="problematic" id="id84">``</span></a><a href="#id85"><span class="problematic" id="id86">`</span></a></p>
<p>Where <cite>caller</cite> is the Object to use the menu on - it will get a new
cmdset while using the Menu. The menu_module_path is the python path
to a python module containing function definitions. By adjusting the
keyword options of the Menu() initialization call you can start the
menu at different places in the menu definition file, adjust if the
menu command should overload the normal commands or not, etc.</p>
<p>The <cite>persistent</cite> keyword will make the menu survive a server reboot.
It is <cite>False</cite> by default. Note that if using persistent mode, every
node and callback in the menu must be possible to be <em>pickled</em>, this
excludes e.g. callables that are class methods or functions defined
dynamically or as part of another function. In non-persistent mode
no such restrictions exist.</p>
<p>The menu is defined in a module (this can be the same module as the
command definition too) with function definitions:</p>
<p><a href="#id87"><span class="problematic" id="id88">``</span></a><a href="#id89"><span class="problematic" id="id90">`</span></a>python</p>
<blockquote>
<div><dl class="simple">
<dt>def node1(caller):</dt><dd><p># (this is the start node if called like above)
# code
return text, options</p>
</dd>
<dt>def node_with_other_name(caller, input_string):</dt><dd><p># code
return text, options</p>
</dd>
<dt>def another_node(caller, input_string, <a href="#id91"><span class="problematic" id="id92">**</span></a>kwargs):</dt><dd><p># code
return text, options</p>
</dd>
</dl>
</div></blockquote>
<p><a href="#id93"><span class="problematic" id="id94">``</span></a><a href="#id95"><span class="problematic" id="id96">`</span></a></p>
<p>Where caller is the object using the menu and input_string is the
command entered by the user on the <em>previous</em> node (the command
entered to get to this node). The node function code will only be
executed once per node-visit and the system will accept nodes with
both one or two arguments interchangeably. It also accepts nodes
that takes <a href="#id97"><span class="problematic" id="id98">**</span></a>kwargs.</p>
<p>The menu tree itself is available on the caller as
<cite>caller.ndb._menutree</cite>. This makes it a convenient place to store
temporary state variables between nodes, since this NAttribute is
deleted when the menu is exited.</p>
<p>The return values must be given in the above order, but each can be
returned as None as well. If the options are returned as None, the
menu is immediately exited and the default “look” command is called.</p>
<blockquote>
<div><dl>
<dt>text (str, tuple or None): Text shown at this node. If a tuple, the</dt><dd><p>second element in the tuple is a help text to display at this
node when the user enters the menu help command there.</p>
</dd>
<dt>options (tuple, dict or None): If <cite>None</cite>, this exits the menu.</dt><dd><p>If a single dict, this is a single-option node. If a tuple,
it should be a tuple of option dictionaries. Option dicts have
the following keys:</p>
<blockquote>
<div><ul class="simple">
<li><dl class="simple">
<dt><cite>key</cite> (str or tuple, optional): What to enter to choose this option.</dt><dd><p>If a tuple, it must be a tuple of strings, where the first string is the
key which will be shown to the user and the others are aliases.
If unset, the options number will be used. The special key <cite>_default</cite>
marks this option as the default fallback when no other option matches
the user input. There can only be one <cite>_default</cite> option per node. It
will not be displayed in the list.</p>
</dd>
</dl>
</li>
<li><p><cite>desc</cite> (str, optional): This describes what choosing the option will do.</p></li>
<li><dl class="simple">
<dt><cite>goto</cite> (str, tuple or callable): If string, should be the name of node to go to</dt><dd><p>when this option is selected. If a callable, it has the signature
<a href="#id99"><span class="problematic" id="id100">`</span></a>callable(caller[,raw_input][,**kwargs]). If a tuple, the first element
is the callable and the second is a dict with the <a href="#id101"><span class="problematic" id="id102">**</span></a>kwargs to pass to
the callable. Those kwargs will also be passed into the next node if possible.
Such a callable should return either a str or a (str, dict), where the
string is the name of the next node to go to and the dict is the new,
(possibly modified) kwarg to pass into the next node. If the callable returns
None or the empty string, the current node will be revisited.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><cite>exec</cite> (str, callable or tuple, optional): This takes the same input as <cite>goto</cite> above</dt><dd><p>and runs before it. If given a node name, the node will be executed but will not
be considered the next node. If node/callback returns str or (str, dict), these will
replace the <cite>goto</cite> step (<cite>goto</cite> callbacks will not fire), with the string being the
next node name and the optional dict acting as the kwargs-input for the next node.
If an exec callable returns the empty string (only), the current node is re-run.</p>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
</dd>
</dl>
</div></blockquote>
<p>If key is not given, the option will automatically be identified by
its number 1..N.</p>
<p>Example:</p>
<p><a href="#id103"><span class="problematic" id="id104">``</span></a><a href="#id105"><span class="problematic" id="id106">`</span></a>python</p>
<blockquote>
<div><p># in menu_module.py</p>
<dl>
<dt>def node1(caller):</dt><dd><dl>
<dt>text = (“This is a node text”,</dt><dd><p>“This is help text for this node”)</p>
</dd>
<dt>options = ({“key”: “testing”,</dt><dd><blockquote>
<div><p>“desc”: “Select this to go to node 2”,
“goto”: (“node2”, {“foo”: “bar”}),
“exec”: “callback1”},</p>
</div></blockquote>
<dl class="simple">
<dt>{“desc”: “Go to node 3.”,</dt><dd><p>“goto”: “node3”})</p>
</dd>
</dl>
</dd>
</dl>
<p>return text, options</p>
</dd>
<dt>def callback1(caller):</dt><dd><p># this is called when choosing the “testing” option in node1
# (before going to node2). If it returned a string, say node3,
# then the next node would be node3 instead of node2 as specified
# by the normal goto option key above.
caller.msg(“Callback called!”)</p>
</dd>
<dt>def node2(caller, <a href="#id107"><span class="problematic" id="id108">**</span></a>kwargs):</dt><dd><dl class="simple">
<dt>text = </dt><dd><p>This is node 2. It only allows you to go back
to the original node1. This extra indent will
be stripped. We dont include a help text but
here are the variables passed to us: {}
.format(kwargs)</p>
</dd>
</dl>
<p>options = {“goto”: “node1”}
return text, options</p>
</dd>
<dt>def node3(caller):</dt><dd><p>text = “This ends the menu since there are no options.”
return text, None</p>
</dd>
</dl>
</div></blockquote>
<p><a href="#id109"><span class="problematic" id="id110">``</span></a><a href="#id111"><span class="problematic" id="id112">`</span></a></p>
<p>When starting this menu with <cite>Menu(caller, “path.to.menu_module”)</cite>,
the first node will look something like this:</p>
<blockquote>
<div><p>testing: Select this to go to node 2
2: Go to node 3</p>
</div></blockquote>
<p>Where you can both enter “testing” and “1” to select the first option.
If the client supports MXP, they may also mouse-click on “testing” to
do the same. When making this selection, a function “callback1” in the
same Using <cite>help</cite> will show the help text, otherwise a list of
available commands while in menu mode.</p>
<p>The menu tree is exited either by using the in-menu quit command or by
reaching a node without any options.</p>
<p>For a menu demo, import CmdTestMenu from this module and add it to
your default cmdset. Run it with this module, like <cite>testmenu
evennia.utils.evmenu</cite>.</p>
<dl class="class">
<dt id="evennia.utils.evmenu.CmdEvMenuNode">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">CmdEvMenuNode</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#CmdEvMenuNode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.CmdEvMenuNode" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.command.Command</span></code></a></p>
<p>Menu options.</p>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdEvMenuNode._keyaliases">
<code class="sig-name descname">_keyaliases</code><em class="property"> = ('__noinput_command', '__nomatch_command')</em><a class="headerlink" href="#evennia.utils.evmenu.CmdEvMenuNode._keyaliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdEvMenuNode._matchset">
<code class="sig-name descname">_matchset</code><em class="property"> = {'__noinput_command', '__nomatch_command'}</em><a class="headerlink" href="#evennia.utils.evmenu.CmdEvMenuNode._matchset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdEvMenuNode.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['__nomatch_command']</em><a class="headerlink" href="#evennia.utils.evmenu.CmdEvMenuNode.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.CmdEvMenuNode.func">
<code class="sig-name descname">func</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#CmdEvMenuNode.func"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.CmdEvMenuNode.func" title="Permalink to this definition"></a></dt>
<dd><p>Implement all menu commands.</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdEvMenuNode.help_category">
<code class="sig-name descname">help_category</code><em class="property"> = 'menu'</em><a class="headerlink" href="#evennia.utils.evmenu.CmdEvMenuNode.help_category" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdEvMenuNode.key">
<code class="sig-name descname">key</code><em class="property"> = '__noinput_command'</em><a class="headerlink" href="#evennia.utils.evmenu.CmdEvMenuNode.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdEvMenuNode.lock_storage">
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all()'</em><a class="headerlink" href="#evennia.utils.evmenu.CmdEvMenuNode.lock_storage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdEvMenuNode.locks">
<code class="sig-name descname">locks</code><em class="property"> = 'cmd:all()'</em><a class="headerlink" href="#evennia.utils.evmenu.CmdEvMenuNode.locks" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdEvMenuNode.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '__nomatch_command', 'category': 'menu', 'key': '__noinput_command', 'tags': '', 'text': '\n Menu options.\n '}</em><a class="headerlink" href="#evennia.utils.evmenu.CmdEvMenuNode.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evmenu.CmdGetInput">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">CmdGetInput</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#CmdGetInput"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.CmdGetInput" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.command.Command</span></code></a></p>
<p>Enter your data and press return.</p>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdGetInput._keyaliases">
<code class="sig-name descname">_keyaliases</code><em class="property"> = ('__noinput_command', '__nomatch_command')</em><a class="headerlink" href="#evennia.utils.evmenu.CmdGetInput._keyaliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdGetInput._matchset">
<code class="sig-name descname">_matchset</code><em class="property"> = {'__noinput_command', '__nomatch_command'}</em><a class="headerlink" href="#evennia.utils.evmenu.CmdGetInput._matchset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdGetInput.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['__noinput_command']</em><a class="headerlink" href="#evennia.utils.evmenu.CmdGetInput.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.CmdGetInput.func">
<code class="sig-name descname">func</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#CmdGetInput.func"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.CmdGetInput.func" title="Permalink to this definition"></a></dt>
<dd><p>This is called when user enters anything.</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdGetInput.help_category">
<code class="sig-name descname">help_category</code><em class="property"> = 'general'</em><a class="headerlink" href="#evennia.utils.evmenu.CmdGetInput.help_category" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdGetInput.key">
<code class="sig-name descname">key</code><em class="property"> = '__nomatch_command'</em><a class="headerlink" href="#evennia.utils.evmenu.CmdGetInput.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdGetInput.lock_storage">
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all();'</em><a class="headerlink" href="#evennia.utils.evmenu.CmdGetInput.lock_storage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdGetInput.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '__noinput_command', 'category': 'general', 'key': '__nomatch_command', 'tags': '', 'text': '\n Enter your data and press return.\n '}</em><a class="headerlink" href="#evennia.utils.evmenu.CmdGetInput.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evmenu.CmdTestMenu">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">CmdTestMenu</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#CmdTestMenu"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.CmdTestMenu" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.command.Command</span></code></a></p>
<p>Test menu</p>
<dl class="simple">
<dt>Usage:</dt><dd><p>testmenu &lt;menumodule&gt;</p>
</dd>
</dl>
<p>Starts a demo menu from a menu node definition module.</p>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdTestMenu._keyaliases">
<code class="sig-name descname">_keyaliases</code><em class="property"> = ('testmenu',)</em><a class="headerlink" href="#evennia.utils.evmenu.CmdTestMenu._keyaliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdTestMenu._matchset">
<code class="sig-name descname">_matchset</code><em class="property"> = {'testmenu'}</em><a class="headerlink" href="#evennia.utils.evmenu.CmdTestMenu._matchset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdTestMenu.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = []</em><a class="headerlink" href="#evennia.utils.evmenu.CmdTestMenu.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.CmdTestMenu.func">
<code class="sig-name descname">func</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#CmdTestMenu.func"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.CmdTestMenu.func" title="Permalink to this definition"></a></dt>
<dd><p>This is the actual executing part of the command. It is
called directly after self.parse(). See the docstring of this
module for which object properties are available (beyond those
set in self.parse())</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdTestMenu.help_category">
<code class="sig-name descname">help_category</code><em class="property"> = 'general'</em><a class="headerlink" href="#evennia.utils.evmenu.CmdTestMenu.help_category" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdTestMenu.key">
<code class="sig-name descname">key</code><em class="property"> = 'testmenu'</em><a class="headerlink" href="#evennia.utils.evmenu.CmdTestMenu.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdTestMenu.lock_storage">
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all();'</em><a class="headerlink" href="#evennia.utils.evmenu.CmdTestMenu.lock_storage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.CmdTestMenu.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '', 'category': 'general', 'key': 'testmenu', 'tags': '', 'text': '\n Test menu\n\n Usage:\n testmenu &lt;menumodule&gt;\n\n Starts a demo menu from a menu node definition module.\n\n '}</em><a class="headerlink" href="#evennia.utils.evmenu.CmdTestMenu.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evmenu.EvMenu">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">EvMenu</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">menudata</em>, <em class="sig-param">startnode='start'</em>, <em class="sig-param">cmdset_mergetype='Replace'</em>, <em class="sig-param">cmdset_priority=1</em>, <em class="sig-param">auto_quit=True</em>, <em class="sig-param">auto_look=True</em>, <em class="sig-param">auto_help=True</em>, <em class="sig-param">cmd_on_exit='look'</em>, <em class="sig-param">persistent=False</em>, <em class="sig-param">startnode_input=''</em>, <em class="sig-param">session=None</em>, <em class="sig-param">debug=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This object represents an operational menu. It is initialized from
a menufile.py instruction.</p>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">menudata</em>, <em class="sig-param">startnode='start'</em>, <em class="sig-param">cmdset_mergetype='Replace'</em>, <em class="sig-param">cmdset_priority=1</em>, <em class="sig-param">auto_quit=True</em>, <em class="sig-param">auto_look=True</em>, <em class="sig-param">auto_help=True</em>, <em class="sig-param">cmd_on_exit='look'</em>, <em class="sig-param">persistent=False</em>, <em class="sig-param">startnode_input=''</em>, <em class="sig-param">session=None</em>, <em class="sig-param">debug=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Initialize the menu tree and start the caller onto the first node.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>caller</strong> (<em>Object</em><em>, </em><em>Account</em><em> or </em><a class="reference internal" href="evennia.server.html#evennia.server.session.Session" title="evennia.server.session.Session"><em>Session</em></a>) The user of the menu.</p></li>
<li><p><strong>menudata</strong> (<em>str</em><em>, </em><em>module</em><em> or </em><em>dict</em>) The full or relative path to the module
holding the menu tree data. All global functions in this module
whose name doesnt start with _ will be parsed as menu nodes.
Also the module itself is accepted as input. Finally, a dictionary
menu tree can be given directly. This must then be a mapping
<cite>{“nodekey”:callable,…}</cite> where <cite>callable</cite> must be called as
and return the data expected of a menu node. This allows for
dynamic menu creation.</p></li>
<li><p><strong>startnode</strong> (<em>str</em><em>, </em><em>optional</em>) The starting node name in the menufile.</p></li>
<li><p><strong>cmdset_mergetype</strong> (<em>str</em><em>, </em><em>optional</em>) Replace (default) means the menu
commands will be exclusive - no other normal commands will
be usable while the user is in the menu. Union means the
menu commands will be integrated with the existing commands
(it will merge with <cite>merge_priority</cite>), if so, make sure that
the menus command names dont collide with existing commands
in an unexpected way. Also the CMD_NOMATCH and CMD_NOINPUT will
be overloaded by the menu cmdset. Other cmdser mergetypes
has little purpose for the menu.</p></li>
<li><p><strong>cmdset_priority</strong> (<em>int</em><em>, </em><em>optional</em>) The merge priority for the
menu command set. The default (1) is usually enough for most
types of menus.</p></li>
<li><p><strong>auto_quit</strong> (<em>bool</em><em>, </em><em>optional</em>) Allow user to use “q”, “quit” or
“exit” to leave the menu at any point. Recommended during
development!</p></li>
<li><p><strong>auto_look</strong> (<em>bool</em><em>, </em><em>optional</em>) Automatically make “looK” or “l” to
re-show the last node. Turning this off means you have to handle
re-showing nodes yourself, but may be useful if you need to
use “l” for some other purpose.</p></li>
<li><p><strong>auto_help</strong> (<em>bool</em><em>, </em><em>optional</em>) Automatically make “help” or “h” show
the current help entry for the node. If turned off, eventual
help must be handled manually, but it may be useful if you
need h for some other purpose, for example.</p></li>
<li><p><strong>cmd_on_exit</strong> (<em>callable</em><em>, </em><em>str</em><em> or </em><em>None</em><em>, </em><em>optional</em>) When exiting the menu
(either by reaching a node with no options or by using the
in-built quit command (activated with <cite>allow_quit</cite>), this
callback function or command string will be executed.
The callback function takes two parameters, the caller then the
EvMenu object. This is called after cleanup is complete.
Set to None to not call any command.</p></li>
<li><p><strong>persistent</strong> (<em>bool</em><em>, </em><em>optional</em>) Make the Menu persistent (i.e. it will
survive a reload. This will make the Menu cmdset persistent. Use
with caution - if your menu is buggy you may end up in a state
you cant get out of! Also note that persistent mode requires
that all formatters, menu nodes and callables are possible to
<em>pickle</em>. When the server is reloaded, the latest node shown will be completely
re-run with the same input arguments - so be careful if you are counting
up some persistent counter or similar - the counter may be run twice if
reload happens on the node that does that. Note that if <cite>debug</cite> is True,
this setting is ignored and assumed to be False.</p></li>
<li><p><strong>startnode_input</strong> (<em>str</em><em> or </em><em>(</em><em>str</em><em>, </em><em>dict</em><em>)</em><em>, </em><em>optional</em>) Send an input text to <cite>startnode</cite> as if
a user input text from a fictional previous node. If including the dict, this will
be passed as <a href="#id113"><span class="problematic" id="id114">**</span></a>kwargs to that node. When the server reloads,
the latest visited node will be re-run as <cite>node(caller, raw_string, **kwargs)</cite>.</p></li>
<li><p><strong>session</strong> (<a class="reference internal" href="evennia.server.html#evennia.server.session.Session" title="evennia.server.session.Session"><em>Session</em></a><em>, </em><em>optional</em>) This is useful when calling EvMenu from an account
in multisession mode &gt; 2. Note that this session only really relevant
for the very first display of the first node - after that, EvMenu itself
will keep the session updated from the command input. So a persistent
menu will <em>not</em> be using this same session anymore after a reload.</p></li>
<li><p><strong>debug</strong> (<em>bool</em><em>, </em><em>optional</em>) If set, the menudebug command will be made available
by default in all nodes of the menu. This will print out the current state of
the menu. Deactivate for production use! When the debug flag is active, the
<cite>persistent</cite> flag is deactivated.</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><dl class="simple">
<dt>any (any): All kwargs will become initialization variables on <cite>caller.ndb._menutree</cite>,</dt><dd><p>to be available at run.</p>
</dd>
</dl>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><a class="reference internal" href="#evennia.utils.evmenu.EvMenuError" title="evennia.utils.evmenu.EvMenuError"><strong>EvMenuError</strong></a> If the start/end node is not found in menu tree.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>While running, the menu is stored on the caller as <cite>caller.ndb._menutree</cite>. Also
the current Session (from the Command, so this is still valid in multisession
environments) is available through <cite>caller.ndb._menutree._session</cite>. The <cite>_menutree</cite>
property is a good one for storing intermediary data on between nodes since it
will be automatically deleted when the menu closes.</p>
<p>In persistent mode, all nodes, formatters and callbacks in the menu must be
possible to be <em>pickled</em>, this excludes e.g. callables that are class methods
or functions defined dynamically or as part of another function. In
non-persistent mode no such restrictions exist.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu._execute_node">
<code class="sig-name descname">_execute_node</code><span class="sig-paren">(</span><em class="sig-param">nodename</em>, <em class="sig-param">raw_string</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu._execute_node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu._execute_node" title="Permalink to this definition"></a></dt>
<dd><p>Execute a node.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>nodename</strong> (<em>str</em>) Name of node.</p></li>
<li><p><strong>raw_string</strong> (<em>str</em>) The raw default string entered on the
previous node (only used if the node accepts it as an
argument)</p></li>
<li><p><strong>kwargs</strong> (<em>any</em><em>, </em><em>optional</em>) Optional kwargs for the node.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>The node text (a string or a</dt><dd><p>tuple and the options tuple, if any.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>nodetext, options (tuple)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu._format_node">
<code class="sig-name descname">_format_node</code><span class="sig-paren">(</span><em class="sig-param">nodetext</em>, <em class="sig-param">optionlist</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu._format_node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu._format_node" title="Permalink to this definition"></a></dt>
<dd><p>Format the node text + option section</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>nodetext</strong> (<em>str</em>) The node text</p></li>
<li><p><strong>optionlist</strong> (<em>list</em>) List of (key, desc) pairs.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>The options section, including</dt><dd><p>all needed spaces.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>string (str)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>This will adjust the columns of the options, first to use
a maxiumum of 4 rows (expanding in columns), then gradually
growing to make use of the screen space.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu._parse_menudata">
<code class="sig-name descname">_parse_menudata</code><span class="sig-paren">(</span><em class="sig-param">menudata</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu._parse_menudata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu._parse_menudata" title="Permalink to this definition"></a></dt>
<dd><p>Parse a menufile for node functions and store in dictionary
map. Alternatively, accept a pre-made mapping dictionary of
node functions.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>menudata</strong> (<em>str</em><em>, </em><em>module</em><em> or </em><em>dict</em>) The python.path to the menufile,
or the python module itself. If a dict, this should be a
mapping nodename:callable, where the callable must match
the criteria for a menu node.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A {nodekey: func}</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>menutree (dict)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu._safe_call">
<code class="sig-name descname">_safe_call</code><span class="sig-paren">(</span><em class="sig-param">callback</em>, <em class="sig-param">raw_string</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu._safe_call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu._safe_call" title="Permalink to this definition"></a></dt>
<dd><p>Call a node-like callable, with a variable number of raw_string, <a href="#id115"><span class="problematic" id="id116">*</span></a>args, <a href="#id117"><span class="problematic" id="id118">**</span></a>kwargs, all of
which should work also if not present (only <cite>caller</cite> is always required). Return its result.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.close_menu">
<code class="sig-name descname">close_menu</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.close_menu"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.close_menu" title="Permalink to this definition"></a></dt>
<dd><p>Shutdown menu; occurs when reaching the end node or using the quit command.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.display_helptext">
<code class="sig-name descname">display_helptext</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.display_helptext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.display_helptext" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.display_nodetext">
<code class="sig-name descname">display_nodetext</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.display_nodetext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.display_nodetext" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.extract_goto_exec">
<code class="sig-name descname">extract_goto_exec</code><span class="sig-paren">(</span><em class="sig-param">nodename</em>, <em class="sig-param">option_dict</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.extract_goto_exec"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.extract_goto_exec" title="Permalink to this definition"></a></dt>
<dd><p>Helper: Get callables and their eventual kwargs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>nodename</strong> (<em>str</em>) The current node name (used for error reporting).</p></li>
<li><p><strong>option_dict</strong> (<em>dict</em>) The seleted options dict.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The goto directive in the option.
goto_kwargs (dict): Kwargs for <cite>goto</cite> if the former is callable, otherwise empty.
execute (callable or None): Executable given by the <cite>exec</cite> directive.
exec_kwargs (dict): Kwargs for <cite>execute</cite> if its callable, otherwise empty.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>goto (str, callable or None)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.goto">
<code class="sig-name descname">goto</code><span class="sig-paren">(</span><em class="sig-param">nodename</em>, <em class="sig-param">raw_string</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.goto"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.goto" title="Permalink to this definition"></a></dt>
<dd><p>Run a node by name, optionally dynamically generating that name first.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>nodename</strong> (<em>str</em><em> or </em><em>callable</em>) Name of node or a callable
to be called as <cite>function(caller, raw_string, **kwargs)</cite> or
<cite>function(caller, **kwargs)</cite> to return the actual goto string or
a (“nodename”, kwargs) tuple.</p></li>
<li><p><strong>raw_string</strong> (<em>str</em>) The raw default string entered on the
previous node (only used if the node accepts it as an
argument)</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>any: Extra arguments to goto callables.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.helptext_formatter">
<code class="sig-name descname">helptext_formatter</code><span class="sig-paren">(</span><em class="sig-param">helptext</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.helptext_formatter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.helptext_formatter" title="Permalink to this definition"></a></dt>
<dd><p>Format the nodes help text</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>helptext</strong> (<em>str</em>) The unformatted help text for the node.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The formatted help text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>helptext (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.EvMenu.node_border_char">
<code class="sig-name descname">node_border_char</code><em class="property"> = '_'</em><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.node_border_char" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.node_formatter">
<code class="sig-name descname">node_formatter</code><span class="sig-paren">(</span><em class="sig-param">nodetext</em>, <em class="sig-param">optionstext</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.node_formatter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.node_formatter" title="Permalink to this definition"></a></dt>
<dd><p>Formats the entirety of the node.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>nodetext</strong> (<em>str</em>) The node text as returned by <cite>self.nodetext_formatter</cite>.</p></li>
<li><p><strong>optionstext</strong> (<em>str</em>) The options display as returned by <cite>self.options_formatter</cite>.</p></li>
<li><p><strong>caller</strong> (<em>Object</em><em>, </em><em>Account</em><em> or </em><em>None</em><em>, </em><em>optional</em>) The caller of the node.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The formatted node to display.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>node (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.nodetext_formatter">
<code class="sig-name descname">nodetext_formatter</code><span class="sig-paren">(</span><em class="sig-param">nodetext</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.nodetext_formatter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.nodetext_formatter" title="Permalink to this definition"></a></dt>
<dd><p>Format the node text itself.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>nodetext</strong> (<em>str</em>) The full node text (the text describing the node).</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The formatted node text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>nodetext (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.options_formatter">
<code class="sig-name descname">options_formatter</code><span class="sig-paren">(</span><em class="sig-param">optionlist</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.options_formatter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.options_formatter" title="Permalink to this definition"></a></dt>
<dd><p>Formats the option block.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>optionlist</strong> (<em>list</em>) List of (key, description) tuples for every
option related to this node.</p></li>
<li><p><strong>caller</strong> (<em>Object</em><em>, </em><em>Account</em><em> or </em><em>None</em><em>, </em><em>optional</em>) The caller of the node.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The formatted option display.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>options (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.parse_input">
<code class="sig-name descname">parse_input</code><span class="sig-paren">(</span><em class="sig-param">raw_string</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.parse_input"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.parse_input" title="Permalink to this definition"></a></dt>
<dd><p>Parses the incoming string from the menu user.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>raw_string</strong> (<em>str</em>) The incoming, unmodified string
from the user.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>This method is expected to parse input and use the result
to relay execution to the relevant methods of the menu. It
should also report errors directly to the user.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.print_debug_info">
<code class="sig-name descname">print_debug_info</code><span class="sig-paren">(</span><em class="sig-param">arg</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.print_debug_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.print_debug_info" title="Permalink to this definition"></a></dt>
<dd><p>Messages the caller with the current menu state, for debug purposes.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>arg</strong> (<em>str</em>) Arg to debug instruction, either nothing, full or the name
of a property to inspect.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.run_exec">
<code class="sig-name descname">run_exec</code><span class="sig-paren">(</span><em class="sig-param">nodename</em>, <em class="sig-param">raw_string</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.run_exec"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.run_exec" title="Permalink to this definition"></a></dt>
<dd><p>Run a function or node as a callback (with the exec option key).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>nodename</strong> (<em>callable</em><em> or </em><em>str</em>) A callable to run as
<cite>callable(caller, raw_string)</cite>, or the Name of an existing
node to run as a callable. This may or may not return
a string.</p></li>
<li><p><strong>raw_string</strong> (<em>str</em>) The raw default string entered on the
previous node (only used if the node accepts it as an
argument)</p></li>
<li><p><strong>kwargs</strong> (<em>any</em>) These are optional kwargs passed into goto</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A replacement goto location string or</dt><dd><p>None (no replacement).</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>new_goto (str or None)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Relying on exec callbacks to set the goto location is
very powerful but will easily lead to spaghetti structure and
hard-to-trace paths through the menu logic. So be careful with
relying on this.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenu.run_exec_then_goto">
<code class="sig-name descname">run_exec_then_goto</code><span class="sig-paren">(</span><em class="sig-param">runexec</em>, <em class="sig-param">goto</em>, <em class="sig-param">raw_string</em>, <em class="sig-param">runexec_kwargs=None</em>, <em class="sig-param">goto_kwargs=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenu.run_exec_then_goto"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenu.run_exec_then_goto" title="Permalink to this definition"></a></dt>
<dd><p>Call exec callback and goto (which may also be a callable) in sequence.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>runexec</strong> (<em>callable</em><em> or </em><em>str</em>) Callback to run before goto. If
the callback returns a string, this is used to replace
the <cite>goto</cite> string/callable before being passed into the goto handler.</p></li>
<li><p><strong>goto</strong> (<em>str</em>) The target node to go to next (may be replaced
by <cite>runexec</cite>)..</p></li>
<li><p><strong>raw_string</strong> (<em>str</em>) The original user input.</p></li>
<li><p><strong>runexec_kwargs</strong> (<em>dict</em><em>, </em><em>optional</em>) Optional kwargs for runexec.</p></li>
<li><p><strong>goto_kwargs</strong> (<em>dict</em><em>, </em><em>optional</em>) Optional kwargs for goto.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evmenu.EvMenuCmdSet">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">EvMenuCmdSet</code><span class="sig-paren">(</span><em class="sig-param">cmdsetobj=None</em>, <em class="sig-param">key=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenuCmdSet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenuCmdSet" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.cmdset.CmdSet" title="evennia.commands.cmdset.CmdSet"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.cmdset.CmdSet</span></code></a></p>
<p>The Menu cmdset replaces the current cmdset.</p>
<dl class="method">
<dt id="evennia.utils.evmenu.EvMenuCmdSet.at_cmdset_creation">
<code class="sig-name descname">at_cmdset_creation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenuCmdSet.at_cmdset_creation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenuCmdSet.at_cmdset_creation" title="Permalink to this definition"></a></dt>
<dd><p>Called when creating the set.</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.EvMenuCmdSet.key">
<code class="sig-name descname">key</code><em class="property"> = 'menu_cmdset'</em><a class="headerlink" href="#evennia.utils.evmenu.EvMenuCmdSet.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.EvMenuCmdSet.mergetype">
<code class="sig-name descname">mergetype</code><em class="property"> = 'Replace'</em><a class="headerlink" href="#evennia.utils.evmenu.EvMenuCmdSet.mergetype" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.EvMenuCmdSet.no_channels">
<code class="sig-name descname">no_channels</code><em class="property"> = False</em><a class="headerlink" href="#evennia.utils.evmenu.EvMenuCmdSet.no_channels" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.EvMenuCmdSet.no_exits">
<code class="sig-name descname">no_exits</code><em class="property"> = True</em><a class="headerlink" href="#evennia.utils.evmenu.EvMenuCmdSet.no_exits" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.EvMenuCmdSet.no_objs">
<code class="sig-name descname">no_objs</code><em class="property"> = True</em><a class="headerlink" href="#evennia.utils.evmenu.EvMenuCmdSet.no_objs" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.EvMenuCmdSet.path">
<code class="sig-name descname">path</code><em class="property"> = 'evennia.utils.evmenu.EvMenuCmdSet'</em><a class="headerlink" href="#evennia.utils.evmenu.EvMenuCmdSet.path" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.EvMenuCmdSet.priority">
<code class="sig-name descname">priority</code><em class="property"> = 1</em><a class="headerlink" href="#evennia.utils.evmenu.EvMenuCmdSet.priority" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="evennia.utils.evmenu.EvMenuError">
<em class="property">exception </em><code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">EvMenuError</code><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#EvMenuError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.EvMenuError" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">RuntimeError</span></code></p>
<p>Error raised by menu when facing internal errors.</p>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evmenu.InputCmdSet">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">InputCmdSet</code><span class="sig-paren">(</span><em class="sig-param">cmdsetobj=None</em>, <em class="sig-param">key=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#InputCmdSet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.InputCmdSet" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.cmdset.CmdSet" title="evennia.commands.cmdset.CmdSet"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.cmdset.CmdSet</span></code></a></p>
<p>This stores the input command</p>
<dl class="method">
<dt id="evennia.utils.evmenu.InputCmdSet.at_cmdset_creation">
<code class="sig-name descname">at_cmdset_creation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#InputCmdSet.at_cmdset_creation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.InputCmdSet.at_cmdset_creation" title="Permalink to this definition"></a></dt>
<dd><p>called once at creation</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.InputCmdSet.key">
<code class="sig-name descname">key</code><em class="property"> = 'input_cmdset'</em><a class="headerlink" href="#evennia.utils.evmenu.InputCmdSet.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.InputCmdSet.mergetype">
<code class="sig-name descname">mergetype</code><em class="property"> = 'Replace'</em><a class="headerlink" href="#evennia.utils.evmenu.InputCmdSet.mergetype" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.InputCmdSet.no_channels">
<code class="sig-name descname">no_channels</code><em class="property"> = False</em><a class="headerlink" href="#evennia.utils.evmenu.InputCmdSet.no_channels" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.InputCmdSet.no_exits">
<code class="sig-name descname">no_exits</code><em class="property"> = True</em><a class="headerlink" href="#evennia.utils.evmenu.InputCmdSet.no_exits" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.InputCmdSet.no_objs">
<code class="sig-name descname">no_objs</code><em class="property"> = True</em><a class="headerlink" href="#evennia.utils.evmenu.InputCmdSet.no_objs" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.InputCmdSet.path">
<code class="sig-name descname">path</code><em class="property"> = 'evennia.utils.evmenu.InputCmdSet'</em><a class="headerlink" href="#evennia.utils.evmenu.InputCmdSet.path" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmenu.InputCmdSet.priority">
<code class="sig-name descname">priority</code><em class="property"> = 1</em><a class="headerlink" href="#evennia.utils.evmenu.InputCmdSet.priority" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evmenu._Prompt">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">_Prompt</code><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#_Prompt"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu._Prompt" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Dummy holder</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evmenu._generate_goto">
<code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">_generate_goto</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#_generate_goto"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu._generate_goto" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.evmenu._test_call">
<code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">_test_call</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">raw_input</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#_test_call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu._test_call" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.evmenu.get_input">
<code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">get_input</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">prompt</em>, <em class="sig-param">callback</em>, <em class="sig-param">session=None</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#get_input"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.get_input" title="Permalink to this definition"></a></dt>
<dd><p>This is a helper function for easily request input from
the caller.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>caller</strong> (<em>Account</em><em> or </em><em>Object</em>) The entity being asked
the question. This should usually be an object
controlled by a user.</p></li>
<li><p><strong>prompt</strong> (<em>str</em>) This text will be shown to the user,
in order to let them know their input is needed.</p></li>
<li><p><strong>callback</strong> (<em>callable</em>) A function that will be called
when the user enters a reply. It must take three
arguments: the <cite>caller</cite>, the <cite>prompt</cite> text and the
<cite>result</cite> of the input given by the user. If the
callback doesnt return anything or return False,
the input prompt will be cleaned up and exited. If
returning True, the prompt will remain and continue to
accept input.</p></li>
<li><p><strong>session</strong> (<a class="reference internal" href="evennia.server.html#evennia.server.session.Session" title="evennia.server.session.Session"><em>Session</em></a><em>, </em><em>optional</em>) This allows to specify the
session to send the prompt to. Its usually only
needed if <cite>caller</cite> is an Account in multisession modes
greater than 2. The session is then updated by the
command and is available (for example in callbacks)
through <cite>caller.ndb.getinput._session</cite>.</p></li>
<li><p><strong>**kwargs</strong> (<em>*args</em><em>,</em>) <p>Extra arguments will be
passed to the fall back function as a list args
and all keyword arguments as a dictionary kwargs.
To utilise <a href="#id121"><span class="problematic" id="id122">*</span></a>args and <a href="#id123"><span class="problematic" id="id124">**</span></a>kwargs, a value for the
session argument must be provided (None by default)
and the callback function must take <a href="#id125"><span class="problematic" id="id126">*</span></a>args and
<a href="#id127"><span class="problematic" id="id128">**</span></a>kwargs as arguments.</p>
</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>RuntimeError</strong> If the given callback is not callable.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>The result value sent to the callback is raw and not
processed in any way. This means that you will get
the ending line return character from most types of
client inputs. So make sure to strip that before
doing a comparison.</p>
<p>When the prompt is running, a temporary object
<cite>caller.ndb._getinput</cite> is stored; this will be removed
when the prompt finishes.
If you need the specific Session of the caller (which
may not be easy to get if caller is an account in higher
multisession modes), then it is available in the
callback through <cite>caller.ndb._getinput._session</cite>.</p>
<p>Chaining get_input functions will result in the caller
stacking ever more instances of InputCmdSets. Whilst
they will all be cleared on concluding the get_input
chain, EvMenu should be considered for anything beyond
a single question.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evmenu.list_node">
<code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">list_node</code><span class="sig-paren">(</span><em class="sig-param">option_generator</em>, <em class="sig-param">select=None</em>, <em class="sig-param">pagesize=10</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#list_node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.list_node" title="Permalink to this definition"></a></dt>
<dd><p>Decorator for making an EvMenu node into a multi-page list node. Will add new options,
prepending those options added in the node.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>option_generator</strong> (<em>callable</em><em> or </em><em>list</em>) A list of strings indicating the options, or a callable
that is called as option_generator(caller) to produce such a list.</p></li>
<li><p><strong>select</strong> (<em>callable</em><em> or </em><em>str</em><em>, </em><em>optional</em>) <p>Node to redirect a selection to. Its <cite>**kwargs</cite> will
contain the <cite>available_choices</cite> list and <cite>selection</cite> will hold one of the elements in
that list. If a callable, it will be called as</p>
<blockquote>
<div><p>select(caller, menuchoice, <a href="#id131"><span class="problematic" id="id132">**</span></a>kwargs) where menuchoice is the chosen option as a</p>
</div></blockquote>
<p>string and <cite>available_choices</cite> is a kwarg mapping the option keys to the choices
offered by the option_generator. The callable whould return the name of the target node
to goto after this selection (or None to repeat the list-node). Note that if this is not
given, the decorated node must itself provide a way to continue from the node!</p>
</p></li>
<li><p><strong>pagesize</strong> (<em>int</em>) How many options to show per page.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Example</p>
<p>&#64;list_node([foo, bar], select)
def node_index(caller):</p>
<blockquote>
<div><p>text = “describing the list”
return text, []</p>
</div></blockquote>
<p class="rubric">Notes</p>
<p>All normal <cite>goto</cite> or <cite>exec</cite> callables returned from the decorated nodes will, if they accept
<a href="#id133"><span class="problematic" id="id134">**</span></a>kwargs, get a new kwarg available_choices injected. These are the ordered list of named
options (descs) visible on the current node page.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evmenu.test_displayinput_node">
<code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">test_displayinput_node</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">raw_string</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#test_displayinput_node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.test_displayinput_node" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.evmenu.test_dynamic_node">
<code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">test_dynamic_node</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#test_dynamic_node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.test_dynamic_node" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.evmenu.test_end_node">
<code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">test_end_node</code><span class="sig-paren">(</span><em class="sig-param">caller</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#test_end_node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.test_end_node" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.evmenu.test_look_node">
<code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">test_look_node</code><span class="sig-paren">(</span><em class="sig-param">caller</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#test_look_node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.test_look_node" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.evmenu.test_set_node">
<code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">test_set_node</code><span class="sig-paren">(</span><em class="sig-param">caller</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#test_set_node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.test_set_node" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.evmenu.test_start_node">
<code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">test_start_node</code><span class="sig-paren">(</span><em class="sig-param">caller</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#test_start_node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.test_start_node" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.evmenu.test_view_node">
<code class="sig-prename descclassname">evennia.utils.evmenu.</code><code class="sig-name descname">test_view_node</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmenu.html#test_view_node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmenu.test_view_node" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-evennia.utils.evmore">
<span id="evennia-utils-evmore-module"></span><h2>evennia.utils.evmore module<a class="headerlink" href="#module-evennia.utils.evmore" title="Permalink to this headline"></a></h2>
<p>EvMore - pager mechanism</p>
<p>This is a pager for displaying long texts and allows stepping up and
down in the text (the name comes from the traditional more unix
command).</p>
<p>To use, simply pass the text through the EvMore object:</p>
<blockquote>
<div><p>from evennia.utils.evmore import EvMore</p>
<p>text = some_long_text_output()
EvMore(caller, text, always_page=False, session=None, justify_kwargs=None, <a href="#id135"><span class="problematic" id="id136">**</span></a>kwargs)</p>
</div></blockquote>
<p>One can also use the convenience function msg from this module:</p>
<blockquote>
<div><p>from evennia.utils import evmore</p>
<p>text = some_long_text_output()
evmore.msg(caller, text, always_page=False, session=None, justify_kwargs=None, <a href="#id137"><span class="problematic" id="id138">**</span></a>kwargs)</p>
</div></blockquote>
<p>Where always_page decides if the pager is used also if the text is not
long enough to need to scroll, session is used to determine which session to relay to
and justify_kwargs are kwargs to pass to utils.utils.justify in order to change the formatting
of the text. The remaining <a href="#id139"><span class="problematic" id="id140">**</span></a>kwargs will be passed on to the
caller.msg() construct every time the page is updated.</p>
<dl class="class">
<dt id="evennia.utils.evmore.CmdMore">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evmore.</code><code class="sig-name descname">CmdMore</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#CmdMore"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.CmdMore" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.command.Command</span></code></a></p>
<p>Manipulate the text paging</p>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMore._keyaliases">
<code class="sig-name descname">_keyaliases</code><em class="property"> = ('a', 'e', 'abort', '__noinput_command', 'back', 'end', 'next', 'q', 'n', 'b', 'top', 't', 'quit')</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore._keyaliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMore._matchset">
<code class="sig-name descname">_matchset</code><em class="property"> = {'__noinput_command', 'a', 'abort', 'b', 'back', 'e', 'end', 'n', 'next', 'q', 'quit', 't', 'top'}</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore._matchset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMore.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['a', 'e', 'abort', 'back', 'end', 'next', 'q', 'n', 'b', 'top', 't', 'quit']</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMore.auto_help">
<code class="sig-name descname">auto_help</code><em class="property"> = False</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.auto_help" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.CmdMore.func">
<code class="sig-name descname">func</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#CmdMore.func"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.CmdMore.func" title="Permalink to this definition"></a></dt>
<dd><p>Implement the command</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMore.help_category">
<code class="sig-name descname">help_category</code><em class="property"> = 'general'</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.help_category" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMore.key">
<code class="sig-name descname">key</code><em class="property"> = '__noinput_command'</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMore.lock_storage">
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all();'</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.lock_storage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMore.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'a e abort back end next q n b top t quit', 'category': 'general', 'key': '__noinput_command', 'tags': '', 'text': '\n Manipulate the text paging\n '}</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evmore.CmdMoreLook">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evmore.</code><code class="sig-name descname">CmdMoreLook</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#CmdMoreLook"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.CmdMoreLook" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.command.Command</span></code></a></p>
<p>Override look to display window and prevent OOCLook from firing</p>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMoreLook._keyaliases">
<code class="sig-name descname">_keyaliases</code><em class="property"> = ('look', 'l')</em><a class="headerlink" href="#evennia.utils.evmore.CmdMoreLook._keyaliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMoreLook._matchset">
<code class="sig-name descname">_matchset</code><em class="property"> = {'l', 'look'}</em><a class="headerlink" href="#evennia.utils.evmore.CmdMoreLook._matchset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMoreLook.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['l']</em><a class="headerlink" href="#evennia.utils.evmore.CmdMoreLook.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMoreLook.auto_help">
<code class="sig-name descname">auto_help</code><em class="property"> = False</em><a class="headerlink" href="#evennia.utils.evmore.CmdMoreLook.auto_help" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.CmdMoreLook.func">
<code class="sig-name descname">func</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#CmdMoreLook.func"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.CmdMoreLook.func" title="Permalink to this definition"></a></dt>
<dd><p>Implement the command</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMoreLook.help_category">
<code class="sig-name descname">help_category</code><em class="property"> = 'general'</em><a class="headerlink" href="#evennia.utils.evmore.CmdMoreLook.help_category" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMoreLook.key">
<code class="sig-name descname">key</code><em class="property"> = 'look'</em><a class="headerlink" href="#evennia.utils.evmore.CmdMoreLook.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMoreLook.lock_storage">
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all();'</em><a class="headerlink" href="#evennia.utils.evmore.CmdMoreLook.lock_storage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdMoreLook.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'l', 'category': 'general', 'key': 'look', 'tags': '', 'text': '\n Override look to display window and prevent OOCLook from firing\n '}</em><a class="headerlink" href="#evennia.utils.evmore.CmdMoreLook.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evmore.CmdSetMore">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evmore.</code><code class="sig-name descname">CmdSetMore</code><span class="sig-paren">(</span><em class="sig-param">cmdsetobj=None</em>, <em class="sig-param">key=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#CmdSetMore"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.CmdSetMore" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.html#evennia.commands.cmdset.CmdSet" title="evennia.commands.cmdset.CmdSet"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.cmdset.CmdSet</span></code></a></p>
<p>Stores the more command</p>
<dl class="method">
<dt id="evennia.utils.evmore.CmdSetMore.at_cmdset_creation">
<code class="sig-name descname">at_cmdset_creation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#CmdSetMore.at_cmdset_creation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.CmdSetMore.at_cmdset_creation" title="Permalink to this definition"></a></dt>
<dd><p>Hook method - this should be overloaded in the inheriting
class, and should take care of populating the cmdset by use of
self.add().</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdSetMore.key">
<code class="sig-name descname">key</code><em class="property"> = 'more_commands'</em><a class="headerlink" href="#evennia.utils.evmore.CmdSetMore.key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdSetMore.path">
<code class="sig-name descname">path</code><em class="property"> = 'evennia.utils.evmore.CmdSetMore'</em><a class="headerlink" href="#evennia.utils.evmore.CmdSetMore.path" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.evmore.CmdSetMore.priority">
<code class="sig-name descname">priority</code><em class="property"> = 110</em><a class="headerlink" href="#evennia.utils.evmore.CmdSetMore.priority" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evmore.EvMore">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evmore.</code><code class="sig-name descname">EvMore</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">text</em>, <em class="sig-param">always_page=False</em>, <em class="sig-param">session=None</em>, <em class="sig-param">justify=False</em>, <em class="sig-param">justify_kwargs=None</em>, <em class="sig-param">exit_on_lastpage=False</em>, <em class="sig-param">exit_cmd=None</em>, <em class="sig-param">page_formatter=&lt;class 'str'&gt;</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>The main pager object</p>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">text</em>, <em class="sig-param">always_page=False</em>, <em class="sig-param">session=None</em>, <em class="sig-param">justify=False</em>, <em class="sig-param">justify_kwargs=None</em>, <em class="sig-param">exit_on_lastpage=False</em>, <em class="sig-param">exit_cmd=None</em>, <em class="sig-param">page_formatter=&lt;class 'str'&gt;</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.__init__" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>Initialization of the text handler.</p>
<dl>
<dt>Args:</dt><dd><p>caller (Object or Account): Entity reading the text.
text (str, EvTable or iterator): The text or data to put under paging.</p>
<blockquote>
<div><ul class="simple">
<li><dl class="simple">
<dt>If a string, paginage normally. If this text contains</dt><dd><p>one or more `</p>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
</dd>
</dl>
</div></blockquote>
<dl>
<dt>` format symbol, automatic pagination and justification</dt><dd><p>are force-disabled and page-breaks will only happen after each `</p>
</dd>
<dt><a href="#id141"><span class="problematic" id="id142">`</span></a>.</dt><dd><blockquote>
<div><blockquote>
<div><ul class="simple">
<li><dl class="simple">
<dt>If <cite>EvTable</cite>, the EvTable will be paginated with the same</dt><dd><p>setting on each page if it is too long. The table
decorations will be considered in the size of the page.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>Otherwise <cite>text</cite> is converted to an iterator, where each step is</dt><dd><p>expected to be a line in the final display. Each line
will be run through <cite>iter_callable</cite>.</p>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
<dl class="simple">
<dt>always_page (bool, optional): If <cite>False</cite>, the</dt><dd><p>pager will only kick in if <cite>text</cite> is too big
to fit the screen.</p>
</dd>
<dt>session (Session, optional): If given, this session will be used</dt><dd><p>to determine the screen width and will receive all output.</p>
</dd>
<dt>justify (bool, optional): If set, auto-justify long lines. This must be turned</dt><dd><p>off for fixed-width or formatted output, like tables. Its force-disabled
if <cite>text</cite> is an EvTable.</p>
</dd>
<dt>justify_kwargs (dict, optional): Keywords for the justifiy function. Used only</dt><dd><p>if <cite>justify</cite> is True. If this is not set, default arguments will be used.</p>
</dd>
<dt>exit_on_lastpage (bool, optional): If reaching the last page without the</dt><dd><p>page being completely filled, exit pager immediately. If unset,
another move forward is required to exit. If set, the pager
exit message will not be shown.</p>
</dd>
<dt>exit_cmd (str, optional): If given, this command-string will be executed on</dt><dd><p>the caller when the more page exits. Note that this will be using whatever
cmdset the user had <em>before</em> the evmore pager was activated (so none of
the evmore commands will be available when this is run).</p>
</dd>
<dt>page_formatter (callable, optional): If given, this function will be passed the</dt><dd><p>contents of each extracted page. This is useful when paginating
data consisting something other than a string or a list of strings. Especially
queryset data is likely to always need this argument specified. Note however,
that all size calculations assume this function to return one single line
per element on the page!</p>
</dd>
</dl>
<p>kwargs (any, optional): These will be passed on to the <cite>caller.msg</cite> method.</p>
</div></blockquote>
<dl>
<dt>Examples:</dt><dd><p>super_long_text = ” … ”
EvMore(caller, super_long_text)</p>
<p>from django.core.paginator import Paginator
query = ObjectDB.objects.all()
pages = Paginator(query, 10) # 10 objs per page
EvMore(caller, pages) # will repr() each object per line, 10 to a page</p>
<p>multi_page_table = [ [[..],[..]], …]
EvMore(caller, multi_page_table, use_evtable=True,</p>
<blockquote>
<div><p>evtable_args=(“Header1”, “Header2”),
evtable_kwargs={“align”: “r”, “border”: “tablecols”})</p>
</div></blockquote>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.display">
<code class="sig-name descname">display</code><span class="sig-paren">(</span><em class="sig-param">show_footer=True</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.display"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.display" title="Permalink to this definition"></a></dt>
<dd><p>Pretty-print the page.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.format_page">
<code class="sig-name descname">format_page</code><span class="sig-paren">(</span><em class="sig-param">page</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.format_page"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.format_page" title="Permalink to this definition"></a></dt>
<dd><p>Page formatter. Uses the page_formatter callable by default.
This allows to easier override the class if needed.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.init_evtable">
<code class="sig-name descname">init_evtable</code><span class="sig-paren">(</span><em class="sig-param">table</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.init_evtable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.init_evtable" title="Permalink to this definition"></a></dt>
<dd><p>The input is an EvTable.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.init_f_str">
<code class="sig-name descname">init_f_str</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.init_f_str"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.init_f_str" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>The input contains</p>
</div></blockquote>
<p>markers. We use
to indicate the user wants to</p>
<blockquote>
<div><p>enforce their line breaks on their own. If so, we do no automatic
line-breaking/justification at all.</p>
</div></blockquote>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.init_iterable">
<code class="sig-name descname">init_iterable</code><span class="sig-paren">(</span><em class="sig-param">inp</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.init_iterable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.init_iterable" title="Permalink to this definition"></a></dt>
<dd><p>The input is something other than a string - convert to iterable of strings</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.init_queryset">
<code class="sig-name descname">init_queryset</code><span class="sig-paren">(</span><em class="sig-param">qs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.init_queryset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.init_queryset" title="Permalink to this definition"></a></dt>
<dd><p>The input is a queryset</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.init_str">
<code class="sig-name descname">init_str</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.init_str"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.init_str" title="Permalink to this definition"></a></dt>
<dd><p>The input is a string</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.page_back">
<code class="sig-name descname">page_back</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.page_back"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.page_back" title="Permalink to this definition"></a></dt>
<dd><p>Scroll the text back up, at the most to the top.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.page_end">
<code class="sig-name descname">page_end</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.page_end"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.page_end" title="Permalink to this definition"></a></dt>
<dd><p>Display the bottom page.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.page_next">
<code class="sig-name descname">page_next</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.page_next"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.page_next" title="Permalink to this definition"></a></dt>
<dd><p>Scroll the text to the next page. Quit if already at the end
of the page.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.page_quit">
<code class="sig-name descname">page_quit</code><span class="sig-paren">(</span><em class="sig-param">quiet=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.page_quit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.page_quit" title="Permalink to this definition"></a></dt>
<dd><p>Quit the pager</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.page_top">
<code class="sig-name descname">page_top</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.page_top"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.page_top" title="Permalink to this definition"></a></dt>
<dd><p>Display the top page</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.paginator_index">
<code class="sig-name descname">paginator_index</code><span class="sig-paren">(</span><em class="sig-param">pageno</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.paginator_index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.paginator_index" title="Permalink to this definition"></a></dt>
<dd><p>Paginate to specific, known index</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.paginator_slice">
<code class="sig-name descname">paginator_slice</code><span class="sig-paren">(</span><em class="sig-param">pageno</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.paginator_slice"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.paginator_slice" title="Permalink to this definition"></a></dt>
<dd><p>Paginate by slice. This is done with an eye on memory efficiency (usually for
querysets); to avoid fetching all objects at the same time.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evmore.EvMore.start">
<code class="sig-name descname">start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#EvMore.start"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.EvMore.start" title="Permalink to this definition"></a></dt>
<dd><p>Starts the pagination</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evmore.msg">
<code class="sig-prename descclassname">evennia.utils.evmore.</code><code class="sig-name descname">msg</code><span class="sig-paren">(</span><em class="sig-param">caller</em>, <em class="sig-param">text=''</em>, <em class="sig-param">always_page=False</em>, <em class="sig-param">session=None</em>, <em class="sig-param">justify=False</em>, <em class="sig-param">justify_kwargs=None</em>, <em class="sig-param">exit_on_lastpage=True</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#msg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.msg" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>EvMore-supported version of msg, mimicking the normal msg method.</p>
<dl>
<dt>Args:</dt><dd><p>caller (Object or Account): Entity reading the text.
text (str, EvTable or iterator): The text or data to put under paging.</p>
<blockquote>
<div><ul class="simple">
<li><p>If a string, paginage normally. If this text contains
one or more `</p></li>
</ul>
</div></blockquote>
</dd>
</dl>
</div></blockquote>
<dl>
<dt>` format symbol, automatic pagination is disabled</dt><dd><p>and page-breaks will only happen after each `</p>
</dd>
<dt><a href="#id143"><span class="problematic" id="id144">`</span></a>.</dt><dd><blockquote>
<div><ul class="simple">
<li><dl class="simple">
<dt>If <cite>EvTable</cite>, the EvTable will be paginated with the same</dt><dd><p>setting on each page if it is too long. The table
decorations will be considered in the size of the page.</p>
</dd>
</dl>
</li>
<li><p>Otherwise <cite>text</cite> is converted to an iterator, where each step is
is expected to be a line in the final display, and each line
will be run through repr().</p></li>
</ul>
</div></blockquote>
<dl class="simple">
<dt>always_page (bool, optional): If <cite>False</cite>, the</dt><dd><p>pager will only kick in if <cite>text</cite> is too big
to fit the screen.</p>
</dd>
<dt>session (Session, optional): If given, this session will be used</dt><dd><p>to determine the screen width and will receive all output.</p>
</dd>
<dt>justify (bool, optional): If set, justify long lines in output. Disable for</dt><dd><p>fixed-format output, like tables.</p>
</dd>
<dt>justify_kwargs (dict, bool or None, optional): If given, this should</dt><dd><p>be valid keyword arguments to the utils.justify() function. If False,
no justification will be done.</p>
</dd>
</dl>
<p>exit_on_lastpage (bool, optional): Immediately exit pager when reaching the last page.
use_evtable (bool, optional): If True, each page will be rendered as an</p>
<blockquote>
<div><p>EvTable. For this to work, <cite>text</cite> must be an iterable, where each element
is the table (list of list) to render on that page.</p>
</div></blockquote>
<p>evtable_args (tuple, optional): The args to use for EvTable on each page.
evtable_kwargs (dict, optional): The kwargs to use for EvTable on each</p>
<blockquote>
<div><p>page (except <cite>table</cite>, which is supplied by EvMore per-page).</p>
</div></blockquote>
<dl class="simple">
<dt>kwargs (any, optional): These will be passed on</dt><dd><p>to the <cite>caller.msg</cite> method.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evmore.queryset_maxsize">
<code class="sig-prename descclassname">evennia.utils.evmore.</code><code class="sig-name descname">queryset_maxsize</code><span class="sig-paren">(</span><em class="sig-param">qs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evmore.html#queryset_maxsize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evmore.queryset_maxsize" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-evennia.utils.evtable">
<span id="evennia-utils-evtable-module"></span><h2>evennia.utils.evtable module<a class="headerlink" href="#module-evennia.utils.evtable" title="Permalink to this headline"></a></h2>
<p>This is an advanced ASCII table creator. It was inspired by
[prettytable](<a class="reference external" href="https://code.google.com/p/prettytable/">https://code.google.com/p/prettytable/</a>) but shares no
code.</p>
<p>Example usage:</p>
<dl>
<dt><a href="#id145"><span class="problematic" id="id146">``</span></a><a href="#id147"><span class="problematic" id="id148">`</span></a>python</dt><dd><p>from evennia.utils import evtable</p>
<dl class="simple">
<dt>table = evtable.EvTable(“Heading1”, “Heading2”,</dt><dd><p>table=[[1,2,3],[4,5,6],[7,8,9]], border=”cells”)</p>
</dd>
</dl>
<p>table.add_column(“This is long data”, “This is even longer data”)
table.add_row(“This is a single row”)
print table</p>
</dd>
</dl>
<p><a href="#id149"><span class="problematic" id="id150">``</span></a><a href="#id151"><span class="problematic" id="id152">`</span></a></p>
<p>Result:</p>
<p><code class="docutils literal notranslate"><span class="pre">`</span>
<span class="pre">+----------------------+----------+---+--------------------------+</span>
<span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">Heading1</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">Heading2</span> <span class="pre">|</span>&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">+~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~+~~~+~~~~~~~~~~~~~~~~~~~~~~~~~~+</span>
<span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">1</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160; <span class="pre">4</span>&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">7</span> <span class="pre">|</span>&#160;&#160;&#160;&#160; <span class="pre">This</span> <span class="pre">is</span> <span class="pre">long</span> <span class="pre">data</span>&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">+----------------------+----------+---+--------------------------+</span>
<span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">2</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160; <span class="pre">5</span>&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">8</span> <span class="pre">|</span> <span class="pre">This</span> <span class="pre">is</span> <span class="pre">even</span> <span class="pre">longer</span> <span class="pre">data</span> <span class="pre">|</span>
<span class="pre">+----------------------+----------+---+--------------------------+</span>
<span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">3</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160; <span class="pre">6</span>&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">9</span> <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">+----------------------+----------+---+--------------------------+</span>
<span class="pre">|</span> <span class="pre">This</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">single</span> <span class="pre">row</span> <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">+----------------------+----------+---+--------------------------+</span>
<span class="pre">`</span></code></p>
<p>As seen, the table will automatically expand with empty cells to make
the table symmetric. Tables can be restricted to a given width:</p>
<dl class="simple">
<dt><a href="#id153"><span class="problematic" id="id154">``</span></a><a href="#id155"><span class="problematic" id="id156">`</span></a>python</dt><dd><p>table.reformat(width=50, align=”l”)</p>
</dd>
</dl>
<p><a href="#id157"><span class="problematic" id="id158">``</span></a><a href="#id159"><span class="problematic" id="id160">`</span></a></p>
<p>(We could just have added these keywords to the table creation call)</p>
<p>This yields the following result:</p>
<p><code class="docutils literal notranslate"><span class="pre">`</span>
<span class="pre">+-----------+------------+-----------+-----------+</span>
<span class="pre">|</span> <span class="pre">Heading1</span>&#160; <span class="pre">|</span> <span class="pre">Heading2</span>&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">+~~~~~~~~~~~+~~~~~~~~~~~~+~~~~~~~~~~~+~~~~~~~~~~~+</span>
<span class="pre">|</span> <span class="pre">1</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">4</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">7</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">This</span> <span class="pre">is</span>&#160;&#160; <span class="pre">|</span>
<span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">long</span> <span class="pre">data</span> <span class="pre">|</span>
<span class="pre">+-----------+------------+-----------+-----------+</span>
<span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">This</span> <span class="pre">is</span>&#160;&#160; <span class="pre">|</span>
<span class="pre">|</span> <span class="pre">2</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">5</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">8</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">even</span>&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">longer</span>&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">data</span>&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">+-----------+------------+-----------+-----------+</span>
<span class="pre">|</span> <span class="pre">3</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">6</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">9</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">+-----------+------------+-----------+-----------+</span>
<span class="pre">|</span> <span class="pre">This</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">|</span>&#160; <span class="pre">single</span>&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">|</span> <span class="pre">row</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">+-----------+------------+-----------+-----------+</span>
<span class="pre">`</span></code></p>
<p>Table-columns can be individually formatted. Note that if an
individual column is set with a specific width, table auto-balancing
will not affect this column (this may lead to the full table being too
wide, so be careful mixing fixed-width columns with auto- balancing).
Here we change the width and alignment of the column at index 3
(Python starts from 0):</p>
<p><a href="#id161"><span class="problematic" id="id162">``</span></a><a href="#id163"><span class="problematic" id="id164">`</span></a>python</p>
<p>table.reformat_column(3, width=30, align=”r”)
print table
<a href="#id165"><span class="problematic" id="id166">``</span></a><a href="#id167"><span class="problematic" id="id168">`</span></a></p>
<p><code class="docutils literal notranslate"><span class="pre">`</span>
<span class="pre">+-----------+-------+-----+-----------------------------+---------+</span>
<span class="pre">|</span> <span class="pre">Heading1</span>&#160; <span class="pre">|</span> <span class="pre">Headi</span> <span class="pre">|</span>&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">ng2</span>&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">+~~~~~~~~~~~+~~~~~~~+~~~~~+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~+</span>
<span class="pre">|</span> <span class="pre">1</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">4</span>&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">7</span>&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">This</span> <span class="pre">is</span> <span class="pre">long</span> <span class="pre">data</span> <span class="pre">|</span> <span class="pre">Test1</span>&#160;&#160; <span class="pre">|</span>
<span class="pre">+-----------+-------+-----+-----------------------------+---------+</span>
<span class="pre">|</span> <span class="pre">2</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">5</span>&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">8</span>&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160; <span class="pre">This</span> <span class="pre">is</span> <span class="pre">even</span> <span class="pre">longer</span> <span class="pre">data</span> <span class="pre">|</span> <span class="pre">Test3</span>&#160;&#160; <span class="pre">|</span>
<span class="pre">+-----------+-------+-----+-----------------------------+---------+</span>
<span class="pre">|</span> <span class="pre">3</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">6</span>&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">9</span>&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span> <span class="pre">Test4</span>&#160;&#160; <span class="pre">|</span>
<span class="pre">+-----------+-------+-----+-----------------------------+---------+</span>
<span class="pre">|</span> <span class="pre">This</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">|</span>&#160; <span class="pre">single</span>&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">|</span> <span class="pre">row</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">|</span>
<span class="pre">+-----------+-------+-----+-----------------------------+---------+</span>
<span class="pre">`</span></code></p>
<p>When adding new rows/columns their data can have its own alignments
(left/center/right, top/center/bottom).</p>
<p>If the height is restricted, cells will be restricted from expanding
vertically. This will lead to text contents being cropped. Each cell
can only shrink to a minimum width and height of 1.</p>
<p><cite>EvTable</cite> is intended to be used with [ANSIString](evennia.utils.ansi#ansistring)
for supporting ANSI-coloured string types.</p>
<p>When a cell is auto-wrapped across multiple lines, ANSI-reset
sequences will be put at the end of each wrapped line. This means that
the colour of a wrapped cell will not “bleed”, but it also means that
eventual colour outside the table will not transfer “across” a table,
you need to re-set the color to have it appear on both sides of the
table string.</p>
<dl class="class">
<dt id="evennia.utils.evtable.ANSITextWrapper">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">ANSITextWrapper</code><span class="sig-paren">(</span><em class="sig-param">width=70</em>, <em class="sig-param">initial_indent=''</em>, <em class="sig-param">subsequent_indent=''</em>, <em class="sig-param">expand_tabs=True</em>, <em class="sig-param">replace_whitespace=True</em>, <em class="sig-param">fix_sentence_endings=False</em>, <em class="sig-param">break_long_words=True</em>, <em class="sig-param">drop_whitespace=True</em>, <em class="sig-param">break_on_hyphens=True</em>, <em class="sig-param">tabsize=8</em>, <em class="sig-param">*</em>, <em class="sig-param">max_lines=None</em>, <em class="sig-param">placeholder=' [...]'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#ANSITextWrapper"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.ANSITextWrapper" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">textwrap.TextWrapper</span></code></p>
<p>This is a wrapper work class for handling strings with ANSI tags
in it. It overloads the standard library <cite>TextWrapper</cite> class and
is used internally in <cite>EvTable</cite> and has no public methods.</p>
<dl class="method">
<dt id="evennia.utils.evtable.ANSITextWrapper._munge_whitespace">
<code class="sig-name descname">_munge_whitespace</code><span class="sig-paren">(</span><em class="sig-param">text : string</em><span class="sig-paren">)</span> &#x2192; string<a class="reference internal" href="../_modules/evennia/utils/evtable.html#ANSITextWrapper._munge_whitespace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.ANSITextWrapper._munge_whitespace" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>Munge whitespace in text: expand tabs and convert all other
whitespace characters to spaces. Eg. ” foo bar</p>
</div></blockquote>
<dl class="simple">
<dt>baz”</dt><dd><p>becomes ” foo bar baz”.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.ANSITextWrapper._split">
<code class="sig-name descname">_split</code><span class="sig-paren">(</span><em class="sig-param">text : string</em><span class="sig-paren">)</span> &#x2192; [string]<a class="reference internal" href="../_modules/evennia/utils/evtable.html#ANSITextWrapper._split"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.ANSITextWrapper._split" title="Permalink to this definition"></a></dt>
<dd><p>Split the text to wrap into indivisible chunks. Chunks are
not quite the same as words; see _wrap_chunks() for full
details. As an example, the text</p>
<blockquote>
<div><p>Look, goof-ball use the -b option!</p>
</div></blockquote>
<dl class="simple">
<dt>breaks into the following chunks:</dt><dd><p>Look,, , goof-, ball, , , ,
use, , the, , -b, , option!</p>
</dd>
<dt>if break_on_hyphens is True, or in:</dt><dd><p>Look,, , goof-ball, , , ,
use, , the, , -b, , option!</p>
</dd>
</dl>
<p>otherwise.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.ANSITextWrapper._wrap_chunks">
<code class="sig-name descname">_wrap_chunks</code><span class="sig-paren">(</span><em class="sig-param">chunks : [string]</em><span class="sig-paren">)</span> &#x2192; [string]<a class="reference internal" href="../_modules/evennia/utils/evtable.html#ANSITextWrapper._wrap_chunks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.ANSITextWrapper._wrap_chunks" title="Permalink to this definition"></a></dt>
<dd><p>Wrap a sequence of text chunks and return a list of lines of
length self.width or less. (If break_long_words is false,
some lines may be longer than this.) Chunks correspond roughly
to words and the whitespace between them: each chunk is
indivisible (modulo break_long_words), but a line break can
come between any two chunks. Chunks should not have internal
whitespace; ie. a chunk is either all whitespace or a “word”.
Whitespace chunks will be removed from the beginning and end of
lines, but apart from that whitespace is preserved.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evtable.EvCell">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">EvCell</code><span class="sig-paren">(</span><em class="sig-param">data</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Holds a single data cell for the table. A cell has a certain width
and height and contains one or more lines of data. It can shrink
and resize as needed.</p>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">data</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.__init__" title="Permalink to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> (<em>str</em>) The un-padded data of the entry.</p>
</dd>
</dl>
<dl>
<dt>Kwargs:</dt><dd><dl class="simple">
<dt>width (int): Desired width of cell. It will pad</dt><dd><p>to this size.</p>
</dd>
<dt>height (int): Desired height of cell. it will pad</dt><dd><p>to this size.</p>
</dd>
<dt>pad_width (int): General padding width. This can be overruled</dt><dd><p>by individual settings below.</p>
</dd>
</dl>
<p>pad_left (int): Number of extra pad characters on the left.
pad_right (int): Number of extra pad characters on the right.
pad_top (int): Number of extra pad lines top (will pad with <cite>vpad_char</cite>).
pad_bottom (int): Number of extra pad lines bottom (will pad with <cite>vpad_char</cite>).
pad_char (str)- pad character to use for padding. This is overruled</p>
<blockquote>
<div><p>by individual settings below (default <cite>” “</cite>).</p>
</div></blockquote>
<dl class="simple">
<dt>hpad_char (str): Pad character to use both for extra horizontal</dt><dd><p>padding (default <cite>” “</cite>).</p>
</dd>
<dt>vpad_char (str): Pad character to use for extra vertical padding</dt><dd><p>and for vertical fill (default <cite>” “</cite>).</p>
</dd>
<dt>fill_char (str): Character used to filling (expanding cells to</dt><dd><p>desired size). This can be overruled by individual settings below.</p>
</dd>
</dl>
<p>hfill_char (str): Character used for horizontal fill (default <cite>” “</cite>).
vfill_char (str): Character used for vertical fill (default <cite>” “</cite>).
align (str): Should be one of “l”, “r” or “c” for left-, right- or center</p>
<blockquote>
<div><p>horizontal alignment respectively. Default is left-aligned.</p>
</div></blockquote>
<dl class="simple">
<dt>valign (str): Should be one of “t”, “b” or “c” for top-, bottom and center</dt><dd><p>vertical alignment respectively. Default is centered.</p>
</dd>
<dt>border_width (int): General border width. This is overruled</dt><dd><p>by individual settings below.</p>
</dd>
</dl>
<p>border_left (int): Left border width.
border_right (int): Right border width.
border_top (int): Top border width.
border_bottom (int): Bottom border width.
border_char (str): This will use a single border char for all borders.</p>
<blockquote>
<div><p>overruled by individual settings below.</p>
</div></blockquote>
<p>border_left_char (str): Char used for left border.
border_right_char (str): Char used for right border.
border_top_char (str): Char used for top border.
border_bottom_char (str): Char user for bottom border.
corner_char (str): Character used when two borders cross. (default is “”).</p>
<blockquote>
<div><p>This is overruled by individual settings below.</p>
</div></blockquote>
<p>corner_top_left_char (str): Char used for “nw” corner.
corner_top_right_char (str): Char used for “ne” corner.
corner_bottom_left_char (str): Char used for “sw” corner.
corner_bottom_right_char (str): Char used for “se” corner.
crop_string (str): String to use when cropping sideways, default is <cite>[…]</cite>.
crop (bool): Crop contentof cell rather than expand vertically, default=`False`.
enforce_size (bool): If true, the width/height of the cell is</p>
<blockquote>
<div><p>strictly enforced and extra text will be cropped rather than the
cell growing vertically.</p>
</div></blockquote>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>Exception</strong> for impossible cell size requirements where the
border width or height cannot fit, or the content is too
small.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell._align">
<code class="sig-name descname">_align</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell._align"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell._align" title="Permalink to this definition"></a></dt>
<dd><p>Align list of rows of cell. Whitespace characters will be stripped
if there is only one whitespace character - otherwise, its assumed
the caller may be trying some manual formatting in the text.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> (<em>str</em>) Text to align.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Aligned result.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell._border">
<code class="sig-name descname">_border</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell._border"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell._border" title="Permalink to this definition"></a></dt>
<dd><p>Add borders to the cell.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> (<em>str</em>) Text to surround with borders.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Text with borders.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell._center">
<code class="sig-name descname">_center</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">width</em>, <em class="sig-param">pad_char</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell._center"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell._center" title="Permalink to this definition"></a></dt>
<dd><p>Horizontally center text on line of certain width, using padding.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em>) The text to center.</p></li>
<li><p><strong>width</strong> (<em>int</em>) How wide the area is (in characters) where <cite>text</cite>
should be centered.</p></li>
<li><p><strong>pad_char</strong> (<em>str</em>) Which padding character to use.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Centered text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell._crop">
<code class="sig-name descname">_crop</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">width</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell._crop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell._crop" title="Permalink to this definition"></a></dt>
<dd><p>Apply cropping of text.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em>) The text to crop.</p></li>
<li><p><strong>width</strong> (<em>int</em>) The width to crop <cite>text</cite> to.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell._fit_width">
<code class="sig-name descname">_fit_width</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell._fit_width"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell._fit_width" title="Permalink to this definition"></a></dt>
<dd><p>Split too-long lines to fit the desired width of the Cell.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> (<em>str</em>) Text to adjust to the cells width.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The adjusted text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>adjusted data (str)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>This also updates <cite>raw_width</cite>.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell._pad">
<code class="sig-name descname">_pad</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell._pad"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell._pad" title="Permalink to this definition"></a></dt>
<dd><p>Pad data with extra characters on all sides.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> (<em>str</em>) Text to pad.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Padded text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell._reformat">
<code class="sig-name descname">_reformat</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell._reformat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell._reformat" title="Permalink to this definition"></a></dt>
<dd><p>Apply all EvCells formatting operations.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell._split_lines">
<code class="sig-name descname">_split_lines</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell._split_lines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell._split_lines" title="Permalink to this definition"></a></dt>
<dd><p>Simply split by linebreaks</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>text</strong> (<em>str</em>) text to split.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>split text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>split (list)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell._valign">
<code class="sig-name descname">_valign</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell._valign"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell._valign" title="Permalink to this definition"></a></dt>
<dd><p>Align cell vertically</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> (<em>str</em>) Text to align.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Vertically aligned text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell.get">
<code class="sig-name descname">get</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.get" title="Permalink to this definition"></a></dt>
<dd><p>Get data, padded and aligned in the form of a list of lines.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell.get_height">
<code class="sig-name descname">get_height</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.get_height"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.get_height" title="Permalink to this definition"></a></dt>
<dd><p>Get natural height of cell, including padding.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Height of cell.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>natural_height (int)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell.get_min_height">
<code class="sig-name descname">get_min_height</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.get_min_height"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.get_min_height" title="Permalink to this definition"></a></dt>
<dd><p>Get the minimum possible height of cell, including at least
one line for data.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The mininum height of cell.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>min_height (int)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell.get_min_width">
<code class="sig-name descname">get_min_width</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.get_min_width"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.get_min_width" title="Permalink to this definition"></a></dt>
<dd><p>Get the minimum possible width of cell, including at least one
character-width for data.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The minimum width of cell.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>min_width (int)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell.get_width">
<code class="sig-name descname">get_width</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.get_width"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.get_width" title="Permalink to this definition"></a></dt>
<dd><p>Get natural width of cell, including padding.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Width of cell.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>natural_width (int)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell.reformat">
<code class="sig-name descname">reformat</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.reformat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.reformat" title="Permalink to this definition"></a></dt>
<dd><p>Reformat the EvCell with new options</p>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>The available keyword arguments are the same as for <cite>EvCell.__init__</cite>.</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>Exception</strong> If the cells cannot shrink enough to accomodate
the options or the data given.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvCell.replace_data">
<code class="sig-name descname">replace_data</code><span class="sig-paren">(</span><em class="sig-param">data</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvCell.replace_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvCell.replace_data" title="Permalink to this definition"></a></dt>
<dd><p>Replace cell data. This causes a full reformat of the cell.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> (<em>str</em>) Cell data.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>The available keyword arguments are the same as for
<cite>EvCell.__init__</cite>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evtable.EvColumn">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">EvColumn</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvColumn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvColumn" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This class holds a list of Cells to represent a column of a table.
It holds operations and settings that affect <em>all</em> cells in the
column.</p>
<p>Columns are not intended to be used stand-alone; they should be
incorporated into an EvTable (like EvCells)</p>
<dl class="method">
<dt id="evennia.utils.evtable.EvColumn.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvColumn.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvColumn.__init__" title="Permalink to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>for each row in the column</strong> (<a class="reference internal" href="#evennia.utils.optionclasses.Text" title="evennia.utils.optionclasses.Text"><em>Text</em></a>) </p>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>All <cite>EvCell.__init_</cite> keywords are available, these
settings will be persistently applied to every Cell in the
column.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvColumn._balance">
<code class="sig-name descname">_balance</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvColumn._balance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvColumn._balance" title="Permalink to this definition"></a></dt>
<dd><p>Make sure to adjust the width of all cells so we form a
coherent and lined-up column. Will enforce column-specific
options to cells.</p>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>Extra keywords to modify the column setting. Same keywords
as in <cite>EvCell.__init__</cite>.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvColumn.add_rows">
<code class="sig-name descname">add_rows</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvColumn.add_rows"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvColumn.add_rows" title="Permalink to this definition"></a></dt>
<dd><p>Add new cells to column. They will be inserted as
a series of rows. It will inherit the options
of the rest of the columns cells (use update to change
options).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>for the new cells</strong> (<em>Texts</em>) </p></li>
<li><p><strong>ypos</strong> (<em>int</em><em>, </em><em>optional</em>) Index position in table before which to insert the
new column. Uses Python indexing, so to insert at the top,
use <cite>ypos=0</cite>. If not given, data will be inserted at the end
of the column.</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>Available keywods as per <cite>EvCell.__init__</cite>.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvColumn.reformat">
<code class="sig-name descname">reformat</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvColumn.reformat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvColumn.reformat" title="Permalink to this definition"></a></dt>
<dd><p>Change the options for the column.</p>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>Keywords as per <cite>EvCell.__init__</cite>.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvColumn.reformat_cell">
<code class="sig-name descname">reformat_cell</code><span class="sig-paren">(</span><em class="sig-param">index</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvColumn.reformat_cell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvColumn.reformat_cell" title="Permalink to this definition"></a></dt>
<dd><p>reformat cell at given index, keeping column options if
necessary.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>index</strong> (<em>int</em>) Index location of the cell in the column,
starting from 0 for the first row to Nrows-1.</p>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>Keywords as per <cite>EvCell.__init__</cite>.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.evtable.EvTable">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">EvTable</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>The table class holds a list of EvColumns, each consisting of EvCells so
that the result is a 2D matrix.</p>
<dl class="method">
<dt id="evennia.utils.evtable.EvTable.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.__init__" title="Permalink to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>texts for the table.</strong> (<em>Header</em>) </p>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><dl class="simple">
<dt>table (list of lists or list of <cite>EvColumns</cite>, optional):</dt><dd><p>This is used to build the table in a quick way. If not
given, the table will start out empty and <cite>add_</cite> methods
need to be used to add rows/columns.</p>
</dd>
<dt>header (bool, optional): <cite>True</cite>/<cite>False</cite> - turn off the</dt><dd><p>header texts (<cite>*args</cite>) being treated as a header (such as
not adding extra underlining)</p>
</dd>
<dt>pad_width (int, optional): How much empty space to pad your cells with</dt><dd><p>(default is 1)</p>
</dd>
<dt>border (str, optional)): The border style to use. This is one of</dt><dd><ul class="simple">
<li><p><cite>None</cite> - No border drawing at all.</p></li>
<li><p>“table” - only a border around the whole table.</p></li>
<li><p>“tablecols” - table and column borders. (default)</p></li>
<li><p>“header” - only border under header.</p></li>
<li><p>“cols” - only vertical borders.</p></li>
<li><p>“incols” - vertical borders, no outer edges.</p></li>
<li><p>“rows” - only borders between rows.</p></li>
<li><p>“cells” - border around all cells.</p></li>
</ul>
</dd>
<dt>border_width (int, optional): Width of table borders, if border is active.</dt><dd><p>Note that widths wider than 1 may give artifacts in the corners. Default is 1.</p>
</dd>
<dt>corner_char (str, optional): Character to use in corners when border is active.</dt><dd><p>Default is <cite>+</cite>.</p>
</dd>
<dt>corner_top_left_char (str, optional): Character used for “nw” corner of table.</dt><dd><p>Defaults to <cite>corner_char</cite>.</p>
</dd>
<dt>corner_top_right_char (str, optional): Character used for “ne” corner of table.</dt><dd><p>Defaults to <cite>corner_char</cite>.</p>
</dd>
<dt>corner_bottom_left_char (str, optional): Character used for “sw” corner of table.</dt><dd><p>Defaults to <cite>corner_char</cite>.</p>
</dd>
<dt>corner_bottom_right_char (str, optional): Character used for “se” corner of table.</dt><dd><p>Defaults to <cite>corner_char</cite>.</p>
</dd>
<dt>pretty_corners (bool, optional): Use custom characters to</dt><dd><p>make the table corners look “rounded”. Uses UTF-8
characters. Defaults to <cite>False</cite> for maximum compatibility with various displays
that may occationally have issues with UTF-8 characters.</p>
</dd>
<dt>header_line_char (str, optional): Character to use for underlining</dt><dd><p>the header row (default is ~). Requires <cite>border</cite> to not be <cite>None</cite>.</p>
</dd>
<dt>width (int, optional): Fixed width of table. If not set,</dt><dd><p>width is set by the total width of each column. This will
resize individual columns in the vertical direction to fit.</p>
</dd>
<dt>height (int, optional): Fixed height of table. Defaults to being unset. Width is</dt><dd><p>still given precedence. If given, table cells will crop text rather
than expand vertically.</p>
</dd>
<dt>evenwidth (bool, optional): Used with the <cite>width</cite> keyword. Adjusts columns to have as even width as</dt><dd><p>possible. This often looks best also for mixed-length tables. Default is <cite>False</cite>.</p>
</dd>
<dt>maxwidth (int, optional): This will set a maximum width</dt><dd><p>of the table while allowing it to be smaller. Only if it grows wider than this
size will it be resized by expanding horizontally (or crop <cite>height</cite> is given).
This keyword has no meaning if <cite>width</cite> is set.</p>
</dd>
</dl>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>Exception</strong> If given erroneous input or width settings for the data.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Beyond those table-specific keywords, the non-overlapping keywords
of <cite>EcCell.__init__</cite> are also available. These will be passed down
to every cell in the table.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvTable._balance">
<code class="sig-name descname">_balance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable._balance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable._balance" title="Permalink to this definition"></a></dt>
<dd><p>Balance the table. This means to make sure
all cells on the same row have the same height,
that all columns have the same number of rows
and that the table fits within the given width.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvTable._borders">
<code class="sig-name descname">_borders</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable._borders"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable._borders" title="Permalink to this definition"></a></dt>
<dd><p>Add borders to table. This is called from self._balance.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvTable._cellborders">
<code class="sig-name descname">_cellborders</code><span class="sig-paren">(</span><em class="sig-param">ix</em>, <em class="sig-param">iy</em>, <em class="sig-param">nx</em>, <em class="sig-param">ny</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable._cellborders"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable._cellborders" title="Permalink to this definition"></a></dt>
<dd><p>Adds borders to the table by adjusting the input kwarg to
instruct cells to build a border in the right positions.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ix</strong> (<em>int</em>) x index positions in table.</p></li>
<li><p><strong>iy</strong> (<em>int</em>) y index positions in table.</p></li>
<li><p><strong>nx</strong> (<em>int</em>) x size of table.</p></li>
<li><p><strong>ny</strong> (<em>int</em>) y size of table.</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>Keywords as per <cite>EvTable.__init__</cite>.</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>string with the correct borders.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>table (str)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>A copy of the kwarg is returned to the cell. This is method
is called by self._borders.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvTable._generate_lines">
<code class="sig-name descname">_generate_lines</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable._generate_lines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable._generate_lines" title="Permalink to this definition"></a></dt>
<dd><p>Generates lines across all columns
(each cell may contain multiple lines)
This will also balance the table.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvTable.add_column">
<code class="sig-name descname">add_column</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.add_column"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.add_column" title="Permalink to this definition"></a></dt>
<dd><p>Add a column to table. If there are more rows in new column
than there are rows in the current table, the table will
expand with empty rows in the other columns. If too few, the
new column with get new empty rows. All filling rows are added
to the end.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>args</strong> (<cite>EvColum</cite> or multiple strings) Either a single EvColumn instance or
a number of data string arguments to be used to create a new column.</p></li>
<li><p><strong>header</strong> (<em>str</em><em>, </em><em>optional</em>) The header text for the column</p></li>
<li><p><strong>xpos</strong> (<em>int</em><em>, </em><em>optional</em>) Index position in table <em>before</em> which
to input new column. If not given, column will be added to the end
of the table. Uses Python indexing (so first column is <cite>xpos=0</cite>)</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>Other keywords as per <cite>Cell.__init__</cite>.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvTable.add_header">
<code class="sig-name descname">add_header</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.add_header"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.add_header" title="Permalink to this definition"></a></dt>
<dd><p>Add header to table. This is a number of texts to be put at
the top of the table. They will replace an existing header.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>args</strong> (<em>str</em>) These strings will be used as the header texts.</p>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>Same keywords as per <cite>EvTable.__init__</cite>. Will be applied
to the new headers cells.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvTable.add_row">
<code class="sig-name descname">add_row</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.add_row"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.add_row" title="Permalink to this definition"></a></dt>
<dd><p>Add a row to table (not a header). If there are more cells in
the given row than there are cells in the current table the
table will be expanded with empty columns to match. These will
be added to the end of the table. In the same way, adding a
line with too few cells will lead to the last ones getting
padded.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>args</strong> (<em>str</em>) Any number of string argumnets to use as the
data in the row (one cell per argument).</p></li>
<li><p><strong>ypos</strong> (<em>int</em><em>, </em><em>optional</em>) Index position in table before which to
input new row. If not given, will be added to the end of the table.
Uses Python indexing (so first row is <cite>ypos=0</cite>)</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>Other keywords are as per <cite>EvCell.__init__</cite>.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvTable.get">
<code class="sig-name descname">get</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.get" title="Permalink to this definition"></a></dt>
<dd><p>Return lines of table as a list.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The lines of the table, in order.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>table_lines (list)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvTable.reformat">
<code class="sig-name descname">reformat</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.reformat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.reformat" title="Permalink to this definition"></a></dt>
<dd><p>Force a re-shape of the entire table.</p>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>Table options as per <cite>EvTable.__init__</cite>.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.evtable.EvTable.reformat_column">
<code class="sig-name descname">reformat_column</code><span class="sig-paren">(</span><em class="sig-param">index</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#EvTable.reformat_column"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.EvTable.reformat_column" title="Permalink to this definition"></a></dt>
<dd><p>Sends custom options to a specific column in the table.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>index</strong> (<em>int</em>) Which column to reformat. The column index is
given from 0 to Ncolumns-1.</p>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>Column options as per <cite>EvCell.__init__</cite>.</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>Exception</strong> if an invalid index is found.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evtable._test">
<code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">_test</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#_test"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable._test" title="Permalink to this definition"></a></dt>
<dd><p>Test</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evtable._test2">
<code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">_test2</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#_test2"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable._test2" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.evtable._to_ansi">
<code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">_to_ansi</code><span class="sig-paren">(</span><em class="sig-param">obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#_to_ansi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable._to_ansi" title="Permalink to this definition"></a></dt>
<dd><p>convert to ANSIString.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>obj</strong> (<em>str</em>) Convert incoming text to
be ANSI aware ANSIStrings.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evtable.fill">
<code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">fill</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">width=78</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#fill"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.fill" title="Permalink to this definition"></a></dt>
<dd><p>Fill a single paragraph of text, returning a new string.</p>
<p>Reformat the single paragraph in text to fit in lines of no more
than width columns, and return a new string containing the entire
wrapped paragraph. As with wrap(), tabs are expanded and other
whitespace characters converted to space.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em>) Text to fill.</p></li>
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) Width of fill area.</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>See TextWrapper class for available keyword args to customize
filling behaviour.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.evtable.wrap">
<code class="sig-prename descclassname">evennia.utils.evtable.</code><code class="sig-name descname">wrap</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">width=78</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/evtable.html#wrap"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.evtable.wrap" title="Permalink to this definition"></a></dt>
<dd><p>Wrap a single paragraph of text, returning a list of wrapped lines.</p>
<p>Reformat the single paragraph in text so it fits in lines of no
more than width columns, and return a list of wrapped lines. By
default, tabs in text are expanded with string.expandtabs(), and
all other whitespace characters (including newline) are converted to</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em>) Text to wrap.</p></li>
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) Width to wrap <cite>text</cite> to.</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>See TextWrapper class for available keyword args to customize
wrapping behaviour.</p>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.gametime">
<span id="evennia-utils-gametime-module"></span><h2>evennia.utils.gametime module<a class="headerlink" href="#module-evennia.utils.gametime" title="Permalink to this headline"></a></h2>
<p>The gametime module handles the global passage of time in the mud.</p>
<p>It also supplies some useful methods to convert between
in-mud time and real-world time as well allows to get the
total runtime of the server and the current uptime.</p>
<dl class="class">
<dt id="evennia.utils.gametime.TimeScript">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.gametime.</code><code class="sig-name descname">TimeScript</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#TimeScript"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.TimeScript" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.scripts.html#evennia.scripts.scripts.DefaultScript" title="evennia.scripts.scripts.DefaultScript"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.scripts.scripts.DefaultScript</span></code></a></p>
<p>Gametime-sensitive script.</p>
<dl class="exception">
<dt id="evennia.utils.gametime.TimeScript.DoesNotExist">
<em class="property">exception </em><code class="sig-name descname">DoesNotExist</code><a class="headerlink" href="#evennia.utils.gametime.TimeScript.DoesNotExist" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.scripts.scripts.DoesNotExist</span></code></p>
</dd></dl>
<dl class="exception">
<dt id="evennia.utils.gametime.TimeScript.MultipleObjectsReturned">
<em class="property">exception </em><code class="sig-name descname">MultipleObjectsReturned</code><a class="headerlink" href="#evennia.utils.gametime.TimeScript.MultipleObjectsReturned" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.scripts.scripts.MultipleObjectsReturned</span></code></p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.gametime.TimeScript._meta">
<code class="sig-name descname">_meta</code><em class="property"> = &lt;Options for TimeScript&gt;</em><a class="headerlink" href="#evennia.utils.gametime.TimeScript._meta" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.gametime.TimeScript.at_repeat">
<code class="sig-name descname">at_repeat</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#TimeScript.at_repeat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.TimeScript.at_repeat" title="Permalink to this definition"></a></dt>
<dd><p>Call the callback and reset interval.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.gametime.TimeScript.at_script_creation">
<code class="sig-name descname">at_script_creation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#TimeScript.at_script_creation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.TimeScript.at_script_creation" title="Permalink to this definition"></a></dt>
<dd><p>The script is created.</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.gametime.TimeScript.path">
<code class="sig-name descname">path</code><em class="property"> = 'evennia.utils.gametime.TimeScript'</em><a class="headerlink" href="#evennia.utils.gametime.TimeScript.path" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.gametime.TimeScript.typename">
<code class="sig-name descname">typename</code><em class="property"> = 'TimeScript'</em><a class="headerlink" href="#evennia.utils.gametime.TimeScript.typename" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.gametime.game_epoch">
<code class="sig-prename descclassname">evennia.utils.gametime.</code><code class="sig-name descname">game_epoch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#game_epoch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.game_epoch" title="Permalink to this definition"></a></dt>
<dd><p>Get the game epoch.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.gametime.gametime">
<code class="sig-prename descclassname">evennia.utils.gametime.</code><code class="sig-name descname">gametime</code><span class="sig-paren">(</span><em class="sig-param">absolute=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#gametime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.gametime" title="Permalink to this definition"></a></dt>
<dd><p>Get the total gametime of the server since first start (minus downtimes)</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>absolute</strong> (<em>bool</em><em>, </em><em>optional</em>) Get the absolute game time, including
the epoch. This could be converted to an absolute in-game
date.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The gametime as a virtual timestamp.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>time (float)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>If one is using a standard calendar, one could convert the unformatted
return to a date using Pythons standard <cite>datetime</cite> module like this:
<cite>datetime.datetime.fromtimestamp(gametime(absolute=True))</cite></p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.gametime.portal_uptime">
<code class="sig-prename descclassname">evennia.utils.gametime.</code><code class="sig-name descname">portal_uptime</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#portal_uptime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.portal_uptime" title="Permalink to this definition"></a></dt>
<dd><p>Get the current uptime of the portal.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The uptime of the portal.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>time (float)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.gametime.real_seconds_until">
<code class="sig-prename descclassname">evennia.utils.gametime.</code><code class="sig-name descname">real_seconds_until</code><span class="sig-paren">(</span><em class="sig-param">sec=None</em>, <em class="sig-param">min=None</em>, <em class="sig-param">hour=None</em>, <em class="sig-param">day=None</em>, <em class="sig-param">month=None</em>, <em class="sig-param">year=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#real_seconds_until"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.real_seconds_until" title="Permalink to this definition"></a></dt>
<dd><p>Return the real seconds until game time.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sec</strong> (<em>int</em><em> or </em><em>None</em>) number of absolute seconds.</p></li>
<li><p><strong>min</strong> (<em>int</em><em> or </em><em>None</em>) number of absolute minutes.</p></li>
<li><p><strong>hour</strong> (<em>int</em><em> or </em><em>None</em>) number of absolute hours.</p></li>
<li><p><strong>day</strong> (<em>int</em><em> or </em><em>None</em>) number of absolute days.</p></li>
<li><p><strong>month</strong> (<em>int</em><em> or </em><em>None</em>) number of absolute months.</p></li>
<li><p><strong>year</strong> (<em>int</em><em> or </em><em>None</em>) number of absolute years.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The number of real seconds before the given game time is up.</p>
</dd>
</dl>
<p class="rubric">Example</p>
<p>real_seconds_until(hour=5, min=10, sec=0)</p>
<p>If the game time is 5:00, TIME_FACTOR is set to 2 and you ask
the number of seconds until its 5:10, then this function should
return 300 (5 minutes).</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.gametime.reset_gametime">
<code class="sig-prename descclassname">evennia.utils.gametime.</code><code class="sig-name descname">reset_gametime</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#reset_gametime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.reset_gametime" title="Permalink to this definition"></a></dt>
<dd><p>Resets the game time to make it start from the current time. Note that
the epoch set by <cite>settings.TIME_GAME_EPOCH</cite> will still apply.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.gametime.runtime">
<code class="sig-prename descclassname">evennia.utils.gametime.</code><code class="sig-name descname">runtime</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#runtime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.runtime" title="Permalink to this definition"></a></dt>
<dd><p>Get the total runtime of the server since first start (minus
downtimes)</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>format</strong> (<em>bool</em><em>, </em><em>optional</em>) Format into a time representation.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>The runtime or the same time split up</dt><dd><p>into time units.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>time (float or tuple)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.gametime.schedule">
<code class="sig-prename descclassname">evennia.utils.gametime.</code><code class="sig-name descname">schedule</code><span class="sig-paren">(</span><em class="sig-param">callback</em>, <em class="sig-param">repeat=False</em>, <em class="sig-param">sec=None</em>, <em class="sig-param">min=None</em>, <em class="sig-param">hour=None</em>, <em class="sig-param">day=None</em>, <em class="sig-param">month=None</em>, <em class="sig-param">year=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#schedule"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.schedule" title="Permalink to this definition"></a></dt>
<dd><p>Call a callback at a given in-game time.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>callback</strong> (<em>function</em>) The callback function that will be called. Note
that the callback must be a module-level function, since the script will
be persistent.</p></li>
<li><p><strong>repeat</strong> (<em>bool</em><em>, </em><em>optional</em>) Defines if the callback should be called regularly
at the specified time.</p></li>
<li><p><strong>sec</strong> (<em>int</em><em> or </em><em>None</em>) Number of absolute game seconds at which to run repeat.</p></li>
<li><p><strong>min</strong> (<em>int</em><em> or </em><em>None</em>) Number of absolute minutes.</p></li>
<li><p><strong>hour</strong> (<em>int</em><em> or </em><em>None</em>) Number of absolute hours.</p></li>
<li><p><strong>day</strong> (<em>int</em><em> or </em><em>None</em>) Number of absolute days.</p></li>
<li><p><strong>month</strong> (<em>int</em><em> or </em><em>None</em>) Number of absolute months.</p></li>
<li><p><strong>year</strong> (<em>int</em><em> or </em><em>None</em>) Number of absolute years.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The created Script handling the sceduling.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>script (Script)</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>schedule(func, min=5, sec=0) # Will call 5 minutes past the next (in-game) hour.
schedule(func, hour=2, min=30, sec=0) # Will call the next (in-game) day at 02:30.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.gametime.server_epoch">
<code class="sig-prename descclassname">evennia.utils.gametime.</code><code class="sig-name descname">server_epoch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#server_epoch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.server_epoch" title="Permalink to this definition"></a></dt>
<dd><p>Get the server epoch. We may need to calculate this on the fly.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.gametime.uptime">
<code class="sig-prename descclassname">evennia.utils.gametime.</code><code class="sig-name descname">uptime</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/gametime.html#uptime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.gametime.uptime" title="Permalink to this definition"></a></dt>
<dd><p>Get the current uptime of the server since last reload</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>format</strong> (<em>bool</em><em>, </em><em>optional</em>) Format into time representation.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>The uptime or the same time split up</dt><dd><p>into time units.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>time (float or tuple)</p>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.inlinefuncs">
<span id="evennia-utils-inlinefuncs-module"></span><h2>evennia.utils.inlinefuncs module<a class="headerlink" href="#module-evennia.utils.inlinefuncs" title="Permalink to this headline"></a></h2>
<p>Inline functions (nested form).</p>
<p>This parser accepts nested inlinefunctions on the form</p>
<p><code class="docutils literal notranslate"><span class="pre">`</span>
<span class="pre">$funcname(arg,</span> <span class="pre">arg,</span> <span class="pre">...)</span>
<span class="pre">`</span></code></p>
<p>embedded in any text where any arg can be another $funcname{} call.
This functionality is turned off by default - to activate,
<cite>settings.INLINEFUNC_ENABLED</cite> must be set to <cite>True</cite>.</p>
<p>Each token starts with “$funcname(” where there must be no space
between the $funcname and (. It ends with a matched ending parentesis.
“)”.</p>
<p>Inside the inlinefunc definition, one can use <cite>` to escape. This is
mainly needed for escaping commas in flowing text (which would
otherwise be interpreted as an argument separator), or to escape `}</cite>
when not intended to close the function block. Enclosing text in
matched <cite>“””</cite> (triple quotes) or <cite></cite> (triple single-quotes) will
also escape <em>everything</em> within without needing to escape individual
characters.</p>
<p>The available inlinefuncs are defined as global-level functions in
modules defined by <cite>settings.INLINEFUNC_MODULES</cite>. They are identified
by their function name (and ignored if this name starts with <cite>_</cite>). They
should be on the following form:</p>
<p><a href="#id169"><span class="problematic" id="id170">``</span></a><a href="#id171"><span class="problematic" id="id172">`</span></a>python
def funcname (<a href="#id173"><span class="problematic" id="id174">*</span></a>args, <a href="#id175"><span class="problematic" id="id176">**</span></a>kwargs):</p>
<blockquote>
<div><p># …</p>
</div></blockquote>
<p><a href="#id177"><span class="problematic" id="id178">``</span></a><a href="#id179"><span class="problematic" id="id180">`</span></a></p>
<p>Here, the arguments given to <cite>$funcname(arg1,arg2)</cite> will appear as the
<cite>*args</cite> tuple. This will be populated by the arguments given to the
inlinefunc in-game - the only part that will be available from
in-game. <cite>**kwargs</cite> are not supported from in-game but are only used
internally by Evennia to make details about the caller available to
the function. The kwarg passed to all functions is <cite>session</cite>, the
Sessionobject for the object seeing the string. This may be <cite>None</cite> if
the string is sent to a non-puppetable object. The inlinefunc should
never raise an exception.</p>
<p>There are two reserved function names:
- “nomatch”: This is called if the user uses a functionname that is</p>
<blockquote>
<div><p>not registered. The nomatch function will get the name of the
not-found function as its first argument followed by the normal
arguments to the given function. If not defined the default effect is
to print <cite>&lt;UNKNOWN&gt;</cite> to replace the unknown function.</p>
</div></blockquote>
<ul class="simple">
<li><p>“stackfull”: This is called when the maximum nested function stack is reached.
When this happens, the original parsed string is returned and the result of
the <cite>stackfull</cite> inlinefunc is appended to the end. By default this is an
error message.</p></li>
</ul>
<dl class="simple">
<dt>Error handling:</dt><dd><p>Syntax errors, notably not completely closing all inlinefunc
blocks, will lead to the entire string remaining unparsed.</p>
</dd>
</dl>
<dl class="exception">
<dt id="evennia.utils.inlinefuncs.InlinefuncError">
<em class="property">exception </em><code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">InlinefuncError</code><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#InlinefuncError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.InlinefuncError" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">RuntimeError</span></code></p>
</dd></dl>
<dl class="exception">
<dt id="evennia.utils.inlinefuncs.NickTemplateInvalid">
<em class="property">exception </em><code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">NickTemplateInvalid</code><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#NickTemplateInvalid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.NickTemplateInvalid" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">ValueError</span></code></p>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.inlinefuncs.ParseStack">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">ParseStack</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#ParseStack"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.ParseStack" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></p>
<p>Custom stack that always concatenates strings together when the
strings are added next to one another. Tuples are stored
separately and None is used to mark that a string should be broken
up into a new chunk. Below is the resulting stack after separately
appending 3 strings, None, 2 strings, a tuple and finally 2
strings:</p>
<p>[string + string + string,
None
string + string,
tuple,
string + string]</p>
<dl class="method">
<dt id="evennia.utils.inlinefuncs.ParseStack.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#ParseStack.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.ParseStack.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.inlinefuncs.ParseStack.append">
<code class="sig-name descname">append</code><span class="sig-paren">(</span><em class="sig-param">item</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#ParseStack.append"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.ParseStack.append" title="Permalink to this definition"></a></dt>
<dd><p>The stack will merge strings, add other things as normal</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.inlinefuncs.clr">
<code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">clr</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#clr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.clr" title="Permalink to this definition"></a></dt>
<dd><p>Inlinefunc. Colorizes nested text.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>startclr</strong> (<em>str</em><em>, </em><em>optional</em>) An ANSI color abbreviation without the
prefix <cite>|</cite>, such as <cite>r</cite> (red foreground) or <cite>[r</cite> (red background).</p></li>
<li><p><strong>text</strong> (<em>str</em><em>, </em><em>optional</em>) Text</p></li>
<li><p><strong>endclr</strong> (<em>str</em><em>, </em><em>optional</em>) The color to use at the end of the string. Defaults
to <cite>|n</cite> (reset-color).</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>session (Session): Session object triggering inlinefunc.</p>
</dd>
</dl>
<p class="rubric">Example</p>
<p><cite>$clr(startclr, text, endclr)</cite></p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.inlinefuncs.crop">
<code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">crop</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#crop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.crop" title="Permalink to this definition"></a></dt>
<dd><p>Inlinefunc. Crops ingoing text to given widths.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em><em>, </em><em>optional</em>) Text to crop.</p></li>
<li><p><strong>width</strong> (<em>str</em><em>, </em><em>optional</em>) Will be converted to an integer. Width of
crop in characters.</p></li>
<li><p><strong>suffix</strong> (<em>str</em><em>, </em><em>optional</em>) End string to mark the fact that a part
of the string was cropped. Defaults to <cite>[…]</cite>.</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>session (Session): Session performing the crop.</p>
</dd>
</dl>
<p class="rubric">Example</p>
<p><cite>$crop(text, width=78, suffix=[…])</cite></p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.inlinefuncs.initialize_nick_templates">
<code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">initialize_nick_templates</code><span class="sig-paren">(</span><em class="sig-param">in_template</em>, <em class="sig-param">out_template</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#initialize_nick_templates"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.initialize_nick_templates" title="Permalink to this definition"></a></dt>
<dd><p>Initialize the nick templates for matching and remapping a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>in_template</strong> (<em>str</em>) The template to be used for nick recognition.</p></li>
<li><p><strong>out_template</strong> (<em>str</em>) The template to be used to replace the string
matched by the in_template.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>Regex to match against strings
template (str): Template with markers {arg1}, {arg2}, etc for</p>
<blockquote>
<div><p>replacement using the standard .format method.</p>
</div></blockquote>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>regex (regex)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.typeclasses.html#evennia.typeclasses.attributes.NickTemplateInvalid" title="evennia.typeclasses.attributes.NickTemplateInvalid"><strong>NickTemplateInvalid</strong></a> If the in/out template does not have a matching
number of $args.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.inlinefuncs.nomatch">
<code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">nomatch</code><span class="sig-paren">(</span><em class="sig-param">name</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#nomatch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.nomatch" title="Permalink to this definition"></a></dt>
<dd><p>Default implementation of nomatch returns the function as-is as a string.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.inlinefuncs.null">
<code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">null</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#null"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.null" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.inlinefuncs.pad">
<code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">pad</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#pad"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.pad" title="Permalink to this definition"></a></dt>
<dd><p>Inlinefunc. Pads text to given width.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em><em>, </em><em>optional</em>) Text to pad.</p></li>
<li><p><strong>width</strong> (<em>str</em><em>, </em><em>optional</em>) Will be converted to integer. Width
of padding.</p></li>
<li><p><strong>align</strong> (<em>str</em><em>, </em><em>optional</em>) Alignment of padding; one of c, l or r.</p></li>
<li><p><strong>fillchar</strong> (<em>str</em><em>, </em><em>optional</em>) Character used for padding. Defaults to a space.</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>session (Session): Session performing the pad.</p>
</dd>
</dl>
<p class="rubric">Example</p>
<p><cite>$pad(text, width, align, fillchar)</cite></p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.inlinefuncs.parse_inlinefunc">
<code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">parse_inlinefunc</code><span class="sig-paren">(</span><em class="sig-param">string</em>, <em class="sig-param">strip=False</em>, <em class="sig-param">available_funcs=None</em>, <em class="sig-param">stacktrace=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#parse_inlinefunc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.parse_inlinefunc" title="Permalink to this definition"></a></dt>
<dd><p>Parse the incoming string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> (<em>str</em>) The incoming string to parse.</p></li>
<li><p><strong>strip</strong> (<em>bool</em><em>, </em><em>optional</em>) Whether to strip function calls rather than
execute them.</p></li>
<li><p><strong>available_funcs</strong> (<em>dict</em><em>, </em><em>optional</em>) Define an alternative source of functions to parse for.
If unset, use the functions found through <cite>settings.INLINEFUNC_MODULES</cite>.</p></li>
<li><p><strong>stacktrace</strong> (<em>bool</em><em>, </em><em>optional</em>) If set, print the stacktrace to log.</p></li>
</ul>
</dd>
</dl>
<dl>
<dt>Kwargs:</dt><dd><dl class="simple">
<dt>session (Session): This is sent to this function by Evennia when triggering</dt><dd><p>it. It is passed to the inlinefunc.</p>
</dd>
</dl>
<p>kwargs (any): All other kwargs are also passed on to the inlinefunc.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.inlinefuncs.parse_nick_template">
<code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">parse_nick_template</code><span class="sig-paren">(</span><em class="sig-param">string</em>, <em class="sig-param">template_regex</em>, <em class="sig-param">outtemplate</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#parse_nick_template"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.parse_nick_template" title="Permalink to this definition"></a></dt>
<dd><p>Parse a text using a template and map it to another template</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> (<em>str</em>) The input string to processj</p></li>
<li><p><strong>template_regex</strong> (<em>regex</em>) A template regex created with
initialize_nick_template.</p></li>
<li><p><strong>outtemplate</strong> (<em>str</em>) The template to which to map the matches
produced by the template_regex. This should have $1, $2,
etc to match the regex.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.inlinefuncs.space">
<code class="sig-prename descclassname">evennia.utils.inlinefuncs.</code><code class="sig-name descname">space</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/inlinefuncs.html#space"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.inlinefuncs.space" title="Permalink to this definition"></a></dt>
<dd><p>Inlinefunc. Inserts an arbitrary number of spaces. Defaults to 4 spaces.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>spaces</strong> (<em>int</em><em>, </em><em>optional</em>) The number of spaces to insert.</p>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>session (Session): Session performing the crop.</p>
</dd>
</dl>
<p class="rubric">Example</p>
<p><cite>$space(20)</cite></p>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.logger">
<span id="evennia-utils-logger-module"></span><h2>evennia.utils.logger module<a class="headerlink" href="#module-evennia.utils.logger" title="Permalink to this headline"></a></h2>
<p>Logging facilities</p>
<p>These are thin wrappers on top of Twisteds logging facilities; logs
are all directed either to stdout (if Evennia is running in
interactive mode) or to $GAME_DIR/server/logs.</p>
<p>The log_file() function uses its own threading system to log to
arbitrary files in $GAME_DIR/server/logs.</p>
<p>Note: All logging functions have two aliases, log_type() and
log_typemsg(). This is for historical, back-compatible reasons.</p>
<dl class="class">
<dt id="evennia.utils.logger.EvenniaLogFile">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">EvenniaLogFile</code><span class="sig-paren">(</span><em class="sig-param">name</em>, <em class="sig-param">directory</em>, <em class="sig-param">rotateLength=1000000</em>, <em class="sig-param">defaultMode=None</em>, <em class="sig-param">maxRotatedFiles=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#EvenniaLogFile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">twisted.python.logfile.LogFile</span></code></p>
<p>A rotating logfile based off Twisteds LogFile. It overrides
the LogFiles rotate method in order to append some of the last
lines of the previous log to the start of the new log, in order
to preserve a continuous chat history for channel log files.</p>
<dl class="attribute">
<dt id="evennia.utils.logger.EvenniaLogFile.num_lines_to_append">
<code class="sig-name descname">num_lines_to_append</code><em class="property"> = 20</em><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile.num_lines_to_append" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.logger.EvenniaLogFile.readlines">
<code class="sig-name descname">readlines</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#EvenniaLogFile.readlines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile.readlines" title="Permalink to this definition"></a></dt>
<dd><p>Convenience method for accessing our _file attributes readlines method,
which is used in tail_log_function.
:param *args: same args as file.readlines
:param **kwargs: same kwargs as file.readlines</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>lines from our _file attribute.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>lines (list)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.logger.EvenniaLogFile.rotate">
<code class="sig-name descname">rotate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#EvenniaLogFile.rotate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile.rotate" title="Permalink to this definition"></a></dt>
<dd><p>Rotates our log file and appends some number of lines from
the previous log to the start of the new one.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.logger.EvenniaLogFile.seek">
<code class="sig-name descname">seek</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#EvenniaLogFile.seek"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile.seek" title="Permalink to this definition"></a></dt>
<dd><p>Convenience method for accessing our _file attributes seek method,
which is used in tail_log_function.
:param *args: Same args as file.seek
:param **kwargs: Same kwargs as file.seek</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.logger.EvenniaLogFile.settings">
<code class="sig-name descname">settings</code><em class="property"> = &lt;LazySettings &quot;server.conf.settings&quot;&gt;</em><a class="headerlink" href="#evennia.utils.logger.EvenniaLogFile.settings" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.logger.PortalLogObserver">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">PortalLogObserver</code><span class="sig-paren">(</span><em class="sig-param">f</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#PortalLogObserver"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.PortalLogObserver" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">twisted.python.log.FileLogObserver</span></code></p>
<p>Reformat logging</p>
<dl class="method">
<dt id="evennia.utils.logger.PortalLogObserver.emit">
<code class="sig-name descname">emit</code><span class="sig-paren">(</span><em class="sig-param">eventDict</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#PortalLogObserver.emit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.PortalLogObserver.emit" title="Permalink to this definition"></a></dt>
<dd><p>Copied from Twisted parent, to change logging output</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.logger.PortalLogObserver.prefix">
<code class="sig-name descname">prefix</code><em class="property"> = ' |Portal| '</em><a class="headerlink" href="#evennia.utils.logger.PortalLogObserver.prefix" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.logger.PortalLogObserver.timeFormat">
<code class="sig-name descname">timeFormat</code><em class="property"> = None</em><a class="headerlink" href="#evennia.utils.logger.PortalLogObserver.timeFormat" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.logger.ServerLogObserver">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">ServerLogObserver</code><span class="sig-paren">(</span><em class="sig-param">f</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#ServerLogObserver"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.ServerLogObserver" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.logger.PortalLogObserver" title="evennia.utils.logger.PortalLogObserver"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.logger.PortalLogObserver</span></code></a></p>
<dl class="attribute">
<dt id="evennia.utils.logger.ServerLogObserver.prefix">
<code class="sig-name descname">prefix</code><em class="property"> = ' '</em><a class="headerlink" href="#evennia.utils.logger.ServerLogObserver.prefix" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.logger.WeeklyLogFile">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">WeeklyLogFile</code><span class="sig-paren">(</span><em class="sig-param">name</em>, <em class="sig-param">directory</em>, <em class="sig-param">defaultMode=None</em>, <em class="sig-param">day_rotation=7</em>, <em class="sig-param">max_size=1000000</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.WeeklyLogFile" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">twisted.python.logfile.DailyLogFile</span></code></p>
<p>Log file that rotates once per week by default. Overrides key methods to change format.</p>
<dl class="method">
<dt id="evennia.utils.logger.WeeklyLogFile.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">name</em>, <em class="sig-param">directory</em>, <em class="sig-param">defaultMode=None</em>, <em class="sig-param">day_rotation=7</em>, <em class="sig-param">max_size=1000000</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.WeeklyLogFile.__init__" title="Permalink to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<em>str</em>) Name of log file.</p></li>
<li><p><strong>directory</strong> (<em>str</em>) Directory holding the file.</p></li>
<li><p><strong>defaultMode</strong> (<em>str</em>) Permissions used to create file. Defaults to
current permissions of this file if it exists.</p></li>
<li><p><strong>day_rotation</strong> (<em>int</em>) How often to rotate the file.</p></li>
<li><p><strong>max_size</strong> (<em>int</em>) Max size of log file before rotation (regardless of
time). Defaults to 1M.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.logger.WeeklyLogFile._openFile">
<code class="sig-name descname">_openFile</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile._openFile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.WeeklyLogFile._openFile" title="Permalink to this definition"></a></dt>
<dd><p>Open the log file.</p>
<p>The log file is always opened in binary mode.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.logger.WeeklyLogFile.shouldRotate">
<code class="sig-name descname">shouldRotate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile.shouldRotate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.WeeklyLogFile.shouldRotate" title="Permalink to this definition"></a></dt>
<dd><p>Rotate when the date has changed since last write</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.logger.WeeklyLogFile.suffix">
<code class="sig-name descname">suffix</code><span class="sig-paren">(</span><em class="sig-param">tupledate</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile.suffix"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.WeeklyLogFile.suffix" title="Permalink to this definition"></a></dt>
<dd><p>Return the suffix given a (year, month, day) tuple or unixtime.
Format changed to have 03 for march instead of 3 etc (retaining unix
file order)</p>
<p>If we get duplicate suffixes in location (due to hitting size limit),
we append __1, __2 etc.</p>
<p class="rubric">Examples</p>
<p>server.log.2020_01_29
server.log.2020_01_29__1
server.log.2020_01_29__2</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.logger.WeeklyLogFile.write">
<code class="sig-name descname">write</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#WeeklyLogFile.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.WeeklyLogFile.write" title="Permalink to this definition"></a></dt>
<dd><p>Write data to log file</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger._open_log_file">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">_open_log_file</code><span class="sig-paren">(</span><em class="sig-param">filename</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#_open_log_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger._open_log_file" title="Permalink to this definition"></a></dt>
<dd><p>Helper to open the log file (always in the log dir) and cache its
handle. Will create a new file in the log dir if one didnt
exist.</p>
<p>To avoid keeping the filehandle open indefinitely we reset it every
_LOG_FILE_HANDLE_RESET accesses. This may help resolve issues for very
long uptimes and heavy log use.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_dep">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_dep</code><span class="sig-paren">(</span><em class="sig-param">depmsg</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_dep"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_dep" title="Permalink to this definition"></a></dt>
<dd><p>Prints a deprecation message.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>depmsg</strong> (<em>str</em>) The deprecation message to log.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_depmsg">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_depmsg</code><span class="sig-paren">(</span><em class="sig-param">depmsg</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.log_depmsg" title="Permalink to this definition"></a></dt>
<dd><p>Prints a deprecation message.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>depmsg</strong> (<em>str</em>) The deprecation message to log.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_err">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_err</code><span class="sig-paren">(</span><em class="sig-param">errmsg</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_err"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_err" title="Permalink to this definition"></a></dt>
<dd><p>Prints/logs an error message to the server log.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>errmsg</strong> (<em>str</em>) The message to be logged.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_errmsg">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_errmsg</code><span class="sig-paren">(</span><em class="sig-param">errmsg</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.log_errmsg" title="Permalink to this definition"></a></dt>
<dd><p>Prints/logs an error message to the server log.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>errmsg</strong> (<em>str</em>) The message to be logged.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_file">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_file</code><span class="sig-paren">(</span><em class="sig-param">msg</em>, <em class="sig-param">filename='game.log'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_file" title="Permalink to this definition"></a></dt>
<dd><p>Arbitrary file logger using threads.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>msg</strong> (<em>str</em>) String to append to logfile.</p></li>
<li><p><strong>filename</strong> (<em>str</em><em>, </em><em>optional</em>) Defaults to game.log. All logs
will appear in the logs directory and log entries will start
on new lines following datetime info.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_info">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_info</code><span class="sig-paren">(</span><em class="sig-param">infomsg</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_info" title="Permalink to this definition"></a></dt>
<dd><p>Prints any generic debugging/informative info that should appear in the log.</p>
<p>infomsg: (string) The message to be logged.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_infomsg">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_infomsg</code><span class="sig-paren">(</span><em class="sig-param">infomsg</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.log_infomsg" title="Permalink to this definition"></a></dt>
<dd><p>Prints any generic debugging/informative info that should appear in the log.</p>
<p>infomsg: (string) The message to be logged.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_msg">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_msg</code><span class="sig-paren">(</span><em class="sig-param">msg</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_msg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_msg" title="Permalink to this definition"></a></dt>
<dd><p>Wrapper around log.msg call to catch any exceptions that might
occur in logging. If an exception is raised, well print to
stdout instead.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>msg</strong> The message that was passed to log.msg</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_sec">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_sec</code><span class="sig-paren">(</span><em class="sig-param">secmsg</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_sec"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_sec" title="Permalink to this definition"></a></dt>
<dd><p>Prints a security-related message.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>secmsg</strong> (<em>str</em>) The security message to log.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_secmsg">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_secmsg</code><span class="sig-paren">(</span><em class="sig-param">secmsg</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.log_secmsg" title="Permalink to this definition"></a></dt>
<dd><p>Prints a security-related message.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>secmsg</strong> (<em>str</em>) The security message to log.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_server">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_server</code><span class="sig-paren">(</span><em class="sig-param">servermsg</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_server"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_server" title="Permalink to this definition"></a></dt>
<dd><p>This is for the Portal to log captured Server stdout messages (its
usually only used during startup, before Server log is open)</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_trace">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_trace</code><span class="sig-paren">(</span><em class="sig-param">errmsg=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_trace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_trace" title="Permalink to this definition"></a></dt>
<dd><p>Log a traceback to the log. This should be called from within an
exception.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>errmsg</strong> (<em>str</em><em>, </em><em>optional</em>) Adds an extra line with added info
at the end of the traceback in the log.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_tracemsg">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_tracemsg</code><span class="sig-paren">(</span><em class="sig-param">errmsg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.log_tracemsg" title="Permalink to this definition"></a></dt>
<dd><p>Log a traceback to the log. This should be called from within an
exception.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>errmsg</strong> (<em>str</em><em>, </em><em>optional</em>) Adds an extra line with added info
at the end of the traceback in the log.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_warn">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_warn</code><span class="sig-paren">(</span><em class="sig-param">warnmsg</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#log_warn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.log_warn" title="Permalink to this definition"></a></dt>
<dd><p>Prints/logs any warnings that arent critical but should be noted.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>warnmsg</strong> (<em>str</em>) The message to be logged.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.log_warnmsg">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">log_warnmsg</code><span class="sig-paren">(</span><em class="sig-param">warnmsg</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.logger.log_warnmsg" title="Permalink to this definition"></a></dt>
<dd><p>Prints/logs any warnings that arent critical but should be noted.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>warnmsg</strong> (<em>str</em>) The message to be logged.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.tail_log_file">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">tail_log_file</code><span class="sig-paren">(</span><em class="sig-param">filename</em>, <em class="sig-param">offset</em>, <em class="sig-param">nlines</em>, <em class="sig-param">callback=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#tail_log_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.tail_log_file" title="Permalink to this definition"></a></dt>
<dd><p>Return the tail of the log file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>filename</strong> (<em>str</em>) The name of the log file, presumed to be in
the Evennia log dir.</p></li>
<li><p><strong>offset</strong> (<em>int</em>) The line offset <em>from the end of the file</em> to start
reading from. 0 means to start at the latest entry.</p></li>
<li><p><strong>nlines</strong> (<em>int</em>) How many lines to return, counting backwards
from the offset. If file is shorter, will get all lines.</p></li>
<li><p><strong>callback</strong> (<em>callable</em><em>, </em><em>optional</em>) A function to manage the result of the
asynchronous file access. This will get a list of lines. If unset,
the tail will happen synchronously.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>This will be a deferred if <cite>callable</cite> is given,</dt><dd><p>otherwise it will be a list with The nline entries from the end of the file, or
all if the file is shorter than nlines.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>lines (deferred or list)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.logger.timeformat">
<code class="sig-prename descclassname">evennia.utils.logger.</code><code class="sig-name descname">timeformat</code><span class="sig-paren">(</span><em class="sig-param">when=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/logger.html#timeformat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.logger.timeformat" title="Permalink to this definition"></a></dt>
<dd><p>This helper function will format the current time in the same
way as the twisted logger does, including time zone info. Only
difference from official logger is that we only use two digits
for the year and dont show timezone for CET times.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>when</strong> (<em>int</em><em>, </em><em>optional</em>) This is a time in POSIX seconds on the form
given by time.time(). If not given, this function will
use the current time.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A formatted string of the given time.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>timestring (str)</p>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.optionclasses">
<span id="evennia-utils-optionclasses-module"></span><h2>evennia.utils.optionclasses module<a class="headerlink" href="#module-evennia.utils.optionclasses" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="evennia.utils.optionclasses.BaseOption">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">BaseOption</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#BaseOption"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Abstract Class to deal with encapsulating individual Options. An Option has
a name/key, a description to display in relevant commands and menus, and a
default value. It saves to the owners Attributes using its Handlers save
category.</p>
<p>Designed to be extremely overloadable as some options can be cantankerous.</p>
<dl class="simple">
<dt>Properties:</dt><dd><p>valid: Shortcut to the loaded VALID_HANDLER.
validator_key (str): The key of the Validator this uses.</p>
</dd>
</dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.BaseOption.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#BaseOption.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption.__init__" title="Permalink to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>handler</strong> (<a class="reference internal" href="#evennia.utils.optionhandler.OptionHandler" title="evennia.utils.optionhandler.OptionHandler"><em>OptionHandler</em></a>) The OptionHandler that owns this Option.</p></li>
<li><p><strong>key</strong> (<em>str</em>) The name this will be used for storage in a dictionary.
Must be unique per OptionHandler.</p></li>
<li><p><strong>description</strong> (<em>str</em>) What this Options text will show in commands and menus.</p></li>
<li><p><strong>default</strong> A default value for this Option.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.BaseOption.changed">
<em class="property">property </em><code class="sig-name descname">changed</code><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption.changed" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.BaseOption.default">
<em class="property">property </em><code class="sig-name descname">default</code><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption.default" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.BaseOption.deserialize">
<code class="sig-name descname">deserialize</code><span class="sig-paren">(</span><em class="sig-param">save_data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#BaseOption.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Perform sanity-checking on the save data as it is loaded from storage.
This isnt the same as what validator-functions provide (those work on
user input). For example, save data might be a timedelta or a list or
some other object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>save_data</strong> The data to check.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Whatever the Option needs to track, like a string or a</dt><dd><p>datetime. The display hook is responsible for what is actually
displayed to user.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.BaseOption.display">
<code class="sig-name descname">display</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#BaseOption.display"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption.display" title="Permalink to this definition"></a></dt>
<dd><p>Renders the Options value as something pretty to look at.</p>
<dl class="simple">
<dt>Kwargs:</dt><dd><dl class="simple">
<dt>any (any): These are options passed by the caller to potentially</dt><dd><p>customize display dynamically.</p>
</dd>
</dl>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><dl class="simple">
<dt>How the stored value should be projected to users (e.g. a raw</dt><dd><p>timedelta is pretty ugly).</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>str</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.BaseOption.load">
<code class="sig-name descname">load</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#BaseOption.load"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption.load" title="Permalink to this definition"></a></dt>
<dd><p>Takes the provided save data, validates it, and gets this Option ready to use.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Whether loading was successful.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#evennia.utils.optionclasses.Boolean" title="evennia.utils.optionclasses.Boolean">Boolean</a></p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.BaseOption.save">
<code class="sig-name descname">save</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#BaseOption.save"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption.save" title="Permalink to this definition"></a></dt>
<dd><p>Stores the current value using .handler.save_handler(self.key, value, <a href="#id181"><span class="problematic" id="id182">**</span></a>kwargs)
where kwargs are a combination of those passed into this function and the
ones specified by the OptionHandler.</p>
<dl class="simple">
<dt>Kwargs:</dt><dd><dl class="simple">
<dt>any (any): Not used by default. These are passed in from self.set</dt><dd><p>and allows the option to let the caller customize saving by
overriding or extend the default save kwargs</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.BaseOption.serialize">
<code class="sig-name descname">serialize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#BaseOption.serialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption.serialize" title="Permalink to this definition"></a></dt>
<dd><p>Serializes the save data for Attribute storage.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Whatever is best for storage.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.BaseOption.set">
<code class="sig-name descname">set</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#BaseOption.set"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption.set" title="Permalink to this definition"></a></dt>
<dd><p>Takes user input and stores appropriately. This method allows for
passing extra instructions into the validator.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) The new value of this Option.</p></li>
<li><p><strong>kwargs</strong> (<em>any</em>) Any kwargs will be passed into
<cite>self.validate(value, **kwargs)</cite> and <cite>self.save(**kwargs)</cite>.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.BaseOption.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#BaseOption.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.BaseOption.value">
<em class="property">property </em><code class="sig-name descname">value</code><a class="headerlink" href="#evennia.utils.optionclasses.BaseOption.value" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.Boolean">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">Boolean</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Boolean"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Boolean" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.BaseOption" title="evennia.utils.optionclasses.BaseOption"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.BaseOption</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.Boolean.deserialize">
<code class="sig-name descname">deserialize</code><span class="sig-paren">(</span><em class="sig-param">save_data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Boolean.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Boolean.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Perform sanity-checking on the save data as it is loaded from storage.
This isnt the same as what validator-functions provide (those work on
user input). For example, save data might be a timedelta or a list or
some other object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>save_data</strong> The data to check.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Whatever the Option needs to track, like a string or a</dt><dd><p>datetime. The display hook is responsible for what is actually
displayed to user.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Boolean.display">
<code class="sig-name descname">display</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Boolean.display"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Boolean.display" title="Permalink to this definition"></a></dt>
<dd><p>Renders the Options value as something pretty to look at.</p>
<dl class="simple">
<dt>Kwargs:</dt><dd><dl class="simple">
<dt>any (any): These are options passed by the caller to potentially</dt><dd><p>customize display dynamically.</p>
</dd>
</dl>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><dl class="simple">
<dt>How the stored value should be projected to users (e.g. a raw</dt><dd><p>timedelta is pretty ugly).</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>str</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Boolean.serialize">
<code class="sig-name descname">serialize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Boolean.serialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Boolean.serialize" title="Permalink to this definition"></a></dt>
<dd><p>Serializes the save data for Attribute storage.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Whatever is best for storage.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Boolean.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Boolean.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Boolean.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.Color">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">Color</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Color"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Color" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.BaseOption" title="evennia.utils.optionclasses.BaseOption"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.BaseOption</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.Color.deserialize">
<code class="sig-name descname">deserialize</code><span class="sig-paren">(</span><em class="sig-param">save_data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Color.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Color.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Perform sanity-checking on the save data as it is loaded from storage.
This isnt the same as what validator-functions provide (those work on
user input). For example, save data might be a timedelta or a list or
some other object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>save_data</strong> The data to check.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Whatever the Option needs to track, like a string or a</dt><dd><p>datetime. The display hook is responsible for what is actually
displayed to user.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Color.display">
<code class="sig-name descname">display</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Color.display"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Color.display" title="Permalink to this definition"></a></dt>
<dd><p>Renders the Options value as something pretty to look at.</p>
<dl class="simple">
<dt>Kwargs:</dt><dd><dl class="simple">
<dt>any (any): These are options passed by the caller to potentially</dt><dd><p>customize display dynamically.</p>
</dd>
</dl>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><dl class="simple">
<dt>How the stored value should be projected to users (e.g. a raw</dt><dd><p>timedelta is pretty ugly).</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>str</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Color.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Color.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Color.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.Datetime">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">Datetime</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Datetime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Datetime" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.BaseOption" title="evennia.utils.optionclasses.BaseOption"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.BaseOption</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.Datetime.deserialize">
<code class="sig-name descname">deserialize</code><span class="sig-paren">(</span><em class="sig-param">save_data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Datetime.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Datetime.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Perform sanity-checking on the save data as it is loaded from storage.
This isnt the same as what validator-functions provide (those work on
user input). For example, save data might be a timedelta or a list or
some other object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>save_data</strong> The data to check.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Whatever the Option needs to track, like a string or a</dt><dd><p>datetime. The display hook is responsible for what is actually
displayed to user.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Datetime.serialize">
<code class="sig-name descname">serialize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Datetime.serialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Datetime.serialize" title="Permalink to this definition"></a></dt>
<dd><p>Serializes the save data for Attribute storage.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Whatever is best for storage.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Datetime.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Datetime.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Datetime.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.Duration">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">Duration</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Duration"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Duration" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.BaseOption" title="evennia.utils.optionclasses.BaseOption"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.BaseOption</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.Duration.deserialize">
<code class="sig-name descname">deserialize</code><span class="sig-paren">(</span><em class="sig-param">save_data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Duration.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Duration.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Perform sanity-checking on the save data as it is loaded from storage.
This isnt the same as what validator-functions provide (those work on
user input). For example, save data might be a timedelta or a list or
some other object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>save_data</strong> The data to check.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Whatever the Option needs to track, like a string or a</dt><dd><p>datetime. The display hook is responsible for what is actually
displayed to user.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Duration.serialize">
<code class="sig-name descname">serialize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Duration.serialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Duration.serialize" title="Permalink to this definition"></a></dt>
<dd><p>Serializes the save data for Attribute storage.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Whatever is best for storage.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Duration.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Duration.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Duration.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.Email">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">Email</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Email"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Email" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.BaseOption" title="evennia.utils.optionclasses.BaseOption"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.BaseOption</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.Email.deserialize">
<code class="sig-name descname">deserialize</code><span class="sig-paren">(</span><em class="sig-param">save_data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Email.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Email.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Perform sanity-checking on the save data as it is loaded from storage.
This isnt the same as what validator-functions provide (those work on
user input). For example, save data might be a timedelta or a list or
some other object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>save_data</strong> The data to check.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Whatever the Option needs to track, like a string or a</dt><dd><p>datetime. The display hook is responsible for what is actually
displayed to user.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Email.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Email.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Email.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.Future">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">Future</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Future" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.Datetime" title="evennia.utils.optionclasses.Datetime"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.Datetime</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.Future.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Future.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Future.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.Lock">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">Lock</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Lock"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Lock" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.Text" title="evennia.utils.optionclasses.Text"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.Text</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.Lock.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Lock.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Lock.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.PositiveInteger">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">PositiveInteger</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#PositiveInteger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.PositiveInteger" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.BaseOption" title="evennia.utils.optionclasses.BaseOption"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.BaseOption</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.PositiveInteger.deserialize">
<code class="sig-name descname">deserialize</code><span class="sig-paren">(</span><em class="sig-param">save_data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#PositiveInteger.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.PositiveInteger.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Perform sanity-checking on the save data as it is loaded from storage.
This isnt the same as what validator-functions provide (those work on
user input). For example, save data might be a timedelta or a list or
some other object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>save_data</strong> The data to check.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Whatever the Option needs to track, like a string or a</dt><dd><p>datetime. The display hook is responsible for what is actually
displayed to user.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.PositiveInteger.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#PositiveInteger.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.PositiveInteger.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.SignedInteger">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">SignedInteger</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#SignedInteger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.SignedInteger" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.BaseOption" title="evennia.utils.optionclasses.BaseOption"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.BaseOption</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.SignedInteger.deserialize">
<code class="sig-name descname">deserialize</code><span class="sig-paren">(</span><em class="sig-param">save_data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#SignedInteger.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.SignedInteger.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Perform sanity-checking on the save data as it is loaded from storage.
This isnt the same as what validator-functions provide (those work on
user input). For example, save data might be a timedelta or a list or
some other object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>save_data</strong> The data to check.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Whatever the Option needs to track, like a string or a</dt><dd><p>datetime. The display hook is responsible for what is actually
displayed to user.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.SignedInteger.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#SignedInteger.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.SignedInteger.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.Text">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">Text</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Text"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Text" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.BaseOption" title="evennia.utils.optionclasses.BaseOption"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.BaseOption</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.Text.deserialize">
<code class="sig-name descname">deserialize</code><span class="sig-paren">(</span><em class="sig-param">save_data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Text.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Text.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Perform sanity-checking on the save data as it is loaded from storage.
This isnt the same as what validator-functions provide (those work on
user input). For example, save data might be a timedelta or a list or
some other object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>save_data</strong> The data to check.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Whatever the Option needs to track, like a string or a</dt><dd><p>datetime. The display hook is responsible for what is actually
displayed to user.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.Timezone">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">Timezone</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Timezone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Timezone" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.BaseOption" title="evennia.utils.optionclasses.BaseOption"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.BaseOption</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.Timezone.default">
<em class="property">property </em><code class="sig-name descname">default</code><a class="headerlink" href="#evennia.utils.optionclasses.Timezone.default" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Timezone.deserialize">
<code class="sig-name descname">deserialize</code><span class="sig-paren">(</span><em class="sig-param">save_data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Timezone.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Timezone.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Perform sanity-checking on the save data as it is loaded from storage.
This isnt the same as what validator-functions provide (those work on
user input). For example, save data might be a timedelta or a list or
some other object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>save_data</strong> The data to check.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Whatever the Option needs to track, like a string or a</dt><dd><p>datetime. The display hook is responsible for what is actually
displayed to user.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Timezone.serialize">
<code class="sig-name descname">serialize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Timezone.serialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Timezone.serialize" title="Permalink to this definition"></a></dt>
<dd><p>Serializes the save data for Attribute storage.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Whatever is best for storage.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.Timezone.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#Timezone.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.Timezone.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionclasses.UnsignedInteger">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionclasses.</code><code class="sig-name descname">UnsignedInteger</code><span class="sig-paren">(</span><em class="sig-param">handler</em>, <em class="sig-param">key</em>, <em class="sig-param">description</em>, <em class="sig-param">default</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#UnsignedInteger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.UnsignedInteger" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.optionclasses.BaseOption" title="evennia.utils.optionclasses.BaseOption"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.optionclasses.BaseOption</span></code></a></p>
<dl class="method">
<dt id="evennia.utils.optionclasses.UnsignedInteger.deserialize">
<code class="sig-name descname">deserialize</code><span class="sig-paren">(</span><em class="sig-param">save_data</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#UnsignedInteger.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.UnsignedInteger.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Perform sanity-checking on the save data as it is loaded from storage.
This isnt the same as what validator-functions provide (those work on
user input). For example, save data might be a timedelta or a list or
some other object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>save_data</strong> The data to check.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Whatever the Option needs to track, like a string or a</dt><dd><p>datetime. The display hook is responsible for what is actually
displayed to user.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionclasses.UnsignedInteger.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionclasses.html#UnsignedInteger.validate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionclasses.UnsignedInteger.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate user input, which is presumed to be a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>str</em>) User input.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account that is performing the validation.
This is necessary because of other settings which may affect the
check, such as an Accounts timezone affecting how their datetime
entries are processed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The results of the validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>any (any)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="evennia.prototypes.html#evennia.prototypes.prototypes.ValidationError" title="evennia.prototypes.prototypes.ValidationError"><strong>ValidationError</strong></a> If input value failed validation.</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.optionclasses.UnsignedInteger.validator_key">
<code class="sig-name descname">validator_key</code><em class="property"> = 'unsigned_integer'</em><a class="headerlink" href="#evennia.utils.optionclasses.UnsignedInteger.validator_key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.optionhandler">
<span id="evennia-utils-optionhandler-module"></span><h2>evennia.utils.optionhandler module<a class="headerlink" href="#module-evennia.utils.optionhandler" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="evennia.utils.optionhandler.InMemorySaveHandler">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionhandler.</code><code class="sig-name descname">InMemorySaveHandler</code><a class="reference internal" href="../_modules/evennia/utils/optionhandler.html#InMemorySaveHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionhandler.InMemorySaveHandler" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Fallback SaveHandler, implementing a minimum of the required save mechanism
and storing data in memory.</p>
<dl class="method">
<dt id="evennia.utils.optionhandler.InMemorySaveHandler.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionhandler.html#InMemorySaveHandler.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionhandler.InMemorySaveHandler.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionhandler.InMemorySaveHandler.add">
<code class="sig-name descname">add</code><span class="sig-paren">(</span><em class="sig-param">key</em>, <em class="sig-param">value=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionhandler.html#InMemorySaveHandler.add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionhandler.InMemorySaveHandler.add" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.optionhandler.InMemorySaveHandler.get">
<code class="sig-name descname">get</code><span class="sig-paren">(</span><em class="sig-param">key</em>, <em class="sig-param">default=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionhandler.html#InMemorySaveHandler.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionhandler.InMemorySaveHandler.get" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.optionhandler.OptionHandler">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.optionhandler.</code><code class="sig-name descname">OptionHandler</code><span class="sig-paren">(</span><em class="sig-param">obj</em>, <em class="sig-param">options_dict=None</em>, <em class="sig-param">savefunc=None</em>, <em class="sig-param">loadfunc=None</em>, <em class="sig-param">save_kwargs=None</em>, <em class="sig-param">load_kwargs=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionhandler.html#OptionHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionhandler.OptionHandler" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This is a generic Option handler. Retrieve options either as properties on
this handler or by using the .get method.</p>
<p>This is used for Account.options but it could be used by Scripts or Objects
just as easily. All it needs to be provided is an options_dict.</p>
<dl class="method">
<dt id="evennia.utils.optionhandler.OptionHandler.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">obj</em>, <em class="sig-param">options_dict=None</em>, <em class="sig-param">savefunc=None</em>, <em class="sig-param">loadfunc=None</em>, <em class="sig-param">save_kwargs=None</em>, <em class="sig-param">load_kwargs=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionhandler.html#OptionHandler.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionhandler.OptionHandler.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Initialize an OptionHandler.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>obj</strong> (<em>object</em>) The object this handler sits on. This is usually a TypedObject.</p></li>
<li><p><strong>options_dict</strong> (<em>dict</em>) A dictionary of option keys, where the values
are options. The format of those tuples is: (key, “Description to
show”, option_type, &lt;default value&gt;)</p></li>
<li><p><strong>savefunc</strong> (<em>callable</em>) A callable for all options to call when saving itself.
It will be called as <cite>savefunc(key, value, **save_kwargs)</cite>. A common one
to pass would be AttributeHandler.add.</p></li>
<li><p><strong>loadfunc</strong> (<em>callable</em>) A callable for all options to call when loading data into
itself. It will be called as <cite>loadfunc(key, default=default, **load_kwargs)</cite>.
A common one to pass would be AttributeHandler.get.</p></li>
<li><p><strong>save_kwargs</strong> (<em>any</em>) Optional extra kwargs to pass into <cite>savefunc</cite> above.</p></li>
<li><p><strong>load_kwargs</strong> (<em>any</em>) Optional extra kwargs to pass into <cite>loadfunc</cite> above.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Both loadfunc and savefunc must be specified. If only one is given, the other
will be ignored and in-memory storage will be used.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionhandler.OptionHandler._load_option">
<code class="sig-name descname">_load_option</code><span class="sig-paren">(</span><em class="sig-param">key</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionhandler.html#OptionHandler._load_option"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionhandler.OptionHandler._load_option" title="Permalink to this definition"></a></dt>
<dd><p>Loads option on-demand if it has not been loaded yet.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>key</strong> (<em>str</em>) The option being loaded.</p>
</dd>
</dl>
<p>Returns:</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionhandler.OptionHandler.all">
<code class="sig-name descname">all</code><span class="sig-paren">(</span><em class="sig-param">return_objs=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionhandler.html#OptionHandler.all"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionhandler.OptionHandler.all" title="Permalink to this definition"></a></dt>
<dd><p>Get all options defined on this handler.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>return_objs</strong> (<em>bool</em><em>, </em><em>optional</em>) Return the actual Option objects rather
than their values.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>All options on this handler, either <cite>{key: value}</cite></dt><dd><p>or <cite>{key: &lt;Option&gt;}</cite> if <cite>return_objs</cite> is <cite>True</cite>.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>all_options (dict)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionhandler.OptionHandler.get">
<code class="sig-name descname">get</code><span class="sig-paren">(</span><em class="sig-param">key</em>, <em class="sig-param">default=None</em>, <em class="sig-param">return_obj=False</em>, <em class="sig-param">raise_error=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionhandler.html#OptionHandler.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionhandler.OptionHandler.get" title="Permalink to this definition"></a></dt>
<dd><p>Retrieves an Option stored in the handler. Will load it if it doesnt exist.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> (<em>str</em>) The option key to retrieve.</p></li>
<li><p><strong>default</strong> (<em>any</em>) What to return if the option is defined.</p></li>
<li><p><strong>return_obj</strong> (<em>bool</em><em>, </em><em>optional</em>) If True, returns the actual option
object instead of its value.</p></li>
<li><p><strong>raise_error</strong> (<em>bool</em><em>, </em><em>optional</em>) Raise Exception if key is not found in options.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>An option value the Option itself.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>option_value (any or Option)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>KeyError</strong> If option is not defined.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.optionhandler.OptionHandler.set">
<code class="sig-name descname">set</code><span class="sig-paren">(</span><em class="sig-param">key</em>, <em class="sig-param">value</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/optionhandler.html#OptionHandler.set"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.optionhandler.OptionHandler.set" title="Permalink to this definition"></a></dt>
<dd><p>Change an individual option.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> (<em>str</em>) The key of an option that can be changed. Allows partial matching.</p></li>
<li><p><strong>value</strong> (<em>str</em>) The value that should be checked, coerced, and stored.:</p></li>
<li><p><strong>kwargs</strong> (<em>any</em><em>, </em><em>optional</em>) These are passed into the Options validation function,
save function and display function and allows to customize either.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Value stored in option, after validation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>value (any)</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.optionhandler._GA">
<code class="sig-prename descclassname">evennia.utils.optionhandler.</code><code class="sig-name descname">_GA</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.optionhandler._GA" title="Permalink to this definition"></a></dt>
<dd><p>Return getattr(self, name).</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.optionhandler._SA">
<code class="sig-prename descclassname">evennia.utils.optionhandler.</code><code class="sig-name descname">_SA</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.optionhandler._SA" title="Permalink to this definition"></a></dt>
<dd><p>Implement setattr(self, name, value).</p>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.picklefield">
<span id="evennia-utils-picklefield-module"></span><h2>evennia.utils.picklefield module<a class="headerlink" href="#module-evennia.utils.picklefield" title="Permalink to this headline"></a></h2>
<p>Pickle field implementation for Django.</p>
<p>Modified for Evennia by Griatch and the Evennia community.</p>
<dl class="class">
<dt id="evennia.utils.picklefield.PickledFormField">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.picklefield.</code><code class="sig-name descname">PickledFormField</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledFormField"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledFormField" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">django.forms.fields.CharField</span></code></p>
<p>This represents one input field for the form.</p>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledFormField.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledFormField.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledFormField.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledFormField.clean">
<code class="sig-name descname">clean</code><span class="sig-paren">(</span><em class="sig-param">value</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledFormField.clean"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledFormField.clean" title="Permalink to this definition"></a></dt>
<dd><p>Validate the given value and return its “cleaned” value as an
appropriate Python object. Raise ValidationError for any errors.</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.picklefield.PickledFormField.default_error_messages">
<code class="sig-name descname">default_error_messages</code><em class="property"> = {'invalid': 'This is not a Python Literal. You can store things like strings, integers, or floats, but you must do it by typing them as you would type them in the Python Interpreter. For instance, strings must be surrounded by quote marks. We have converted it to a string for your convenience. If it is acceptable, please hit save again.', 'required': 'This field is required.'}</em><a class="headerlink" href="#evennia.utils.picklefield.PickledFormField.default_error_messages" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.picklefield.PickledFormField.widget">
<code class="sig-name descname">widget</code><a class="headerlink" href="#evennia.utils.picklefield.PickledFormField.widget" title="Permalink to this definition"></a></dt>
<dd><p>alias of <a class="reference internal" href="#evennia.utils.picklefield.PickledWidget" title="evennia.utils.picklefield.PickledWidget"><code class="xref py py-class docutils literal notranslate"><span class="pre">PickledWidget</span></code></a></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.picklefield.PickledObject">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.picklefield.</code><code class="sig-name descname">PickledObject</code><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledObject"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledObject" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
<p>A subclass of string so it can be told whether a string is a pickled
object or not (if the object is an instance of this class then it must
[well, should] be a pickled one).</p>
<p>Only really useful for passing pre-encoded values to <code class="docutils literal notranslate"><span class="pre">default</span></code>
with <code class="docutils literal notranslate"><span class="pre">dbsafe_encode</span></code>, not that doing so is necessary. If you
remove PickledObject and its references, you wont be able to pass
in pre-encoded values anymore, but you can always just pass in the
python objects themselves.</p>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.picklefield.PickledObjectField">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.picklefield.</code><code class="sig-name descname">PickledObjectField</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledObjectField"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledObjectField" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">django.db.models.fields.Field</span></code></p>
<p>A field that will accept <em>any</em> python object and store it in the
database. PickledObjectField will optionally compress its values if
declared with the keyword argument <code class="docutils literal notranslate"><span class="pre">compress=True</span></code>.</p>
<p>Does not actually encode and compress <code class="docutils literal notranslate"><span class="pre">None</span></code> objects (although you
can still do lookups using None). This way, it is still possible to
use the <code class="docutils literal notranslate"><span class="pre">isnull</span></code> lookup type correctly.</p>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledObjectField.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledObjectField.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledObjectField.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledObjectField.formfield">
<code class="sig-name descname">formfield</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledObjectField.formfield"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledObjectField.formfield" title="Permalink to this definition"></a></dt>
<dd><p>Return a django.forms.Field instance for this field.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledObjectField.from_db_value">
<code class="sig-name descname">from_db_value</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">*args</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledObjectField.from_db_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledObjectField.from_db_value" title="Permalink to this definition"></a></dt>
<dd><p>B64decode and unpickle the object, optionally decompressing it.</p>
<p>If an error is raised in de-pickling and were sure the value is
a definite pickle, the error is allowed to propagate. If we
arent sure if the value is a pickle or not, then we catch the
error and return the original value instead.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledObjectField.get_db_prep_lookup">
<code class="sig-name descname">get_db_prep_lookup</code><span class="sig-paren">(</span><em class="sig-param">lookup_type</em>, <em class="sig-param">value</em>, <em class="sig-param">connection=None</em>, <em class="sig-param">prepared=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledObjectField.get_db_prep_lookup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledObjectField.get_db_prep_lookup" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledObjectField.get_db_prep_value">
<code class="sig-name descname">get_db_prep_value</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">connection=None</em>, <em class="sig-param">prepared=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledObjectField.get_db_prep_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledObjectField.get_db_prep_value" title="Permalink to this definition"></a></dt>
<dd><p>Pickle and b64encode the object, optionally compressing it.</p>
<p>The pickling protocol is specified explicitly (by default 2),
rather than as -1 or HIGHEST_PROTOCOL, because we dont want the
protocol to change over time. If it did, <code class="docutils literal notranslate"><span class="pre">exact</span></code> and <code class="docutils literal notranslate"><span class="pre">in</span></code>
lookups would likely fail, since pickle would now be generating
a different string.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledObjectField.get_default">
<code class="sig-name descname">get_default</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledObjectField.get_default"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledObjectField.get_default" title="Permalink to this definition"></a></dt>
<dd><p>Returns the default value for this field.</p>
<p>The default implementation on models.Field calls force_str
on the default, which means you cant set arbitrary Python
objects as the default. To fix this, we just return the value
without calling force_str on it. Note that if you set a
callable as a default, the field will still call it. It will
<em>not</em> try to pickle and encode it.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledObjectField.get_internal_type">
<code class="sig-name descname">get_internal_type</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledObjectField.get_internal_type"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledObjectField.get_internal_type" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledObjectField.pre_save">
<code class="sig-name descname">pre_save</code><span class="sig-paren">(</span><em class="sig-param">model_instance</em>, <em class="sig-param">add</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledObjectField.pre_save"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledObjectField.pre_save" title="Permalink to this definition"></a></dt>
<dd><p>Return fields value just before saving.</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledObjectField.value_to_string">
<code class="sig-name descname">value_to_string</code><span class="sig-paren">(</span><em class="sig-param">obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledObjectField.value_to_string"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledObjectField.value_to_string" title="Permalink to this definition"></a></dt>
<dd><p>Return a string value of this field from the passed obj.
This is used by the serialization framework.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.picklefield.PickledWidget">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.picklefield.</code><code class="sig-name descname">PickledWidget</code><span class="sig-paren">(</span><em class="sig-param">attrs=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledWidget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledWidget" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">django.forms.widgets.Textarea</span></code></p>
<p>This is responsible for outputting HTML representing a given field.</p>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledWidget.media">
<em class="property">property </em><code class="sig-name descname">media</code><a class="headerlink" href="#evennia.utils.picklefield.PickledWidget.media" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledWidget.render">
<code class="sig-name descname">render</code><span class="sig-paren">(</span><em class="sig-param">name</em>, <em class="sig-param">value</em>, <em class="sig-param">attrs=None</em>, <em class="sig-param">renderer=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledWidget.render"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledWidget.render" title="Permalink to this definition"></a></dt>
<dd><p>Display of the PickledField in django admin</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.picklefield.PickledWidget.value_from_datadict">
<code class="sig-name descname">value_from_datadict</code><span class="sig-paren">(</span><em class="sig-param">data</em>, <em class="sig-param">files</em>, <em class="sig-param">name</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#PickledWidget.value_from_datadict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.PickledWidget.value_from_datadict" title="Permalink to this definition"></a></dt>
<dd><p>Given a dictionary of data and this widgets name, return the value
of this widget or None if its not provided.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.picklefield._ObjectWrapper">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.picklefield.</code><code class="sig-name descname">_ObjectWrapper</code><span class="sig-paren">(</span><em class="sig-param">obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#_ObjectWrapper"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield._ObjectWrapper" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>A class used to wrap object that have properties that may clash with the
ORM internals.</p>
<p>For example, objects with the <cite>prepare_database_save</cite> property such as
<cite>django.db.Model</cite> subclasses wont work under certain conditions and the
same apply for trying to retrieve any <cite>callable</cite> object.</p>
<dl class="method">
<dt id="evennia.utils.picklefield._ObjectWrapper.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#_ObjectWrapper.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield._ObjectWrapper.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.picklefield._ObjectWrapper._obj">
<code class="sig-name descname">_obj</code><a class="headerlink" href="#evennia.utils.picklefield._ObjectWrapper._obj" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.picklefield.dbsafe_decode">
<code class="sig-prename descclassname">evennia.utils.picklefield.</code><code class="sig-name descname">dbsafe_decode</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">compress_object=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#dbsafe_decode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.dbsafe_decode" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.picklefield.dbsafe_encode">
<code class="sig-prename descclassname">evennia.utils.picklefield.</code><code class="sig-name descname">dbsafe_encode</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">compress_object=False</em>, <em class="sig-param">pickle_protocol=4</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#dbsafe_encode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.dbsafe_encode" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.picklefield.wrap_conflictual_object">
<code class="sig-prename descclassname">evennia.utils.picklefield.</code><code class="sig-name descname">wrap_conflictual_object</code><span class="sig-paren">(</span><em class="sig-param">obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/picklefield.html#wrap_conflictual_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.picklefield.wrap_conflictual_object" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-evennia.utils.search">
<span id="evennia-utils-search-module"></span><h2>evennia.utils.search module<a class="headerlink" href="#module-evennia.utils.search" title="Permalink to this headline"></a></h2>
<p>This is a convenient container gathering all the main
search methods for the various database tables.</p>
<p>It is intended to be used e.g. as</p>
<p>&gt; from evennia.utils import search
&gt; match = search.objects(…)</p>
<p>Note that this is not intended to be a complete listing of all search
methods! You need to refer to the respective manager to get all
possible search methods. To get to the managers from your code, import
the database model and call its objects property.</p>
<p>Also remember that all commands in this file return lists (also if
there is only one match) unless noted otherwise.</p>
<dl class="simple">
<dt>Example: To reach the search method get_object_with_account</dt><dd><p>in evennia/objects/managers.py:</p>
</dd>
</dl>
<p>&gt; from evennia.objects.models import ObjectDB
&gt; match = Object.objects.get_object_with_account(…)</p>
<dl class="function">
<dt id="evennia.utils.search.search_object">
<code class="sig-prename descclassname">evennia.utils.search.</code><code class="sig-name descname">search_object</code><span class="sig-paren">(</span><em class="sig-param">searchdata</em>, <em class="sig-param">attribute_name=None</em>, <em class="sig-param">typeclass=None</em>, <em class="sig-param">candidates=None</em>, <em class="sig-param">exact=True</em>, <em class="sig-param">use_dbref=True</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.search.search_object" title="Permalink to this definition"></a></dt>
<dd><p>Search as an object globally or in a list of candidates and
return results. The result is always an Object. Always returns
a list.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>searchdata</strong> (<em>str</em><em> or </em><em>Object</em>) The entity to match for. This is
usually a key string but may also be an object itself.
By default (if no <cite>attribute_name</cite> is set), this will
search <cite>object.key</cite> and <cite>object.aliases</cite> in order.
Can also be on the form #dbref, which will (if
<cite>exact=True</cite>) be matched against primary key.</p></li>
<li><p><strong>attribute_name</strong> (<em>str</em>) Use this named Attribute to
match searchdata against, instead of the defaults. If
this is the name of a database field (with or without
the <cite>db_</cite> prefix), that will be matched too.</p></li>
<li><p><strong>typeclass</strong> (<em>str</em><em> or </em><em>TypeClass</em>) restrict matches to objects
having this typeclass. This will help speed up global
searches.</p></li>
<li><p><strong>candidates</strong> (<em>list</em>) If supplied, search will
only be performed among the candidates in this list. A
common list of candidates is the contents of the
current location searched.</p></li>
<li><p><strong>exact</strong> (<em>bool</em>) Match names/aliases exactly or partially.
Partial matching matches the beginning of words in the
names/aliases, using a matching routine to separate
multiple matches in names with multiple components (so
“bi sw” will match “Big sword”). Since this is more
expensive than exact matching, it is recommended to be
used together with the <cite>candidates</cite> keyword to limit the
number of possibilities. This value has no meaning if
searching for attributes/properties.</p></li>
<li><p><strong>use_dbref</strong> (<em>bool</em>) If False, bypass direct lookup of a string
on the form #dbref and treat it like any string.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Matching objects</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>matches (list)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.search.search_account">
<code class="sig-prename descclassname">evennia.utils.search.</code><code class="sig-name descname">search_account</code><span class="sig-paren">(</span><em class="sig-param">ostring</em>, <em class="sig-param">exact=True</em>, <em class="sig-param">typeclass=None</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.search.search_account" title="Permalink to this definition"></a></dt>
<dd><p>Searches for a particular account by name or
database id.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ostring</strong> (<em>str</em><em> or </em><em>int</em>) A key string or database id.</p></li>
<li><p><strong>exact</strong> (<em>bool</em><em>, </em><em>optional</em>) Only valid for string matches. If
<cite>True</cite>, requires exact (non-case-sensitive) match,
otherwise also match also keys containing the <cite>ostring</cite>
(non-case-sensitive fuzzy match).</p></li>
<li><p><strong>typeclass</strong> (<em>str</em><em> or </em><em>Typeclass</em><em>, </em><em>optional</em>) Limit the search only to
accounts of this typeclass.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.search.search_script">
<code class="sig-prename descclassname">evennia.utils.search.</code><code class="sig-name descname">search_script</code><span class="sig-paren">(</span><em class="sig-param">ostring</em>, <em class="sig-param">obj=None</em>, <em class="sig-param">only_timed=False</em>, <em class="sig-param">typeclass=None</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.search.search_script" title="Permalink to this definition"></a></dt>
<dd><p>Search for a particular script.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ostring</strong> (<em>str</em>) Search criterion - a script dbef or key.</p></li>
<li><p><strong>obj</strong> (<em>Object</em><em>, </em><em>optional</em>) Limit search to scripts defined on
this object</p></li>
<li><p><strong>only_timed</strong> (<em>bool</em>) Limit search only to scripts that run
on a timer.</p></li>
<li><p><strong>typeclass</strong> (<em>class</em><em> or </em><em>str</em>) Typeclass or path to typeclass.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.search.search_message">
<code class="sig-prename descclassname">evennia.utils.search.</code><code class="sig-name descname">search_message</code><span class="sig-paren">(</span><em class="sig-param">sender=None</em>, <em class="sig-param">receiver=None</em>, <em class="sig-param">freetext=None</em>, <em class="sig-param">dbref=None</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.search.search_message" title="Permalink to this definition"></a></dt>
<dd><p>Search the message database for particular messages. At least
one of the arguments must be given to do a search.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sender</strong> (<em>Object</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) Get messages sent by a particular account or object</p></li>
<li><p><strong>receiver</strong> (<em>Object</em><em>, </em><em>Account</em><em> or </em><em>Channel</em><em>, </em><em>optional</em>) Get messages
received by a certain account,object or channel</p></li>
<li><p><strong>freetext</strong> (<em>str</em>) Search for a text string in a message. NOTE:
This can potentially be slow, so make sure to supply one of
the other arguments to limit the search.</p></li>
<li><p><strong>dbref</strong> (<em>int</em>) The exact database id of the message. This will override
all other search criteria since its unique and
always gives only one match.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A list of message matches or a single match if <cite>dbref</cite> was given.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>messages (list or <a class="reference internal" href="evennia.comms.html#evennia.comms.models.Msg" title="evennia.comms.models.Msg">Msg</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.search.search_channel">
<code class="sig-prename descclassname">evennia.utils.search.</code><code class="sig-name descname">search_channel</code><span class="sig-paren">(</span><em class="sig-param">ostring</em>, <em class="sig-param">exact=True</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.search.search_channel" title="Permalink to this definition"></a></dt>
<dd><p>Search the channel database for a particular channel.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ostring</strong> (<em>str</em>) The key or database id of the channel.</p></li>
<li><p><strong>exact</strong> (<em>bool</em><em>, </em><em>optional</em>) Require an exact (but not
case sensitive) match.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.search.search_help_entry">
<code class="sig-prename descclassname">evennia.utils.search.</code><code class="sig-name descname">search_help_entry</code><span class="sig-paren">(</span><em class="sig-param">ostring</em>, <em class="sig-param">help_category=None</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.search.search_help_entry" title="Permalink to this definition"></a></dt>
<dd><p>Retrieve a search entry object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ostring</strong> (<em>str</em>) The help topic to look for.</p></li>
<li><p><strong>category</strong> (<em>str</em>) Limit the search to a particular help topic</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.search.search_script_tag">
<code class="sig-prename descclassname">evennia.utils.search.</code><code class="sig-name descname">search_script_tag</code><span class="sig-paren">(</span><em class="sig-param">key=None</em>, <em class="sig-param">category=None</em>, <em class="sig-param">tagtype=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/search.html#search_script_tag"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.search.search_script_tag" title="Permalink to this definition"></a></dt>
<dd><p>Find script based on tag or category.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> (<em>str</em><em>, </em><em>optional</em>) The tag key to search for.</p></li>
<li><p><strong>category</strong> (<em>str</em><em>, </em><em>optional</em>) The category of tag
to search for. If not set, uncategorized
tags will be searched.</p></li>
<li><p><strong>tagtype</strong> (<em>str</em><em>, </em><em>optional</em>) type of Tag, by default
this is either <cite>None</cite> (a normal Tag), <cite>alias</cite> or
<cite>permission</cite>. This always apply to all queried tags.</p></li>
<li><p><strong>kwargs</strong> (<em>any</em>) Other optional parameter that may be supported
by the manager method.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>List of Scripts with tags matching</dt><dd><p>the search criteria, or an empty list if no
matches were found.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>matches (list)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.search.search_account_tag">
<code class="sig-prename descclassname">evennia.utils.search.</code><code class="sig-name descname">search_account_tag</code><span class="sig-paren">(</span><em class="sig-param">key=None</em>, <em class="sig-param">category=None</em>, <em class="sig-param">tagtype=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/search.html#search_account_tag"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.search.search_account_tag" title="Permalink to this definition"></a></dt>
<dd><p>Find account based on tag or category.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> (<em>str</em><em>, </em><em>optional</em>) The tag key to search for.</p></li>
<li><p><strong>category</strong> (<em>str</em><em>, </em><em>optional</em>) The category of tag
to search for. If not set, uncategorized
tags will be searched.</p></li>
<li><p><strong>tagtype</strong> (<em>str</em><em>, </em><em>optional</em>) type of Tag, by default
this is either <cite>None</cite> (a normal Tag), <cite>alias</cite> or
<cite>permission</cite>. This always apply to all queried tags.</p></li>
<li><p><strong>kwargs</strong> (<em>any</em>) Other optional parameter that may be supported
by the manager method.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>List of Accounts with tags matching</dt><dd><p>the search criteria, or an empty list if no
matches were found.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>matches (list)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.search.search_channel_tag">
<code class="sig-prename descclassname">evennia.utils.search.</code><code class="sig-name descname">search_channel_tag</code><span class="sig-paren">(</span><em class="sig-param">key=None</em>, <em class="sig-param">category=None</em>, <em class="sig-param">tagtype=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/search.html#search_channel_tag"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.search.search_channel_tag" title="Permalink to this definition"></a></dt>
<dd><p>Find channel based on tag or category.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> (<em>str</em><em>, </em><em>optional</em>) The tag key to search for.</p></li>
<li><p><strong>category</strong> (<em>str</em><em>, </em><em>optional</em>) The category of tag
to search for. If not set, uncategorized
tags will be searched.</p></li>
<li><p><strong>tagtype</strong> (<em>str</em><em>, </em><em>optional</em>) type of Tag, by default
this is either <cite>None</cite> (a normal Tag), <cite>alias</cite> or
<cite>permission</cite>. This always apply to all queried tags.</p></li>
<li><p><strong>kwargs</strong> (<em>any</em>) Other optional parameter that may be supported
by the manager method.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>List of Channels with tags matching</dt><dd><p>the search criteria, or an empty list if no
matches were found.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>matches (list)</p>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.test_resources">
<span id="evennia-utils-test-resources-module"></span><h2>evennia.utils.test_resources module<a class="headerlink" href="#module-evennia.utils.test_resources" title="Permalink to this headline"></a></h2>
<p>Various helper resources for writing unittests.</p>
<dl class="class">
<dt id="evennia.utils.test_resources.EvenniaTest">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">EvenniaTest</code><span class="sig-paren">(</span><em class="sig-param">methodName='runTest'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#EvenniaTest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.EvenniaTest" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">django.test.testcases.TestCase</span></code></p>
<p>Base test for Evennia, sets up a basic environment.</p>
<dl class="attribute">
<dt id="evennia.utils.test_resources.EvenniaTest.account_typeclass">
<code class="sig-name descname">account_typeclass</code><a class="headerlink" href="#evennia.utils.test_resources.EvenniaTest.account_typeclass" title="Permalink to this definition"></a></dt>
<dd><p>alias of <a class="reference internal" href="evennia.accounts.html#evennia.accounts.accounts.DefaultAccount" title="evennia.accounts.accounts.DefaultAccount"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.accounts.accounts.DefaultAccount</span></code></a></p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.test_resources.EvenniaTest.character_typeclass">
<code class="sig-name descname">character_typeclass</code><a class="headerlink" href="#evennia.utils.test_resources.EvenniaTest.character_typeclass" title="Permalink to this definition"></a></dt>
<dd><p>alias of <a class="reference internal" href="evennia.objects.html#evennia.objects.objects.DefaultCharacter" title="evennia.objects.objects.DefaultCharacter"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.objects.objects.DefaultCharacter</span></code></a></p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.test_resources.EvenniaTest.exit_typeclass">
<code class="sig-name descname">exit_typeclass</code><a class="headerlink" href="#evennia.utils.test_resources.EvenniaTest.exit_typeclass" title="Permalink to this definition"></a></dt>
<dd><p>alias of <a class="reference internal" href="evennia.objects.html#evennia.objects.objects.DefaultExit" title="evennia.objects.objects.DefaultExit"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.objects.objects.DefaultExit</span></code></a></p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.test_resources.EvenniaTest.object_typeclass">
<code class="sig-name descname">object_typeclass</code><a class="headerlink" href="#evennia.utils.test_resources.EvenniaTest.object_typeclass" title="Permalink to this definition"></a></dt>
<dd><p>alias of <a class="reference internal" href="evennia.objects.html#evennia.objects.objects.DefaultObject" title="evennia.objects.objects.DefaultObject"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.objects.objects.DefaultObject</span></code></a></p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.test_resources.EvenniaTest.room_typeclass">
<code class="sig-name descname">room_typeclass</code><a class="headerlink" href="#evennia.utils.test_resources.EvenniaTest.room_typeclass" title="Permalink to this definition"></a></dt>
<dd><p>alias of <a class="reference internal" href="evennia.objects.html#evennia.objects.objects.DefaultRoom" title="evennia.objects.objects.DefaultRoom"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.objects.objects.DefaultRoom</span></code></a></p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.test_resources.EvenniaTest.script_typeclass">
<code class="sig-name descname">script_typeclass</code><a class="headerlink" href="#evennia.utils.test_resources.EvenniaTest.script_typeclass" title="Permalink to this definition"></a></dt>
<dd><p>alias of <a class="reference internal" href="evennia.scripts.html#evennia.scripts.scripts.DefaultScript" title="evennia.scripts.scripts.DefaultScript"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.scripts.scripts.DefaultScript</span></code></a></p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.test_resources.EvenniaTest.setUp">
<code class="sig-name descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#EvenniaTest.setUp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.EvenniaTest.setUp" title="Permalink to this definition"></a></dt>
<dd><p>Sets up testing environment</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.test_resources.EvenniaTest.tearDown">
<code class="sig-name descname">tearDown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#EvenniaTest.tearDown"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.EvenniaTest.tearDown" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for deconstructing the test fixture after testing it.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.test_resources.LocalEvenniaTest">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">LocalEvenniaTest</code><span class="sig-paren">(</span><em class="sig-param">methodName='runTest'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#LocalEvenniaTest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.LocalEvenniaTest" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.test_resources.EvenniaTest" title="evennia.utils.test_resources.EvenniaTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaTest</span></code></a></p>
<p>This test class is intended for inheriting in mygame tests.
It helps ensure your tests are run with your own objects.</p>
<dl class="attribute">
<dt id="evennia.utils.test_resources.LocalEvenniaTest.account_typeclass">
<code class="sig-name descname">account_typeclass</code><em class="property"> = 'typeclasses.accounts.Account'</em><a class="headerlink" href="#evennia.utils.test_resources.LocalEvenniaTest.account_typeclass" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.test_resources.LocalEvenniaTest.character_typeclass">
<code class="sig-name descname">character_typeclass</code><em class="property"> = 'typeclasses.characters.Character'</em><a class="headerlink" href="#evennia.utils.test_resources.LocalEvenniaTest.character_typeclass" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.test_resources.LocalEvenniaTest.exit_typeclass">
<code class="sig-name descname">exit_typeclass</code><em class="property"> = 'typeclasses.exits.Exit'</em><a class="headerlink" href="#evennia.utils.test_resources.LocalEvenniaTest.exit_typeclass" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.test_resources.LocalEvenniaTest.object_typeclass">
<code class="sig-name descname">object_typeclass</code><em class="property"> = 'typeclasses.objects.Object'</em><a class="headerlink" href="#evennia.utils.test_resources.LocalEvenniaTest.object_typeclass" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.test_resources.LocalEvenniaTest.room_typeclass">
<code class="sig-name descname">room_typeclass</code><em class="property"> = 'typeclasses.rooms.Room'</em><a class="headerlink" href="#evennia.utils.test_resources.LocalEvenniaTest.room_typeclass" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.test_resources.LocalEvenniaTest.script_typeclass">
<code class="sig-name descname">script_typeclass</code><em class="property"> = 'typeclasses.scripts.Script'</em><a class="headerlink" href="#evennia.utils.test_resources.LocalEvenniaTest.script_typeclass" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.test_resources._mock_deferlater">
<code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">_mock_deferlater</code><span class="sig-paren">(</span><em class="sig-param">reactor</em>, <em class="sig-param">timedelay</em>, <em class="sig-param">callback</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#_mock_deferlater"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources._mock_deferlater" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.test_resources.mockdeferLater">
<code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">mockdeferLater</code><span class="sig-paren">(</span><em class="sig-param">reactor</em>, <em class="sig-param">timedelay</em>, <em class="sig-param">callback</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#mockdeferLater"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.mockdeferLater" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.test_resources.mockdelay">
<code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">mockdelay</code><span class="sig-paren">(</span><em class="sig-param">timedelay</em>, <em class="sig-param">callback</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#mockdelay"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.mockdelay" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.test_resources.unload_module">
<code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">unload_module</code><span class="sig-paren">(</span><em class="sig-param">module</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#unload_module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.unload_module" title="Permalink to this definition"></a></dt>
<dd><p>Reset import so one can mock global constants.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>module</strong> (<em>module</em><em>, </em><em>object</em><em> or </em><em>str</em>) The module will
be removed so it will have to be imported again. If given
an object, the module in which that object sits will be unloaded. A string
should directly give the module pathname to unload.</p>
</dd>
</dl>
<p class="rubric">Example</p>
<p># (in a test method)
unload_module(foo)
with mock.patch(“foo.GLOBALTHING”, “mockval”):</p>
<blockquote>
<div><p>import foo
… # test code using foo.GLOBALTHING, now set to mockval</p>
</div></blockquote>
<p>This allows for mocking constants global to the module, since
otherwise those would not be mocked (since a module is only
loaded once).</p>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.text2html">
<span id="evennia-utils-text2html-module"></span><h2>evennia.utils.text2html module<a class="headerlink" href="#module-evennia.utils.text2html" title="Permalink to this headline"></a></h2>
<p>ANSI -&gt; html converter</p>
<p>Credit for original idea and implementation
goes to Muhammad Alkarouri and his
snippet #577349 on <a class="reference external" href="http://code.activestate.com">http://code.activestate.com</a>.</p>
<p>(extensively modified by Griatch 2010)</p>
<dl class="class">
<dt id="evennia.utils.text2html.TextToHTMLparser">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.text2html.</code><code class="sig-name descname">TextToHTMLparser</code><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This class describes a parser for converting from ANSI to html.</p>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser._sub_bg">
<code class="sig-name descname">_sub_bg</code><span class="sig-paren">(</span><em class="sig-param">colormatch</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser._sub_bg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser._sub_bg" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser._sub_bgfg">
<code class="sig-name descname">_sub_bgfg</code><span class="sig-paren">(</span><em class="sig-param">colormatch</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser._sub_bgfg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser._sub_bgfg" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser._sub_fg">
<code class="sig-name descname">_sub_fg</code><span class="sig-paren">(</span><em class="sig-param">colormatch</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser._sub_fg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser._sub_fg" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.bg_colormap">
<code class="sig-name descname">bg_colormap</code><em class="property"> = {'\x1b[1m\x1b[40m': 'bgcolor-008', '\x1b[1m\x1b[41m': 'bgcolor-009', '\x1b[1m\x1b[42m': 'bgcolor-010', '\x1b[1m\x1b[43m': 'bgcolor-011', '\x1b[1m\x1b[44m': 'bgcolor-012', '\x1b[1m\x1b[45m': 'bgcolor-013', '\x1b[1m\x1b[46m': 'bgcolor-014', '\x1b[1m\x1b[47m': 'bgcolor-015', '\x1b[40m': 'bgcolor-000', '\x1b[41m': 'bgcolor-001', '\x1b[42m': 'bgcolor-002', '\x1b[43m': 'bgcolor-003', '\x1b[44m': 'bgcolor-004', '\x1b[45m': 'bgcolor-005', '\x1b[46m': 'bgcolor-006', '\x1b[47m': 'bgcolor-007', '\x1b[48;5;100m': 'bgcolor-100', '\x1b[48;5;101m': 'bgcolor-101', '\x1b[48;5;102m': 'bgcolor-102', '\x1b[48;5;103m': 'bgcolor-103', '\x1b[48;5;104m': 'bgcolor-104', '\x1b[48;5;105m': 'bgcolor-105', '\x1b[48;5;106m': 'bgcolor-106', '\x1b[48;5;107m': 'bgcolor-107', '\x1b[48;5;108m': 'bgcolor-108', '\x1b[48;5;109m': 'bgcolor-109', '\x1b[48;5;110m': 'bgcolor-110', '\x1b[48;5;111m': 'bgcolor-111', '\x1b[48;5;112m': 'bgcolor-112', '\x1b[48;5;113m': 'bgcolor-113', '\x1b[48;5;114m': 'bgcolor-114', '\x1b[48;5;115m': 'bgcolor-115', '\x1b[48;5;116m': 'bgcolor-116', '\x1b[48;5;117m': 'bgcolor-117', '\x1b[48;5;118m': 'bgcolor-118', '\x1b[48;5;119m': 'bgcolor-119', '\x1b[48;5;120m': 'bgcolor-120', '\x1b[48;5;121m': 'bgcolor-121', '\x1b[48;5;122m': 'bgcolor-122', '\x1b[48;5;123m': 'bgcolor-123', '\x1b[48;5;124m': 'bgcolor-124', '\x1b[48;5;125m': 'bgcolor-125', '\x1b[48;5;126m': 'bgcolor-126', '\x1b[48;5;127m': 'bgcolor-127', '\x1b[48;5;128m': 'bgcolor-128', '\x1b[48;5;129m': 'bgcolor-129', '\x1b[48;5;130m': 'bgcolor-130', '\x1b[48;5;131m': 'bgcolor-131', '\x1b[48;5;132m': 'bgcolor-132', '\x1b[48;5;133m': 'bgcolor-133', '\x1b[48;5;134m': 'bgcolor-134', '\x1b[48;5;135m': 'bgcolor-135', '\x1b[48;5;136m': 'bgcolor-136', '\x1b[48;5;137m': 'bgcolor-137', '\x1b[48;5;138m': 'bgcolor-138', '\x1b[48;5;139m': 'bgcolor-139', '\x1b[48;5;140m': 'bgcolor-140', '\x1b[48;5;141m': 'bgcolor-141', '\x1b[48;5;142m': 'bgcolor-142', '\x1b[48;5;143m': 'bgcolor-143', '\x1b[48;5;144m': 'bgcolor-144', '\x1b[48;5;145m': 'bgcolor-145', '\x1b[48;5;146m': 'bgcolor-146', '\x1b[48;5;147m': 'bgcolor-147', '\x1b[48;5;148m': 'bgcolor-148', '\x1b[48;5;149m': 'bgcolor-149', '\x1b[48;5;150m': 'bgcolor-150', '\x1b[48;5;151m': 'bgcolor-151', '\x1b[48;5;152m': 'bgcolor-152', '\x1b[48;5;153m': 'bgcolor-153', '\x1b[48;5;154m': 'bgcolor-154', '\x1b[48;5;155m': 'bgcolor-155', '\x1b[48;5;156m': 'bgcolor-156', '\x1b[48;5;157m': 'bgcolor-157', '\x1b[48;5;158m': 'bgcolor-158', '\x1b[48;5;159m': 'bgcolor-159', '\x1b[48;5;160m': 'bgcolor-160', '\x1b[48;5;161m': 'bgcolor-161', '\x1b[48;5;162m': 'bgcolor-162', '\x1b[48;5;163m': 'bgcolor-163', '\x1b[48;5;164m': 'bgcolor-164', '\x1b[48;5;165m': 'bgcolor-165', '\x1b[48;5;166m': 'bgcolor-166', '\x1b[48;5;167m': 'bgcolor-167', '\x1b[48;5;168m': 'bgcolor-168', '\x1b[48;5;169m': 'bgcolor-169', '\x1b[48;5;16m': 'bgcolor-016', '\x1b[48;5;170m': 'bgcolor-170', '\x1b[48;5;171m': 'bgcolor-171', '\x1b[48;5;172m': 'bgcolor-172', '\x1b[48;5;173m': 'bgcolor-173', '\x1b[48;5;174m': 'bgcolor-174', '\x1b[48;5;175m': 'bgcolor-175', '\x1b[48;5;176m': 'bgcolor-176', '\x1b[48;5;177m': 'bgcolor-177', '\x1b[48;5;178m': 'bgcolor-178', '\x1b[48;5;179m': 'bgcolor-179', '\x1b[48;5;17m': 'bgcolor-017', '\x1b[48;5;180m': 'bgcolor-180', '\x1b[48;5;181m': 'bgcolor-181', '\x1b[48;5;182m': 'bgcolor-182', '\x1b[48;5;183m': 'bgcolor-183', '\x1b[48;5;184m': 'bgcolor-184', '\x1b[48;5;185m': 'bgcolor-185', '\x1b[48;5;186m': 'bgcolor-186', '\x1b[48;5;187m': 'bgcolor-187', '\x1b[48;5;188m': 'bgcolor-188', '\x1b[48;5;189m': 'bgcolor-189', '\x1b[48;5;18m': 'bgcolor-018', '\x1b[48;5;190m': 'bgcolor-190', '\x1b[48;5;191m': 'bgcolor-191', '\x1b[48;5;192m': 'bgcolor-192', '\x1b[48;5;193m': 'bgcolor-193', '\x1b[48;5;194m': 'bgcolor-194', '\x1b[48;5;195m': 'bgcolor-195', '\x1b[48;5;196m': 'bgcolor-196', '\x1b[48;5;197m': 'bgcolor-197', '\x1b[48;5;198m': 'bgcolor-198', '\x1b[48;5;199m': 'bgcolor-199', '\x1b[48;5;19m': 'bgcolor-019', '\x1b[48;5;200m': 'bgcolor-200', '\x1b[48;5;201m': 'bgcolor-201', '\x1b[48;5;202m': 'bgcolor-202', '\x1b[48;5;203m': 'bgcolor-203', '\x1b[48;5;204m': 'bgcolor-204', '\x1b[48;5;205m': 'bgcolor-205', '\x1b[48;5;206m': 'bgcolor-206', '\x1b[48;5;207m': 'bgcolor-207', '\x1b[48;5;208m': 'bgcolor-208', '\x1b[48;5;209m': 'bgcolor-209', '\x1b[48;5;20m': 'bgcolor-020', '\x1b[48;5;210m': 'bgcolor-210', '\x1b[48;5;211m': 'bgcolor-211', '\x1b[48;5;212m': 'bgcolor-212', '\x1b[48;5;213m': 'bgcolor-213', '\x1b[48;5;214m': 'bgcolor-214', '\x1b[48;5;215m': 'bgcolor-215', '\x1b[48;5;216m': 'bgcolor-216', '\x1b[48;5;217m': 'bgcolor-217', '\x1b[48;5;218m': 'bgcolor-218', '\x1b[48;5;219m': 'bgcolor-219', '\x1b[48;5;21m': 'bgcolor-021', '\x1b[48;5;220m': 'bgcolor-220', '\x1b[48;5;221m': 'bgcolor-221', '\x1b[48;5;222m': 'bgcolor-222', '\x1b[48;5;223m': 'bgcolor-223', '\x1b[48;5;224m': 'bgcolor-224', '\x1b[48;5;225m': 'bgcolor-225', '\x1b[48;5;226m': 'bgcolor-226', '\x1b[48;5;227m': 'bgcolor-227', '\x1b[48;5;228m': 'bgcolor-228', '\x1b[48;5;229m': 'bgcolor-229', '\x1b[48;5;22m': 'bgcolor-022', '\x1b[48;5;230m': 'bgcolor-230', '\x1b[48;5;231m': 'bgcolor-231', '\x1b[48;5;232m': 'bgcolor-232', '\x1b[48;5;233m': 'bgcolor-233', '\x1b[48;5;234m': 'bgcolor-234', '\x1b[48;5;235m': 'bgcolor-235', '\x1b[48;5;236m': 'bgcolor-236', '\x1b[48;5;237m': 'bgcolor-237', '\x1b[48;5;238m': 'bgcolor-238', '\x1b[48;5;239m': 'bgcolor-239', '\x1b[48;5;23m': 'bgcolor-023', '\x1b[48;5;240m': 'bgcolor-240', '\x1b[48;5;241m': 'bgcolor-241', '\x1b[48;5;242m': 'bgcolor-242', '\x1b[48;5;243m': 'bgcolor-243', '\x1b[48;5;244m': 'bgcolor-244', '\x1b[48;5;245m': 'bgcolor-245', '\x1b[48;5;246m': 'bgcolor-246', '\x1b[48;5;247m': 'bgcolor-247', '\x1b[48;5;248m': 'bgcolor-248', '\x1b[48;5;249m': 'bgcolor-249', '\x1b[48;5;24m': 'bgcolor-024', '\x1b[48;5;250m': 'bgcolor-250', '\x1b[48;5;251m': 'bgcolor-251', '\x1b[48;5;252m': 'bgcolor-252', '\x1b[48;5;253m': 'bgcolor-253', '\x1b[48;5;254m': 'bgcolor-254', '\x1b[48;5;255m': 'bgcolor-255', '\x1b[48;5;25m': 'bgcolor-025', '\x1b[48;5;26m': 'bgcolor-026', '\x1b[48;5;27m': 'bgcolor-027', '\x1b[48;5;28m': 'bgcolor-028', '\x1b[48;5;29m': 'bgcolor-029', '\x1b[48;5;30m': 'bgcolor-030', '\x1b[48;5;31m': 'bgcolor-031', '\x1b[48;5;32m': 'bgcolor-032', '\x1b[48;5;33m': 'bgcolor-033', '\x1b[48;5;34m': 'bgcolor-034', '\x1b[48;5;35m': 'bgcolor-035', '\x1b[48;5;36m': 'bgcolor-036', '\x1b[48;5;37m': 'bgcolor-037', '\x1b[48;5;38m': 'bgcolor-038', '\x1b[48;5;39m': 'bgcolor-039', '\x1b[48;5;40m': 'bgcolor-040', '\x1b[48;5;41m': 'bgcolor-041', '\x1b[48;5;42m': 'bgcolor-042', '\x1b[48;5;43m': 'bgcolor-043', '\x1b[48;5;44m': 'bgcolor-044', '\x1b[48;5;45m': 'bgcolor-045', '\x1b[48;5;46m': 'bgcolor-046', '\x1b[48;5;47m': 'bgcolor-047', '\x1b[48;5;48m': 'bgcolor-048', '\x1b[48;5;49m': 'bgcolor-049', '\x1b[48;5;50m': 'bgcolor-050', '\x1b[48;5;51m': 'bgcolor-051', '\x1b[48;5;52m': 'bgcolor-052', '\x1b[48;5;53m': 'bgcolor-053', '\x1b[48;5;54m': 'bgcolor-054', '\x1b[48;5;55m': 'bgcolor-055', '\x1b[48;5;56m': 'bgcolor-056', '\x1b[48;5;57m': 'bgcolor-057', '\x1b[48;5;58m': 'bgcolor-058', '\x1b[48;5;59m': 'bgcolor-059', '\x1b[48;5;60m': 'bgcolor-060', '\x1b[48;5;61m': 'bgcolor-061', '\x1b[48;5;62m': 'bgcolor-062', '\x1b[48;5;63m': 'bgcolor-063', '\x1b[48;5;64m': 'bgcolor-064', '\x1b[48;5;65m': 'bgcolor-065', '\x1b[48;5;66m': 'bgcolor-066', '\x1b[48;5;67m': 'bgcolor-067', '\x1b[48;5;68m': 'bgcolor-068', '\x1b[48;5;69m': 'bgcolor-069', '\x1b[48;5;70m': 'bgcolor-070', '\x1b[48;5;71m': 'bgcolor-071', '\x1b[48;5;72m': 'bgcolor-072', '\x1b[48;5;73m': 'bgcolor-073', '\x1b[48;5;74m': 'bgcolor-074', '\x1b[48;5;75m': 'bgcolor-075', '\x1b[48;5;76m': 'bgcolor-076', '\x1b[48;5;77m': 'bgcolor-077', '\x1b[48;5;78m': 'bgcolor-078', '\x1b[48;5;79m': 'bgcolor-079', '\x1b[48;5;80m': 'bgcolor-080', '\x1b[48;5;81m': 'bgcolor-081', '\x1b[48;5;82m': 'bgcolor-082', '\x1b[48;5;83m': 'bgcolor-083', '\x1b[48;5;84m': 'bgcolor-084', '\x1b[48;5;85m': 'bgcolor-085', '\x1b[48;5;86m': 'bgcolor-086', '\x1b[48;5;87m': 'bgcolor-087', '\x1b[48;5;88m': 'bgcolor-088', '\x1b[48;5;89m': 'bgcolor-089', '\x1b[48;5;90m': 'bgcolor-090', '\x1b[48;5;91m': 'bgcolor-091', '\x1b[48;5;92m': 'bgcolor-092', '\x1b[48;5;93m': 'bgcolor-093', '\x1b[48;5;94m': 'bgcolor-094', '\x1b[48;5;95m': 'bgcolor-095', '\x1b[48;5;96m': 'bgcolor-096', '\x1b[48;5;97m': 'bgcolor-097', '\x1b[48;5;98m': 'bgcolor-098', '\x1b[48;5;99m': 'bgcolor-099'}</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.bg_colormap" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.bgfgstart">
<code class="sig-name descname">bgfgstart</code><em class="property"> = '((?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m)(\\s*)((?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[[3-4][0-8].*?m){0,1}'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.bgfgstart" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.bgfgstop">
<code class="sig-name descname">bgfgstop</code><em class="property"> = '(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m|\x1b\\[0m(\\s*)(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[3[0-8].*?m|\x1b\\[0m|$'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.bgfgstop" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.bgstart">
<code class="sig-name descname">bgstart</code><em class="property"> = '((?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m)'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.bgstart" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.bgstop">
<code class="sig-name descname">bgstop</code><em class="property"> = '(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m|\x1b\\[0m|$'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.bgstop" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.blink">
<code class="sig-name descname">blink</code><em class="property"> = '\x1b[5m'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.blink" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.colorback">
<code class="sig-name descname">colorback</code><em class="property"> = [('bgcolor-000', '\x1b[40m'), ('bgcolor-001', '\x1b[41m'), ('bgcolor-002', '\x1b[42m'), ('bgcolor-003', '\x1b[43m'), ('bgcolor-004', '\x1b[44m'), ('bgcolor-005', '\x1b[45m'), ('bgcolor-006', '\x1b[46m'), ('bgcolor-007', '\x1b[47m'), ('bgcolor-008', '\x1b[1m\x1b[40m'), ('bgcolor-009', '\x1b[1m\x1b[41m'), ('bgcolor-010', '\x1b[1m\x1b[42m'), ('bgcolor-011', '\x1b[1m\x1b[43m'), ('bgcolor-012', '\x1b[1m\x1b[44m'), ('bgcolor-013', '\x1b[1m\x1b[45m'), ('bgcolor-014', '\x1b[1m\x1b[46m'), ('bgcolor-015', '\x1b[1m\x1b[47m'), ('bgcolor-016', '\x1b[48;5;16m'), ('bgcolor-017', '\x1b[48;5;17m'), ('bgcolor-018', '\x1b[48;5;18m'), ('bgcolor-019', '\x1b[48;5;19m'), ('bgcolor-020', '\x1b[48;5;20m'), ('bgcolor-021', '\x1b[48;5;21m'), ('bgcolor-022', '\x1b[48;5;22m'), ('bgcolor-023', '\x1b[48;5;23m'), ('bgcolor-024', '\x1b[48;5;24m'), ('bgcolor-025', '\x1b[48;5;25m'), ('bgcolor-026', '\x1b[48;5;26m'), ('bgcolor-027', '\x1b[48;5;27m'), ('bgcolor-028', '\x1b[48;5;28m'), ('bgcolor-029', '\x1b[48;5;29m'), ('bgcolor-030', '\x1b[48;5;30m'), ('bgcolor-031', '\x1b[48;5;31m'), ('bgcolor-032', '\x1b[48;5;32m'), ('bgcolor-033', '\x1b[48;5;33m'), ('bgcolor-034', '\x1b[48;5;34m'), ('bgcolor-035', '\x1b[48;5;35m'), ('bgcolor-036', '\x1b[48;5;36m'), ('bgcolor-037', '\x1b[48;5;37m'), ('bgcolor-038', '\x1b[48;5;38m'), ('bgcolor-039', '\x1b[48;5;39m'), ('bgcolor-040', '\x1b[48;5;40m'), ('bgcolor-041', '\x1b[48;5;41m'), ('bgcolor-042', '\x1b[48;5;42m'), ('bgcolor-043', '\x1b[48;5;43m'), ('bgcolor-044', '\x1b[48;5;44m'), ('bgcolor-045', '\x1b[48;5;45m'), ('bgcolor-046', '\x1b[48;5;46m'), ('bgcolor-047', '\x1b[48;5;47m'), ('bgcolor-048', '\x1b[48;5;48m'), ('bgcolor-049', '\x1b[48;5;49m'), ('bgcolor-050', '\x1b[48;5;50m'), ('bgcolor-051', '\x1b[48;5;51m'), ('bgcolor-052', '\x1b[48;5;52m'), ('bgcolor-053', '\x1b[48;5;53m'), ('bgcolor-054', '\x1b[48;5;54m'), ('bgcolor-055', '\x1b[48;5;55m'), ('bgcolor-056', '\x1b[48;5;56m'), ('bgcolor-057', '\x1b[48;5;57m'), ('bgcolor-058', '\x1b[48;5;58m'), ('bgcolor-059', '\x1b[48;5;59m'), ('bgcolor-060', '\x1b[48;5;60m'), ('bgcolor-061', '\x1b[48;5;61m'), ('bgcolor-062', '\x1b[48;5;62m'), ('bgcolor-063', '\x1b[48;5;63m'), ('bgcolor-064', '\x1b[48;5;64m'), ('bgcolor-065', '\x1b[48;5;65m'), ('bgcolor-066', '\x1b[48;5;66m'), ('bgcolor-067', '\x1b[48;5;67m'), ('bgcolor-068', '\x1b[48;5;68m'), ('bgcolor-069', '\x1b[48;5;69m'), ('bgcolor-070', '\x1b[48;5;70m'), ('bgcolor-071', '\x1b[48;5;71m'), ('bgcolor-072', '\x1b[48;5;72m'), ('bgcolor-073', '\x1b[48;5;73m'), ('bgcolor-074', '\x1b[48;5;74m'), ('bgcolor-075', '\x1b[48;5;75m'), ('bgcolor-076', '\x1b[48;5;76m'), ('bgcolor-077', '\x1b[48;5;77m'), ('bgcolor-078', '\x1b[48;5;78m'), ('bgcolor-079', '\x1b[48;5;79m'), ('bgcolor-080', '\x1b[48;5;80m'), ('bgcolor-081', '\x1b[48;5;81m'), ('bgcolor-082', '\x1b[48;5;82m'), ('bgcolor-083', '\x1b[48;5;83m'), ('bgcolor-084', '\x1b[48;5;84m'), ('bgcolor-085', '\x1b[48;5;85m'), ('bgcolor-086', '\x1b[48;5;86m'), ('bgcolor-087', '\x1b[48;5;87m'), ('bgcolor-088', '\x1b[48;5;88m'), ('bgcolor-089', '\x1b[48;5;89m'), ('bgcolor-090', '\x1b[48;5;90m'), ('bgcolor-091', '\x1b[48;5;91m'), ('bgcolor-092', '\x1b[48;5;92m'), ('bgcolor-093', '\x1b[48;5;93m'), ('bgcolor-094', '\x1b[48;5;94m'), ('bgcolor-095', '\x1b[48;5;95m'), ('bgcolor-096', '\x1b[48;5;96m'), ('bgcolor-097', '\x1b[48;5;97m'), ('bgcolor-098', '\x1b[48;5;98m'), ('bgcolor-099', '\x1b[48;5;99m'), ('bgcolor-100', '\x1b[48;5;100m'), ('bgcolor-101', '\x1b[48;5;101m'), ('bgcolor-102', '\x1b[48;5;102m'), ('bgcolor-103', '\x1b[48;5;103m'), ('bgcolor-104', '\x1b[48;5;104m'), ('bgcolor-105', '\x1b[48;5;105m'), ('bgcolor-106', '\x1b[48;5;106m'), ('bgcolor-107', '\x1b[48;5;107m'), ('bgcolor-108', '\x1b[48;5;108m'), ('bgcolor-109', '\x1b[48;5;109m'), ('bgcolor-110', '\x1b[48;5;110m'), ('bgcolor-111', '\x1b[48;5;111m'), ('bgcolor-112', '\x1b[48;5;112m'), ('bgcolor-113', '\x1b[48;5;113m'), ('bgcolor-114', '\x1b[48;5;114m'), ('bgcolor-115', '\x1b[48;5;115m'), ('bgcolor-116', '\x1b[48;5;116m'), ('bgcolor-117', '\x1b[48;5;117m'), ('bgcolor-118', '\x1b[48;5;118m'), ('bgcolor-119', '\x1b[48;5;119m'), ('bgcolor-120', '\x1b[48;5;120m'), ('bgcolor-121', '\x1b[48;5;121m'), ('bgcolor-122', '\x1b[48;5;122m'), ('bgcolor-123', '\x1b[48;5;123m'), ('bgcolor-124', '\x1b[48;5;124m'), ('bgcolor-125', '\x1b[48;5;125m'), ('bgcolor-126', '\x1b[48;5;126m'), ('bgcolor-127', '\x1b[48;5;127m'), ('bgcolor-128', '\x1b[48;5;128m'), ('bgcolor-129', '\x1b[48;5;129m'), ('bgcolor-130', '\x1b[48;5;130m'), ('bgcolor-131', '\x1b[48;5;131m'), ('bgcolor-132', '\x1b[48;5;132m'), ('bgcolor-133', '\x1b[48;5;133m'), ('bgcolor-134', '\x1b[48;5;134m'), ('bgcolor-135', '\x1b[48;5;135m'), ('bgcolor-136', '\x1b[48;5;136m'), ('bgcolor-137', '\x1b[48;5;137m'), ('bgcolor-138', '\x1b[48;5;138m'), ('bgcolor-139', '\x1b[48;5;139m'), ('bgcolor-140', '\x1b[48;5;140m'), ('bgcolor-141', '\x1b[48;5;141m'), ('bgcolor-142', '\x1b[48;5;142m'), ('bgcolor-143', '\x1b[48;5;143m'), ('bgcolor-144', '\x1b[48;5;144m'), ('bgcolor-145', '\x1b[48;5;145m'), ('bgcolor-146', '\x1b[48;5;146m'), ('bgcolor-147', '\x1b[48;5;147m'), ('bgcolor-148', '\x1b[48;5;148m'), ('bgcolor-149', '\x1b[48;5;149m'), ('bgcolor-150', '\x1b[48;5;150m'), ('bgcolor-151', '\x1b[48;5;151m'), ('bgcolor-152', '\x1b[48;5;152m'), ('bgcolor-153', '\x1b[48;5;153m'), ('bgcolor-154', '\x1b[48;5;154m'), ('bgcolor-155', '\x1b[48;5;155m'), ('bgcolor-156', '\x1b[48;5;156m'), ('bgcolor-157', '\x1b[48;5;157m'), ('bgcolor-158', '\x1b[48;5;158m'), ('bgcolor-159', '\x1b[48;5;159m'), ('bgcolor-160', '\x1b[48;5;160m'), ('bgcolor-161', '\x1b[48;5;161m'), ('bgcolor-162', '\x1b[48;5;162m'), ('bgcolor-163', '\x1b[48;5;163m'), ('bgcolor-164', '\x1b[48;5;164m'), ('bgcolor-165', '\x1b[48;5;165m'), ('bgcolor-166', '\x1b[48;5;166m'), ('bgcolor-167', '\x1b[48;5;167m'), ('bgcolor-168', '\x1b[48;5;168m'), ('bgcolor-169', '\x1b[48;5;169m'), ('bgcolor-170', '\x1b[48;5;170m'), ('bgcolor-171', '\x1b[48;5;171m'), ('bgcolor-172', '\x1b[48;5;172m'), ('bgcolor-173', '\x1b[48;5;173m'), ('bgcolor-174', '\x1b[48;5;174m'), ('bgcolor-175', '\x1b[48;5;175m'), ('bgcolor-176', '\x1b[48;5;176m'), ('bgcolor-177', '\x1b[48;5;177m'), ('bgcolor-178', '\x1b[48;5;178m'), ('bgcolor-179', '\x1b[48;5;179m'), ('bgcolor-180', '\x1b[48;5;180m'), ('bgcolor-181', '\x1b[48;5;181m'), ('bgcolor-182', '\x1b[48;5;182m'), ('bgcolor-183', '\x1b[48;5;183m'), ('bgcolor-184', '\x1b[48;5;184m'), ('bgcolor-185', '\x1b[48;5;185m'), ('bgcolor-186', '\x1b[48;5;186m'), ('bgcolor-187', '\x1b[48;5;187m'), ('bgcolor-188', '\x1b[48;5;188m'), ('bgcolor-189', '\x1b[48;5;189m'), ('bgcolor-190', '\x1b[48;5;190m'), ('bgcolor-191', '\x1b[48;5;191m'), ('bgcolor-192', '\x1b[48;5;192m'), ('bgcolor-193', '\x1b[48;5;193m'), ('bgcolor-194', '\x1b[48;5;194m'), ('bgcolor-195', '\x1b[48;5;195m'), ('bgcolor-196', '\x1b[48;5;196m'), ('bgcolor-197', '\x1b[48;5;197m'), ('bgcolor-198', '\x1b[48;5;198m'), ('bgcolor-199', '\x1b[48;5;199m'), ('bgcolor-200', '\x1b[48;5;200m'), ('bgcolor-201', '\x1b[48;5;201m'), ('bgcolor-202', '\x1b[48;5;202m'), ('bgcolor-203', '\x1b[48;5;203m'), ('bgcolor-204', '\x1b[48;5;204m'), ('bgcolor-205', '\x1b[48;5;205m'), ('bgcolor-206', '\x1b[48;5;206m'), ('bgcolor-207', '\x1b[48;5;207m'), ('bgcolor-208', '\x1b[48;5;208m'), ('bgcolor-209', '\x1b[48;5;209m'), ('bgcolor-210', '\x1b[48;5;210m'), ('bgcolor-211', '\x1b[48;5;211m'), ('bgcolor-212', '\x1b[48;5;212m'), ('bgcolor-213', '\x1b[48;5;213m'), ('bgcolor-214', '\x1b[48;5;214m'), ('bgcolor-215', '\x1b[48;5;215m'), ('bgcolor-216', '\x1b[48;5;216m'), ('bgcolor-217', '\x1b[48;5;217m'), ('bgcolor-218', '\x1b[48;5;218m'), ('bgcolor-219', '\x1b[48;5;219m'), ('bgcolor-220', '\x1b[48;5;220m'), ('bgcolor-221', '\x1b[48;5;221m'), ('bgcolor-222', '\x1b[48;5;222m'), ('bgcolor-223', '\x1b[48;5;223m'), ('bgcolor-224', '\x1b[48;5;224m'), ('bgcolor-225', '\x1b[48;5;225m'), ('bgcolor-226', '\x1b[48;5;226m'), ('bgcolor-227', '\x1b[48;5;227m'), ('bgcolor-228', '\x1b[48;5;228m'), ('bgcolor-229', '\x1b[48;5;229m'), ('bgcolor-230', '\x1b[48;5;230m'), ('bgcolor-231', '\x1b[48;5;231m'), ('bgcolor-232', '\x1b[48;5;232m'), ('bgcolor-233', '\x1b[48;5;233m'), ('bgcolor-234', '\x1b[48;5;234m'), ('bgcolor-235', '\x1b[48;5;235m'), ('bgcolor-236', '\x1b[48;5;236m'), ('bgcolor-237', '\x1b[48;5;237m'), ('bgcolor-238', '\x1b[48;5;238m'), ('bgcolor-239', '\x1b[48;5;239m'), ('bgcolor-240', '\x1b[48;5;240m'), ('bgcolor-241', '\x1b[48;5;241m'), ('bgcolor-242', '\x1b[48;5;242m'), ('bgcolor-243', '\x1b[48;5;243m'), ('bgcolor-244', '\x1b[48;5;244m'), ('bgcolor-245', '\x1b[48;5;245m'), ('bgcolor-246', '\x1b[48;5;246m'), ('bgcolor-247', '\x1b[48;5;247m'), ('bgcolor-248', '\x1b[48;5;248m'), ('bgcolor-249', '\x1b[48;5;249m'), ('bgcolor-250', '\x1b[48;5;250m'), ('bgcolor-251', '\x1b[48;5;251m'), ('bgcolor-252', '\x1b[48;5;252m'), ('bgcolor-253', '\x1b[48;5;253m'), ('bgcolor-254', '\x1b[48;5;254m'), ('bgcolor-255', '\x1b[48;5;255m')]</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.colorback" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.colorcodes">
<code class="sig-name descname">colorcodes</code><em class="property"> = [('color-000', '\x1b[22m\x1b[30m'), ('color-001', '\x1b[22m\x1b[31m'), ('color-002', '\x1b[22m\x1b[32m'), ('color-003', '\x1b[22m\x1b[33m'), ('color-004', '\x1b[22m\x1b[34m'), ('color-005', '\x1b[22m\x1b[35m'), ('color-006', '\x1b[22m\x1b[36m'), ('color-007', '\x1b[22m\x1b[37m'), ('color-008', '\x1b[1m\x1b[30m'), ('color-009', '\x1b[1m\x1b[31m'), ('color-010', '\x1b[1m\x1b[32m'), ('color-011', '\x1b[1m\x1b[33m'), ('color-012', '\x1b[1m\x1b[34m'), ('color-013', '\x1b[1m\x1b[35m'), ('color-014', '\x1b[1m\x1b[36m'), ('color-015', '\x1b[1m\x1b[37m'), ('color-016', '\x1b[38;5;16m'), ('color-017', '\x1b[38;5;17m'), ('color-018', '\x1b[38;5;18m'), ('color-019', '\x1b[38;5;19m'), ('color-020', '\x1b[38;5;20m'), ('color-021', '\x1b[38;5;21m'), ('color-022', '\x1b[38;5;22m'), ('color-023', '\x1b[38;5;23m'), ('color-024', '\x1b[38;5;24m'), ('color-025', '\x1b[38;5;25m'), ('color-026', '\x1b[38;5;26m'), ('color-027', '\x1b[38;5;27m'), ('color-028', '\x1b[38;5;28m'), ('color-029', '\x1b[38;5;29m'), ('color-030', '\x1b[38;5;30m'), ('color-031', '\x1b[38;5;31m'), ('color-032', '\x1b[38;5;32m'), ('color-033', '\x1b[38;5;33m'), ('color-034', '\x1b[38;5;34m'), ('color-035', '\x1b[38;5;35m'), ('color-036', '\x1b[38;5;36m'), ('color-037', '\x1b[38;5;37m'), ('color-038', '\x1b[38;5;38m'), ('color-039', '\x1b[38;5;39m'), ('color-040', '\x1b[38;5;40m'), ('color-041', '\x1b[38;5;41m'), ('color-042', '\x1b[38;5;42m'), ('color-043', '\x1b[38;5;43m'), ('color-044', '\x1b[38;5;44m'), ('color-045', '\x1b[38;5;45m'), ('color-046', '\x1b[38;5;46m'), ('color-047', '\x1b[38;5;47m'), ('color-048', '\x1b[38;5;48m'), ('color-049', '\x1b[38;5;49m'), ('color-050', '\x1b[38;5;50m'), ('color-051', '\x1b[38;5;51m'), ('color-052', '\x1b[38;5;52m'), ('color-053', '\x1b[38;5;53m'), ('color-054', '\x1b[38;5;54m'), ('color-055', '\x1b[38;5;55m'), ('color-056', '\x1b[38;5;56m'), ('color-057', '\x1b[38;5;57m'), ('color-058', '\x1b[38;5;58m'), ('color-059', '\x1b[38;5;59m'), ('color-060', '\x1b[38;5;60m'), ('color-061', '\x1b[38;5;61m'), ('color-062', '\x1b[38;5;62m'), ('color-063', '\x1b[38;5;63m'), ('color-064', '\x1b[38;5;64m'), ('color-065', '\x1b[38;5;65m'), ('color-066', '\x1b[38;5;66m'), ('color-067', '\x1b[38;5;67m'), ('color-068', '\x1b[38;5;68m'), ('color-069', '\x1b[38;5;69m'), ('color-070', '\x1b[38;5;70m'), ('color-071', '\x1b[38;5;71m'), ('color-072', '\x1b[38;5;72m'), ('color-073', '\x1b[38;5;73m'), ('color-074', '\x1b[38;5;74m'), ('color-075', '\x1b[38;5;75m'), ('color-076', '\x1b[38;5;76m'), ('color-077', '\x1b[38;5;77m'), ('color-078', '\x1b[38;5;78m'), ('color-079', '\x1b[38;5;79m'), ('color-080', '\x1b[38;5;80m'), ('color-081', '\x1b[38;5;81m'), ('color-082', '\x1b[38;5;82m'), ('color-083', '\x1b[38;5;83m'), ('color-084', '\x1b[38;5;84m'), ('color-085', '\x1b[38;5;85m'), ('color-086', '\x1b[38;5;86m'), ('color-087', '\x1b[38;5;87m'), ('color-088', '\x1b[38;5;88m'), ('color-089', '\x1b[38;5;89m'), ('color-090', '\x1b[38;5;90m'), ('color-091', '\x1b[38;5;91m'), ('color-092', '\x1b[38;5;92m'), ('color-093', '\x1b[38;5;93m'), ('color-094', '\x1b[38;5;94m'), ('color-095', '\x1b[38;5;95m'), ('color-096', '\x1b[38;5;96m'), ('color-097', '\x1b[38;5;97m'), ('color-098', '\x1b[38;5;98m'), ('color-099', '\x1b[38;5;99m'), ('color-100', '\x1b[38;5;100m'), ('color-101', '\x1b[38;5;101m'), ('color-102', '\x1b[38;5;102m'), ('color-103', '\x1b[38;5;103m'), ('color-104', '\x1b[38;5;104m'), ('color-105', '\x1b[38;5;105m'), ('color-106', '\x1b[38;5;106m'), ('color-107', '\x1b[38;5;107m'), ('color-108', '\x1b[38;5;108m'), ('color-109', '\x1b[38;5;109m'), ('color-110', '\x1b[38;5;110m'), ('color-111', '\x1b[38;5;111m'), ('color-112', '\x1b[38;5;112m'), ('color-113', '\x1b[38;5;113m'), ('color-114', '\x1b[38;5;114m'), ('color-115', '\x1b[38;5;115m'), ('color-116', '\x1b[38;5;116m'), ('color-117', '\x1b[38;5;117m'), ('color-118', '\x1b[38;5;118m'), ('color-119', '\x1b[38;5;119m'), ('color-120', '\x1b[38;5;120m'), ('color-121', '\x1b[38;5;121m'), ('color-122', '\x1b[38;5;122m'), ('color-123', '\x1b[38;5;123m'), ('color-124', '\x1b[38;5;124m'), ('color-125', '\x1b[38;5;125m'), ('color-126', '\x1b[38;5;126m'), ('color-127', '\x1b[38;5;127m'), ('color-128', '\x1b[38;5;128m'), ('color-129', '\x1b[38;5;129m'), ('color-130', '\x1b[38;5;130m'), ('color-131', '\x1b[38;5;131m'), ('color-132', '\x1b[38;5;132m'), ('color-133', '\x1b[38;5;133m'), ('color-134', '\x1b[38;5;134m'), ('color-135', '\x1b[38;5;135m'), ('color-136', '\x1b[38;5;136m'), ('color-137', '\x1b[38;5;137m'), ('color-138', '\x1b[38;5;138m'), ('color-139', '\x1b[38;5;139m'), ('color-140', '\x1b[38;5;140m'), ('color-141', '\x1b[38;5;141m'), ('color-142', '\x1b[38;5;142m'), ('color-143', '\x1b[38;5;143m'), ('color-144', '\x1b[38;5;144m'), ('color-145', '\x1b[38;5;145m'), ('color-146', '\x1b[38;5;146m'), ('color-147', '\x1b[38;5;147m'), ('color-148', '\x1b[38;5;148m'), ('color-149', '\x1b[38;5;149m'), ('color-150', '\x1b[38;5;150m'), ('color-151', '\x1b[38;5;151m'), ('color-152', '\x1b[38;5;152m'), ('color-153', '\x1b[38;5;153m'), ('color-154', '\x1b[38;5;154m'), ('color-155', '\x1b[38;5;155m'), ('color-156', '\x1b[38;5;156m'), ('color-157', '\x1b[38;5;157m'), ('color-158', '\x1b[38;5;158m'), ('color-159', '\x1b[38;5;159m'), ('color-160', '\x1b[38;5;160m'), ('color-161', '\x1b[38;5;161m'), ('color-162', '\x1b[38;5;162m'), ('color-163', '\x1b[38;5;163m'), ('color-164', '\x1b[38;5;164m'), ('color-165', '\x1b[38;5;165m'), ('color-166', '\x1b[38;5;166m'), ('color-167', '\x1b[38;5;167m'), ('color-168', '\x1b[38;5;168m'), ('color-169', '\x1b[38;5;169m'), ('color-170', '\x1b[38;5;170m'), ('color-171', '\x1b[38;5;171m'), ('color-172', '\x1b[38;5;172m'), ('color-173', '\x1b[38;5;173m'), ('color-174', '\x1b[38;5;174m'), ('color-175', '\x1b[38;5;175m'), ('color-176', '\x1b[38;5;176m'), ('color-177', '\x1b[38;5;177m'), ('color-178', '\x1b[38;5;178m'), ('color-179', '\x1b[38;5;179m'), ('color-180', '\x1b[38;5;180m'), ('color-181', '\x1b[38;5;181m'), ('color-182', '\x1b[38;5;182m'), ('color-183', '\x1b[38;5;183m'), ('color-184', '\x1b[38;5;184m'), ('color-185', '\x1b[38;5;185m'), ('color-186', '\x1b[38;5;186m'), ('color-187', '\x1b[38;5;187m'), ('color-188', '\x1b[38;5;188m'), ('color-189', '\x1b[38;5;189m'), ('color-190', '\x1b[38;5;190m'), ('color-191', '\x1b[38;5;191m'), ('color-192', '\x1b[38;5;192m'), ('color-193', '\x1b[38;5;193m'), ('color-194', '\x1b[38;5;194m'), ('color-195', '\x1b[38;5;195m'), ('color-196', '\x1b[38;5;196m'), ('color-197', '\x1b[38;5;197m'), ('color-198', '\x1b[38;5;198m'), ('color-199', '\x1b[38;5;199m'), ('color-200', '\x1b[38;5;200m'), ('color-201', '\x1b[38;5;201m'), ('color-202', '\x1b[38;5;202m'), ('color-203', '\x1b[38;5;203m'), ('color-204', '\x1b[38;5;204m'), ('color-205', '\x1b[38;5;205m'), ('color-206', '\x1b[38;5;206m'), ('color-207', '\x1b[38;5;207m'), ('color-208', '\x1b[38;5;208m'), ('color-209', '\x1b[38;5;209m'), ('color-210', '\x1b[38;5;210m'), ('color-211', '\x1b[38;5;211m'), ('color-212', '\x1b[38;5;212m'), ('color-213', '\x1b[38;5;213m'), ('color-214', '\x1b[38;5;214m'), ('color-215', '\x1b[38;5;215m'), ('color-216', '\x1b[38;5;216m'), ('color-217', '\x1b[38;5;217m'), ('color-218', '\x1b[38;5;218m'), ('color-219', '\x1b[38;5;219m'), ('color-220', '\x1b[38;5;220m'), ('color-221', '\x1b[38;5;221m'), ('color-222', '\x1b[38;5;222m'), ('color-223', '\x1b[38;5;223m'), ('color-224', '\x1b[38;5;224m'), ('color-225', '\x1b[38;5;225m'), ('color-226', '\x1b[38;5;226m'), ('color-227', '\x1b[38;5;227m'), ('color-228', '\x1b[38;5;228m'), ('color-229', '\x1b[38;5;229m'), ('color-230', '\x1b[38;5;230m'), ('color-231', '\x1b[38;5;231m'), ('color-232', '\x1b[38;5;232m'), ('color-233', '\x1b[38;5;233m'), ('color-234', '\x1b[38;5;234m'), ('color-235', '\x1b[38;5;235m'), ('color-236', '\x1b[38;5;236m'), ('color-237', '\x1b[38;5;237m'), ('color-238', '\x1b[38;5;238m'), ('color-239', '\x1b[38;5;239m'), ('color-240', '\x1b[38;5;240m'), ('color-241', '\x1b[38;5;241m'), ('color-242', '\x1b[38;5;242m'), ('color-243', '\x1b[38;5;243m'), ('color-244', '\x1b[38;5;244m'), ('color-245', '\x1b[38;5;245m'), ('color-246', '\x1b[38;5;246m'), ('color-247', '\x1b[38;5;247m'), ('color-248', '\x1b[38;5;248m'), ('color-249', '\x1b[38;5;249m'), ('color-250', '\x1b[38;5;250m'), ('color-251', '\x1b[38;5;251m'), ('color-252', '\x1b[38;5;252m'), ('color-253', '\x1b[38;5;253m'), ('color-254', '\x1b[38;5;254m'), ('color-255', '\x1b[38;5;255m')]</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.colorcodes" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.convert_linebreaks">
<code class="sig-name descname">convert_linebreaks</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.convert_linebreaks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.convert_linebreaks" title="Permalink to this definition"></a></dt>
<dd><p>Extra method for cleaning linebreaks</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>text</strong> (<em>str</em>) Text to process.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Processed text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.convert_urls">
<code class="sig-name descname">convert_urls</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.convert_urls"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.convert_urls" title="Permalink to this definition"></a></dt>
<dd><p>Replace urls (<a class="reference external" href="http://">http://</a>…) by valid HTML.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>text</strong> (<em>str</em>) Text to process.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Processed text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.fg_colormap">
<code class="sig-name descname">fg_colormap</code><em class="property"> = {'\x1b[1m\x1b[30m': 'color-008', '\x1b[1m\x1b[31m': 'color-009', '\x1b[1m\x1b[32m': 'color-010', '\x1b[1m\x1b[33m': 'color-011', '\x1b[1m\x1b[34m': 'color-012', '\x1b[1m\x1b[35m': 'color-013', '\x1b[1m\x1b[36m': 'color-014', '\x1b[1m\x1b[37m': 'color-015', '\x1b[22m\x1b[30m': 'color-000', '\x1b[22m\x1b[31m': 'color-001', '\x1b[22m\x1b[32m': 'color-002', '\x1b[22m\x1b[33m': 'color-003', '\x1b[22m\x1b[34m': 'color-004', '\x1b[22m\x1b[35m': 'color-005', '\x1b[22m\x1b[36m': 'color-006', '\x1b[22m\x1b[37m': 'color-007', '\x1b[38;5;100m': 'color-100', '\x1b[38;5;101m': 'color-101', '\x1b[38;5;102m': 'color-102', '\x1b[38;5;103m': 'color-103', '\x1b[38;5;104m': 'color-104', '\x1b[38;5;105m': 'color-105', '\x1b[38;5;106m': 'color-106', '\x1b[38;5;107m': 'color-107', '\x1b[38;5;108m': 'color-108', '\x1b[38;5;109m': 'color-109', '\x1b[38;5;110m': 'color-110', '\x1b[38;5;111m': 'color-111', '\x1b[38;5;112m': 'color-112', '\x1b[38;5;113m': 'color-113', '\x1b[38;5;114m': 'color-114', '\x1b[38;5;115m': 'color-115', '\x1b[38;5;116m': 'color-116', '\x1b[38;5;117m': 'color-117', '\x1b[38;5;118m': 'color-118', '\x1b[38;5;119m': 'color-119', '\x1b[38;5;120m': 'color-120', '\x1b[38;5;121m': 'color-121', '\x1b[38;5;122m': 'color-122', '\x1b[38;5;123m': 'color-123', '\x1b[38;5;124m': 'color-124', '\x1b[38;5;125m': 'color-125', '\x1b[38;5;126m': 'color-126', '\x1b[38;5;127m': 'color-127', '\x1b[38;5;128m': 'color-128', '\x1b[38;5;129m': 'color-129', '\x1b[38;5;130m': 'color-130', '\x1b[38;5;131m': 'color-131', '\x1b[38;5;132m': 'color-132', '\x1b[38;5;133m': 'color-133', '\x1b[38;5;134m': 'color-134', '\x1b[38;5;135m': 'color-135', '\x1b[38;5;136m': 'color-136', '\x1b[38;5;137m': 'color-137', '\x1b[38;5;138m': 'color-138', '\x1b[38;5;139m': 'color-139', '\x1b[38;5;140m': 'color-140', '\x1b[38;5;141m': 'color-141', '\x1b[38;5;142m': 'color-142', '\x1b[38;5;143m': 'color-143', '\x1b[38;5;144m': 'color-144', '\x1b[38;5;145m': 'color-145', '\x1b[38;5;146m': 'color-146', '\x1b[38;5;147m': 'color-147', '\x1b[38;5;148m': 'color-148', '\x1b[38;5;149m': 'color-149', '\x1b[38;5;150m': 'color-150', '\x1b[38;5;151m': 'color-151', '\x1b[38;5;152m': 'color-152', '\x1b[38;5;153m': 'color-153', '\x1b[38;5;154m': 'color-154', '\x1b[38;5;155m': 'color-155', '\x1b[38;5;156m': 'color-156', '\x1b[38;5;157m': 'color-157', '\x1b[38;5;158m': 'color-158', '\x1b[38;5;159m': 'color-159', '\x1b[38;5;160m': 'color-160', '\x1b[38;5;161m': 'color-161', '\x1b[38;5;162m': 'color-162', '\x1b[38;5;163m': 'color-163', '\x1b[38;5;164m': 'color-164', '\x1b[38;5;165m': 'color-165', '\x1b[38;5;166m': 'color-166', '\x1b[38;5;167m': 'color-167', '\x1b[38;5;168m': 'color-168', '\x1b[38;5;169m': 'color-169', '\x1b[38;5;16m': 'color-016', '\x1b[38;5;170m': 'color-170', '\x1b[38;5;171m': 'color-171', '\x1b[38;5;172m': 'color-172', '\x1b[38;5;173m': 'color-173', '\x1b[38;5;174m': 'color-174', '\x1b[38;5;175m': 'color-175', '\x1b[38;5;176m': 'color-176', '\x1b[38;5;177m': 'color-177', '\x1b[38;5;178m': 'color-178', '\x1b[38;5;179m': 'color-179', '\x1b[38;5;17m': 'color-017', '\x1b[38;5;180m': 'color-180', '\x1b[38;5;181m': 'color-181', '\x1b[38;5;182m': 'color-182', '\x1b[38;5;183m': 'color-183', '\x1b[38;5;184m': 'color-184', '\x1b[38;5;185m': 'color-185', '\x1b[38;5;186m': 'color-186', '\x1b[38;5;187m': 'color-187', '\x1b[38;5;188m': 'color-188', '\x1b[38;5;189m': 'color-189', '\x1b[38;5;18m': 'color-018', '\x1b[38;5;190m': 'color-190', '\x1b[38;5;191m': 'color-191', '\x1b[38;5;192m': 'color-192', '\x1b[38;5;193m': 'color-193', '\x1b[38;5;194m': 'color-194', '\x1b[38;5;195m': 'color-195', '\x1b[38;5;196m': 'color-196', '\x1b[38;5;197m': 'color-197', '\x1b[38;5;198m': 'color-198', '\x1b[38;5;199m': 'color-199', '\x1b[38;5;19m': 'color-019', '\x1b[38;5;200m': 'color-200', '\x1b[38;5;201m': 'color-201', '\x1b[38;5;202m': 'color-202', '\x1b[38;5;203m': 'color-203', '\x1b[38;5;204m': 'color-204', '\x1b[38;5;205m': 'color-205', '\x1b[38;5;206m': 'color-206', '\x1b[38;5;207m': 'color-207', '\x1b[38;5;208m': 'color-208', '\x1b[38;5;209m': 'color-209', '\x1b[38;5;20m': 'color-020', '\x1b[38;5;210m': 'color-210', '\x1b[38;5;211m': 'color-211', '\x1b[38;5;212m': 'color-212', '\x1b[38;5;213m': 'color-213', '\x1b[38;5;214m': 'color-214', '\x1b[38;5;215m': 'color-215', '\x1b[38;5;216m': 'color-216', '\x1b[38;5;217m': 'color-217', '\x1b[38;5;218m': 'color-218', '\x1b[38;5;219m': 'color-219', '\x1b[38;5;21m': 'color-021', '\x1b[38;5;220m': 'color-220', '\x1b[38;5;221m': 'color-221', '\x1b[38;5;222m': 'color-222', '\x1b[38;5;223m': 'color-223', '\x1b[38;5;224m': 'color-224', '\x1b[38;5;225m': 'color-225', '\x1b[38;5;226m': 'color-226', '\x1b[38;5;227m': 'color-227', '\x1b[38;5;228m': 'color-228', '\x1b[38;5;229m': 'color-229', '\x1b[38;5;22m': 'color-022', '\x1b[38;5;230m': 'color-230', '\x1b[38;5;231m': 'color-231', '\x1b[38;5;232m': 'color-232', '\x1b[38;5;233m': 'color-233', '\x1b[38;5;234m': 'color-234', '\x1b[38;5;235m': 'color-235', '\x1b[38;5;236m': 'color-236', '\x1b[38;5;237m': 'color-237', '\x1b[38;5;238m': 'color-238', '\x1b[38;5;239m': 'color-239', '\x1b[38;5;23m': 'color-023', '\x1b[38;5;240m': 'color-240', '\x1b[38;5;241m': 'color-241', '\x1b[38;5;242m': 'color-242', '\x1b[38;5;243m': 'color-243', '\x1b[38;5;244m': 'color-244', '\x1b[38;5;245m': 'color-245', '\x1b[38;5;246m': 'color-246', '\x1b[38;5;247m': 'color-247', '\x1b[38;5;248m': 'color-248', '\x1b[38;5;249m': 'color-249', '\x1b[38;5;24m': 'color-024', '\x1b[38;5;250m': 'color-250', '\x1b[38;5;251m': 'color-251', '\x1b[38;5;252m': 'color-252', '\x1b[38;5;253m': 'color-253', '\x1b[38;5;254m': 'color-254', '\x1b[38;5;255m': 'color-255', '\x1b[38;5;25m': 'color-025', '\x1b[38;5;26m': 'color-026', '\x1b[38;5;27m': 'color-027', '\x1b[38;5;28m': 'color-028', '\x1b[38;5;29m': 'color-029', '\x1b[38;5;30m': 'color-030', '\x1b[38;5;31m': 'color-031', '\x1b[38;5;32m': 'color-032', '\x1b[38;5;33m': 'color-033', '\x1b[38;5;34m': 'color-034', '\x1b[38;5;35m': 'color-035', '\x1b[38;5;36m': 'color-036', '\x1b[38;5;37m': 'color-037', '\x1b[38;5;38m': 'color-038', '\x1b[38;5;39m': 'color-039', '\x1b[38;5;40m': 'color-040', '\x1b[38;5;41m': 'color-041', '\x1b[38;5;42m': 'color-042', '\x1b[38;5;43m': 'color-043', '\x1b[38;5;44m': 'color-044', '\x1b[38;5;45m': 'color-045', '\x1b[38;5;46m': 'color-046', '\x1b[38;5;47m': 'color-047', '\x1b[38;5;48m': 'color-048', '\x1b[38;5;49m': 'color-049', '\x1b[38;5;50m': 'color-050', '\x1b[38;5;51m': 'color-051', '\x1b[38;5;52m': 'color-052', '\x1b[38;5;53m': 'color-053', '\x1b[38;5;54m': 'color-054', '\x1b[38;5;55m': 'color-055', '\x1b[38;5;56m': 'color-056', '\x1b[38;5;57m': 'color-057', '\x1b[38;5;58m': 'color-058', '\x1b[38;5;59m': 'color-059', '\x1b[38;5;60m': 'color-060', '\x1b[38;5;61m': 'color-061', '\x1b[38;5;62m': 'color-062', '\x1b[38;5;63m': 'color-063', '\x1b[38;5;64m': 'color-064', '\x1b[38;5;65m': 'color-065', '\x1b[38;5;66m': 'color-066', '\x1b[38;5;67m': 'color-067', '\x1b[38;5;68m': 'color-068', '\x1b[38;5;69m': 'color-069', '\x1b[38;5;70m': 'color-070', '\x1b[38;5;71m': 'color-071', '\x1b[38;5;72m': 'color-072', '\x1b[38;5;73m': 'color-073', '\x1b[38;5;74m': 'color-074', '\x1b[38;5;75m': 'color-075', '\x1b[38;5;76m': 'color-076', '\x1b[38;5;77m': 'color-077', '\x1b[38;5;78m': 'color-078', '\x1b[38;5;79m': 'color-079', '\x1b[38;5;80m': 'color-080', '\x1b[38;5;81m': 'color-081', '\x1b[38;5;82m': 'color-082', '\x1b[38;5;83m': 'color-083', '\x1b[38;5;84m': 'color-084', '\x1b[38;5;85m': 'color-085', '\x1b[38;5;86m': 'color-086', '\x1b[38;5;87m': 'color-087', '\x1b[38;5;88m': 'color-088', '\x1b[38;5;89m': 'color-089', '\x1b[38;5;90m': 'color-090', '\x1b[38;5;91m': 'color-091', '\x1b[38;5;92m': 'color-092', '\x1b[38;5;93m': 'color-093', '\x1b[38;5;94m': 'color-094', '\x1b[38;5;95m': 'color-095', '\x1b[38;5;96m': 'color-096', '\x1b[38;5;97m': 'color-097', '\x1b[38;5;98m': 'color-098', '\x1b[38;5;99m': 'color-099'}</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.fg_colormap" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.fgstart">
<code class="sig-name descname">fgstart</code><em class="property"> = '((?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[3[0-8].*?m)'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.fgstart" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.fgstop">
<code class="sig-name descname">fgstop</code><em class="property"> = '(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[3[0-8].*?m|\x1b\\[0m|$'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.fgstop" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.hilite">
<code class="sig-name descname">hilite</code><em class="property"> = '\x1b[1m'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.hilite" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.inverse">
<code class="sig-name descname">inverse</code><em class="property"> = '\x1b[7m'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.inverse" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.normal">
<code class="sig-name descname">normal</code><em class="property"> = '\x1b[0m'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.normal" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.parse">
<code class="sig-name descname">parse</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">strip_ansi=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.parse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.parse" title="Permalink to this definition"></a></dt>
<dd><p>Main access function, converts a text containing ANSI codes
into html statements.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em>) Text to process.</p></li>
<li><p><strong>strip_ansi</strong> (<em>bool</em><em>, </em><em>optional</em>) </p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Parsed text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_bgfg">
<code class="sig-name descname">re_bgfg</code><em class="property"> = re.compile('((?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m)(\\s*)((?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[[3-4][0-8].*?m){0,1}(.*?)(?=(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m|\x1b\\[0m(\\s*)(?:\x1b\\[1m|\x1b\)</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_bgfg" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_bgs">
<code class="sig-name descname">re_bgs</code><em class="property"> = re.compile('((?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m)(.*?)(?=(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m|\x1b\\[0m|$)')</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_bgs" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_blink">
<code class="sig-name descname">re_blink</code><em class="property"> = re.compile('(?:\x1b\\[5m)(.*?)(?=(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[3[0-8].*?m|\x1b\\[0m|$|(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m|\x1b\\[0m|$)')</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_blink" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_blinking">
<code class="sig-name descname">re_blinking</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.re_blinking"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_blinking" title="Permalink to this definition"></a></dt>
<dd><p>Replace ansi blink with custom blink css class</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>text</strong> (<em>str</em>) Text to process.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Processed text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_bold">
<code class="sig-name descname">re_bold</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.re_bold"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_bold" title="Permalink to this definition"></a></dt>
<dd><p>Clean out superfluous hilights rather than set &lt;strong&gt;to make
it match the look of telnet.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>text</strong> (<em>str</em>) Text to process.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Processed text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_color">
<code class="sig-name descname">re_color</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.re_color"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_color" title="Permalink to this definition"></a></dt>
<dd><p>Replace ansi colors with html color class names. Let the
client choose how it will display colors, if it wishes to.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>text</strong> (<em>str</em>) the string with color to replace.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Re-colored text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_dblspace">
<code class="sig-name descname">re_dblspace</code><em class="property"> = re.compile(' {2,}', re.MULTILINE)</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_dblspace" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_double_space">
<code class="sig-name descname">re_double_space</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.re_double_space"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_double_space" title="Permalink to this definition"></a></dt>
<dd><p>HTML will swallow any normal space after the first, so if any slipped
through we must make sure to replace them with ” &amp;nbsp;”</p>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_fgs">
<code class="sig-name descname">re_fgs</code><em class="property"> = re.compile('((?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[3[0-8].*?m)(.*?)(?=(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[3[0-8].*?m|\x1b\\[0m|$)')</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_fgs" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_hilite">
<code class="sig-name descname">re_hilite</code><em class="property"> = re.compile('(?:\x1b\\[1m)(.*)(?=(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[3[0-8].*?m|\x1b\\[0m|$|(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m|\x1b\\[0m|$)')</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_hilite" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_inverse">
<code class="sig-name descname">re_inverse</code><em class="property"> = re.compile('(?:\x1b\\[7m)(.*?)(?=(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[3[0-8].*?m|\x1b\\[0m|$|(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m|\x1b\\[0m|$)')</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_inverse" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_inversing">
<code class="sig-name descname">re_inversing</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.re_inversing"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_inversing" title="Permalink to this definition"></a></dt>
<dd><p>Replace ansi inverse with custom inverse css class</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>text</strong> (<em>str</em>) Text to process.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Processed text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_mxplink">
<code class="sig-name descname">re_mxplink</code><em class="property"> = re.compile('\\|lc(.*?)\\|lt(.*?)\\|le', re.DOTALL)</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_mxplink" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_normal">
<code class="sig-name descname">re_normal</code><em class="property"> = re.compile('\x1b\\[0m')</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_normal" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_string">
<code class="sig-name descname">re_string</code><em class="property"> = re.compile('(?P&lt;htmlchars&gt;[&lt;&amp;&gt;])|(?P&lt;firstspace&gt;(?&lt;=\\S) )|(?P&lt;space&gt; [ \\t]+)|(?P&lt;spacestart&gt;^ )|(?P&lt;lineend&gt;\\r\\n|\\r|\\n)', re.IGNORECASE|re.MULTILINE|re.DOTALL)</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_string" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_uline">
<code class="sig-name descname">re_uline</code><em class="property"> = re.compile('(?:\x1b\\[4m)(.*?)(?=(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[3[0-8].*?m|\x1b\\[0m|$|(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m|\x1b\\[0m|$)')</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_uline" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_underline">
<code class="sig-name descname">re_underline</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.re_underline"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_underline" title="Permalink to this definition"></a></dt>
<dd><p>Replace ansi underline with html underline class name.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>text</strong> (<em>str</em>) Text to process.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Processed text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_unhilite">
<code class="sig-name descname">re_unhilite</code><em class="property"> = re.compile('(?:\x1b\\[22m)(.*)(?=(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[3[0-8].*?m|\x1b\\[0m|$|(?:\x1b\\[1m|\x1b\\[22m){0,1}\x1b\\[4[0-8].*?m|\x1b\\[0m|$)')</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_unhilite" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.re_url">
<code class="sig-name descname">re_url</code><em class="property"> = re.compile('((?:ftp|www|https?)\\W+(?:(?!\\.(?:\\s|$)|&amp;\\w+;)[^&quot;\\\',;$*^\\\\(){}&lt;&gt;\\[\\]\\s])+)(\\.(?:\\s|$)|&amp;\\w+;|)')</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.re_url" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.remove_backspaces">
<code class="sig-name descname">remove_backspaces</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.remove_backspaces"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.remove_backspaces" title="Permalink to this definition"></a></dt>
<dd><p>Removes special escape sequences</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>text</strong> (<em>str</em>) Text to process.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Processed text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.remove_bells">
<code class="sig-name descname">remove_bells</code><span class="sig-paren">(</span><em class="sig-param">text</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.remove_bells"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.remove_bells" title="Permalink to this definition"></a></dt>
<dd><p>Remove ansi specials</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>text</strong> (<em>str</em>) Text to process.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Processed text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.sub_dblspace">
<code class="sig-name descname">sub_dblspace</code><span class="sig-paren">(</span><em class="sig-param">match</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.sub_dblspace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.sub_dblspace" title="Permalink to this definition"></a></dt>
<dd><p>clean up double-spaces</p>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.sub_mxp_links">
<code class="sig-name descname">sub_mxp_links</code><span class="sig-paren">(</span><em class="sig-param">match</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.sub_mxp_links"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.sub_mxp_links" title="Permalink to this definition"></a></dt>
<dd><p>Helper method to be passed to re.sub,
replaces MXP links with HTML code.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>match</strong> (<em>re.Matchobject</em>) Match for substitution.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Processed text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.text2html.TextToHTMLparser.sub_text">
<code class="sig-name descname">sub_text</code><span class="sig-paren">(</span><em class="sig-param">match</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#TextToHTMLparser.sub_text"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.sub_text" title="Permalink to this definition"></a></dt>
<dd><p>Helper method to be passed to re.sub,
for handling all substitutions.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>match</strong> (<em>re.Matchobject</em>) Match for substitution.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Processed text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.tabstop">
<code class="sig-name descname">tabstop</code><em class="property"> = 4</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.tabstop" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.underline">
<code class="sig-name descname">underline</code><em class="property"> = '\x1b[4m'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.underline" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="evennia.utils.text2html.TextToHTMLparser.unhilite">
<code class="sig-name descname">unhilite</code><em class="property"> = '\x1b[22m'</em><a class="headerlink" href="#evennia.utils.text2html.TextToHTMLparser.unhilite" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.text2html.parse_html">
<code class="sig-prename descclassname">evennia.utils.text2html.</code><code class="sig-name descname">parse_html</code><span class="sig-paren">(</span><em class="sig-param">string</em>, <em class="sig-param">strip_ansi=False</em>, <em class="sig-param">parser=&lt;evennia.utils.text2html.TextToHTMLparser object&gt;</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/text2html.html#parse_html"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.text2html.parse_html" title="Permalink to this definition"></a></dt>
<dd><p>Parses a string, replace ANSI markup with html</p>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.utils">
<span id="evennia-utils-utils-module"></span><h2>evennia.utils.utils module<a class="headerlink" href="#module-evennia.utils.utils" title="Permalink to this headline"></a></h2>
<p>General helper functions that dont fit neatly under any given category.</p>
<p>They provide some useful string and conversion methods that might
be of use when designing your own game.</p>
<dl class="class">
<dt id="evennia.utils.utils.LimitedSizeOrderedDict">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">LimitedSizeOrderedDict</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#LimitedSizeOrderedDict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.LimitedSizeOrderedDict" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">collections.OrderedDict</span></code></p>
<p>This dictionary subclass is both ordered and limited to a maximum
number of elements. Its main use is to hold a cache that can never
grow out of bounds.</p>
<dl class="method">
<dt id="evennia.utils.utils.LimitedSizeOrderedDict.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#LimitedSizeOrderedDict.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.LimitedSizeOrderedDict.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Limited-size ordered dict.</p>
<dl class="simple">
<dt>Kwargs:</dt><dd><dl class="simple">
<dt>size_limit (int): Use this to limit the number of elements</dt><dd><p>alloweds to be in this list. By default the overshooting elements
will be removed in FIFO order.</p>
</dd>
<dt>fifo (bool, optional): Defaults to <cite>True</cite>. Remove overshooting elements</dt><dd><p>in FIFO order. If <cite>False</cite>, remove in FILO order.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="evennia.utils.utils.LimitedSizeOrderedDict._check_size">
<code class="sig-name descname">_check_size</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#LimitedSizeOrderedDict._check_size"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.LimitedSizeOrderedDict._check_size" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="evennia.utils.utils.LimitedSizeOrderedDict.update">
<code class="sig-name descname">update</code><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param">E</em>, <span class="optional">]</span><em class="sig-param">**F</em><span class="sig-paren">)</span> &#x2192; None. Update D from dict/iterable E and F.<a class="reference internal" href="../_modules/evennia/utils/utils.html#LimitedSizeOrderedDict.update"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.LimitedSizeOrderedDict.update" title="Permalink to this definition"></a></dt>
<dd><p>If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils._DA">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">_DA</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.utils._DA" title="Permalink to this definition"></a></dt>
<dd><p>Implement delattr(self, name).</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils._GA">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">_GA</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.utils._GA" title="Permalink to this definition"></a></dt>
<dd><p>Return getattr(self, name).</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils._SA">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">_SA</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.utils._SA" title="Permalink to this definition"></a></dt>
<dd><p>Implement setattr(self, name, value).</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.all_from_module">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">all_from_module</code><span class="sig-paren">(</span><em class="sig-param">module</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#all_from_module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.all_from_module" title="Permalink to this definition"></a></dt>
<dd><p>Return all global-level variables defined in a module.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>module</strong> (<em>str</em><em>, </em><em>module</em>) This can be either a Python path
(dot-notation like <cite>evennia.objects.models</cite>), an absolute path
(e.g. <cite>/home/eve/evennia/evennia/objects.models.py</cite>) or an
already imported module object (e.g. <cite>models</cite>)</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A dict of {variablename: variable} for all</dt><dd><p>variables in the given module.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>variables (dict)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Ignores modules and variable names starting with an underscore.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.at_search_result">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">at_search_result</code><span class="sig-paren">(</span><em class="sig-param">matches</em>, <em class="sig-param">caller</em>, <em class="sig-param">query=''</em>, <em class="sig-param">quiet=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#at_search_result"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.at_search_result" title="Permalink to this definition"></a></dt>
<dd><p>This is a generic hook for handling all processing of a search
result, including error reporting. This is also called by the cmdhandler
to manage errors in command lookup.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>matches</strong> (<em>list</em>) This is a list of 0, 1 or more typeclass
instances or Command instances, the matched result of the
search. If 0, a nomatch error should be echoed, and if &gt;1,
multimatch errors should be given. Only if a single match
should the result pass through.</p></li>
<li><p><strong>caller</strong> (<em>Object</em>) The object performing the search and/or which should</p></li>
<li><p><strong>error messages.</strong> (<em>receive</em>) </p></li>
<li><p><strong>query</strong> (<em>str</em><em>, </em><em>optional</em>) The search query used to produce <cite>matches</cite>.</p></li>
<li><p><strong>quiet</strong> (<em>bool</em><em>, </em><em>optional</em>) If <cite>True</cite>, no messages will be echoed to caller
on errors.</p></li>
</ul>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><p>nofound_string (str): Replacement string to echo on a notfound error.
multimatch_string (str): Replacement string to echo on a multimatch error.</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><dl class="simple">
<dt>This is always a single result</dt><dd><p>or <cite>None</cite>. If <cite>None</cite>, any error reporting/handling should
already have happened. The returned object is of the type we are
checking multimatches for (e.g. Objects or Commands)</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>processed_result (Object or None)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.callables_from_module">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">callables_from_module</code><span class="sig-paren">(</span><em class="sig-param">module</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#callables_from_module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.callables_from_module" title="Permalink to this definition"></a></dt>
<dd><p>Return all global-level callables defined in a module.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>module</strong> (<em>str</em><em>, </em><em>module</em>) A python-path to a module or an actual
module object.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A dict of {name: callable, …} from the module.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>callables (dict)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Will ignore callables whose names start with underscore “_”.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.calledby">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">calledby</code><span class="sig-paren">(</span><em class="sig-param">callerdepth=1</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#calledby"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.calledby" title="Permalink to this definition"></a></dt>
<dd><p>Only to be used for debug purposes. Insert this debug function in
another function; it will print which function called it.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>callerdepth</strong> (<em>int</em>) Must be larger than 0. When &gt; 1, it will
print the caller of the caller etc.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A debug string detailing which routine called</dt><dd><p>us.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>calledby (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.check_evennia_dependencies">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">check_evennia_dependencies</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#check_evennia_dependencies"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.check_evennia_dependencies" title="Permalink to this definition"></a></dt>
<dd><p>Checks the versions of Evennias dependencies including making
some checks for runtime libraries.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><dl class="simple">
<dt><cite>False</cite> if a show-stopping version mismatch is</dt><dd><p>found.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>result (bool)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.class_from_module">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">class_from_module</code><span class="sig-paren">(</span><em class="sig-param">path</em>, <em class="sig-param">defaultpaths=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#class_from_module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.class_from_module" title="Permalink to this definition"></a></dt>
<dd><p>Return a class from a module, given the modules path. This is
primarily used to convert db_typeclass_path:s to classes.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>path</strong> (<em>str</em>) Full Python dot-path to module.</p></li>
<li><p><strong>defaultpaths</strong> (<em>iterable</em><em>, </em><em>optional</em>) If a direct import from <cite>path</cite> fails,
try subsequent imports by prepending those paths to <cite>path</cite>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>An uninstatiated class recovered from path.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>class (Class)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>ImportError</strong> If all loading failed.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.columnize">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">columnize</code><span class="sig-paren">(</span><em class="sig-param">string</em>, <em class="sig-param">columns=2</em>, <em class="sig-param">spacing=4</em>, <em class="sig-param">align='l'</em>, <em class="sig-param">width=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#columnize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.columnize" title="Permalink to this definition"></a></dt>
<dd><p>Break a string into a number of columns, using as little
vertical space as possible.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> (<em>str</em>) The string to columnize.</p></li>
<li><p><strong>columns</strong> (<em>int</em><em>, </em><em>optional</em>) The number of columns to use.</p></li>
<li><p><strong>spacing</strong> (<em>int</em><em>, </em><em>optional</em>) How much space to have between columns.</p></li>
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) The max width of the columns.
Defaults to clients default width.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Text divided into columns.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>columns (str)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>RuntimeError</strong> If given invalid values.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.crop">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">crop</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">width=None</em>, <em class="sig-param">suffix='[...]'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#crop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.crop" title="Permalink to this definition"></a></dt>
<dd><p>Crop text to a certain width, throwing away text from too-long
lines.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em>) Text to crop.</p></li>
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) Width of line to crop, in characters.</p></li>
<li><p><strong>suffix</strong> (<em>str</em><em>, </em><em>optional</em>) This is appended to the end of cropped
lines to show that the line actually continues. Cropping
will be done so that the suffix will also fit within the
given width. If width is too small to fit both crop and
suffix, the suffix will be dropped.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The cropped text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.datetime_format">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">datetime_format</code><span class="sig-paren">(</span><em class="sig-param">dtobj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#datetime_format"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.datetime_format" title="Permalink to this definition"></a></dt>
<dd><p>Pretty-prints the time since a given time.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>dtobj</strong> (<em>datetime</em>) An datetime object, e.g. from Djangos
<cite>DateTimeField</cite>.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A string describing how long ago <cite>dtobj</cite></dt><dd><p>took place.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>deltatime (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.dbid_to_obj">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">dbid_to_obj</code><span class="sig-paren">(</span><em class="sig-param">inp</em>, <em class="sig-param">objclass</em>, <em class="sig-param">raise_errors=True</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.utils.dbid_to_obj" title="Permalink to this definition"></a></dt>
<dd><p>Convert a #dbref to a valid object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inp</strong> (<em>str</em><em> or </em><em>int</em>) A valid #dbref.</p></li>
<li><p><strong>objclass</strong> (<em>class</em>) A valid django model to filter against.</p></li>
<li><p><strong>raise_errors</strong> (<em>bool</em><em>, </em><em>optional</em>) Whether to raise errors
or return <cite>None</cite> on errors.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>An entity loaded from the dbref.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>obj (Object or None)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>Exception</strong> If <cite>raise_errors</cite> is <cite>True</cite> and
<cite>objclass.objects.get(id=dbref)</cite> did not return a valid
object.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.dbref">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">dbref</code><span class="sig-paren">(</span><em class="sig-param">inp</em>, <em class="sig-param">reqhash=True</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#dbref"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.dbref" title="Permalink to this definition"></a></dt>
<dd><p>Converts/checks if input is a valid dbref.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inp</strong> (<em>int</em><em>, </em><em>str</em>) A database ref on the form N or #N.</p></li>
<li><p><strong>reqhash</strong> (<em>bool</em><em>, </em><em>optional</em>) Require the #N form to accept
input as a valid dbref.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>The integer part of the dbref or <cite>None</cite></dt><dd><p>if input was not a valid dbref.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>dbref (int or None)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.dbref_to_obj">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">dbref_to_obj</code><span class="sig-paren">(</span><em class="sig-param">inp</em>, <em class="sig-param">objclass</em>, <em class="sig-param">raise_errors=True</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#dbref_to_obj"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.dbref_to_obj" title="Permalink to this definition"></a></dt>
<dd><p>Convert a #dbref to a valid object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inp</strong> (<em>str</em><em> or </em><em>int</em>) A valid #dbref.</p></li>
<li><p><strong>objclass</strong> (<em>class</em>) A valid django model to filter against.</p></li>
<li><p><strong>raise_errors</strong> (<em>bool</em><em>, </em><em>optional</em>) Whether to raise errors
or return <cite>None</cite> on errors.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>An entity loaded from the dbref.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>obj (Object or None)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>Exception</strong> If <cite>raise_errors</cite> is <cite>True</cite> and
<cite>objclass.objects.get(id=dbref)</cite> did not return a valid
object.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.dedent">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">dedent</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">baseline_index=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#dedent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.dedent" title="Permalink to this definition"></a></dt>
<dd><p>Safely clean all whitespace at the left of a paragraph.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em>) The text to dedent.</p></li>
<li><p><strong>baseline_index</strong> (<em>int</em><em> or </em><em>None</em><em>, </em><em>optional</em>) Which row to use as a base
for the indentation. Lines will be dedented to this level but
no further. If None, indent so as to completely deindent the
least indented text.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Dedented string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>This is useful for preserving triple-quoted string indentation
while still shifting it all to be next to the left edge of the
display.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.deepsize">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">deepsize</code><span class="sig-paren">(</span><em class="sig-param">obj</em>, <em class="sig-param">max_depth=4</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#deepsize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.deepsize" title="Permalink to this definition"></a></dt>
<dd><p>Get not only size of the given object, but also the size of
objects referenced by the object, down to <cite>max_depth</cite> distance
from the object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>obj</strong> (<em>object</em>) the object to be measured.</p></li>
<li><p><strong>max_depth</strong> (<em>int</em><em>, </em><em>optional</em>) maximum referential distance
from <cite>obj</cite> that <cite>deepsize()</cite> should cover for
measuring objects referenced by <cite>obj</cite>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>deepsize of <cite>obj</cite> in Bytes.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>size (int)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>This measure is necessarily approximate since some
memory is shared between objects. The <cite>max_depth</cite> of 4 is roughly
tested to give reasonable size information about database models
and their handlers.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.delay">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">delay</code><span class="sig-paren">(</span><em class="sig-param">timedelay</em>, <em class="sig-param">callback</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#delay"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.delay" title="Permalink to this definition"></a></dt>
<dd><p>Delay the return of a value.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timedelay</strong> (<em>int</em><em> or </em><em>float</em>) The delay in seconds</p></li>
<li><p><strong>callback</strong> (<em>callable</em>) Will be called as <cite>callback(*args, **kwargs)</cite>
after <cite>timedelay</cite> seconds.</p></li>
<li><p><strong>args</strong> (<em>any</em><em>, </em><em>optional</em>) Will be used as arguments to callback</p></li>
</ul>
</dd>
</dl>
<dl>
<dt>Kwargs:</dt><dd><dl class="simple">
<dt>persistent (bool, optional): should make the delay persistent</dt><dd><p>over a reboot or reload</p>
</dd>
</dl>
<p>any (any): Will be used as keyword arguments to callback.</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><dl class="simple">
<dt>Will fire with callback after</dt><dd><p><cite>timedelay</cite> seconds. Note that if <cite>timedelay()</cite> is used in the
commandhandler callback chain, the callback chain can be
defined directly in the command body and dont need to be
specified here.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>deferred (deferred)</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The task handler (<cite>evennia.scripts.taskhandler.TASK_HANDLER</cite>) will
be called for persistent or non-persistent tasks.
If persistent is set to True, the callback, its arguments
and other keyword arguments will be saved in the database,
assuming they can be. The callback will be executed even after
a server restart/reload, taking into account the specified delay
(and server down time).</p>
</div>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.fill">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">fill</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">width=None</em>, <em class="sig-param">indent=0</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.utils.fill" title="Permalink to this definition"></a></dt>
<dd><p>Safely wrap text to a certain number of characters.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em>) The text to wrap.</p></li>
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) The number of characters to wrap to.</p></li>
<li><p><strong>indent</strong> (<em>int</em>) How much to indent each line (with whitespace).</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Properly wrapped text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.format_grid">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">format_grid</code><span class="sig-paren">(</span><em class="sig-param">elements</em>, <em class="sig-param">width=78</em>, <em class="sig-param">sep=' '</em>, <em class="sig-param">verbatim_elements=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#format_grid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.format_grid" title="Permalink to this definition"></a></dt>
<dd><p>This helper function makes a grid output, where it distributes the given
string-elements as evenly as possible to fill out the given width.
will not work well if the variation of length is very big!</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>elements</strong> (<em>iterable</em>) A 1D list of string elements to put in the grid.</p></li>
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) The width of the grid area to fill.</p></li>
<li><p><strong>sep</strong> (<em>str</em><em>, </em><em>optional</em>) The extra separator to put between words. If
set to the empty string, words may run into each other.</p></li>
<li><p><strong>verbatim_elements</strong> (<em>list</em><em>, </em><em>optional</em>) This is a list of indices pointing to
specific items in the <cite>elements</cite> list. An element at this index will
not be included in the calculation of the slot sizes. It will still
be inserted into the grid at the correct position and may be surrounded
by padding unless filling the entire line. This is useful for embedding
decorations in the grid, such as horizontal bars.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>The grid as a list of ready-formatted rows. We return it</dt><dd><p>like this to make it easier to insert decorations between rows, such
as horizontal bars.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>gridstr (list)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.format_table">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">format_table</code><span class="sig-paren">(</span><em class="sig-param">table</em>, <em class="sig-param">extra_space=1</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#format_table"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.format_table" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>Note: <cite>evennia.utils.evtable</cite> is more powerful than this, but this
function can be useful when the number of columns and rows are
unknown and must be calculated on the fly.</p>
<dl class="simple">
<dt>Args.</dt><dd><dl class="simple">
<dt>table (list): A list of lists to represent columns in the</dt><dd><p>table: <cite>[[val,val,val,…], [val,val,val,…], …]</cite>, where
each val will be placed on a separate row in the
column. All columns must have the same number of rows (some
positions may be empty though).</p>
</dd>
<dt>extra_space (int, optional): Sets how much <em>minimum</em> extra</dt><dd><p>padding (in characters) should be left between columns.</p>
</dd>
</dl>
</dd>
<dt>Returns:</dt><dd><dl class="simple">
<dt>table (list): A list of lists representing the rows to print</dt><dd><p>out one by one.</p>
</dd>
</dl>
</dd>
<dt>Notes:</dt><dd><p>The function formats the columns to be as wide as the widest member
of each column.</p>
</dd>
</dl>
<p>Examples:</p>
<blockquote>
<div><p><a href="#id183"><span class="problematic" id="id184">``</span></a><a href="#id185"><span class="problematic" id="id186">`</span></a>python
ftable = format_table([[…], […], …])
for ir, row in enumarate(ftable):</p>
<blockquote>
<div><dl class="simple">
<dt>if ir == 0:</dt><dd><p># make first row white
string += “</p>
</dd>
</dl>
</div></blockquote>
</div></blockquote>
</div></blockquote>
<dl>
<dt><a href="#id187"><span class="problematic" id="id188">|</span></a>w” + “”join(row) + “<a href="#id189"><span class="problematic" id="id190">|</span></a>n”</dt><dd><dl class="simple">
<dt>else:</dt><dd><p>string += “</p>
</dd>
</dl>
</dd>
<dt>” + “”.join(row)</dt><dd><blockquote>
<div><p>print string</p>
</div></blockquote>
<p><a href="#id191"><span class="problematic" id="id192">``</span></a><a href="#id193"><span class="problematic" id="id194">`</span></a></p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.fuzzy_import_from_module">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">fuzzy_import_from_module</code><span class="sig-paren">(</span><em class="sig-param">path</em>, <em class="sig-param">variable</em>, <em class="sig-param">default=None</em>, <em class="sig-param">defaultpaths=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#fuzzy_import_from_module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.fuzzy_import_from_module" title="Permalink to this definition"></a></dt>
<dd><p>Import a variable based on a fuzzy path. First the literal
<cite>path</cite> will be tried, then all given <cite>defaultpaths</cite> will be
prepended to see a match is found.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>path</strong> (<em>str</em>) Full or partial python path.</p></li>
<li><p><strong>variable</strong> (<em>str</em>) Name of variable to import from module.</p></li>
<li><p><strong>default</strong> (<em>string</em><em>, </em><em>optional</em>) Default value to use if a variable fails to
be extracted. Ignored if <cite>variable</cite> is not given.</p></li>
<li><p><strong>defaultpaths</strong> (<em>iterable</em><em>, </em><em>options</em>) Python paths to attempt in order if
importing directly from <cite>path</cite> doesnt work.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>The variable imported from the module, or <cite>default</cite>, if</dt><dd><p>not found.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>value (any)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.get_all_typeclasses">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">get_all_typeclasses</code><span class="sig-paren">(</span><em class="sig-param">parent=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#get_all_typeclasses"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.get_all_typeclasses" title="Permalink to this definition"></a></dt>
<dd><p>List available typeclasses from all available modules.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>parent</strong> (<em>str</em><em>, </em><em>optional</em>) If given, only return typeclasses inheriting (at any distance)
from this parent.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>On the form {“typeclass.path”: typeclass, …}</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>typeclasses (dict)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>This will dynamicall retrieve all abstract django models inheriting at any distance
from the TypedObject base (aka a Typeclass) so it will work fine with any custom
classes being added.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.get_evennia_pids">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">get_evennia_pids</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#get_evennia_pids"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.get_evennia_pids" title="Permalink to this definition"></a></dt>
<dd><p>Get the currently valid PIDs (Process IDs) of the Portal and
Server by trying to access a PID file.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><dl class="simple">
<dt>The PIDs of the respective processes,</dt><dd><p>or two <cite>None</cite> values if not found.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>server, portal (tuple)</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>This can be used to determine if we are in a subprocess by
something like:</p>
<p><code class="docutils literal notranslate"><span class="pre">`python</span>
<span class="pre">self_pid</span> <span class="pre">=</span> <span class="pre">os.getpid()</span>
<span class="pre">server_pid,</span> <span class="pre">portal_pid</span> <span class="pre">=</span> <span class="pre">get_evennia_pids()</span>
<span class="pre">is_subprocess</span> <span class="pre">=</span> <span class="pre">self_pid</span> <span class="pre">not</span> <span class="pre">in</span> <span class="pre">(server_pid,</span> <span class="pre">portal_pid)</span>
<span class="pre">`</span></code></p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.get_evennia_version">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">get_evennia_version</code><span class="sig-paren">(</span><em class="sig-param">mode='long'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#get_evennia_version"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.get_evennia_version" title="Permalink to this definition"></a></dt>
<dd><p>Helper method for getting the current evennia version.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>mode</strong> (<em>str</em><em>, </em><em>optional</em>) One of:
- long: 0.9.0 rev342453534
- short: 0.9.0
- pretty: Evennia 0.9.0</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The version string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>version (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.get_game_dir_path">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">get_game_dir_path</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#get_game_dir_path"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.get_game_dir_path" title="Permalink to this definition"></a></dt>
<dd><p>This is called by settings_default in order to determine the path
of the game directory.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Full OS path to the game dir</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>path (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.has_parent">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">has_parent</code><span class="sig-paren">(</span><em class="sig-param">basepath</em>, <em class="sig-param">obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#has_parent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.has_parent" title="Permalink to this definition"></a></dt>
<dd><p>Checks if <cite>basepath</cite> is somewhere in <a href="#id195"><span class="problematic" id="id196">`</span></a>obj`s parent tree.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>basepath</strong> (<em>str</em>) Python dotpath to compare against obj path.</p></li>
<li><p><strong>obj</strong> (<em>any</em>) Object whose path is to be checked.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If the check was successful or not.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>has_parent (bool)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.host_os_is">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">host_os_is</code><span class="sig-paren">(</span><em class="sig-param">osname</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#host_os_is"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.host_os_is" title="Permalink to this definition"></a></dt>
<dd><p>Check to see if the host OS matches the query.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>osname</strong> (<em>str</em>) Common names are “posix” (linux/unix/mac) and
“nt” (windows).</p></li>
<li><p><strong>is_os</strong> (<em>bool</em>) If the os matches or not.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.inherits_from">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">inherits_from</code><span class="sig-paren">(</span><em class="sig-param">obj</em>, <em class="sig-param">parent</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#inherits_from"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.inherits_from" title="Permalink to this definition"></a></dt>
<dd><p>Takes an object and tries to determine if it inherits at <em>any</em>
distance from parent.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>obj</strong> (<em>any</em>) Object to analyze. This may be either an instance
or a class.</p></li>
<li><p><strong>parent</strong> (<em>any</em>) Can be either instance, class or python path to class.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If <cite>parent</cite> is a parent to <cite>obj</cite> or not.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>inherits_from (bool)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>What differs this function from e.g. <cite>isinstance()</cite> is that <cite>obj</cite>
may be both an instance and a class, and parent may be an
instance, a class, or the python path to a class (counting from
the evennia root directory).</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.init_new_account">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">init_new_account</code><span class="sig-paren">(</span><em class="sig-param">account</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#init_new_account"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.init_new_account" title="Permalink to this definition"></a></dt>
<dd><p>Deprecated.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.interactive">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">interactive</code><span class="sig-paren">(</span><em class="sig-param">func</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#interactive"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.interactive" title="Permalink to this definition"></a></dt>
<dd><p>Decorator to make a method pausable with yield(seconds)
and able to ask for user-input with response=yield(question).
For the question-asking to work, caller must the name
of an argument or kwarg to the decorated function.</p>
<p>Note that this turns the method into a generator.</p>
<p>Example usage:</p>
<p>&#64;interactive
def myfunc(caller):</p>
<blockquote>
<div><p>caller.msg(“This is a test”)
# wait five seconds
yield(5)
# ask user (caller) a question
response = yield(“Do you want to continue waiting?”)
if response == “yes”:</p>
<blockquote>
<div><p>yield(5)</p>
</div></blockquote>
<dl class="simple">
<dt>else:</dt><dd><p># …</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.is_iter">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">is_iter</code><span class="sig-paren">(</span><em class="sig-param">obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#is_iter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.is_iter" title="Permalink to this definition"></a></dt>
<dd><p>Checks if an object behaves iterably.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>obj</strong> (<em>any</em>) Entity to check for iterability.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If <cite>obj</cite> is iterable or not.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>is_iterable (bool)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Strings are <em>not</em> accepted as iterable (although they are
actually iterable), since string iterations are usually not
what we want to do with a string.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.justify">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">justify</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">width=None</em>, <em class="sig-param">align='f'</em>, <em class="sig-param">indent=0</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#justify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.justify" title="Permalink to this definition"></a></dt>
<dd><p>Fully justify a text so that it fits inside <cite>width</cite>. When using
full justification (default) this will be done by padding between
words with extra whitespace where necessary. Paragraphs will
be retained.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em>) Text to justify.</p></li>
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) The length of each line, in characters.</p></li>
<li><p><strong>align</strong> (<em>str</em><em>, </em><em>optional</em>) The alignment, l, c, r or f
for left, center, right or full justification respectively.</p></li>
<li><p><strong>indent</strong> (<em>int</em><em>, </em><em>optional</em>) Number of characters indentation of
entire justified text block.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The justified and indented block of text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>justified (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.latinify">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">latinify</code><span class="sig-paren">(</span><em class="sig-param">string</em>, <em class="sig-param">default='?'</em>, <em class="sig-param">pure_ascii=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#latinify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.latinify" title="Permalink to this definition"></a></dt>
<dd><p>Convert a unicode string to “safe” ascii/latin-1 characters.
This is used as a last resort when normal encoding does not work.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> (<em>str</em>) A string to convert to safe characters convertable
to an latin-1 bytestring later.</p></li>
<li><p><strong>default</strong> (<em>str</em><em>, </em><em>optional</em>) Characters resisting mapping will be replaced
with this character or string. The intent is to apply an encode operation
on the string soon after.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A latinified string where each unicode character has been</dt><dd><p>replaced with a safe equivalent available in the ascii/latin-1 charset.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>string (str)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<dl class="simple">
<dt>This is inspired by the gist by Ricardo Murri:</dt><dd><p><a class="reference external" href="https://gist.github.com/riccardomurri/3c3ccec30f037be174d3">https://gist.github.com/riccardomurri/3c3ccec30f037be174d3</a></p>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="evennia.utils.utils.lazy_property">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">lazy_property</code><span class="sig-paren">(</span><em class="sig-param">func</em>, <em class="sig-param">name=None</em>, <em class="sig-param">doc=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#lazy_property"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.lazy_property" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Delays loading of property until first access. Credit goes to the
Implementation in the werkzeug suite:
<a class="reference external" href="http://werkzeug.pocoo.org/docs/utils/#werkzeug.utils.cached_property">http://werkzeug.pocoo.org/docs/utils/#werkzeug.utils.cached_property</a></p>
<p>This should be used as a decorator in a class and in Evennia is
mainly used to lazy-load handlers:</p>
<blockquote>
<div><p><a href="#id197"><span class="problematic" id="id198">``</span></a><a href="#id199"><span class="problematic" id="id200">`</span></a>python
&#64;lazy_property
def attributes(self):</p>
<blockquote>
<div><p>return AttributeHandler(self)</p>
</div></blockquote>
<p><a href="#id201"><span class="problematic" id="id202">``</span></a><a href="#id203"><span class="problematic" id="id204">`</span></a></p>
</div></blockquote>
<p>Once initialized, the <cite>AttributeHandler</cite> will be available as a
property “attributes” on the object.</p>
<dl class="method">
<dt id="evennia.utils.utils.lazy_property.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">func</em>, <em class="sig-param">name=None</em>, <em class="sig-param">doc=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#lazy_property.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.lazy_property.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Store all properties for now</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.list_to_string">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">list_to_string</code><span class="sig-paren">(</span><em class="sig-param">inlist</em>, <em class="sig-param">endsep='and'</em>, <em class="sig-param">addquote=False</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#list_to_string"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.list_to_string" title="Permalink to this definition"></a></dt>
<dd><p>This pretty-formats a list as string output, adding an optional
alternative separator to the second to last entry. If <cite>addquote</cite>
is <cite>True</cite>, the outgoing strings will be surrounded by quotes.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inlist</strong> (<em>list</em>) The list to print.</p></li>
<li><p><strong>endsep</strong> (<em>str</em><em>, </em><em>optional</em>) If set, the last item separator will
be replaced with this value.</p></li>
<li><p><strong>addquote</strong> (<em>bool</em><em>, </em><em>optional</em>) This will surround all outgoing
values with double quotes.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The list represented as a string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>liststr (str)</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<dl class="simple">
<dt><a href="#id205"><span class="problematic" id="id206">``</span></a><a href="#id207"><span class="problematic" id="id208">`</span></a>python</dt><dd><dl class="simple">
<dt># no endsep:</dt><dd><p>[1,2,3] -&gt; 1, 2, 3</p>
</dd>
<dt># with endsep==and:</dt><dd><p>[1,2,3] -&gt; 1, 2 and 3</p>
</dd>
<dt># with addquote and endsep</dt><dd><p>[1,2,3] -&gt; “1”, “2” and “3”</p>
</dd>
</dl>
</dd>
</dl>
<p><a href="#id209"><span class="problematic" id="id210">``</span></a><a href="#id211"><span class="problematic" id="id212">`</span></a></p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.m_len">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">m_len</code><span class="sig-paren">(</span><em class="sig-param">target</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#m_len"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.m_len" title="Permalink to this definition"></a></dt>
<dd><p>Provides length checking for strings with MXP patterns, and falls
back to normal len for other objects.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>target</strong> (<em>string</em>) A string with potential MXP components
to search.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The length of <cite>target</cite>, ignoring MXP components.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>length (int)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.make_iter">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">make_iter</code><span class="sig-paren">(</span><em class="sig-param">obj</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#make_iter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.make_iter" title="Permalink to this definition"></a></dt>
<dd><p>Makes sure that the object is always iterable.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>obj</strong> (<em>any</em>) Object to make iterable.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>The same object</dt><dd><p>passed-through or made iterable.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>iterable (list or iterable)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.mod_import">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">mod_import</code><span class="sig-paren">(</span><em class="sig-param">module</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#mod_import"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.mod_import" title="Permalink to this definition"></a></dt>
<dd><p>A generic Python module loader.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>module</strong> (<em>str</em><em>, </em><em>module</em>) This can be either a Python path
(dot-notation like <cite>evennia.objects.models</cite>), an absolute path
(e.g. <cite>/home/eve/evennia/evennia/objects/models.py</cite>) or an
already imported module object (e.g. <cite>models</cite>)</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>An imported module. If the input argument was
already a module, this is returned as-is, otherwise the path is
parsed and imported. Returns <cite>None</cite> and logs error if import failed.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(module or None)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.mod_import_from_path">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">mod_import_from_path</code><span class="sig-paren">(</span><em class="sig-param">path</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#mod_import_from_path"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.mod_import_from_path" title="Permalink to this definition"></a></dt>
<dd><p>Load a Python module at the specified path.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>path</strong> (<em>str</em>) An absolute path to a Python module to load.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>An imported module if the path was a valid
Python module. Returns <cite>None</cite> if the import failed.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(module or None)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.object_from_module">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">object_from_module</code><span class="sig-paren">(</span><em class="sig-param">path</em>, <em class="sig-param">defaultpaths=None</em><span class="sig-paren">)</span><a class="headerlink" href="#evennia.utils.utils.object_from_module" title="Permalink to this definition"></a></dt>
<dd><p>Return a class from a module, given the modules path. This is
primarily used to convert db_typeclass_path:s to classes.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>path</strong> (<em>str</em>) Full Python dot-path to module.</p></li>
<li><p><strong>defaultpaths</strong> (<em>iterable</em><em>, </em><em>optional</em>) If a direct import from <cite>path</cite> fails,
try subsequent imports by prepending those paths to <cite>path</cite>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>An uninstatiated class recovered from path.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>class (Class)</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>ImportError</strong> If all loading failed.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.pad">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">pad</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">width=None</em>, <em class="sig-param">align='c'</em>, <em class="sig-param">fillchar=' '</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#pad"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.pad" title="Permalink to this definition"></a></dt>
<dd><p>Pads to a given width.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em>) Text to pad.</p></li>
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) The width to pad to, in characters.</p></li>
<li><p><strong>align</strong> (<em>str</em><em>, </em><em>optional</em>) This is one of c, l or r (center,
left or right).</p></li>
<li><p><strong>fillchar</strong> (<em>str</em><em>, </em><em>optional</em>) The character to fill with.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The padded text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.percent">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">percent</code><span class="sig-paren">(</span><em class="sig-param">value</em>, <em class="sig-param">minval</em>, <em class="sig-param">maxval</em>, <em class="sig-param">formatting='{:3.1f}%'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#percent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.percent" title="Permalink to this definition"></a></dt>
<dd><p>Get a value in an interval as a percentage of its position
in that interval. This also understands negative numbers.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> (<em>number</em>) This should be a value minval&lt;=value&lt;=maxval.</p></li>
<li><p><strong>minval</strong> (<em>number</em><em> or </em><em>None</em>) Smallest value in interval. This could be None
for an open interval (then return will always be 100%)</p></li>
<li><p><strong>maxval</strong> (<em>number</em><em> or </em><em>None</em>) Biggest value in interval. This could be None
for an open interval (then return will always be 100%)</p></li>
<li><p><strong>formatted</strong> (<em>str</em><em>, </em><em>optional</em>) This is a string that should
accept one formatting tag. This will receive the
current value as a percentage. If None, the
raw float will be returned instead.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>The formatted value or the raw percentage</dt><dd><p>as a float.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>str or float</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>We try to handle a weird interval gracefully.
- If either maxval or minval is None (open interval),</p>
<blockquote>
<div><p>we (aribtrarily) assume 100%.</p>
</div></blockquote>
<ul class="simple">
<li><p>If minval &gt; maxval, we return 0%.</p></li>
<li><dl class="simple">
<dt>If minval == maxval == value we are looking at a single value match</dt><dd><p>and return 100%.</p>
</dd>
</dl>
</li>
<li><p>If minval == maxval != value we return 0%.</p></li>
<li><dl class="simple">
<dt>If value not in [minval..maxval], we set value to the closest</dt><dd><p>boundary, so the result will be 0% or 100%, respectively.</p>
</dd>
</dl>
</li>
</ul>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.percentile">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">percentile</code><span class="sig-paren">(</span><em class="sig-param">iterable</em>, <em class="sig-param">percent</em>, <em class="sig-param">key=&lt;function &lt;lambda&gt;&gt;</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#percentile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.percentile" title="Permalink to this definition"></a></dt>
<dd><p>Find the percentile of a list of values.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>iterable</strong> (<em>iterable</em>) A list of values. Note N MUST BE already sorted.</p></li>
<li><p><strong>percent</strong> (<em>float</em>) A value from 0.0 to 1.0.</p></li>
<li><p><strong>key</strong> (<em>callable</em><em>, </em><em>optional</em>) </p></li>
</ul>
</dd>
</dl>
<p>&#64;return - the percentile of the values</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.pypath_to_realpath">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">pypath_to_realpath</code><span class="sig-paren">(</span><em class="sig-param">python_path</em>, <em class="sig-param">file_ending='.py'</em>, <em class="sig-param">pypath_prefixes=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#pypath_to_realpath"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.pypath_to_realpath" title="Permalink to this definition"></a></dt>
<dd><p>Converts a dotted Python path to an absolute path under the
Evennia library directory or under the current game directory.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>python_path</strong> (<em>str</em>) A dot-python path</p></li>
<li><p><strong>file_ending</strong> (<em>str</em>) A file ending, including the period.</p></li>
<li><p><strong>pypath_prefixes</strong> (<em>list</em>) A list of paths to test for existence. These
should be on python.path form. EVENNIA_DIR and GAME_DIR are automatically
checked, they need not be added to this list.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>All existing, absolute paths created by</dt><dd><p>converting <cite>python_path</cite> to an absolute paths and/or
prepending <cite>python_path</cite> by <cite>settings.EVENNIA_DIR</cite>,
<cite>settings.GAME_DIR</cite> and by`pypath_prefixes` respectively.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>abspaths (list)</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>This will also try a few combinations of paths to allow cases
where pypath is given including the “evennia.” or “mygame.”
prefixes.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.random_string_from_module">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">random_string_from_module</code><span class="sig-paren">(</span><em class="sig-param">module</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#random_string_from_module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.random_string_from_module" title="Permalink to this definition"></a></dt>
<dd><p>Returns a random global string from a module.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>module</strong> (<em>string</em><em> or </em><em>module</em>) Python path, absolute path or a module.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A random stribg variable from <cite>module</cite>.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>random (string)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.run_async">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">run_async</code><span class="sig-paren">(</span><em class="sig-param">to_execute</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#run_async"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.run_async" title="Permalink to this definition"></a></dt>
<dd><p>Runs a function or executes a code snippet asynchronously.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>to_execute</strong> (<em>callable</em>) If this is a callable, it will be
executed with <a href="#id213"><span class="problematic" id="id214">*</span></a>args and non-reserved <a href="#id215"><span class="problematic" id="id216">*</span></a>kwargs as arguments.
The callable will be executed using ProcPool, or in a thread
if ProcPool is not available.</p>
</dd>
</dl>
<dl class="simple">
<dt>Kwargs:</dt><dd><dl class="simple">
<dt>at_return (callable): Should point to a callable with one</dt><dd><p>argument. It will be called with the return value from
to_execute.</p>
</dd>
<dt>at_return_kwargs (dict): This dictionary will be used as</dt><dd><p>keyword arguments to the at_return callback.</p>
</dd>
<dt>at_err (callable): This will be called with a Failure instance</dt><dd><p>if there is an error in to_execute.</p>
</dd>
<dt>at_err_kwargs (dict): This dictionary will be used as keyword</dt><dd><p>arguments to the at_err errback.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>All other <cite>*args</cite> and <cite>**kwargs</cite> will be passed on to
<cite>to_execute</cite>. Run_async will relay executed code to a thread
or procpool.</p>
<p>Use this function with restrain and only for features/commands
that you know has no influence on the cause-and-effect order of your
game (commands given after the async function might be executed before
it has finished). Accessing the same property from different threads
can lead to unpredicted behaviour if you are not careful (this is called a
“race condition”).</p>
<p>Also note that some databases, notably sqlite3, dont support access from
multiple threads simultaneously, so if you do heavy database access from
your <cite>to_execute</cite> under sqlite3 you will probably run very slow or even get
tracebacks.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.server_services">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">server_services</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#server_services"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.server_services" title="Permalink to this definition"></a></dt>
<dd><p>Lists all services active on the Server. Observe that since
services are launched in memory, this function will only return
any results if called from inside the game.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A dict of available services.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>services (dict)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.string_from_module">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">string_from_module</code><span class="sig-paren">(</span><em class="sig-param">module</em>, <em class="sig-param">variable=None</em>, <em class="sig-param">default=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#string_from_module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.string_from_module" title="Permalink to this definition"></a></dt>
<dd><p>This is a wrapper for <cite>variable_from_module</cite> that requires return
value to be a string to pass. Its primarily used by login screen.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>module</strong> (<em>string</em><em> or </em><em>module</em>) Python path, absolute path or a module.</p></li>
<li><p><strong>variable</strong> (<em>string</em><em> or </em><em>iterable</em><em>, </em><em>optional</em>) Single variable name or iterable
of variable names to extract. If not given, all variables in
the module will be returned.</p></li>
<li><p><strong>default</strong> (<em>string</em><em>, </em><em>optional</em>) Default value to use if a variable fails to
be extracted. Ignored if <cite>variable</cite> is not given.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A single (string) value or a list of values
depending on if <cite>variable</cite> is given or not. Errors in lists (such
as the value not being a string) are replaced by the <cite>default</cite> argument.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>variables (value or list)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.string_partial_matching">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">string_partial_matching</code><span class="sig-paren">(</span><em class="sig-param">alternatives</em>, <em class="sig-param">inp</em>, <em class="sig-param">ret_index=True</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#string_partial_matching"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.string_partial_matching" title="Permalink to this definition"></a></dt>
<dd><p>Partially matches a string based on a list of <cite>alternatives</cite>.
Matching is made from the start of each subword in each
alternative. Case is not important. So e.g. “bi sh sw” or just
“big” or “shiny” or “sw” will match “Big shiny sword”. Scoring is
done to allow to separate by most common demoninator. You will get
multiple matches returned if appropriate.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>alternatives</strong> (<em>list of str</em>) A list of possible strings to
match.</p></li>
<li><p><strong>inp</strong> (<em>str</em>) Search criterion.</p></li>
<li><p><strong>ret_index</strong> (<em>bool</em><em>, </em><em>optional</em>) Return list of indices (from alternatives
array) instead of strings.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>String-matches or indices if <cite>ret_index</cite> is <cite>True</cite>.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>matches (list)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.string_similarity">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">string_similarity</code><span class="sig-paren">(</span><em class="sig-param">string1</em>, <em class="sig-param">string2</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#string_similarity"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.string_similarity" title="Permalink to this definition"></a></dt>
<dd><dl class="simple">
<dt>This implements a “cosine-similarity” algorithm as described for example in</dt><dd><p><em>Proceedings of the 22nd International Conference on Computation
Linguistics</em> (Coling 2008), pages 593-600, Manchester, August 2008.</p>
</dd>
</dl>
<p>The measure-vectors used is simply a “bag of words” type histogram
(but for letters).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string1</strong> (<em>str</em>) String to compare (may contain any number of words).</p></li>
<li><p><strong>string2</strong> (<em>str</em>) Second string to compare (any number of words).</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A value 0…1 rating how similar the two</dt><dd><p>strings are.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>similarity (float)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.string_suggestions">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">string_suggestions</code><span class="sig-paren">(</span><em class="sig-param">string</em>, <em class="sig-param">vocabulary</em>, <em class="sig-param">cutoff=0.6</em>, <em class="sig-param">maxnum=3</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#string_suggestions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.string_suggestions" title="Permalink to this definition"></a></dt>
<dd><p>Given a <cite>string</cite> and a <cite>vocabulary</cite>, return a match or a list of
suggestions based on string similarity.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> (<em>str</em>) A string to search for.</p></li>
<li><p><strong>vocabulary</strong> (<em>iterable</em>) A list of available strings.</p></li>
<li><p><strong>cutoff</strong> (<em>int</em><em>, </em><em>0-1</em>) Limit the similarity matches (the higher
the value, the more exact a match is required).</p></li>
<li><p><strong>maxnum</strong> (<em>int</em>) Maximum number of suggestions to return.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Suggestions from <cite>vocabulary</cite> with a</dt><dd><p>similarity-rating that higher than or equal to <cite>cutoff</cite>.
Could be empty if there are no matches.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>suggestions (list)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.strip_control_sequences">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">strip_control_sequences</code><span class="sig-paren">(</span><em class="sig-param">string</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#strip_control_sequences"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.strip_control_sequences" title="Permalink to this definition"></a></dt>
<dd><p>Remove non-print text sequences.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>string</strong> (<em>str</em>) Text to strip.</p>
</dd>
</dl>
<dl class="simple">
<dt>Returns.</dt><dd><p>text (str): Stripped text.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.time_format">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">time_format</code><span class="sig-paren">(</span><em class="sig-param">seconds</em>, <em class="sig-param">style=0</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#time_format"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.time_format" title="Permalink to this definition"></a></dt>
<dd><p>Function to return a prettified version of a value in seconds.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>seconds</strong> (<em>int</em>) Number if seconds to format.</p></li>
<li><p><strong>style</strong> (<em>int</em>) One of the following styles:
0. “1d 08:30”
1. “1d”
2. “1 day, 8 hours, 30 minutes”
3. “1 day, 8 hours, 30 minutes, 10 seconds”
4. highest unit (like “3 years” or “8 months” or “1 second”)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A pretty time string.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>timeformatted (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.to_bytes">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">to_bytes</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">session=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#to_bytes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.to_bytes" title="Permalink to this definition"></a></dt>
<dd><p>Try to encode the given text to bytes, using encodings from settings or from Session. Will
always return a bytes, even if given something that is not str or bytes.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>any</em>) The text to encode to bytes. If bytes, return unchanged. If not a str, convert
to str before converting.</p></li>
<li><p><strong>session</strong> (<a class="reference internal" href="evennia.server.html#evennia.server.session.Session" title="evennia.server.session.Session"><em>Session</em></a><em>, </em><em>optional</em>) A Session to get encoding info from. Will try this before
falling back to settings.ENCODINGS.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>the encoded text following the sessions protocol flag followed by the</dt><dd><p>encodings specified in settings.ENCODINGS. If all attempt fail, log the error and send
the text with “?” in place of problematic characters. If the specified encoding cannot
be found, the protocol flag is reset to utf-8. In any case, returns bytes.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>encoded_text (bytes)</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If <cite>text</cite> is already bytes, return it as is.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.to_str">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">to_str</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">session=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#to_str"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.to_str" title="Permalink to this definition"></a></dt>
<dd><p>Try to decode a bytestream to a python str, using encoding schemas from settings
or from Session. Will always return a str(), also if not given a str/bytes.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>any</em>) The text to encode to bytes. If a str, return it. If also not bytes, convert
to str using str() or repr() as a fallback.</p></li>
<li><p><strong>session</strong> (<a class="reference internal" href="evennia.server.html#evennia.server.session.Session" title="evennia.server.session.Session"><em>Session</em></a><em>, </em><em>optional</em>) A Session to get encoding info from. Will try this before
falling back to settings.ENCODINGS.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The decoded text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>decoded_text (str)</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If <cite>text</cite> is already str, return it as is.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.uses_database">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">uses_database</code><span class="sig-paren">(</span><em class="sig-param">name='sqlite3'</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#uses_database"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.uses_database" title="Permalink to this definition"></a></dt>
<dd><p>Checks if the game is currently using a given database. This is a
shortcut to having to use the full backend name.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<em>str</em>) One of sqlite3, mysql, postgresql</p></li>
<li><p><strong>'oracle'.</strong> (<em>or</em>) </p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If the given database is used or not.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>uses (bool)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.validate_email_address">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">validate_email_address</code><span class="sig-paren">(</span><em class="sig-param">emailaddress</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#validate_email_address"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.validate_email_address" title="Permalink to this definition"></a></dt>
<dd><p>Checks if an email address is syntactically correct.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>emailaddress</strong> (<em>str</em>) Email address to validate.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>If this is a valid email or not.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>is_valid (bool)</p>
</dd>
</dl>
<dl class="simple">
<dt>Notes.</dt><dd><p>(This snippet was adapted from
<a class="reference external" href="http://commandline.org.uk/python/email-syntax-check">http://commandline.org.uk/python/email-syntax-check</a>.)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.variable_from_module">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">variable_from_module</code><span class="sig-paren">(</span><em class="sig-param">module</em>, <em class="sig-param">variable=None</em>, <em class="sig-param">default=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#variable_from_module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.variable_from_module" title="Permalink to this definition"></a></dt>
<dd><p>Retrieve a variable or list of variables from a module. The
variable(s) must be defined globally in the module. If no variable
is given (or a list entry is <cite>None</cite>), all global variables are
extracted from the module.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>module</strong> (<em>string</em><em> or </em><em>module</em>) Python path, absolute path or a module.</p></li>
<li><p><strong>variable</strong> (<em>string</em><em> or </em><em>iterable</em><em>, </em><em>optional</em>) Single variable name or iterable
of variable names to extract. If not given, all variables in
the module will be returned.</p></li>
<li><p><strong>default</strong> (<em>string</em><em>, </em><em>optional</em>) Default value to use if a variable fails to
be extracted. Ignored if <cite>variable</cite> is not given.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A single value or a list of values
depending on if <cite>variable</cite> is given or not. Errors in lists
are replaced by the <cite>default</cite> argument.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>variables (value or list)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.wildcard_to_regexp">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">wildcard_to_regexp</code><span class="sig-paren">(</span><em class="sig-param">instring</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#wildcard_to_regexp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.wildcard_to_regexp" title="Permalink to this definition"></a></dt>
<dd><p>Converts a player-supplied string that may have wildcards in it to
regular expressions. This is useful for name matching.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>instring</strong> (<em>string</em>) A string that may potentially contain
wildcards (<cite>*</cite> or <cite>?</cite>).</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>A string where wildcards were replaced with</dt><dd><p>regular expressions.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>regex (str)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.utils.wrap">
<code class="sig-prename descclassname">evennia.utils.utils.</code><code class="sig-name descname">wrap</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">width=None</em>, <em class="sig-param">indent=0</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/utils.html#wrap"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.utils.wrap" title="Permalink to this definition"></a></dt>
<dd><p>Safely wrap text to a certain number of characters.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> (<em>str</em>) The text to wrap.</p></li>
<li><p><strong>width</strong> (<em>int</em><em>, </em><em>optional</em>) The number of characters to wrap to.</p></li>
<li><p><strong>indent</strong> (<em>int</em>) How much to indent each line (with whitespace).</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Properly wrapped text.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>text (str)</p>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-evennia.utils.validatorfuncs">
<span id="evennia-utils-validatorfuncs-module"></span><h2>evennia.utils.validatorfuncs module<a class="headerlink" href="#module-evennia.utils.validatorfuncs" title="Permalink to this headline"></a></h2>
<p>Contains all the validation functions.</p>
<p>All validation functions must have a checker (probably a session) and entry arg.</p>
<p>They can employ more paramters at your leisure.</p>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.boolean">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">boolean</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='True/False'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#boolean"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.boolean" title="Permalink to this definition"></a></dt>
<dd><p>Simplest check in computer logic, right? This will take user input to flick the switch on or off
:param entry: A value such as True, On, Enabled, Disabled, False, 0, or 1.
:type entry: str
:param option_key: What kind of Boolean we are setting. What Option is this for?
:type option_key: str</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Boolean</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.color">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">color</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='Color'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#color"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.color" title="Permalink to this definition"></a></dt>
<dd><p>The color should be just a color character, so r if red color is desired.</p>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.datetime">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">datetime</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='Datetime'</em>, <em class="sig-param">account=None</em>, <em class="sig-param">from_tz=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#datetime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.datetime" title="Permalink to this definition"></a></dt>
<dd><p>Process a datetime string in standard forms while accounting for the inputers timezone. Always
returns a result in UTC.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>entry</strong> (<em>str</em>) A date string from a user.</p></li>
<li><p><strong>option_key</strong> (<em>str</em>) Name to display this datetime as.</p></li>
<li><p><strong>account</strong> (<a class="reference internal" href="evennia.accounts.html#evennia.accounts.models.AccountDB" title="evennia.accounts.models.AccountDB"><em>AccountDB</em></a>) The Account performing this lookup. Unless <cite>from_tz</cite> is provided,
the accounts timezone option will be used.</p></li>
<li><p><strong>from_tz</strong> (<em>pytz.timezone</em>) An instance of a pytz timezone object from the
user. If not provided, tries to use the timezone option of the <a href="#id217"><span class="problematic" id="id218">`</span></a>account.
If neither one is provided, defaults to UTC.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>datetime in UTC.</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>ValueError</strong> If encountering a malformed timezone, date string or other format error.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.duration">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">duration</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='Duration'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#duration"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.duration" title="Permalink to this definition"></a></dt>
<dd><p>Take a string and derive a datetime timedelta from it.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>entry</strong> (<em>string</em>) This is a string from user-input. The intended format is, for example: “5d 2w 90s” for
five days, two weeks, and ninety seconds. Invalid sections are ignored.</p></li>
<li><p><strong>option_key</strong> (<em>str</em>) Name to display this query as.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>timedelta</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.email">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">email</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='Email Address'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#email"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.email" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.future">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">future</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='Future Datetime'</em>, <em class="sig-param">from_tz=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.future" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.lock">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">lock</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='locks'</em>, <em class="sig-param">access_options=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#lock"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.lock" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.positive_integer">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">positive_integer</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='Positive Integer'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#positive_integer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.positive_integer" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.signed_integer">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">signed_integer</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='Signed Integer'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#signed_integer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.signed_integer" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.text">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">text</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='Text'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#text"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.text" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.timezone">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">timezone</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='Timezone'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#timezone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.timezone" title="Permalink to this definition"></a></dt>
<dd><p>Takes user input as string, and partial matches a Timezone.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>entry</strong> (<em>str</em>) The name of the Timezone.</p></li>
<li><p><strong>option_key</strong> (<em>str</em>) What this Timezone is used for.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A PYTZ timezone.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="evennia.utils.validatorfuncs.unsigned_integer">
<code class="sig-prename descclassname">evennia.utils.validatorfuncs.</code><code class="sig-name descname">unsigned_integer</code><span class="sig-paren">(</span><em class="sig-param">entry</em>, <em class="sig-param">option_key='Unsigned Integer'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/validatorfuncs.html#unsigned_integer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.validatorfuncs.unsigned_integer" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
<p><h3><a href="../index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">evennia.utils package</a><ul>
<li><a class="reference internal" href="#subpackages">Subpackages</a></li>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-evennia.utils.ansi">evennia.utils.ansi module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.batchprocessors">evennia.utils.batchprocessors module</a><ul>
<li><a class="reference internal" href="#example-of-batch-ev-file">Example of batch.ev file:</a></li>
<li><a class="reference internal" href="#example-batch-py-file">Example batch.py file</a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-evennia.utils.containers">evennia.utils.containers module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.create">evennia.utils.create module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.dbserialize">evennia.utils.dbserialize module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.eveditor">evennia.utils.eveditor module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.evform">evennia.utils.evform module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.evmenu">evennia.utils.evmenu module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.evmore">evennia.utils.evmore module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.evtable">evennia.utils.evtable module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.gametime">evennia.utils.gametime module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.inlinefuncs">evennia.utils.inlinefuncs module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.logger">evennia.utils.logger module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.optionclasses">evennia.utils.optionclasses module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.optionhandler">evennia.utils.optionhandler module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.picklefield">evennia.utils.picklefield module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.search">evennia.utils.search module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.test_resources">evennia.utils.test_resources module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.text2html">evennia.utils.text2html module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.utils">evennia.utils.utils module</a></li>
<li><a class="reference internal" href="#module-evennia.utils.validatorfuncs">evennia.utils.validatorfuncs module</a></li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div role="note" aria-label="source link">
<!--h3>This Page</h3-->
<ul class="this-page-menu">
<li><a href="../_sources/api/evennia.utils.rst.txt"
rel="nofollow">Show Page Source</a></li>
</ul>
</div>
<h3>Versions</h3>
<ul>
<li><a href="evennia.utils.html">1.0-dev (develop branch)</a></li>
<li><a href="../../../versions/0.9.1/api/evennia.utils.html">0.9.1 (master branch)</a></li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2020, The Evennia developer community.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.4.4</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="../_sources/api/evennia.utils.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>