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

1806 lines
147 KiB
HTML
Raw Normal View History

2019-12-03 18:26:23 +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">
2020-01-30 18:33:15 +00:00
<title>API Reference &mdash; Royalnet 5.3.2 documentation</title>
2019-12-03 18:26:23 +00:00
<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="Random discoveries" href="randomdiscoveries.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">
2020-01-30 18:33:15 +00:00
5.3.2
2019-12-03 18:26:23 +00:00
</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"><a class="reference internal" href="randomdiscoveries.html">Random discoveries</a></li>
<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><a class="reference internal" href="#royalnet.alchemy.TableNotFoundError" title="royalnet.alchemy.TableNotFoundError"><strong>TableNotFoundError</strong></a> 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.TableNotFoundError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.alchemy.</code><code class="sig-name descname">TableNotFoundError</code><a class="headerlink" href="#royalnet.alchemy.TableNotFoundError" 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 Royalnet instances.</p>
<p>Keep things here to a minimum!</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 <a class="reference external" href="https://ytdl-org.github.io/youtube-dl/index.html">youtube_dl</a> 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 <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> from the dict returned by the <code class="xref py py-func docutils literal notranslate"><span class="pre">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-class docutils literal notranslate"><span class="pre">YoutubeDL</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 <a class="reference external" href="https://ytdl-org.github.io/youtube-dl/index.html">youtube_dl</a>.</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 <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> 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': './downloads/%(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 <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> 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 <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> through <code class="xref py py-class docutils literal notranslate"><span class="pre">YoutubeDL</span></code>.</p>
</dd></dl>
2020-01-30 18:33:15 +00:00
<dl class="method">
<dt id="royalnet.bard.YtdlFile.set_ytdlinfo_from_id3_tags">
<code class="sig-name descname">set_ytdlinfo_from_id3_tags</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bard.YtdlFile.set_ytdlinfo_from_id3_tags" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
2019-12-03 18:26:23 +00:00
</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="class">
<dt id="royalnet.bard.YtdlDiscord">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.bard.</code><code class="sig-name descname">YtdlDiscord</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.YtdlDiscord" 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 the <code class="xref py py-mod docutils literal notranslate"><span class="pre">discord</span></code> PCM format.</p>
<dl class="method">
<dt id="royalnet.bard.YtdlDiscord.convert_to_pcm">
<em class="property">async </em><code class="sig-name descname">convert_to_pcm</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.bard.YtdlDiscord.convert_to_pcm" title="Permalink to this definition"></a></dt>
<dd><p>Convert the file to pcm 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.YtdlDiscord.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.YtdlDiscord.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.YtdlDiscord.embed">
<code class="sig-name descname">embed</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; discord.embeds.Embed<a class="headerlink" href="#royalnet.bard.YtdlDiscord.embed" title="Permalink to this definition"></a></dt>
2020-01-30 18:33:15 +00:00
<dd><p>Return this info as a <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed" title="(in discord.py v1.3.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Embed</span></code></a>.</p>
2019-12-03 18:26:23 +00:00
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlDiscord.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.ytdldiscord.YtdlDiscord]<a class="headerlink" href="#royalnet.bard.YtdlDiscord.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.YtdlDiscord.info">
<em class="property">property </em><code class="sig-name descname">info</code><a class="headerlink" href="#royalnet.bard.YtdlDiscord.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.YtdlDiscord.is_converted">
<em class="property">property </em><code class="sig-name descname">is_converted</code><a class="headerlink" href="#royalnet.bard.YtdlDiscord.is_converted" title="Permalink to this definition"></a></dt>
<dd><p>Has the file been converted?</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.bard.YtdlDiscord.spawn_audiosource">
<code class="sig-name descname">spawn_audiosource</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bard.YtdlDiscord.spawn_audiosource" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</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><span class="sig-paren">(</span><em class="sig-param">config: Dict[str, Any]</em><span class="sig-paren">)</span><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_event">
<em class="property">async </em><code class="sig-name descname">call_herald_event</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">**kwargs</em><span class="sig-paren">)</span> &#x2192; dict<a class="headerlink" href="#royalnet.commands.CommandInterface.call_herald_event" title="Permalink to this definition"></a></dt>
<dd><p>Call an event function on a different <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>
<p class="rubric">Example</p>
<p>You can run a function on a <code class="xref py py-class docutils literal notranslate"><span class="pre">DiscordSerf</span></code> from a
<code class="xref py py-class docutils literal notranslate"><span class="pre">TelegramSerf</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.CommandInterface.config">
<code class="sig-name descname">config</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.commands.CommandInterface.config" title="Permalink to this definition"></a></dt>
<dd><p>The config section for the pack of the command.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.CommandInterface.constellation">
<code class="sig-name descname">constellation</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.commands.CommandInterface.constellation" title="Permalink to this definition"></a></dt>
<dd><p>A reference to the Constellation 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">Example</p>
<p>A reference to a <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.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="attribute">
<dt id="royalnet.commands.CommandInterface.serf">
<code class="sig-name descname">serf</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.commands.CommandInterface.serf" title="Permalink to this definition"></a></dt>
<dd><p>A reference to the <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> 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">Example</p>
<p>A reference to a <code class="xref py py-class docutils literal notranslate"><span class="pre">TelegramSerf</span></code>.</p>
</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="method">
<dt id="royalnet.commands.Command.config">
<em class="property">property </em><code class="sig-name descname">config</code><a class="headerlink" href="#royalnet.commands.Command.config" 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.config</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="method">
<dt id="royalnet.commands.Command.serf">
<em class="property">property </em><code class="sig-name descname">serf</code><a class="headerlink" href="#royalnet.commands.Command.serf" 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.serf</span></code>.</p>
</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>
</dd></dl>
<dl class="class">
<dt id="royalnet.commands.CommandData">
2020-01-30 18:33:15 +00:00
<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</em>, <em class="sig-param">loop: asyncio.events.AbstractEventLoop</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData" title="Permalink to this definition"></a></dt>
2019-12-03 18:26:23 +00:00
<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>
2020-01-30 18:33:15 +00:00
<dl class="method">
<dt id="royalnet.commands.CommandData.keyboard">
<code class="sig-name descname">keyboard</code><span class="sig-paren">(</span><em class="sig-param">text, keys: List[KeyboardKey]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.keyboard" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
2019-12-03 18:26:23 +00:00
<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>
2020-01-30 18:33:15 +00:00
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandData.session_close">
<em class="property">async </em><code class="sig-name descname">session_close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.session_close" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
2019-12-03 18:26:23 +00:00
<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>
2020-01-30 18:33:15 +00:00
<dd></dd></dl>
2019-12-03 18:26:23 +00:00
</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><a class="reference internal" href="#royalnet.commands.InvalidInputError" title="royalnet.commands.InvalidInputError"><strong>InvalidInputError</strong></a> 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"><p><strong>require_at_least</strong> the minimum amount of arguments required.</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 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>
<dl class="exception">
<dt id="royalnet.commands.ProgramError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">ProgramError</code><span class="sig-paren">(</span><em class="sig-param">message=''</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.ProgramError" title="Permalink to this definition"></a></dt>
<dd><p>The command encountered an error in the program.</p>
</dd></dl>
<dl class="class">
<dt id="royalnet.commands.Event">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">Event</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.Event" title="Permalink to this definition"></a></dt>
<dd><p>A remote procedure call triggered by a <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> request.</p>
<dl class="method">
<dt id="royalnet.commands.Event.__init__">
<code class="sig-name descname">__init__</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.Event.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Bind the event to 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>
<dl class="method">
<dt id="royalnet.commands.Event.alchemy">
<em class="property">property </em><code class="sig-name descname">alchemy</code><a class="headerlink" href="#royalnet.commands.Event.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="method">
<dt id="royalnet.commands.Event.config">
<em class="property">property </em><code class="sig-name descname">config</code><a class="headerlink" href="#royalnet.commands.Event.config" 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.config</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.Event.interface">
<code class="sig-name descname">interface</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.commands.Event.interface" title="Permalink to this definition"></a></dt>
<dd><p>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> available to this <a class="reference internal" href="#royalnet.commands.Event" title="royalnet.commands.Event"><code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.Event.loop">
<em class="property">property </em><code class="sig-name descname">loop</code><a class="headerlink" href="#royalnet.commands.Event.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.Event.name">
<code class="sig-name descname">name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.Event.name" title="Permalink to this definition"></a></dt>
<dd><p>The event_name that will trigger this event.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.Event.run">
<em class="property">async </em><code class="sig-name descname">run</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.Event.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.commands.Event.serf">
<em class="property">property </em><code class="sig-name descname">serf</code><a class="headerlink" href="#royalnet.commands.Event.serf" 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.serf</span></code>.</p>
</dd></dl>
</dd></dl>
2020-01-30 18:33:15 +00:00
<dl class="class">
<dt id="royalnet.commands.KeyboardKey">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">KeyboardKey</code><span class="sig-paren">(</span><em class="sig-param">interface: royalnet.commands.commandinterface.CommandInterface, short: str, text: str, callback: Callable[[royalnet.commands.commanddata.CommandData], Awaitable[None]]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.KeyboardKey" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.commands.KeyboardKey.press">
<em class="property">async </em><code class="sig-name descname">press</code><span class="sig-paren">(</span><em class="sig-param">data: royalnet.commands.commanddata.CommandData</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.KeyboardKey.press" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
2019-12-03 18:26:23 +00:00
</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">
2020-01-30 18:33:15 +00:00
<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">alchemy_cfg: Dict[str, Any], herald_cfg: Dict[str, Any], packs_cfg: Dict[str, Any], constellation_cfg: Dict[str, Any], logging_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Constellation" title="Permalink to this definition"></a></dt>
2019-12-03 18:26:23 +00:00
<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 Herald connections too.</p>
<dl class="attribute">
<dt id="royalnet.constellation.Constellation.Interface">
<code class="sig-name descname">Interface</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.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 <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.Constellation.address">
<code class="sig-name descname">address</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.address" title="Permalink to this definition"></a></dt>
<dd><p>The address that 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> will bind to when run.</p>
</dd></dl>
<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="attribute">
<dt id="royalnet.constellation.Constellation.events">
<code class="sig-name descname">events</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.events" title="Permalink to this definition"></a></dt>
<dd><p>A dictionary containing all <code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code> that can be handled by this <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.Constellation.herald">
<code class="sig-name descname">herald</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.herald" title="Permalink to this definition"></a></dt>
2020-01-30 18:33:15 +00:00
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code> object connecting 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> to the rest of the herald network.
As is the case with the logging module, it will be started on the first request received by 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>, as the event loop wont be available before that.</p>
2019-12-03 18:26:23 +00:00
</dd></dl>
<dl class="attribute">
<dt id="royalnet.constellation.Constellation.herald_task">
<code class="sig-name descname">herald_task</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.herald_task" title="Permalink to this definition"></a></dt>
<dd><p>A reference to the <code class="xref py py-class docutils literal notranslate"><span class="pre">aio.Task</span></code> that runs the <code class="xref py py-class docutils literal notranslate"><span class="pre">rh.Link</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Constellation.init_herald">
<code class="sig-name descname">init_herald</code><span class="sig-paren">(</span><em class="sig-param">herald_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Constellation.init_herald" title="Permalink to this definition"></a></dt>
<dd><p>Create a <code class="xref py py-class docutils literal notranslate"><span class="pre">rh.Link</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Constellation.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.constellation.Constellation.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">rc.CommandInterface</span></code> class for 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>
2020-01-30 18:33:15 +00:00
<dl class="attribute">
<dt id="royalnet.constellation.Constellation.loop">
<code class="sig-name descname">loop</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.loop" title="Permalink to this definition"></a></dt>
<dd><p>The event loop 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>
<p>Because of how <code class="xref py py-mod docutils literal notranslate"><span class="pre">uvicorn</span></code> runs, it will stay <code class="xref py py-const docutils literal notranslate"><span class="pre">None</span></code> until the first page is requested.</p>
</dd></dl>
2019-12-03 18:26:23 +00:00
<dl class="method">
<dt id="royalnet.constellation.Constellation.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.constellation.Constellation.network_handler" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="royalnet.constellation.Constellation.port">
<code class="sig-name descname">port</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.port" title="Permalink to this definition"></a></dt>
<dd><p>The port on which 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> will listen for connection on.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Constellation.register_events">
<code class="sig-name descname">register_events</code><span class="sig-paren">(</span><em class="sig-param">events: List[Type[royalnet.commands.event.Event]], pack_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Constellation.register_events" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Constellation.register_exc_stars">
<code class="sig-name descname">register_exc_stars</code><span class="sig-paren">(</span><em class="sig-param">exc_stars: List[Type[royalnet.constellation.star.ExceptionStar]], pack_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Constellation.register_exc_stars" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Constellation.register_page_stars">
<code class="sig-name descname">register_page_stars</code><span class="sig-paren">(</span><em class="sig-param">page_stars: List[Type[royalnet.constellation.star.PageStar]], pack_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Constellation.register_page_stars" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Constellation.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.constellation.Constellation.run_blocking" title="Permalink to this definition"></a></dt>
<dd></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">alchemy_cfg: Dict[str, Any], herald_cfg: Dict[str, Any], sentry_cfg: Dict[str, Any], packs_cfg: Dict[str, Any], constellation_cfg: Dict[str, Any], logging_cfg: Dict[str, Any]</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>
</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 <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> server currently running?</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</span></code> app.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.constellation.Star">
2020-01-30 18:33:15 +00:00
<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">interface: royalnet.commands.commandinterface.CommandInterface</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Star" title="Permalink to this definition"></a></dt>
2019-12-03 18:26:23 +00:00
<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 <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> <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 <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> 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>
2020-01-30 18:33:15 +00:00
<dl class="method">
<dt id="royalnet.constellation.Star.config">
<em class="property">property </em><code class="sig-name descname">config</code><a class="headerlink" href="#royalnet.constellation.Star.config" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for the Pack configuration 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.constellation">
<em class="property">property </em><code class="sig-name descname">constellation</code><a class="headerlink" href="#royalnet.constellation.Star.constellation" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for 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>
2019-12-03 18:26:23 +00:00
<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: starlette.requests.Request</em><span class="sig-paren">)</span> &#x2192; starlette.responses.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 <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>
</dd></dl>
<dl class="class">
<dt id="royalnet.constellation.PageStar">
2020-01-30 18:33:15 +00:00
<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">interface: royalnet.commands.commandinterface.CommandInterface</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.PageStar" title="Permalink to this definition"></a></dt>
2019-12-03 18:26:23 +00:00
<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
<a class="reference internal" href="#royalnet.constellation.Star.page" title="royalnet.constellation.Star.page"><code class="xref py py-meth docutils literal notranslate"><span class="pre">page()</span></code></a> 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>.</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">
2020-01-30 18:33:15 +00:00
<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">interface: royalnet.commands.commandinterface.CommandInterface</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.ExceptionStar" title="Permalink to this definition"></a></dt>
2019-12-03 18:26:23 +00:00
<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 <a class="reference internal" href="#royalnet.constellation.Star.page" title="royalnet.constellation.Star.page"><code class="xref py py-meth docutils literal notranslate"><span class="pre">page()</span></code></a> and changing the value 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>.</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.from_config">
<em class="property">classmethod </em><code class="sig-name descname">from_config</code><span class="sig-paren">(</span><em class="sig-param">*</em>, <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>, <em class="sig-param">enabled: ... = Ellipsis</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.herald.Config.from_config" title="Permalink to this definition"></a></dt>
<dd></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">config.url</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 <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> 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><em class="sig-param">logging_cfg: Dict[str, Any]</em><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">loop: asyncio.events.AbstractEventLoop, alchemy_cfg: Dict[str, Any], herald_cfg: Dict[str, Any], packs_cfg: Dict[str, Any], **_</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.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 <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> to a 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="attribute">
<dt id="royalnet.serf.Serf.events">
<code class="sig-name descname">events</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.events" title="Permalink to this definition"></a></dt>
<dd><p>A dictionary containing all <code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code> that can be handled by this <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>
<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 <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> to the rest of the Herald network.</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.identity_chain">
<em class="property">property </em><code class="sig-name descname">identity_chain</code><a class="headerlink" href="#royalnet.serf.Serf.identity_chain" title="Permalink to this definition"></a></dt>
<dd><p>Find a relationship path starting from the master table and ending at the identity table, and return it.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.serf.Serf.identity_table">
<code class="sig-name descname">identity_table</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.identity_table" title="Permalink to this definition"></a></dt>
<dd><p>The identity table containing the interface data (such as the Telegram user data) and that is in a
many-to-one relationship with the master table.</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_cfg: Dict[str, Any], 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_herald">
<code class="sig-name descname">init_herald</code><span class="sig-paren">(</span><em class="sig-param">herald_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.init_herald" 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 bind <code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code>.</p>
</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="attribute">
<dt id="royalnet.serf.Serf.master_table">
<code class="sig-name descname">master_table</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.master_table" title="Permalink to this definition"></a></dt>
<dd><p>The central table listing all users. It usually is <code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code>.</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>
2020-01-30 18:33:15 +00:00
<dl class="method">
<dt id="royalnet.serf.Serf.press">
<em class="property">async </em><code class="sig-name descname">press</code><span class="sig-paren">(</span><em class="sig-param">key: royalnet.commands.keyboardkey.KeyboardKey</em>, <em class="sig-param">data: royalnet.commands.commanddata.CommandData</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.press" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
2019-12-03 18:26:23 +00:00
<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]], pack_cfg: Dict[str, Any]</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>
</dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.register_events">
<code class="sig-name descname">register_events</code><span class="sig-paren">(</span><em class="sig-param">events: List[Type[royalnet.commands.event.Event]], pack_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.register_events" title="Permalink to this definition"></a></dt>
<dd></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">**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>
</dd></dl>
<dl class="exception">
<dt id="royalnet.serf.SerfError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.serf.</code><code class="sig-name descname">SerfError</code><a class="headerlink" href="#royalnet.serf.SerfError" title="Permalink to this definition"></a></dt>
<dd><p>Base class for all <a class="reference internal" href="#module-royalnet.serf" title="royalnet.serf"><code class="xref py py-mod docutils literal notranslate"><span class="pre">royalnet.serf</span></code></a> errors.</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>
2020-01-30 18:33:15 +00:00
<dd><p>Asyncronously run the function in a executor, allowing it to run asyncronously.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>function</strong> The function to call.</p></li>
<li><p><strong>args</strong> The arguments to pass to the function.</p></li>
<li><p><strong>kwargs</strong> The keyword arguments to pass to the function.</p></li>
<li><p><strong>loop</strong> The loop to run the function in. If <code class="xref py py-const docutils literal notranslate"><span class="pre">None</span></code>, run it in in the current event loop.</p></li>
</ul>
</dd>
</dl>
2019-12-03 18:26:23 +00:00
<div class="admonition warning">
<p class="admonition-title">Warning</p>
2020-01-30 18:33:15 +00:00
<p>The called function must be thread-safe!</p>
2019-12-03 18:26:23 +00:00
</div>
</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><dl class="simple">
<dt>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 <a class="reference external" href="https://ytdl-org.github.io/youtube-dl/index.html">youtube_dl</a> into</dt><dd><p>the <code class="docutils literal notranslate"><span class="pre">YYYY-MM-DD</span></code> format.</p>
</dd>
</dl>
<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 <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>, in the <code class="docutils literal notranslate"><span class="pre">YYYYMMDD</span></code> format used by youtube_dl.</p></li>
<li><p><strong>separator</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 add between the years, the months and the days. Defaults to <code class="docutils literal notranslate"><span class="pre">&quot;-&quot;</span></code>.</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> 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="#id3"><span class="problematic" id="id4">`</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>
<dl class="class">
<dt id="royalnet.utils.FileAudioSource">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">FileAudioSource</code><span class="sig-paren">(</span><em class="sig-param">file</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.FileAudioSource" title="Permalink to this definition"></a></dt>
2020-01-30 18:33:15 +00:00
<dd><p>A <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.AudioSource" title="(in discord.py v1.3.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.AudioSource</span></code></a> that uses a <a class="reference external" href="https://docs.python.org/3.8/library/io.html#io.BufferedIOBase" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">io.BufferedIOBase</span></code></a> as an input instead of memory.</p>
2019-12-03 18:26:23 +00:00
<p>The stream should be in the usual PCM encoding.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This AudioSource will consume (and close) the passed stream.</p>
</div>
<dl class="method">
<dt id="royalnet.utils.FileAudioSource.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">file</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.FileAudioSource.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Create a FileAudioSource.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>file</strong> the file to be played back.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.utils.FileAudioSource.is_opus">
<code class="sig-name descname">is_opus</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.FileAudioSource.is_opus" title="Permalink to this definition"></a></dt>
<dd><p>This audio file isnt Opus-encoded, but PCM-encoded.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.utils.FileAudioSource.read">
<code class="sig-name descname">read</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.FileAudioSource.read" title="Permalink to this definition"></a></dt>
<dd><p>Reads 20ms of audio.</p>
<p>If the stream has ended, then return an empty <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#bytes" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>-like object.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.utils.FileAudioSource.stop">
<code class="sig-name descname">stop</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.FileAudioSource.stop" title="Permalink to this definition"></a></dt>
<dd><p>Stop the FileAudioSource. Once stopped, a FileAudioSource will immediatly stop reading more bytes from the
file.</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="royalnet.utils.init_sentry">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">init_sentry</code><span class="sig-paren">(</span><em class="sig-param">sentry_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.init_sentry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="royalnet.utils.sentry_exc">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">sentry_exc</code><span class="sig-paren">(</span><em class="sig-param">exc: Exception</em>, <em class="sig-param">level: str = 'ERROR'</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.sentry_exc" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="royalnet.utils.init_logging">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">init_logging</code><span class="sig-paren">(</span><em class="sig-param">logging_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.init_logging" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="randomdiscoveries.html" class="btn btn-neutral float-left" title="Random discoveries" 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>