mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-30 15:04:18 +00:00
374 lines
No EOL
16 KiB
HTML
374 lines
No EOL
16 KiB
HTML
|
|
|
|
<!DOCTYPE html>
|
|
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>royalnet.utils — Royalnet documentation</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="_static/js/modernizr.min.js"></script>
|
|
|
|
|
|
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
|
<script type="text/javascript" src="_static/underscore.js"></script>
|
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
|
<script type="text/javascript" src="_static/language_data.js"></script>
|
|
|
|
<script type="text/javascript" src="_static/js/theme.js"></script>
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
|
<link rel="index" title="Index" href="genindex.html" />
|
|
<link rel="search" title="Search" href="search.html" />
|
|
<link rel="prev" title="royalnet.network" href="network.html" />
|
|
</head>
|
|
|
|
<body class="wy-body-for-nav">
|
|
|
|
|
|
<div class="wy-grid-for-nav">
|
|
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
<div class="wy-side-scroll">
|
|
<div class="wy-side-nav-search" >
|
|
|
|
|
|
|
|
<a href="index.html" class="icon icon-home"> Royalnet
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div role="search">
|
|
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
|
<input type="text" name="q" placeholder="Search docs" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<ul class="current">
|
|
<li class="toctree-l1"><a class="reference internal" href="audio.html">royalnet.audio</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="bots.html">royalnet.bots</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="commands.html">royalnet.commands</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="database.html">royalnet.database</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="network.html">royalnet.network</a></li>
|
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">royalnet.utils</a><ul class="simple">
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
|
|
|
|
|
<nav class="wy-nav-top" aria-label="top navigation">
|
|
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
<a href="index.html">Royalnet</a>
|
|
|
|
</nav>
|
|
|
|
|
|
<div class="wy-nav-content">
|
|
|
|
<div class="rst-content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
|
|
|
<ul class="wy-breadcrumbs">
|
|
|
|
<li><a href="index.html">Docs</a> »</li>
|
|
|
|
<li>royalnet.utils</li>
|
|
|
|
|
|
<li class="wy-breadcrumbs-aside">
|
|
|
|
|
|
<a href="_sources/utils.rst.txt" rel="nofollow"> View page source</a>
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
<hr/>
|
|
</div>
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
<div itemprop="articleBody">
|
|
|
|
<div class="section" id="royalnet-utils">
|
|
<h1>royalnet.utils<a class="headerlink" href="#royalnet-utils" title="Permalink to this headline">¶</a></h1>
|
|
<div class="toctree-wrapper compound">
|
|
</div>
|
|
<span class="target" id="module-royalnet.utils"></span><dl class="function">
|
|
<dt id="royalnet.utils.asyncify">
|
|
<code class="descclassname">royalnet.utils.</code><code class="descname">asyncify</code><span class="sig-paren">(</span><em>function: Callable</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.asyncify" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="royalnet.utils.Call">
|
|
<em class="property">class </em><code class="descclassname">royalnet.utils.</code><code class="descname">Call</code><span class="sig-paren">(</span><em>channel, command: Type[royalnet.utils.command.Command], command_args: List[str] = None, **kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.Call" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>A command call. Still an abstract class, subbots should create a new call from this.</p>
|
|
<dl class="attribute">
|
|
<dt id="royalnet.utils.Call.alchemy">
|
|
<code class="descname">alchemy</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.utils.Call.alchemy" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="royalnet.utils.Call.get_author">
|
|
<code class="descname">get_author</code><span class="sig-paren">(</span><em>error_if_none=False</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.Call.get_author" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Try to find the universal identifier of the user that sent the message.
|
|
That probably means, the database row identifying the user.
|
|
Raise a UnregisteredError if error_if_none is set to True and no author is found.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="royalnet.utils.Call.interface_name">
|
|
<code class="descname">interface_name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.utils.Call.interface_name" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="royalnet.utils.Call.interface_obj">
|
|
<code class="descname">interface_obj</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.utils.Call.interface_obj" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="royalnet.utils.Call.interface_prefix">
|
|
<code class="descname">interface_prefix</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.utils.Call.interface_prefix" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="royalnet.utils.Call.net_request">
|
|
<code class="descname">net_request</code><span class="sig-paren">(</span><em>message: royalnet.network.messages.Message</em>, <em>destination: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.Call.net_request" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Send data to the rest of the Royalnet, and optionally wait for an answer.
|
|
The data must be pickleable.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="royalnet.utils.Call.reply">
|
|
<code class="descname">reply</code><span class="sig-paren">(</span><em>text: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.Call.reply" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Send a text message to the channel the call was made.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="royalnet.utils.Call.run">
|
|
<code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.Call.run" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="royalnet.utils.Call.session_end">
|
|
<code class="descname">session_end</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.Call.session_end" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="royalnet.utils.Call.session_init">
|
|
<code class="descname">session_init</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.Call.session_init" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="royalnet.utils.Command">
|
|
<em class="property">class </em><code class="descclassname">royalnet.utils.</code><code class="descname">Command</code><a class="headerlink" href="#royalnet.utils.Command" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>A generic command, called from any source.</p>
|
|
<dl class="attribute">
|
|
<dt id="royalnet.utils.Command.command_description">
|
|
<code class="descname">command_description</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.utils.Command.command_description" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="royalnet.utils.Command.command_name">
|
|
<code class="descname">command_name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.utils.Command.command_name" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="royalnet.utils.Command.command_syntax">
|
|
<code class="descname">command_syntax</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.utils.Command.command_syntax" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="classmethod">
|
|
<dt id="royalnet.utils.Command.common">
|
|
<em class="property">classmethod </em><code class="descname">common</code><span class="sig-paren">(</span><em>call: Call</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.Command.common" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="classmethod">
|
|
<dt id="royalnet.utils.Command.network_handler_dict">
|
|
<em class="property">classmethod </em><code class="descname">network_handler_dict</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.Command.network_handler_dict" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="royalnet.utils.Command.network_handlers">
|
|
<code class="descname">network_handlers</code><em class="property"> = {}</em><a class="headerlink" href="#royalnet.utils.Command.network_handlers" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="royalnet.utils.Command.require_alchemy_tables">
|
|
<code class="descname">require_alchemy_tables</code><em class="property"> = {}</em><a class="headerlink" href="#royalnet.utils.Command.require_alchemy_tables" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
</dd></dl>
|
|
|
|
<dl class="function">
|
|
<dt id="royalnet.utils.safeformat">
|
|
<code class="descclassname">royalnet.utils.</code><code class="descname">safeformat</code><span class="sig-paren">(</span><em>string: str</em>, <em>ignore_escaping: bool = False</em>, <em>**words</em><span class="sig-paren">)</span> → str<a class="headerlink" href="#royalnet.utils.safeformat" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="function">
|
|
<dt id="royalnet.utils.cdj">
|
|
<code class="descclassname">royalnet.utils.</code><code class="descname">cdj</code><span class="sig-paren">(</span><em>class_</em><span class="sig-paren">)</span> → dict<a class="headerlink" href="#royalnet.utils.cdj" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Return the cleaned class attributes in a dict.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="function">
|
|
<dt id="royalnet.utils.sleep_until">
|
|
<code class="descclassname">royalnet.utils.</code><code class="descname">sleep_until</code><span class="sig-paren">(</span><em>dt: datetime.datetime</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.sleep_until" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="function">
|
|
<dt id="royalnet.utils.plusformat">
|
|
<code class="descclassname">royalnet.utils.</code><code class="descname">plusformat</code><span class="sig-paren">(</span><em>i: int</em><span class="sig-paren">)</span> → str<a class="headerlink" href="#royalnet.utils.plusformat" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="royalnet.utils.CommandArgs">
|
|
<em class="property">class </em><code class="descclassname">royalnet.utils.</code><code class="descname">CommandArgs</code><a class="headerlink" href="#royalnet.utils.CommandArgs" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>The arguments of a command. Raises InvalidInputError if the requested argument does not exist.</p>
|
|
<dl class="method">
|
|
<dt id="royalnet.utils.CommandArgs.joined">
|
|
<code class="descname">joined</code><span class="sig-paren">(</span><em>*</em>, <em>require_at_least=0</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.CommandArgs.joined" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="royalnet.utils.CommandArgs.match">
|
|
<code class="descname">match</code><span class="sig-paren">(</span><em>pattern: Pattern[AnyStr]</em><span class="sig-paren">)</span> → Sequence[AnyStr]<a class="headerlink" href="#royalnet.utils.CommandArgs.match" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="royalnet.utils.CommandArgs.optional">
|
|
<code class="descname">optional</code><span class="sig-paren">(</span><em>index: int</em>, <em>default=None</em><span class="sig-paren">)</span> → Optional<a class="headerlink" href="#royalnet.utils.CommandArgs.optional" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
</dd></dl>
|
|
|
|
<dl class="class">
|
|
<dt id="royalnet.utils.NetworkHandler">
|
|
<em class="property">class </em><code class="descclassname">royalnet.utils.</code><code class="descname">NetworkHandler</code><a class="headerlink" href="#royalnet.utils.NetworkHandler" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>The NetworkHandler functions are called when a specific Message type is received.</p>
|
|
<dl class="attribute">
|
|
<dt id="royalnet.utils.NetworkHandler.message_type">
|
|
<code class="descname">message_type</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.utils.NetworkHandler.message_type" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
</dd></dl>
|
|
|
|
<dl class="function">
|
|
<dt id="royalnet.utils.safefilename">
|
|
<code class="descclassname">royalnet.utils.</code><code class="descname">safefilename</code><span class="sig-paren">(</span><em>string: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.safefilename" title="Permalink to this definition">¶</a></dt>
|
|
<dd></dd></dl>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<footer>
|
|
|
|
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
|
|
|
|
|
<a href="network.html" class="btn btn-neutral float-left" title="royalnet.network" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
|
|
|
</div>
|
|
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<p>
|
|
© Copyright 2019, Stefano Pigozzi
|
|
|
|
</p>
|
|
</div>
|
|
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
|
|
</footer>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
jQuery(function () {
|
|
SphinxRtdTheme.Navigation.enable(true);
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
</html> |