1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 21:44:21 +00:00
royalnet/docs/html/apireference.html

1597 lines
126 KiB
HTML
Raw Normal View History

2019-11-17 19:24:57 +00:00
<!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>API Reference &mdash; Royalnet 5.1a1 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="stylesheet" href="_static/rygdocs.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" href="index.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 class="version">
5.1a1
</div>
<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 current"><a class="current reference internal" href="#">API Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#module-royalnet.alchemy">Alchemy</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-royalnet.backpack">Backpack</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-royalnet.bard">Bard</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-royalnet.commands">Commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-royalnet.constellation">Constellation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-royalnet.herald">Herald</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-royalnet.serf">Serf</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-royalnet.utils">Utils</a></li>
</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> &raquo;</li>
<li>API Reference</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/apireference.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="api-reference">
<h1>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline"></a></h1>
<p>This page is autogenerated from the docstrings inside the code.</p>
<div class="section" id="module-royalnet.alchemy">
<span id="alchemy"></span><h2>Alchemy<a class="headerlink" href="#module-royalnet.alchemy" title="Permalink to this headline"></a></h2>
<p>Relational database classes and methods.</p>
<dl class="class">
<dt id="royalnet.alchemy.Alchemy">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.alchemy.</code><code class="sig-name descname">Alchemy</code><span class="sig-paren">(</span><em class="sig-param">database_uri: str</em>, <em class="sig-param">tables: Set</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.alchemy.Alchemy" title="Permalink to this definition"></a></dt>
<dd><p>A wrapper around <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/scalar_mapping.html#module-sqlalchemy.orm" title="(in SQLAlchemy v1.3)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlalchemy.orm</span></code></a> that allows the instantiation of multiple engines at once while maintaining
a single declarative class for all of them.</p>
<dl class="method">
<dt id="royalnet.alchemy.Alchemy.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">database_uri: str</em>, <em class="sig-param">tables: Set</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.alchemy.Alchemy.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Create a new <a class="reference internal" href="#royalnet.alchemy.Alchemy" title="royalnet.alchemy.Alchemy"><code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code></a> object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>database_uri</strong> The <a class="reference external" href="https://docs.sqlalchemy.org/en/13/core/engines.html">database URI</a> .</p></li>
<li><p><strong>tables</strong> The <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#set" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">set</span></code></a> of tables to be created and used in the selected database.
Check the tables submodule for more details.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.alchemy.Alchemy.get">
<code class="sig-name descname">get</code><span class="sig-paren">(</span><em class="sig-param">table: Union[str, type]</em><span class="sig-paren">)</span> &#x2192; sqlalchemy.sql.schema.Table<a class="headerlink" href="#royalnet.alchemy.Alchemy.get" title="Permalink to this definition"></a></dt>
<dd><p>Get the table with a specified name or class.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>table</strong> The table name or table class you want to get.</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>TableNotFoundError</strong> if the requested table was not found.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.alchemy.Alchemy.session_acm">
<code class="sig-name descname">session_acm</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.alchemy.Alchemy.session_acm" title="Permalink to this definition"></a></dt>
<dd><p>Create a Session as a async context manager (that can be used in <code class="docutils literal notranslate"><span class="pre">async</span> <span class="pre">with</span></code> statements).</p>
<p>The Session will be closed safely when the context manager exits (even in case of error).</p>
<p class="rubric">Example</p>
<p>You can use the async context manager like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">with</span> <span class="n">alchemy</span><span class="o">.</span><span class="n">session_acm</span><span class="p">()</span> <span class="k">as</span> <span class="n">session</span><span class="p">:</span>
<span class="c1"># Do some stuff</span>
<span class="o">...</span>
<span class="c1"># Commit the session</span>
<span class="k">await</span> <span class="n">asyncify</span><span class="p">(</span><span class="n">session</span><span class="o">.</span><span class="n">commit</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="royalnet.alchemy.Alchemy.session_cm">
<code class="sig-name descname">session_cm</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.alchemy.Alchemy.session_cm" title="Permalink to this definition"></a></dt>
<dd><p>Create a Session as a context manager (that can be used in <code class="docutils literal notranslate"><span class="pre">with</span></code> statements).</p>
<p>The Session will be closed safely when the context manager exits (even in case of error).</p>
<p class="rubric">Example</p>
<p>You can use the context manager like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">alchemy</span><span class="o">.</span><span class="n">session_cm</span><span class="p">()</span> <span class="k">as</span> <span class="n">session</span><span class="p">:</span>
<span class="c1"># Do some stuff</span>
<span class="o">...</span>
<span class="c1"># Commit the session</span>
<span class="n">session</span><span class="o">.</span><span class="n">commit</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="royalnet.alchemy.table_dfs">
<code class="sig-prename descclassname">royalnet.alchemy.</code><code class="sig-name descname">table_dfs</code><span class="sig-paren">(</span><em class="sig-param">starting_table: sqlalchemy.sql.schema.Table</em>, <em class="sig-param">ending_table: sqlalchemy.sql.schema.Table</em><span class="sig-paren">)</span> &#x2192; tuple<a class="headerlink" href="#royalnet.alchemy.table_dfs" title="Permalink to this definition"></a></dt>
<dd><p>Depth-first-search for the path from the starting table to the ending table.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#tuple" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code></a> containing the path, starting from the starting table and ending at the ending table.</p>
</dd>
</dl>
</dd></dl>
<dl class="exception">
<dt id="royalnet.alchemy.AlchemyException">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.alchemy.</code><code class="sig-name descname">AlchemyException</code><a class="headerlink" href="#royalnet.alchemy.AlchemyException" title="Permalink to this definition"></a></dt>
<dd><p>Base class for Alchemy exceptions.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.alchemy.TableNotFoundException">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.alchemy.</code><code class="sig-name descname">TableNotFoundException</code><a class="headerlink" href="#royalnet.alchemy.TableNotFoundException" title="Permalink to this definition"></a></dt>
<dd><p>The requested table was not found.</p>
</dd></dl>
</div>
<div class="section" id="module-royalnet.backpack">
<span id="backpack"></span><h2>Backpack<a class="headerlink" href="#module-royalnet.backpack" title="Permalink to this headline"></a></h2>
<p>A Pack that is imported by default by all <code class="xref py py-mod docutils literal notranslate"><span class="pre">royalnet</span></code> instances.</p>
</div>
<div class="section" id="module-royalnet.bard">
<span id="bard"></span><h2>Bard<a class="headerlink" href="#module-royalnet.bard" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="royalnet.bard.YtdlInfo">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.bard.</code><code class="sig-name descname">YtdlInfo</code><span class="sig-paren">(</span><em class="sig-param">info: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bard.YtdlInfo" title="Permalink to this definition"></a></dt>
<dd><p>A wrapper around youtube_dl extracted info.</p>
<dl class="method">
<dt id="royalnet.bard.YtdlInfo.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">info: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bard.YtdlInfo.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Create a YtdlInfo from the dict returned by the <code class="xref py py-func docutils literal notranslate"><span class="pre">youtube_dl.YoutubeDL.extract_info()</span></code> function.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Does not download the info, to do that use <code class="xref py py-func docutils literal notranslate"><span class="pre">retrieve_for_url()</span></code>.</p>
</div>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlInfo.from_url">
<em class="property">classmethod </em><code class="sig-name descname">from_url</code><span class="sig-paren">(</span><em class="sig-param">url</em>, <em class="sig-param">loop: Optional[asyncio.events.AbstractEventLoop] = None</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.bard.ytdlinfo.YtdlInfo]<a class="headerlink" href="#royalnet.bard.YtdlInfo.from_url" title="Permalink to this definition"></a></dt>
<dd><p>Fetch the info for an url through <code class="xref py py-mod docutils literal notranslate"><span class="pre">youtube_dl</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> containing the infos for the requested videos.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.bard.YtdlFile">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.bard.</code><code class="sig-name descname">YtdlFile</code><span class="sig-paren">(</span><em class="sig-param">url: str</em>, <em class="sig-param">info: Optional[royalnet.bard.ytdlinfo.YtdlInfo] = None</em>, <em class="sig-param">filename: Optional[str] = None</em>, <em class="sig-param">ytdl_args: Optional[Dict[str</em>, <em class="sig-param">Any]] = None</em>, <em class="sig-param">loop: Optional[asyncio.events.AbstractEventLoop] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bard.YtdlFile" title="Permalink to this definition"></a></dt>
<dd><p>A representation of a file download with <code class="xref py py-mod docutils literal notranslate"><span class="pre">youtube_dl</span></code>.</p>
<dl class="method">
<dt id="royalnet.bard.YtdlFile.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">url: str</em>, <em class="sig-param">info: Optional[royalnet.bard.ytdlinfo.YtdlInfo] = None</em>, <em class="sig-param">filename: Optional[str] = None</em>, <em class="sig-param">ytdl_args: Optional[Dict[str</em>, <em class="sig-param">Any]] = None</em>, <em class="sig-param">loop: Optional[asyncio.events.AbstractEventLoop] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bard.YtdlFile.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Create a YtdlFile instance.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Please avoid using directly <a class="reference internal" href="#royalnet.bard.YtdlFile.__init__" title="royalnet.bard.YtdlFile.__init__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__init__()</span></code></a>, use <a class="reference internal" href="#royalnet.bard.YtdlFile.from_url" title="royalnet.bard.YtdlFile.from_url"><code class="xref py py-meth docutils literal notranslate"><span class="pre">from_url()</span></code></a> instead!</p>
</div>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlFile.aopen">
<code class="sig-name descname">aopen</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bard.YtdlFile.aopen" title="Permalink to this definition"></a></dt>
<dd><p>Open the downloaded file as an async context manager (and download it if it isnt available yet).</p>
<p class="rubric">Example</p>
<p>You can use the async context manager like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">with</span> <span class="n">ytdlfile</span><span class="o">.</span><span class="n">aopen</span><span class="p">()</span> <span class="k">as</span> <span class="n">file</span><span class="p">:</span>
<span class="n">b</span><span class="p">:</span> <span class="nb">bytes</span> <span class="o">=</span> <span class="n">file</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.bard.YtdlFile.default_ytdl_args">
<code class="sig-name descname">default_ytdl_args</code><em class="property"> = {'ignoreerrors': True, 'no_warnings': False, 'noplaylist': True, 'outtmpl': '%(epoch)s-%(title)s-%(id)s.%(ext)s', 'quiet': False}</em><a class="headerlink" href="#royalnet.bard.YtdlFile.default_ytdl_args" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlFile.delete_asap">
<em class="property">async </em><code class="sig-name descname">delete_asap</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bard.YtdlFile.delete_asap" title="Permalink to this definition"></a></dt>
<dd><p>As soon as nothing is using the file, delete it.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlFile.download_file">
<em class="property">async </em><code class="sig-name descname">download_file</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.bard.YtdlFile.download_file" title="Permalink to this definition"></a></dt>
<dd><p>Download the file.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlFile.from_url">
<em class="property">classmethod </em><code class="sig-name descname">from_url</code><span class="sig-paren">(</span><em class="sig-param">url: str</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.bard.ytdlfile.YtdlFile]<a class="headerlink" href="#royalnet.bard.YtdlFile.from_url" title="Permalink to this definition"></a></dt>
<dd><p>Create a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> of <a class="reference internal" href="#royalnet.bard.YtdlFile" title="royalnet.bard.YtdlFile"><code class="xref py py-class docutils literal notranslate"><span class="pre">YtdlFile</span></code></a> from a URL.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlFile.has_info">
<em class="property">property </em><code class="sig-name descname">has_info</code><a class="headerlink" href="#royalnet.bard.YtdlFile.has_info" title="Permalink to this definition"></a></dt>
<dd><p>Does the YtdlFile have info available?</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlFile.is_downloaded">
<em class="property">property </em><code class="sig-name descname">is_downloaded</code><a class="headerlink" href="#royalnet.bard.YtdlFile.is_downloaded" title="Permalink to this definition"></a></dt>
<dd><p>Has the file been downloaded yet?</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlFile.retrieve_info">
<em class="property">async </em><code class="sig-name descname">retrieve_info</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.bard.YtdlFile.retrieve_info" title="Permalink to this definition"></a></dt>
<dd><p>Retrieve info about the YtdlFile through <code class="xref py py-mod docutils literal notranslate"><span class="pre">youtube_dl</span></code>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.bard.YtdlMp3">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.bard.</code><code class="sig-name descname">YtdlMp3</code><span class="sig-paren">(</span><em class="sig-param">ytdl_file: royalnet.bard.ytdlfile.YtdlFile</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bard.YtdlMp3" title="Permalink to this definition"></a></dt>
<dd><p>A representation of a <a class="reference internal" href="#royalnet.bard.YtdlFile" title="royalnet.bard.YtdlFile"><code class="xref py py-class docutils literal notranslate"><span class="pre">YtdlFile</span></code></a> conversion to mp3.</p>
<dl class="method">
<dt id="royalnet.bard.YtdlMp3.convert_to_mp3">
<em class="property">async </em><code class="sig-name descname">convert_to_mp3</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.bard.YtdlMp3.convert_to_mp3" title="Permalink to this definition"></a></dt>
<dd><p>Convert the file to mp3 with <a class="reference external" href="https://kkroening.github.io/ffmpeg-python/index.html#module-ffmpeg" title="(in ffmpeg-python)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">ffmpeg</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlMp3.delete_asap">
<em class="property">async </em><code class="sig-name descname">delete_asap</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.bard.YtdlMp3.delete_asap" title="Permalink to this definition"></a></dt>
<dd><p>Delete the mp3 file.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlMp3.from_url">
<em class="property">classmethod </em><code class="sig-name descname">from_url</code><span class="sig-paren">(</span><em class="sig-param">url</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.bard.ytdlmp3.YtdlMp3]<a class="headerlink" href="#royalnet.bard.YtdlMp3.from_url" title="Permalink to this definition"></a></dt>
<dd><p>Create a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> of <a class="reference internal" href="#royalnet.bard.YtdlMp3" title="royalnet.bard.YtdlMp3"><code class="xref py py-class docutils literal notranslate"><span class="pre">YtdlMp3</span></code></a> from a URL.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlMp3.info">
<em class="property">property </em><code class="sig-name descname">info</code><a class="headerlink" href="#royalnet.bard.YtdlMp3.info" title="Permalink to this definition"></a></dt>
<dd><p>Shortcut to get the <a class="reference internal" href="#royalnet.bard.YtdlInfo" title="royalnet.bard.YtdlInfo"><code class="xref py py-class docutils literal notranslate"><span class="pre">YtdlInfo</span></code></a> of the object.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlMp3.is_converted">
<em class="property">property </em><code class="sig-name descname">is_converted</code><a class="headerlink" href="#royalnet.bard.YtdlMp3.is_converted" title="Permalink to this definition"></a></dt>
<dd><p>Has the file been converted?</p>
</dd></dl>
</dd></dl>
<dl class="exception">
<dt id="royalnet.bard.BardError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.bard.</code><code class="sig-name descname">BardError</code><a class="headerlink" href="#royalnet.bard.BardError" title="Permalink to this definition"></a></dt>
<dd><p>Base class for <code class="xref py py-mod docutils literal notranslate"><span class="pre">bard</span></code> errors.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.bard.YtdlError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.bard.</code><code class="sig-name descname">YtdlError</code><a class="headerlink" href="#royalnet.bard.YtdlError" title="Permalink to this definition"></a></dt>
<dd><p>Base class for errors caused by <code class="xref py py-mod docutils literal notranslate"><span class="pre">youtube_dl</span></code>.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.bard.NotFoundError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.bard.</code><code class="sig-name descname">NotFoundError</code><a class="headerlink" href="#royalnet.bard.NotFoundError" title="Permalink to this definition"></a></dt>
<dd><p>The requested resource wasnt found.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.bard.MultipleFilesError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.bard.</code><code class="sig-name descname">MultipleFilesError</code><a class="headerlink" href="#royalnet.bard.MultipleFilesError" title="Permalink to this definition"></a></dt>
<dd><p>The resource contains multiple media files.</p>
</dd></dl>
</div>
<div class="section" id="module-royalnet.commands">
<span id="commands"></span><h2>Commands<a class="headerlink" href="#module-royalnet.commands" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="royalnet.commands.CommandInterface">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">CommandInterface</code><a class="headerlink" href="#royalnet.commands.CommandInterface" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.commands.CommandInterface.alchemy">
<em class="property">property </em><code class="sig-name descname">alchemy</code><a class="headerlink" href="#royalnet.commands.CommandInterface.alchemy" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">serf.alchemy</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandInterface.call_herald_action">
<em class="property">async </em><code class="sig-name descname">call_herald_action</code><span class="sig-paren">(</span><em class="sig-param">destination: str</em>, <em class="sig-param">event_name: str</em>, <em class="sig-param">args: dict</em><span class="sig-paren">)</span> &#x2192; dict<a class="headerlink" href="#royalnet.commands.CommandInterface.call_herald_action" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandInterface.loop">
<em class="property">property </em><code class="sig-name descname">loop</code><a class="headerlink" href="#royalnet.commands.CommandInterface.loop" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">serf.loop</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.CommandInterface.name">
<code class="sig-name descname">name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.CommandInterface.name" title="Permalink to this definition"></a></dt>
<dd><p>The name of the <a class="reference internal" href="#royalnet.commands.CommandInterface" title="royalnet.commands.CommandInterface"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandInterface</span></code></a> thats being implemented.</p>
<p class="rubric">Examples</p>
<p><code class="docutils literal notranslate"><span class="pre">telegram</span></code>, <code class="docutils literal notranslate"><span class="pre">discord</span></code>, <code class="docutils literal notranslate"><span class="pre">console</span></code></p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.CommandInterface.prefix">
<code class="sig-name descname">prefix</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.CommandInterface.prefix" title="Permalink to this definition"></a></dt>
<dd><p>The prefix used by commands on the interface.</p>
<p class="rubric">Examples</p>
<p><code class="docutils literal notranslate"><span class="pre">/</span></code> on Telegram, <code class="docutils literal notranslate"><span class="pre">!</span></code> on Discord</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandInterface.register_herald_action">
<code class="sig-name descname">register_herald_action</code><span class="sig-paren">(</span><em class="sig-param">event_name: str, coroutine: Callable[[Any], Awaitable[dict]]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandInterface.register_herald_action" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.CommandInterface.serf">
<code class="sig-name descname">serf</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.CommandInterface.serf" title="Permalink to this definition"></a></dt>
<dd><p>A reference to the Serf that is implementing this <a class="reference internal" href="#royalnet.commands.CommandInterface" title="royalnet.commands.CommandInterface"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandInterface</span></code></a>.</p>
<p class="rubric">Examples</p>
<p>A reference to a <code class="xref py py-class docutils literal notranslate"><span class="pre">TelegramSerf</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandInterface.unregister_herald_action">
<code class="sig-name descname">unregister_herald_action</code><span class="sig-paren">(</span><em class="sig-param">event_name: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandInterface.unregister_herald_action" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.commands.Command">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">Command</code><span class="sig-paren">(</span><em class="sig-param">interface: royalnet.commands.commandinterface.CommandInterface</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.Command" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.commands.Command.alchemy">
<em class="property">property </em><code class="sig-name descname">alchemy</code><a class="headerlink" href="#royalnet.commands.Command.alchemy" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">interface.alchemy</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.Command.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = []</em><a class="headerlink" href="#royalnet.commands.Command.aliases" title="Permalink to this definition"></a></dt>
<dd><p>A list of possible aliases for a command.</p>
<p class="rubric">Example</p>
<p>To be able to call <code class="docutils literal notranslate"><span class="pre">/e</span></code> as an alias for <code class="docutils literal notranslate"><span class="pre">/example</span></code>, one should set aliases to <code class="docutils literal notranslate"><span class="pre">[&quot;e&quot;]</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.Command.description">
<code class="sig-name descname">description</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.Command.description" title="Permalink to this definition"></a></dt>
<dd><p>A small description of the command, to be displayed when the command is being autocompleted.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.Command.loop">
<em class="property">property </em><code class="sig-name descname">loop</code><a class="headerlink" href="#royalnet.commands.Command.loop" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">interface.loop</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.Command.name">
<code class="sig-name descname">name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.Command.name" title="Permalink to this definition"></a></dt>
<dd><p>The main name of the command.</p>
<p class="rubric">Example</p>
<p>To be able to call <code class="docutils literal notranslate"><span class="pre">/example</span></code> on Telegram, the name should be <code class="docutils literal notranslate"><span class="pre">&quot;example&quot;</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.Command.run">
<em class="property">async </em><code class="sig-name descname">run</code><span class="sig-paren">(</span><em class="sig-param">args: royalnet.commands.commandargs.CommandArgs</em>, <em class="sig-param">data: royalnet.commands.commanddata.CommandData</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.commands.Command.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.Command.syntax">
<code class="sig-name descname">syntax</code><em class="property"> = ''</em><a class="headerlink" href="#royalnet.commands.Command.syntax" title="Permalink to this definition"></a></dt>
<dd><p>The syntax of the command, to be displayed when a <a class="reference internal" href="#royalnet.commands.InvalidInputError" title="royalnet.commands.InvalidInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">InvalidInputError</span></code></a> is raised,
in the format <code class="docutils literal notranslate"><span class="pre">(required_arg)</span> <span class="pre">[optional_arg]</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.Command.tables">
<code class="sig-name descname">tables</code><em class="property"> = {}</em><a class="headerlink" href="#royalnet.commands.Command.tables" title="Permalink to this definition"></a></dt>
<dd><p>A set of <a class="reference internal" href="#module-royalnet.alchemy" title="royalnet.alchemy"><code class="xref py py-mod docutils literal notranslate"><span class="pre">royalnet.alchemy</span></code></a> tables that must exist for this command to work.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.commands.CommandData">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">CommandData</code><span class="sig-paren">(</span><em class="sig-param">interface: royalnet.commands.commandinterface.CommandInterface, session: Optional[Session], loop: asyncio.events.AbstractEventLoop</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.commands.CommandData.delete_invoking">
<em class="property">async </em><code class="sig-name descname">delete_invoking</code><span class="sig-paren">(</span><em class="sig-param">error_if_unavailable=False</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.commands.CommandData.delete_invoking" title="Permalink to this definition"></a></dt>
<dd><p>Delete the invoking message, if supported by the interface.</p>
<p>The invoking message is the message send by the user that contains the command.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>error_if_unavailable</strong> if True, raise an exception if the message cannot been deleted.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandData.get_author">
<em class="property">async </em><code class="sig-name descname">get_author</code><span class="sig-paren">(</span><em class="sig-param">error_if_none: bool = False</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.get_author" title="Permalink to this definition"></a></dt>
<dd><p>Try to find the identifier of the user that sent the message.
That probably means, the database row identifying the user.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>error_if_none</strong> Raise an exception if this is True and the call has no author.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandData.reply">
<em class="property">async </em><code class="sig-name descname">reply</code><span class="sig-paren">(</span><em class="sig-param">text: str</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.commands.CommandData.reply" title="Permalink to this definition"></a></dt>
<dd><p>Send a text message to the channel where the call was made.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>text</strong> The text to be sent, possibly formatted in the weird undescribed markup that Im using.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandData.session">
<em class="property">property </em><code class="sig-name descname">session</code><a class="headerlink" href="#royalnet.commands.CommandData.session" title="Permalink to this definition"></a></dt>
<dd><p>Get the <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> <code class="xref py py-class docutils literal notranslate"><span class="pre">Session</span></code>, if it is available.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><a class="reference internal" href="#royalnet.commands.UnsupportedError" title="royalnet.commands.UnsupportedError"><strong>UnsupportedError</strong></a> if no session is available.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandData.session_commit">
<em class="property">async </em><code class="sig-name descname">session_commit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.session_commit" title="Permalink to this definition"></a></dt>
<dd><p>Commit the changes to the session.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.commands.CommandArgs">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">CommandArgs</code><a class="headerlink" href="#royalnet.commands.CommandArgs" title="Permalink to this definition"></a></dt>
<dd><p>An interface to easily access the arguments of a command.</p>
<p>Inherits from <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a>.</p>
<dl class="method">
<dt id="royalnet.commands.CommandArgs.__getitem__">
<code class="sig-name descname">__getitem__</code><span class="sig-paren">(</span><em class="sig-param">item</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandArgs.__getitem__" title="Permalink to this definition"></a></dt>
<dd><p>Access arguments as if they were a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>royalnet.error.InvalidInputError</strong> if the requested argument does not exist.</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># /pasta spaghetti aldente</span>
<span class="o">&gt;&gt;&gt;</span> <span class="bp">self</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="s2">&quot;spaghetti&quot;</span>
<span class="o">&gt;&gt;&gt;</span> <span class="bp">self</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
<span class="s2">&quot;aldente&quot;</span>
<span class="o">&gt;&gt;&gt;</span> <span class="bp">self</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
<span class="c1"># InvalidInputError: Missing argument #3.</span>
<span class="o">&gt;&gt;&gt;</span> <span class="bp">self</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">2</span><span class="p">]</span>
<span class="p">[</span><span class="s2">&quot;spaghetti&quot;</span><span class="p">,</span> <span class="s2">&quot;aldente&quot;</span><span class="p">]</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandArgs.joined">
<code class="sig-name descname">joined</code><span class="sig-paren">(</span><em class="sig-param">*</em>, <em class="sig-param">require_at_least=0</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.commands.CommandArgs.joined" title="Permalink to this definition"></a></dt>
<dd><p>Get the arguments as a space-joined string.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>require_at_least</strong> the minimum amount of arguments required, will raise <a class="reference internal" href="#royalnet.commands.InvalidInputError" title="royalnet.commands.InvalidInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">InvalidInputError</span></code></a> if the</p></li>
<li><p><strong>is not fullfilled.</strong> (<em>requirement</em>) </p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>royalnet.error.InvalidInputError</strong> if there are less than <code class="docutils literal notranslate"><span class="pre">require_at_least</span></code> arguments.</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The space-joined string.</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># /pasta spaghetti aldente</span>
<span class="o">&gt;&gt;&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">joined</span><span class="p">()</span>
<span class="s2">&quot;spaghetti aldente&quot;</span>
<span class="o">&gt;&gt;&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">joined</span><span class="p">(</span><span class="n">require_at_least</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="c1"># InvalidInputError: Not enough arguments specified (minimum is 3).</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandArgs.match">
<code class="sig-name descname">match</code><span class="sig-paren">(</span><em class="sig-param">pattern: Union[str, Pattern], *flags</em><span class="sig-paren">)</span> &#x2192; Sequence[AnyStr]<a class="headerlink" href="#royalnet.commands.CommandArgs.match" title="Permalink to this definition"></a></dt>
<dd><p>Match the <a class="reference internal" href="#royalnet.commands.CommandArgs.joined" title="royalnet.commands.CommandArgs.joined"><code class="xref py py-meth docutils literal notranslate"><span class="pre">joined()</span></code></a> string to a <code class="xref py py-class docutils literal notranslate"><span class="pre">re.Pattern</span></code>-like object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>pattern</strong> The regex pattern to be passed to <a class="reference external" href="https://docs.python.org/3.8/library/re.html#re.match" title="(in Python v3.8)"><code class="xref py py-func docutils literal notranslate"><span class="pre">re.match()</span></code></a>.</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference internal" href="#royalnet.commands.InvalidInputError" title="royalnet.commands.InvalidInputError"><strong>InvalidInputError</strong></a> if the pattern doesnt match.</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The matched groups, as returned by <code class="xref py py-func docutils literal notranslate"><span class="pre">re.Match.groups()</span></code>.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandArgs.optional">
<code class="sig-name descname">optional</code><span class="sig-paren">(</span><em class="sig-param">index: int</em>, <em class="sig-param">default=None</em><span class="sig-paren">)</span> &#x2192; Optional[str]<a class="headerlink" href="#royalnet.commands.CommandArgs.optional" title="Permalink to this definition"></a></dt>
<dd><p>Get the argument at a specific index, but dont raise an error if nothing is found, instead returning the
<code class="docutils literal notranslate"><span class="pre">default</span></code> value.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>index</strong> The index of the argument you want to retrieve.</p></li>
<li><p><strong>default</strong> The value returned if the argument is missing.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Either the argument or the <code class="docutils literal notranslate"><span class="pre">default</span></code> value, defaulting to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># /pasta spaghetti aldente</span>
<span class="o">&gt;&gt;&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">optional</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="s2">&quot;spaghetti&quot;</span>
<span class="o">&gt;&gt;&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">optional</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="kc">None</span>
<span class="o">&gt;&gt;&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">optional</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;carbonara&quot;</span><span class="p">)</span>
<span class="s2">&quot;carbonara&quot;</span>
</pre></div>
</div>
</dd></dl>
</dd></dl>
<dl class="exception">
<dt id="royalnet.commands.CommandError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">CommandError</code><span class="sig-paren">(</span><em class="sig-param">message=''</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandError" title="Permalink to this definition"></a></dt>
<dd><p>Something went wrong during the execution of this command.</p>
<p>Display an error message to the user, explaining what went wrong.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.commands.InvalidInputError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">InvalidInputError</code><span class="sig-paren">(</span><em class="sig-param">message=''</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.InvalidInputError" title="Permalink to this definition"></a></dt>
<dd><p>The command has received invalid input and cannot complete.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.commands.UnsupportedError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">UnsupportedError</code><span class="sig-paren">(</span><em class="sig-param">message=''</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.UnsupportedError" title="Permalink to this definition"></a></dt>
<dd><p>A requested feature is not available on this interface.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.commands.ConfigurationError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">ConfigurationError</code><span class="sig-paren">(</span><em class="sig-param">message=''</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.ConfigurationError" title="Permalink to this definition"></a></dt>
<dd><p>The command cannot work because of a wrong configuration by part of the Royalnet admin.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.commands.ExternalError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">ExternalError</code><span class="sig-paren">(</span><em class="sig-param">message=''</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.ExternalError" title="Permalink to this definition"></a></dt>
<dd><p>The command failed to execute, but the problem was because of an external factor (such as an external API going
down).</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.commands.UserError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">UserError</code><span class="sig-paren">(</span><em class="sig-param">message=''</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.UserError" title="Permalink to this definition"></a></dt>
<dd><p>The command failed to execute, and the error is because of something that the user did.</p>
</dd></dl>
</div>
<div class="section" id="module-royalnet.constellation">
<span id="constellation"></span><h2>Constellation<a class="headerlink" href="#module-royalnet.constellation" title="Permalink to this headline"></a></h2>
<p>The part of <code class="xref py py-mod docutils literal notranslate"><span class="pre">royalnet</span></code> that handles the webserver and webpages.</p>
<p>It uses many features of <code class="xref py py-mod docutils literal notranslate"><span class="pre">starlette</span></code>.</p>
<dl class="class">
<dt id="royalnet.constellation.Constellation">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.constellation.</code><code class="sig-name descname">Constellation</code><span class="sig-paren">(</span><em class="sig-param">secrets_name: str</em>, <em class="sig-param">database_uri: str</em>, <em class="sig-param">page_stars: List[Type[royalnet.constellation.star.PageStar]] = None</em>, <em class="sig-param">exc_stars: List[Type[royalnet.constellation.star.ExceptionStar]] = None</em>, <em class="sig-param">*</em>, <em class="sig-param">debug: bool = True</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Constellation" title="Permalink to this definition"></a></dt>
<dd><p>The class that represents the webserver.</p>
<p>It runs multiple <a class="reference internal" href="#royalnet.constellation.Star" title="royalnet.constellation.Star"><code class="xref py py-class docutils literal notranslate"><span class="pre">Star</span></code></a> , which represent the routes of the website.</p>
<p>It also handles the <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> connection, and it <em>will eventually</em> support Herald connections too.</p>
<dl class="attribute">
<dt id="royalnet.constellation.Constellation.alchemy">
<code class="sig-name descname">alchemy</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.alchemy" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> of this Constellation.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Constellation.get_secret">
<code class="sig-name descname">get_secret</code><span class="sig-paren">(</span><em class="sig-param">username: str</em><span class="sig-paren">)</span> &#x2192; Optional[str]<a class="headerlink" href="#royalnet.constellation.Constellation.get_secret" title="Permalink to this definition"></a></dt>
<dd><p>Get a Royalnet secret from the keyring.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>username</strong> the name of the secret that should be retrieved.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Constellation.run_process">
<em class="property">classmethod </em><code class="sig-name descname">run_process</code><span class="sig-paren">(</span><em class="sig-param">address: str</em>, <em class="sig-param">port: int</em>, <em class="sig-param">secrets_name: str</em>, <em class="sig-param">database_uri: str</em>, <em class="sig-param">page_stars: List[Type[royalnet.constellation.star.PageStar]] = None</em>, <em class="sig-param">exc_stars: List[Type[royalnet.constellation.star.ExceptionStar]] = None</em>, <em class="sig-param">*</em>, <em class="sig-param">debug: bool = True</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Constellation.run_process" title="Permalink to this definition"></a></dt>
<dd><p>Blockingly create and run the Constellation.</p>
<p>This should be used as the target of a <a class="reference external" href="https://docs.python.org/3.8/library/multiprocessing.html#multiprocessing.Process" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">multiprocessing.Process</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> The IP address this Constellation should bind to.</p></li>
<li><p><strong>port</strong> The port this Constellation should listen for requests on.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.constellation.Constellation.running">
<code class="sig-name descname">running</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.running" title="Permalink to this definition"></a></dt>
<dd><p>Is the Constellation currently running?</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.constellation.Constellation.secrets_name">
<code class="sig-name descname">secrets_name</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.secrets_name" title="Permalink to this definition"></a></dt>
<dd><p>The secrets_name this Constellation is currently using.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.constellation.Constellation.starlette">
<code class="sig-name descname">starlette</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.starlette" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">starlette.Starlette</span></code> app.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.constellation.Star">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.constellation.</code><code class="sig-name descname">Star</code><span class="sig-paren">(</span><em class="sig-param">constellation: Constellation</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Star" title="Permalink to this definition"></a></dt>
<dd><p>A Star is a class representing a part of the website.</p>
<p>It shouldnt be used directly: please use <a class="reference internal" href="#royalnet.constellation.PageStar" title="royalnet.constellation.PageStar"><code class="xref py py-class docutils literal notranslate"><span class="pre">PageStar</span></code></a> and <a class="reference internal" href="#royalnet.constellation.ExceptionStar" title="royalnet.constellation.ExceptionStar"><code class="xref py py-class docutils literal notranslate"><span class="pre">ExceptionStar</span></code></a> instead!</p>
<dl class="method">
<dt id="royalnet.constellation.Star.Session">
<em class="property">property </em><code class="sig-name descname">Session</code><a class="headerlink" href="#royalnet.constellation.Star.Session" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for the alchemy <a class="reference internal" href="#royalnet.constellation.Star.Session" title="royalnet.constellation.Star.Session"><code class="xref py py-class docutils literal notranslate"><span class="pre">Session</span></code></a> of the <a class="reference internal" href="#royalnet.constellation.Constellation" title="royalnet.constellation.Constellation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Constellation</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Star.alchemy">
<em class="property">property </em><code class="sig-name descname">alchemy</code><a class="headerlink" href="#royalnet.constellation.Star.alchemy" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for the <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> of the <a class="reference internal" href="#royalnet.constellation.Constellation" title="royalnet.constellation.Constellation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Constellation</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Star.page">
<em class="property">async </em><code class="sig-name descname">page</code><span class="sig-paren">(</span><em class="sig-param">request: Request</em><span class="sig-paren">)</span> &#x2192; Response<a class="headerlink" href="#royalnet.constellation.Star.page" title="Permalink to this definition"></a></dt>
<dd><p>The function generating the <code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code> to a web <code class="xref py py-class docutils literal notranslate"><span class="pre">Request</span></code>.</p>
<p>If it raises an error, the corresponding <a class="reference internal" href="#royalnet.constellation.ExceptionStar" title="royalnet.constellation.ExceptionStar"><code class="xref py py-class docutils literal notranslate"><span class="pre">ExceptionStar</span></code></a> will be used to handle the request instead.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Star.session_acm">
<em class="property">property </em><code class="sig-name descname">session_acm</code><a class="headerlink" href="#royalnet.constellation.Star.session_acm" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for the <code class="xref py py-func docutils literal notranslate"><span class="pre">Alchemy.session_acm()</span></code> of the <a class="reference internal" href="#royalnet.constellation.Constellation" title="royalnet.constellation.Constellation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Constellation</span></code></a>.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.constellation.Star.tables">
<code class="sig-name descname">tables</code><em class="property"> = {}</em><a class="headerlink" href="#royalnet.constellation.Star.tables" title="Permalink to this definition"></a></dt>
<dd><p>The set of <a class="reference internal" href="#module-royalnet.alchemy" title="royalnet.alchemy"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alchemy</span></code></a> table classes required by this <a class="reference internal" href="#royalnet.constellation.Star" title="royalnet.constellation.Star"><code class="xref py py-class docutils literal notranslate"><span class="pre">Star</span></code></a> to function.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.constellation.PageStar">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.constellation.</code><code class="sig-name descname">PageStar</code><span class="sig-paren">(</span><em class="sig-param">constellation: Constellation</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.PageStar" title="Permalink to this definition"></a></dt>
<dd><p>A PageStar is a class representing a single route of the website (for example, <code class="docutils literal notranslate"><span class="pre">/api/user/get</span></code>).</p>
<p>To create a new website route you should create a new class inheriting from this class with a function overriding
<code class="xref py py-meth docutils literal notranslate"><span class="pre">page()</span></code> and changing the values of <a class="reference internal" href="#royalnet.constellation.PageStar.path" title="royalnet.constellation.PageStar.path"><code class="xref py py-attr docutils literal notranslate"><span class="pre">path</span></code></a> and optionally <a class="reference internal" href="#royalnet.constellation.PageStar.methods" title="royalnet.constellation.PageStar.methods"><code class="xref py py-attr docutils literal notranslate"><span class="pre">methods</span></code></a> and <code class="xref py py-attr docutils literal notranslate"><span class="pre">tables</span></code>.</p>
<dl class="attribute">
<dt id="royalnet.constellation.PageStar.methods">
<code class="sig-name descname">methods</code><em class="property"> = ['GET']</em><a class="headerlink" href="#royalnet.constellation.PageStar.methods" title="Permalink to this definition"></a></dt>
<dd><p>The HTTP methods supported by the Star, in form of a list.</p>
<p>By default, a Star only supports the <code class="docutils literal notranslate"><span class="pre">GET</span></code> method, but more can be added.</p>
<p class="rubric">Example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">methods</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;GET&quot;</span><span class="p">,</span> <span class="s2">&quot;POST&quot;</span><span class="p">,</span> <span class="s2">&quot;PUT&quot;</span><span class="p">,</span> <span class="s2">&quot;DELETE&quot;</span><span class="p">]</span>
</pre></div>
</div>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.constellation.PageStar.path">
<code class="sig-name descname">path</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.constellation.PageStar.path" title="Permalink to this definition"></a></dt>
<dd><p>The route of the star.</p>
<p class="rubric">Example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">path</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">&#39;/api/user/get&#39;</span>
</pre></div>
</div>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.constellation.ExceptionStar">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.constellation.</code><code class="sig-name descname">ExceptionStar</code><span class="sig-paren">(</span><em class="sig-param">constellation: Constellation</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.ExceptionStar" title="Permalink to this definition"></a></dt>
<dd><p>An ExceptionStar is a class that handles an <a class="reference external" href="https://docs.python.org/3.8/library/exceptions.html#Exception" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></a> raised by another star by returning a different
response than the one originally intended.</p>
<p>The handled exception type is specified in the <a class="reference internal" href="#royalnet.constellation.ExceptionStar.error" title="royalnet.constellation.ExceptionStar.error"><code class="xref py py-attr docutils literal notranslate"><span class="pre">error</span></code></a>.</p>
<p>It can also handle standard webserver errors, such as <code class="docutils literal notranslate"><span class="pre">404</span> <span class="pre">Not</span> <span class="pre">Found</span></code>:
to handle them, set <a class="reference internal" href="#royalnet.constellation.ExceptionStar.error" title="royalnet.constellation.ExceptionStar.error"><code class="xref py py-attr docutils literal notranslate"><span class="pre">error</span></code></a> to an <a class="reference external" href="https://docs.python.org/3.8/library/functions.html#int" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a> of the corresponding error code.</p>
<p>To create a new exception handler you should create a new class inheriting from this class with a function
overriding <code class="xref py py-meth docutils literal notranslate"><span class="pre">page()</span></code> and changing the values of <a class="reference internal" href="#royalnet.constellation.ExceptionStar.error" title="royalnet.constellation.ExceptionStar.error"><code class="xref py py-attr docutils literal notranslate"><span class="pre">error</span></code></a> and optionally <code class="xref py py-attr docutils literal notranslate"><span class="pre">tables</span></code>.</p>
<dl class="attribute">
<dt id="royalnet.constellation.ExceptionStar.error">
<code class="sig-name descname">error</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.ExceptionStar.error" title="Permalink to this definition"></a></dt>
<dd><p>The error that should be handled by this star. It should be either a subclass of <a class="reference external" href="https://docs.python.org/3.8/library/exceptions.html#Exception" title="(in Python v3.8)"><code class="xref py py-exc docutils literal notranslate"><span class="pre">Exception</span></code></a>,
or the <a class="reference external" href="https://docs.python.org/3.8/library/functions.html#int" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a> of an HTTP error code.</p>
<p class="rubric">Examples</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">error</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">404</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">error</span><span class="p">:</span> <span class="n">Type</span><span class="p">[</span><span class="ne">Exception</span><span class="p">]</span> <span class="o">=</span> <span class="ne">ValueError</span>
</pre></div>
</div>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="royalnet.constellation.shoot">
<code class="sig-prename descclassname">royalnet.constellation.</code><code class="sig-name descname">shoot</code><span class="sig-paren">(</span><em class="sig-param">code: int</em>, <em class="sig-param">description: str</em><span class="sig-paren">)</span> &#x2192; starlette.responses.JSONResponse<a class="headerlink" href="#royalnet.constellation.shoot" title="Permalink to this definition"></a></dt>
<dd><p>Create a error <code class="xref py py-class docutils literal notranslate"><span class="pre">JSONResponse</span></code> with the passed error code and description.</p>
</dd></dl>
</div>
<div class="section" id="module-royalnet.herald">
<span id="herald"></span><h2>Herald<a class="headerlink" href="#module-royalnet.herald" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="royalnet.herald.Config">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">Config</code><span class="sig-paren">(</span><em class="sig-param">name: str</em>, <em class="sig-param">address: str</em>, <em class="sig-param">port: int</em>, <em class="sig-param">secret: str</em>, <em class="sig-param">secure: bool = False</em>, <em class="sig-param">path: str = '/'</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Config" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.herald.Config.copy">
<code class="sig-name descname">copy</code><span class="sig-paren">(</span><em class="sig-param">name: Optional[str] = None</em>, <em class="sig-param">address: Optional[str] = None</em>, <em class="sig-param">port: Optional[int] = None</em>, <em class="sig-param">secret: Optional[str] = None</em>, <em class="sig-param">secure: Optional[bool] = None</em>, <em class="sig-param">path: Optional[str] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Config.copy" title="Permalink to this definition"></a></dt>
<dd><p>Create an exact copy of this configuration, but with different parameters.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Config.url">
<em class="property">property </em><code class="sig-name descname">url</code><a class="headerlink" href="#royalnet.herald.Config.url" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="royalnet.herald.HeraldError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">HeraldError</code><a class="headerlink" href="#royalnet.herald.HeraldError" title="Permalink to this definition"></a></dt>
<dd><p>A generic <a class="reference internal" href="#module-royalnet.herald" title="royalnet.herald"><code class="xref py py-mod docutils literal notranslate"><span class="pre">royalnet.herald</span></code></a> error.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.herald.ConnectionClosedError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">ConnectionClosedError</code><a class="headerlink" href="#royalnet.herald.ConnectionClosedError" title="Permalink to this definition"></a></dt>
<dd><p>The <a class="reference internal" href="#royalnet.herald.Link" title="royalnet.herald.Link"><code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code></a>s connection was closed unexpectedly. The link cant be used anymore.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.herald.LinkError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">LinkError</code><a class="headerlink" href="#royalnet.herald.LinkError" title="Permalink to this definition"></a></dt>
<dd><p>An error for something that happened in a <a class="reference internal" href="#royalnet.herald.Link" title="royalnet.herald.Link"><code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code></a>.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.herald.InvalidServerResponseError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">InvalidServerResponseError</code><a class="headerlink" href="#royalnet.herald.InvalidServerResponseError" title="Permalink to this definition"></a></dt>
<dd><p>The <a class="reference internal" href="#royalnet.herald.Server" title="royalnet.herald.Server"><code class="xref py py-class docutils literal notranslate"><span class="pre">Server</span></code></a> sent invalid data to the <a class="reference internal" href="#royalnet.herald.Link" title="royalnet.herald.Link"><code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code></a>.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.herald.ServerError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">ServerError</code><a class="headerlink" href="#royalnet.herald.ServerError" title="Permalink to this definition"></a></dt>
<dd><p>An error for something that happened in a <a class="reference internal" href="#royalnet.herald.Server" title="royalnet.herald.Server"><code class="xref py py-class docutils literal notranslate"><span class="pre">Server</span></code></a>.</p>
</dd></dl>
<dl class="class">
<dt id="royalnet.herald.Link">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">Link</code><span class="sig-paren">(</span><em class="sig-param">config: royalnet.herald.config.Config</em>, <em class="sig-param">request_handler</em>, <em class="sig-param">*</em>, <em class="sig-param">loop: asyncio.events.AbstractEventLoop = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Link" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.herald.Link.broadcast">
<em class="property">async </em><code class="sig-name descname">broadcast</code><span class="sig-paren">(</span><em class="sig-param">destination: str</em>, <em class="sig-param">broadcast: royalnet.herald.broadcast.Broadcast</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.herald.Link.broadcast" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.herald.Link.connect">
<em class="property">async </em><code class="sig-name descname">connect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Link.connect" title="Permalink to this definition"></a></dt>
<dd><p>Connect to the <a class="reference internal" href="#royalnet.herald.Server" title="royalnet.herald.Server"><code class="xref py py-class docutils literal notranslate"><span class="pre">Server</span></code></a> at <code class="xref py py-attr docutils literal notranslate"><span class="pre">master_uri</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Link.identify">
<em class="property">async </em><code class="sig-name descname">identify</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.herald.Link.identify" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.herald.Link.receive">
<em class="property">async </em><code class="sig-name descname">receive</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; royalnet.herald.package.Package<a class="headerlink" href="#royalnet.herald.Link.receive" title="Permalink to this definition"></a></dt>
<dd><p>Recieve a <a class="reference internal" href="#royalnet.herald.Package" title="royalnet.herald.Package"><code class="xref py py-class docutils literal notranslate"><span class="pre">Package</span></code></a> from the <a class="reference internal" href="#royalnet.herald.Server" title="royalnet.herald.Server"><code class="xref py py-class docutils literal notranslate"><span class="pre">Server</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><a class="reference internal" href="#royalnet.herald.ConnectionClosedError" title="royalnet.herald.ConnectionClosedError"><strong>ConnectionClosedError</strong></a> </p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Link.request">
<em class="property">async </em><code class="sig-name descname">request</code><span class="sig-paren">(</span><em class="sig-param">destination: str</em>, <em class="sig-param">request: royalnet.herald.request.Request</em><span class="sig-paren">)</span> &#x2192; royalnet.herald.response.Response<a class="headerlink" href="#royalnet.herald.Link.request" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.herald.Link.run">
<em class="property">async </em><code class="sig-name descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Link.run" title="Permalink to this definition"></a></dt>
<dd><p>Blockingly run the Link.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Link.send">
<em class="property">async </em><code class="sig-name descname">send</code><span class="sig-paren">(</span><em class="sig-param">package: royalnet.herald.package.Package</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Link.send" title="Permalink to this definition"></a></dt>
<dd><p>Send a package to the <a class="reference internal" href="#royalnet.herald.Server" title="royalnet.herald.Server"><code class="xref py py-class docutils literal notranslate"><span class="pre">Server</span></code></a>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.herald.Package">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">Package</code><span class="sig-paren">(</span><em class="sig-param">data: dict</em>, <em class="sig-param">*</em>, <em class="sig-param">source: str</em>, <em class="sig-param">destination: str</em>, <em class="sig-param">source_conv_id: Optional[str] = None</em>, <em class="sig-param">destination_conv_id: Optional[str] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Package" title="Permalink to this definition"></a></dt>
<dd><p>A data type with which a <a class="reference internal" href="#royalnet.herald.Link" title="royalnet.herald.Link"><code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code></a> communicates with a <a class="reference internal" href="#royalnet.herald.Server" title="royalnet.herald.Server"><code class="xref py py-class docutils literal notranslate"><span class="pre">Server</span></code></a> or
another Link.</p>
<p>Contains info about the source and the destination.</p>
<dl class="method">
<dt id="royalnet.herald.Package.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">data: dict</em>, <em class="sig-param">*</em>, <em class="sig-param">source: str</em>, <em class="sig-param">destination: str</em>, <em class="sig-param">source_conv_id: Optional[str] = None</em>, <em class="sig-param">destination_conv_id: Optional[str] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Package.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Create a Package.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data</strong> The data that should be sent.</p></li>
<li><p><strong>source</strong> The <code class="docutils literal notranslate"><span class="pre">nid</span></code> of the node that created this Package.</p></li>
<li><p><strong>destination</strong> The <code class="docutils literal notranslate"><span class="pre">link_type</span></code> of the destination node, or alternatively, the <code class="docutils literal notranslate"><span class="pre">nid</span></code> of the node.
Can also be the <code class="docutils literal notranslate"><span class="pre">NULL</span></code> value to send the message to nobody.</p></li>
<li><p><strong>source_conv_id</strong> The conversation id of the node that created this package.
Akin to the sequence number on IP packets.</p></li>
<li><p><strong>destination_conv_id</strong> The conversation id of the node that this Package is a reply to.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Package.from_dict">
<em class="property">static </em><code class="sig-name descname">from_dict</code><span class="sig-paren">(</span><em class="sig-param">d</em><span class="sig-paren">)</span> &#x2192; royalnet.herald.package.Package<a class="headerlink" href="#royalnet.herald.Package.from_dict" title="Permalink to this definition"></a></dt>
<dd><p>Create a <a class="reference internal" href="#royalnet.herald.Package" title="royalnet.herald.Package"><code class="xref py py-class docutils literal notranslate"><span class="pre">Package</span></code></a> from a dictionary.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Package.from_json_bytes">
<em class="property">static </em><code class="sig-name descname">from_json_bytes</code><span class="sig-paren">(</span><em class="sig-param">b: bytes</em><span class="sig-paren">)</span> &#x2192; royalnet.herald.package.Package<a class="headerlink" href="#royalnet.herald.Package.from_json_bytes" title="Permalink to this definition"></a></dt>
<dd><p>Create a <a class="reference internal" href="#royalnet.herald.Package" title="royalnet.herald.Package"><code class="xref py py-class docutils literal notranslate"><span class="pre">Package</span></code></a> from UTF-8-encoded JSON bytes.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Package.from_json_string">
<em class="property">static </em><code class="sig-name descname">from_json_string</code><span class="sig-paren">(</span><em class="sig-param">string: str</em><span class="sig-paren">)</span> &#x2192; royalnet.herald.package.Package<a class="headerlink" href="#royalnet.herald.Package.from_json_string" title="Permalink to this definition"></a></dt>
<dd><p>Create a <a class="reference internal" href="#royalnet.herald.Package" title="royalnet.herald.Package"><code class="xref py py-class docutils literal notranslate"><span class="pre">Package</span></code></a> from a JSON string.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Package.reply">
<code class="sig-name descname">reply</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span> &#x2192; royalnet.herald.package.Package<a class="headerlink" href="#royalnet.herald.Package.reply" title="Permalink to this definition"></a></dt>
<dd><p>Reply to this <a class="reference internal" href="#royalnet.herald.Package" title="royalnet.herald.Package"><code class="xref py py-class docutils literal notranslate"><span class="pre">Package</span></code></a> with another <a class="reference internal" href="#royalnet.herald.Package" title="royalnet.herald.Package"><code class="xref py py-class docutils literal notranslate"><span class="pre">Package</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> The data that should be sent. Usually a <a class="reference internal" href="#royalnet.herald.Request" title="royalnet.herald.Request"><code class="xref py py-class docutils literal notranslate"><span class="pre">Request</span></code></a>.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The reply <a class="reference internal" href="#royalnet.herald.Package" title="royalnet.herald.Package"><code class="xref py py-class docutils literal notranslate"><span class="pre">Package</span></code></a>.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Package.to_dict">
<code class="sig-name descname">to_dict</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; dict<a class="headerlink" href="#royalnet.herald.Package.to_dict" title="Permalink to this definition"></a></dt>
<dd><p>Convert the <a class="reference internal" href="#royalnet.herald.Package" title="royalnet.herald.Package"><code class="xref py py-class docutils literal notranslate"><span class="pre">Package</span></code></a> into a dictionary.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Package.to_json_bytes">
<code class="sig-name descname">to_json_bytes</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; bytes<a class="headerlink" href="#royalnet.herald.Package.to_json_bytes" title="Permalink to this definition"></a></dt>
<dd><p>Convert the <a class="reference internal" href="#royalnet.herald.Package" title="royalnet.herald.Package"><code class="xref py py-class docutils literal notranslate"><span class="pre">Package</span></code></a> into UTF-8-encoded JSON bytes.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Package.to_json_string">
<code class="sig-name descname">to_json_string</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.herald.Package.to_json_string" title="Permalink to this definition"></a></dt>
<dd><p>Convert the <a class="reference internal" href="#royalnet.herald.Package" title="royalnet.herald.Package"><code class="xref py py-class docutils literal notranslate"><span class="pre">Package</span></code></a> into a JSON string.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.herald.Request">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">Request</code><span class="sig-paren">(</span><em class="sig-param">handler: str</em>, <em class="sig-param">data: dict</em>, <em class="sig-param">msg_type: Optional[str] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Request" title="Permalink to this definition"></a></dt>
<dd><p>A request sent from a <a class="reference internal" href="#royalnet.herald.Link" title="royalnet.herald.Link"><code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code></a> to another.</p>
<p>It contains the name of the requested handler, in addition to the data.</p>
<dl class="method">
<dt id="royalnet.herald.Request.from_dict">
<em class="property">classmethod </em><code class="sig-name descname">from_dict</code><span class="sig-paren">(</span><em class="sig-param">d: dict</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Request.from_dict" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.herald.Request.to_dict">
<code class="sig-name descname">to_dict</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Request.to_dict" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.herald.Response">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">Response</code><a class="headerlink" href="#royalnet.herald.Response" title="Permalink to this definition"></a></dt>
<dd><p>A base class to be inherited by all other response types.</p>
<dl class="method">
<dt id="royalnet.herald.Response.from_dict">
<em class="property">classmethod </em><code class="sig-name descname">from_dict</code><span class="sig-paren">(</span><em class="sig-param">d: dict</em><span class="sig-paren">)</span> &#x2192; royalnet.herald.response.Response<a class="headerlink" href="#royalnet.herald.Response.from_dict" title="Permalink to this definition"></a></dt>
<dd><p>Recreate the response from a received <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#dict" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Response.to_dict">
<code class="sig-name descname">to_dict</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; dict<a class="headerlink" href="#royalnet.herald.Response.to_dict" title="Permalink to this definition"></a></dt>
<dd><p>Prepare the Response to be sent by converting it to a JSONable <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#dict" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.herald.ResponseSuccess">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">ResponseSuccess</code><span class="sig-paren">(</span><em class="sig-param">data: Optional[dict] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.ResponseSuccess" title="Permalink to this definition"></a></dt>
<dd><p>A response to a successful <a class="reference internal" href="#royalnet.herald.Request" title="royalnet.herald.Request"><code class="xref py py-class docutils literal notranslate"><span class="pre">Request</span></code></a>.</p>
</dd></dl>
<dl class="class">
<dt id="royalnet.herald.ResponseFailure">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">ResponseFailure</code><span class="sig-paren">(</span><em class="sig-param">name: str</em>, <em class="sig-param">description: str</em>, <em class="sig-param">extra_info: Optional[dict] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.ResponseFailure" title="Permalink to this definition"></a></dt>
<dd><p>A response to a invalid <a class="reference internal" href="#royalnet.herald.Request" title="royalnet.herald.Request"><code class="xref py py-class docutils literal notranslate"><span class="pre">Request</span></code></a>.</p>
</dd></dl>
<dl class="class">
<dt id="royalnet.herald.Server">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">Server</code><span class="sig-paren">(</span><em class="sig-param">config: royalnet.herald.config.Config</em>, <em class="sig-param">*</em>, <em class="sig-param">loop: asyncio.events.AbstractEventLoop = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Server" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.herald.Server.find_client">
<code class="sig-name descname">find_client</code><span class="sig-paren">(</span><em class="sig-param">*</em>, <em class="sig-param">nid: str = None</em>, <em class="sig-param">link_type: str = None</em><span class="sig-paren">)</span> &#x2192; List[royalnet.herald.server.ConnectedClient]<a class="headerlink" href="#royalnet.herald.Server.find_client" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.herald.Server.find_destination">
<code class="sig-name descname">find_destination</code><span class="sig-paren">(</span><em class="sig-param">package: royalnet.herald.package.Package</em><span class="sig-paren">)</span> &#x2192; List[royalnet.herald.server.ConnectedClient]<a class="headerlink" href="#royalnet.herald.Server.find_destination" title="Permalink to this definition"></a></dt>
<dd><p>Find a list of destinations for the package.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>package</strong> The package to find the destination of.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> of <code class="xref py py-class docutils literal notranslate"><span class="pre">ConnectedClient</span></code> to send the package to.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Server.listener">
<em class="property">async </em><code class="sig-name descname">listener</code><span class="sig-paren">(</span><em class="sig-param">websocket: websockets.server.WebSocketServerProtocol</em>, <em class="sig-param">path</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Server.listener" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.herald.Server.route_package">
<em class="property">async </em><code class="sig-name descname">route_package</code><span class="sig-paren">(</span><em class="sig-param">package: royalnet.herald.package.Package</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.herald.Server.route_package" title="Permalink to this definition"></a></dt>
<dd><p>Executed every time a package is received and must be routed somewhere.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.herald.Server.run">
<em class="property">async </em><code class="sig-name descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Server.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.herald.Server.run_blocking">
<code class="sig-name descname">run_blocking</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Server.run_blocking" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.herald.Server.serve">
<code class="sig-name descname">serve</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Server.serve" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.herald.Broadcast">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.herald.</code><code class="sig-name descname">Broadcast</code><span class="sig-paren">(</span><em class="sig-param">handler: str</em>, <em class="sig-param">data: dict</em>, <em class="sig-param">msg_type: Optional[str] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Broadcast" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.herald.Broadcast.from_dict">
<em class="property">classmethod </em><code class="sig-name descname">from_dict</code><span class="sig-paren">(</span><em class="sig-param">d: dict</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Broadcast.from_dict" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.herald.Broadcast.to_dict">
<code class="sig-name descname">to_dict</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Broadcast.to_dict" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-royalnet.serf">
<span id="serf"></span><h2>Serf<a class="headerlink" href="#module-royalnet.serf" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="royalnet.serf.Serf">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.serf.</code><code class="sig-name descname">Serf</code><span class="sig-paren">(</span><em class="sig-param">*</em>, <em class="sig-param">alchemy_config: Optional[royalnet.serf.alchemyconfig.AlchemyConfig] = None</em>, <em class="sig-param">commands: List[Type[royalnet.commands.command.Command]] = None</em>, <em class="sig-param">network_config: Optional[royalnet.herald.config.Config] = None</em>, <em class="sig-param">secrets_name: str = '__default__'</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf" title="Permalink to this definition"></a></dt>
<dd><p>An abstract class, to be used as base to implement Royalnet bots on multiple interfaces (such as Telegram or
Discord).</p>
<dl class="attribute">
<dt id="royalnet.serf.Serf.Data">
<code class="sig-name descname">Data</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.Data" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">CommandData</span></code> class of this Serf.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.serf.Serf.Interface">
<code class="sig-name descname">Interface</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.Interface" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">CommandInterface</span></code> class of this Serf.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.serf.Serf.alchemy">
<code class="sig-name descname">alchemy</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.alchemy" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> object connecting this Serf to the database.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.call">
<em class="property">async </em><code class="sig-name descname">call</code><span class="sig-paren">(</span><em class="sig-param">command: royalnet.commands.command.Command, data: royalnet.commands.commanddata.CommandData, parameters: List[str]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.call" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="royalnet.serf.Serf.commands">
<code class="sig-name descname">commands</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.commands" title="Permalink to this definition"></a></dt>
<dd><p>The <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#dict" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a> connecting each command name to its <code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code> object.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.data_factory">
<code class="sig-name descname">data_factory</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Type[royalnet.commands.commanddata.CommandData]<a class="headerlink" href="#royalnet.serf.Serf.data_factory" title="Permalink to this definition"></a></dt>
<dd><p>Create the <code class="xref py py-class docutils literal notranslate"><span class="pre">CommandData</span></code> for the Serf.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.find_tables">
<em class="property">static </em><code class="sig-name descname">find_tables</code><span class="sig-paren">(</span><em class="sig-param">alchemy_config: royalnet.serf.alchemyconfig.AlchemyConfig, commands: List[Type[royalnet.commands.command.Command]]</em><span class="sig-paren">)</span> &#x2192; Set[type]<a class="headerlink" href="#royalnet.serf.Serf.find_tables" title="Permalink to this definition"></a></dt>
<dd><p>Find the :class:<a href="#id1"><span class="problematic" id="id2">`</span></a>Table`s required by the Serf.</p>
<div class="system-message" id="id1">
<p class="system-message-title">System Message: WARNING/2 (<span class="docutils literal">d:\codice\royalnet\royalnet\serf\serf.py:docstring of royalnet.serf.Serf.find_tables</span>, line 1); <em><a href="#id2">backlink</a></em></p>
<p>Inline interpreted text or phrase reference start-string without end-string.</p>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This function will return a wrong result if there are tables between the master table and the identity table
that arent included by a command.</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> of :class:<a href="#id3"><span class="problematic" id="id4">`</span></a>Table`s.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.get_secret">
<code class="sig-name descname">get_secret</code><span class="sig-paren">(</span><em class="sig-param">username: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.get_secret" title="Permalink to this definition"></a></dt>
<dd><p>Get a Royalnet secret from the keyring.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>username</strong> the name of the secret that should be retrieved.</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.serf.Serf.herald">
<code class="sig-name descname">herald</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.herald" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code> object connecting the Serf to the rest of the herald network.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.serf.Serf.herald_handlers">
<code class="sig-name descname">herald_handlers</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.herald_handlers" title="Permalink to this definition"></a></dt>
<dd><p>A <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#dict" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a> linking <code class="xref py py-class docutils literal notranslate"><span class="pre">Request</span></code> event names to coroutines returning a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#dict" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a> that will be
sent as <code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code> to the event.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.serf.Serf.herald_task">
<code class="sig-name descname">herald_task</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.herald_task" title="Permalink to this definition"></a></dt>
<dd><p>A reference to the <a class="reference external" href="https://docs.python.org/3.8/library/asyncio-task.html#asyncio.Task" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.Task</span></code></a> that runs the <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.init_alchemy">
<code class="sig-name descname">init_alchemy</code><span class="sig-paren">(</span><em class="sig-param">alchemy_config: royalnet.serf.alchemyconfig.AlchemyConfig, tables: Set[type]</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.serf.Serf.init_alchemy" title="Permalink to this definition"></a></dt>
<dd><p>Create and initialize the <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> with the required tables, and find the link between the master
table and the identity table.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.init_network">
<code class="sig-name descname">init_network</code><span class="sig-paren">(</span><em class="sig-param">config: royalnet.herald.config.Config</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.init_network" title="Permalink to this definition"></a></dt>
<dd><p>Create a <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code>, and run it as a <a class="reference external" href="https://docs.python.org/3.8/library/asyncio-task.html#asyncio.Task" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.Task</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.init_sentry">
<em class="property">static </em><code class="sig-name descname">init_sentry</code><span class="sig-paren">(</span><em class="sig-param">dsn</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.init_sentry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.interface_factory">
<code class="sig-name descname">interface_factory</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Type[royalnet.commands.commandinterface.CommandInterface]<a class="headerlink" href="#royalnet.serf.Serf.interface_factory" title="Permalink to this definition"></a></dt>
<dd><p>Create the <code class="xref py py-class docutils literal notranslate"><span class="pre">CommandInterface</span></code> class for the Serf.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.serf.Serf.interface_name">
<code class="sig-name descname">interface_name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.serf.Serf.interface_name" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="royalnet.serf.Serf.loop">
<code class="sig-name descname">loop</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.loop" title="Permalink to this definition"></a></dt>
<dd><p>The event loop this Serf is running on.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.network_handler">
<em class="property">async </em><code class="sig-name descname">network_handler</code><span class="sig-paren">(</span><em class="sig-param">message: Union[royalnet.herald.request.Request, royalnet.herald.broadcast.Broadcast]</em><span class="sig-paren">)</span> &#x2192; royalnet.herald.response.Response<a class="headerlink" href="#royalnet.serf.Serf.network_handler" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.register_commands">
<code class="sig-name descname">register_commands</code><span class="sig-paren">(</span><em class="sig-param">commands: List[Type[royalnet.commands.command.Command]]</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.serf.Serf.register_commands" title="Permalink to this definition"></a></dt>
<dd><p>Initialize and register all commands passed as argument.</p>
<p>If called again during the execution of the bot, all current commands will be replaced with the new ones.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Hot-replacing commands was never tested and probably doesnt work.</p>
</div>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.run">
<em class="property">async </em><code class="sig-name descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.run" title="Permalink to this definition"></a></dt>
<dd><p>A coroutine that starts the event loop and handles command calls.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.run_process">
<em class="property">classmethod </em><code class="sig-name descname">run_process</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="#royalnet.serf.Serf.run_process" title="Permalink to this definition"></a></dt>
<dd><p>Blockingly create and run the Serf.</p>
<p>This should be used as the target of a <a class="reference external" href="https://docs.python.org/3.8/library/multiprocessing.html#multiprocessing.Process" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">multiprocessing.Process</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.sentry_exc">
<em class="property">static </em><code class="sig-name descname">sentry_exc</code><span class="sig-paren">(</span><em class="sig-param">exc: Exception</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.sentry_exc" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.serf.AlchemyConfig">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.serf.</code><code class="sig-name descname">AlchemyConfig</code><span class="sig-paren">(</span><em class="sig-param">database_url: str</em>, <em class="sig-param">master_table: type</em>, <em class="sig-param">identity_table: type</em>, <em class="sig-param">identity_column: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.AlchemyConfig" title="Permalink to this definition"></a></dt>
<dd><p>A helper class to configure <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> in a <a class="reference internal" href="#royalnet.serf.Serf" title="royalnet.serf.Serf"><code class="xref py py-class docutils literal notranslate"><span class="pre">Serf</span></code></a>.</p>
</dd></dl>
</div>
<div class="section" id="module-royalnet.utils">
<span id="utils"></span><h2>Utils<a class="headerlink" href="#module-royalnet.utils" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="royalnet.utils.asyncify">
<em class="property">async </em><code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">asyncify</code><span class="sig-paren">(</span><em class="sig-param">function: Callable</em>, <em class="sig-param">*args</em>, <em class="sig-param">loop: Optional[asyncio.events.AbstractEventLoop] = None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.asyncify" title="Permalink to this definition"></a></dt>
<dd><p>Asyncronously run the function in a different thread or process, preventing it from blocking the event loop.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>If the function has side effects, it may behave strangely.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="royalnet.utils.safeformat">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">safeformat</code><span class="sig-paren">(</span><em class="sig-param">string: str</em>, <em class="sig-param">**words: str</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.safeformat" title="Permalink to this definition"></a></dt>
<dd><p><code class="xref py py-func docutils literal notranslate"><span class="pre">str.format()</span></code> something, but ignore missing keys instead of raising an error.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> The base string to be formatted.</p></li>
<li><p><strong>words</strong> The words to format the string with.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The formatted string.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="royalnet.utils.sleep_until">
<em class="property">async </em><code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">sleep_until</code><span class="sig-paren">(</span><em class="sig-param">dt: datetime.datetime</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.utils.sleep_until" title="Permalink to this definition"></a></dt>
<dd><p>Sleep until the specified datetime.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Accurate only to seconds.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="royalnet.utils.andformat">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">andformat</code><span class="sig-paren">(</span><em class="sig-param">l: Collection[str], middle=', ', final=' and '</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.andformat" title="Permalink to this definition"></a></dt>
<dd><p>Convert a iterable (such as a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a>) to a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> by adding <code class="docutils literal notranslate"><span class="pre">final</span></code> between the last two elements and <code class="docutils literal notranslate"><span class="pre">middle</span></code> between the others.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>l</strong> the input iterable.</p></li>
<li><p><strong>middle</strong> the <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> to be added between the middle elements.</p></li>
<li><p><strong>final</strong> the <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> to be added between the last two elements.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The resulting <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>.</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">andformat</span><span class="p">([</span><span class="s2">&quot;Steffo&quot;</span><span class="p">,</span> <span class="s2">&quot;Kappa&quot;</span><span class="p">,</span> <span class="s2">&quot;Proto&quot;</span><span class="p">])</span>
<span class="go">&quot;Steffo, Kappa and Proto&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">andformat</span><span class="p">([</span><span class="s2">&quot;Viktya&quot;</span><span class="p">,</span> <span class="s2">&quot;Sensei&quot;</span><span class="p">,</span> <span class="s2">&quot;Cate&quot;</span><span class="p">],</span> <span class="n">final</span><span class="o">=</span><span class="s2">&quot; e &quot;</span><span class="p">)</span>
<span class="go">&quot;Viktya, Sensei e Cate&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">andformat</span><span class="p">([</span><span class="s2">&quot;Paltri&quot;</span><span class="p">,</span> <span class="s2">&quot;Spaggia&quot;</span><span class="p">,</span> <span class="s2">&quot;Gesù&quot;</span><span class="p">,</span> <span class="s2">&quot;Mallllco&quot;</span><span class="p">],</span> <span class="n">middle</span><span class="o">=</span><span class="s2">&quot;+&quot;</span><span class="p">,</span> <span class="n">final</span><span class="o">=</span><span class="s2">&quot;+&quot;</span><span class="p">)</span>
<span class="go">&quot;Paltri+Spaggia+Gesù+Mallllco&quot;</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="royalnet.utils.underscorize">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">underscorize</code><span class="sig-paren">(</span><em class="sig-param">string: str</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.underscorize" title="Permalink to this definition"></a></dt>
<dd><p>Replace all non-word characters in a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> with underscores.</p>
<p>It is particularly useful when you want to use random strings from the Internet as filenames.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>string</strong> the input string.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The resulting string.</p>
</dd>
</dl>
<p class="rubric">Example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">underscorize</span><span class="p">(</span><span class="s2">&quot;LE EPIC PRANK [GONE WRONG!?!?]&quot;</span><span class="p">)</span>
<span class="go">&quot;LE EPIC PRANK _GONE WRONG_____&quot;</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="royalnet.utils.ytdldateformat">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">ytdldateformat</code><span class="sig-paren">(</span><em class="sig-param">string: Optional[str], separator: str = '-'</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.ytdldateformat" title="Permalink to this definition"></a></dt>
<dd><p>Convert the date <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> returned by <code class="xref py py-mod docutils literal notranslate"><span class="pre">youtube-dl</span></code> into the <code class="docutils literal notranslate"><span class="pre">YYYY-MM-DD</span></code> format.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> the input string, in the <code class="docutils literal notranslate"><span class="pre">YYYYMMDD</span></code> format used by <code class="xref py py-mod docutils literal notranslate"><span class="pre">youtube_dl</span></code>.</p></li>
<li><p><strong>separator</strong> the string to add between the years, the months and the days. Defaults to <code class="docutils literal notranslate"><span class="pre">-</span></code>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The resulting string in the new format.</p>
</dd>
</dl>
<p class="rubric">Example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">ytdldateformat</span><span class="p">(</span><span class="s2">&quot;20111111&quot;</span><span class="p">)</span>
<span class="go">&quot;2011-11-11&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ytdldateformat</span><span class="p">(</span><span class="s2">&quot;20200202&quot;</span><span class="p">,</span> <span class="n">separator</span><span class="o">=</span><span class="s2">&quot;.&quot;</span><span class="p">)</span>
<span class="go">&quot;2020.02.02&quot;</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="royalnet.utils.numberemojiformat">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">numberemojiformat</code><span class="sig-paren">(</span><em class="sig-param">l: List[str]</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.numberemojiformat" title="Permalink to this definition"></a></dt>
<dd><p>Convert a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> to a Unicode string with one item on every line numbered with emojis.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>l</strong> the list to convert.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The resulting Unicode string.</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>Cannot be displayed, as Sphinx does not render emojis properly.</p>
</dd></dl>
<dl class="function">
<dt id="royalnet.utils.ordinalformat">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">ordinalformat</code><span class="sig-paren">(</span><em class="sig-param">number: int</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.ordinalformat" title="Permalink to this definition"></a></dt>
<dd><p>Convert a <a class="reference external" href="https://docs.python.org/3.8/library/functions.html#int" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a> to the corresponding English ordinal <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>number</strong> the number to convert.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>//en.wikipedia.org/wiki/Ordinal_numeral&gt;`_.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>The corresponding English <a href="#id5"><span class="problematic" id="id6">`</span></a>ordinal numeral &lt;https</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">ordinalformat</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="go">&quot;1st&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ordinalformat</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="go">&quot;2nd&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ordinalformat</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span>
<span class="go">&quot;11th&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ordinalformat</span><span class="p">(</span><span class="mi">101</span><span class="p">)</span>
<span class="go">&quot;101st&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ordinalformat</span><span class="p">(</span><span class="mi">112</span><span class="p">)</span>
<span class="go">&quot;112th&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ordinalformat</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">&quot;0th&quot;</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="royalnet.utils.to_urluuid">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">to_urluuid</code><span class="sig-paren">(</span><em class="sig-param">uuid: uuid.UUID</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.to_urluuid" title="Permalink to this definition"></a></dt>
<dd><p>Return a base64 url-friendly short UUID.</p>
</dd></dl>
<dl class="function">
<dt id="royalnet.utils.from_urluuid">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">from_urluuid</code><span class="sig-paren">(</span><em class="sig-param">b: str</em><span class="sig-paren">)</span> &#x2192; uuid.UUID<a class="headerlink" href="#royalnet.utils.from_urluuid" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="class">
<dt id="royalnet.utils.MultiLock">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">MultiLock</code><a class="headerlink" href="#royalnet.utils.MultiLock" title="Permalink to this definition"></a></dt>
<dd><p>A lock that can allow both simultaneous access and exclusive access to a resource.</p>
<dl class="method">
<dt id="royalnet.utils.MultiLock.exclusive">
<code class="sig-name descname">exclusive</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.MultiLock.exclusive" title="Permalink to this definition"></a></dt>
<dd><p>Acquire the lock for exclusive access.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.utils.MultiLock.normal">
<code class="sig-name descname">normal</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.MultiLock.normal" title="Permalink to this definition"></a></dt>
<dd><p>Acquire the lock for simultaneous access.</p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="index.html" class="btn btn-neutral float-left" title="royalnet" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; 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>