<p>The subpackage providing all functions and classes related to databases and tables.</p>
<p>It requires either the <codeclass="docutils literal notranslate"><spanclass="pre">alchemy_easy</span></code> or the <codeclass="docutils literal notranslate"><spanclass="pre">alchemy_hard</span></code> extras to be installed.</p>
<p>You can install <codeclass="docutils literal notranslate"><spanclass="pre">alchemy_easy</span></code> with:</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.alchemy.</code><codeclass="sig-name descname">Alchemy</code><spanclass="sig-paren">(</span><emclass="sig-param">database_uri: str</em>, <emclass="sig-param">tables: Set</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.alchemy.Alchemy"title="Permalink to this definition">¶</a></dt>
<dd><p>A wrapper around <aclass="reference external"href="https://docs.sqlalchemy.org/en/13/orm/scalar_mapping.html#module-sqlalchemy.orm"title="(in SQLAlchemy v1.3)"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="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>
<dlclass="method">
<dtid="royalnet.alchemy.Alchemy.__init__">
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param">database_uri: str</em>, <emclass="sig-param">tables: Set</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.alchemy.Alchemy.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new <aclass="reference internal"href="#royalnet.alchemy.Alchemy"title="royalnet.alchemy.Alchemy"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Alchemy</span></code></a> object.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>database_uri</strong>– The <aclass="reference external"href="https://docs.sqlalchemy.org/en/13/core/engines.html">database URI</a> .</p></li>
<li><p><strong>tables</strong>– The <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#set"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="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>
<codeclass="sig-name descname">get</code><spanclass="sig-paren">(</span><emclass="sig-param">table: Union[str, type]</em><spanclass="sig-paren">)</span>→ sqlalchemy.ext.declarative.api.DeclarativeMeta<aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>table</strong>– The table name or table class you want to get.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><aclass="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>
<dlclass="method">
<dtid="royalnet.alchemy.Alchemy.session_acm">
<codeclass="sig-name descname">session_acm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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 <codeclass="docutils literal notranslate"><spanclass="pre">async</span><spanclass="pre">with</span></code> statements).</p>
<p>The Session will be closed safely when the context manager exits (even in case of error).</p>
<pclass="rubric">Example</p>
<p>You can use the async context manager like this:</p>
<codeclass="sig-name descname">session_cm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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 <codeclass="docutils literal notranslate"><spanclass="pre">with</span></code> statements).</p>
<p>The Session will be closed safely when the context manager exits (even in case of error).</p>
<codeclass="sig-prename descclassname">royalnet.alchemy.</code><codeclass="sig-name descname">table_dfs</code><spanclass="sig-paren">(</span><emclass="sig-param">starting_table: sqlalchemy.sql.schema.Table</em>, <emclass="sig-param">ending_table: sqlalchemy.sql.schema.Table</em><spanclass="sig-paren">)</span>→ tuple<aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#tuple"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">tuple</span></code></a> containing the path, starting from the starting table and ending at the ending table.</p>
</dd>
</dl>
</dd></dl>
<dlclass="exception">
<dtid="royalnet.alchemy.AlchemyException">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.alchemy.</code><codeclass="sig-name descname">AlchemyException</code><aclass="headerlink"href="#royalnet.alchemy.AlchemyException"title="Permalink to this definition">¶</a></dt>
<dd><p>Base class for Alchemy exceptions.</p>
</dd></dl>
<dlclass="exception">
<dtid="royalnet.alchemy.TableNotFoundError">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.alchemy.</code><codeclass="sig-name descname">TableNotFoundError</code><aclass="headerlink"href="#royalnet.alchemy.TableNotFoundError"title="Permalink to this definition">¶</a></dt>
<dd><p>The requested table was not found.</p>
</dd></dl>
</div>
<divclass="section"id="module-royalnet.backpack">
<spanid="backpack"></span><h2>Backpack<aclass="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>
</div>
<divclass="section"id="module-royalnet.bard">
<spanid="bard"></span><h2>Bard<aclass="headerlink"href="#module-royalnet.bard"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.bard.</code><codeclass="sig-name descname">YtdlInfo</code><spanclass="sig-paren">(</span><emclass="sig-param">info: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bard.YtdlInfo"title="Permalink to this definition">¶</a></dt>
<dd><p>A wrapper around <aclass="reference external"href="https://ytdl-org.github.io/youtube-dl/index.html">youtube_dl</a> extracted info.</p>
<dlclass="method">
<dtid="royalnet.bard.YtdlInfo.__init__">
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param">info: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bard.YtdlInfo.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <aclass="reference internal"href="#royalnet.bard.YtdlInfo"title="royalnet.bard.YtdlInfo"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">YtdlInfo</span></code></a> from the dict returned by the <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">YoutubeDL.extract_info()</span></code> function.</p>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>Does not download the info, to do that use <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">retrieve_for_url()</span></code>.</p>
</div>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bard.YtdlInfo.from_url">
<emclass="property">classmethod </em><codeclass="sig-name descname">from_url</code><spanclass="sig-paren">(</span><emclass="sig-param">url</em>, <emclass="sig-param">loop: Optional[asyncio.events.AbstractEventLoop] = None</em>, <emclass="sig-param">**ytdl_args</em><spanclass="sig-paren">)</span>→ List[royalnet.bard.ytdlinfo.YtdlInfo]<aclass="headerlink"href="#royalnet.bard.YtdlInfo.from_url"title="Permalink to this definition">¶</a></dt>
<dd><p>Fetch the info for an url through <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">YoutubeDL</span></code>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#list"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">list</span></code></a> containing the infos for the requested videos.</p>
<dd><p>A representation of a file download with <aclass="reference external"href="https://ytdl-org.github.io/youtube-dl/index.html">youtube_dl</a>.</p>
<dd><p>Create a <aclass="reference internal"href="#royalnet.bard.YtdlFile"title="royalnet.bard.YtdlFile"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">YtdlFile</span></code></a> instance.</p>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>Please avoid using directly <aclass="reference internal"href="#royalnet.bard.YtdlFile.__init__"title="royalnet.bard.YtdlFile.__init__"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">__init__()</span></code></a>, use <aclass="reference internal"href="#royalnet.bard.YtdlFile.from_url"title="royalnet.bard.YtdlFile.from_url"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">from_url()</span></code></a> instead!</p>
</div>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bard.YtdlFile.aopen">
<codeclass="sig-name descname">aopen</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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 isn’t available yet).</p>
<pclass="rubric">Example</p>
<p>You can use the async context manager like this:</p>
<codeclass="sig-name descname">default_ytdl_args</code><emclass="property"> = {'ignoreerrors': True, 'no_warnings': False, 'noplaylist': True, 'outtmpl': './downloads/%(epoch)s-%(title)s-%(id)s.%(ext)s', 'quiet': False}</em><aclass="headerlink"href="#royalnet.bard.YtdlFile.default_ytdl_args"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.bard.YtdlFile.delete_asap">
<emclass="property">async </em><codeclass="sig-name descname">delete_asap</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<dlclass="method">
<dtid="royalnet.bard.YtdlFile.download_file">
<emclass="property">async </em><codeclass="sig-name descname">download_file</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.bard.YtdlFile.download_file"title="Permalink to this definition">¶</a></dt>
<dd><p>Download the file.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bard.YtdlFile.from_url">
<emclass="property">classmethod </em><codeclass="sig-name descname">from_url</code><spanclass="sig-paren">(</span><emclass="sig-param">url: str</em>, <emclass="sig-param">**ytdl_args</em><spanclass="sig-paren">)</span>→ List[royalnet.bard.ytdlfile.YtdlFile]<aclass="headerlink"href="#royalnet.bard.YtdlFile.from_url"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#list"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">list</span></code></a> of <aclass="reference internal"href="#royalnet.bard.YtdlFile"title="royalnet.bard.YtdlFile"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">YtdlFile</span></code></a> from a URL.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bard.YtdlFile.has_info">
<emclass="property">property </em><codeclass="sig-name descname">has_info</code><aclass="headerlink"href="#royalnet.bard.YtdlFile.has_info"title="Permalink to this definition">¶</a></dt>
<dd><p>Does the <aclass="reference internal"href="#royalnet.bard.YtdlFile"title="royalnet.bard.YtdlFile"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">YtdlFile</span></code></a> have info available?</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bard.YtdlFile.is_downloaded">
<emclass="property">property </em><codeclass="sig-name descname">is_downloaded</code><aclass="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>
<dlclass="method">
<dtid="royalnet.bard.YtdlFile.retrieve_info">
<emclass="property">async </em><codeclass="sig-name descname">retrieve_info</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.bard.YtdlFile.retrieve_info"title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieve info about the <aclass="reference internal"href="#royalnet.bard.YtdlFile"title="royalnet.bard.YtdlFile"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">YtdlFile</span></code></a> through <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">YoutubeDL</span></code>.</p>
<codeclass="sig-name descname">set_ytdlinfo_from_id3_tags</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bard.YtdlFile.set_ytdlinfo_from_id3_tags"title="Permalink to this definition">¶</a></dt>
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.bard.</code><codeclass="sig-name descname">BardError</code><aclass="headerlink"href="#royalnet.bard.BardError"title="Permalink to this definition">¶</a></dt>
<dd><p>Base class for <codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">bard</span></code> errors.</p>
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.bard.</code><codeclass="sig-name descname">YtdlError</code><aclass="headerlink"href="#royalnet.bard.YtdlError"title="Permalink to this definition">¶</a></dt>
<dd><p>Base class for errors caused by <codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">youtube_dl</span></code>.</p>
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.bard.</code><codeclass="sig-name descname">NotFoundError</code><aclass="headerlink"href="#royalnet.bard.NotFoundError"title="Permalink to this definition">¶</a></dt>
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.bard.</code><codeclass="sig-name descname">MultipleFilesError</code><aclass="headerlink"href="#royalnet.bard.MultipleFilesError"title="Permalink to this definition">¶</a></dt>
<dd><p>The resource contains multiple media files.</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">CommandInterface</code><spanclass="sig-paren">(</span><emclass="sig-param">config: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.CommandInterface"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">alchemy</code><aclass="headerlink"href="#royalnet.commands.CommandInterface.alchemy"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">serf.alchemy</span></code>.</p>
<emclass="property">async </em><codeclass="sig-name descname">call_herald_event</code><spanclass="sig-paren">(</span><emclass="sig-param">destination: str</em>, <emclass="sig-param">event_name: str</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span>→ dict<aclass="headerlink"href="#royalnet.commands.CommandInterface.call_herald_event"title="Permalink to this definition">¶</a></dt>
<dd><p>Call an event function on a different <aclass="reference internal"href="#royalnet.serf.Serf"title="royalnet.serf.Serf"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Serf</span></code></a>.</p>
<pclass="rubric">Example</p>
<p>You can run a function on a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">DiscordSerf</span></code> from a
<codeclass="sig-name descname">config</code><emclass="property"> = None</em><aclass="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>
<codeclass="sig-name descname">constellation</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.commands.CommandInterface.constellation"title="Permalink to this definition">¶</a></dt>
<dd><p>A reference to the Constellation that is implementing this <aclass="reference internal"href="#royalnet.commands.CommandInterface"title="royalnet.commands.CommandInterface"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">CommandInterface</span></code></a>.</p>
<pclass="rubric">Example</p>
<p>A reference to a <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.commands.CommandInterface.loop">
<emclass="property">property </em><codeclass="sig-name descname">loop</code><aclass="headerlink"href="#royalnet.commands.CommandInterface.loop"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">serf.loop</span></code>.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.commands.CommandInterface.name">
<codeclass="sig-name descname">name</code><emclass="property"> = NotImplemented</em><aclass="headerlink"href="#royalnet.commands.CommandInterface.name"title="Permalink to this definition">¶</a></dt>
<dd><p>The name of the <aclass="reference internal"href="#royalnet.commands.CommandInterface"title="royalnet.commands.CommandInterface"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">CommandInterface</span></code></a> that’s being implemented.</p>
<codeclass="sig-name descname">prefix</code><emclass="property"> = NotImplemented</em><aclass="headerlink"href="#royalnet.commands.CommandInterface.prefix"title="Permalink to this definition">¶</a></dt>
<dd><p>The prefix used by commands on the interface.</p>
<pclass="rubric">Examples</p>
<p><codeclass="docutils literal notranslate"><spanclass="pre">/</span></code> on Telegram, <codeclass="docutils literal notranslate"><spanclass="pre">!</span></code> on Discord.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.commands.CommandInterface.serf">
<codeclass="sig-name descname">serf</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.commands.CommandInterface.serf"title="Permalink to this definition">¶</a></dt>
<dd><p>A reference to the <aclass="reference internal"href="#royalnet.serf.Serf"title="royalnet.serf.Serf"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Serf</span></code></a> that is implementing this <aclass="reference internal"href="#royalnet.commands.CommandInterface"title="royalnet.commands.CommandInterface"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">CommandInterface</span></code></a>.</p>
<pclass="rubric">Example</p>
<p>A reference to a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">TelegramSerf</span></code>.</p>
<emclass="property">property </em><codeclass="sig-name descname">table</code><aclass="headerlink"href="#royalnet.commands.CommandInterface.table"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">serf.alchemy.get()</span></code>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Raises</dt>
<ddclass="field-odd"><p><aclass="reference internal"href="#royalnet.commands.UnsupportedError"title="royalnet.commands.UnsupportedError"><strong>UnsupportedError</strong></a>– if <aclass="reference internal"href="#royalnet.constellation.Constellation.alchemy"title="royalnet.constellation.Constellation.alchemy"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">alchemy</span></code></a> is <codeclass="xref py py-const docutils literal notranslate"><spanclass="pre">None</span></code>.</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">Command</code><spanclass="sig-paren">(</span><emclass="sig-param">interface: royalnet.commands.commandinterface.CommandInterface</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.Command"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="method">
<dtid="royalnet.commands.Command.alchemy">
<emclass="property">property </em><codeclass="sig-name descname">alchemy</code><aclass="headerlink"href="#royalnet.commands.Command.alchemy"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">interface.alchemy</span></code>.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.commands.Command.aliases">
<codeclass="sig-name descname">aliases</code><emclass="property"> = []</em><aclass="headerlink"href="#royalnet.commands.Command.aliases"title="Permalink to this definition">¶</a></dt>
<dd><p>A list of possible aliases for a command.</p>
<pclass="rubric">Example</p>
<p>To be able to call <codeclass="docutils literal notranslate"><spanclass="pre">/e</span></code> as an alias for <codeclass="docutils literal notranslate"><spanclass="pre">/example</span></code>, one should set aliases to <codeclass="docutils literal notranslate"><spanclass="pre">["e"]</span></code>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.commands.Command.config">
<emclass="property">property </em><codeclass="sig-name descname">config</code><aclass="headerlink"href="#royalnet.commands.Command.config"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">interface.config</span></code>.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.commands.Command.description">
<codeclass="sig-name descname">description</code><emclass="property"> = NotImplemented</em><aclass="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>
<dlclass="method">
<dtid="royalnet.commands.Command.loop">
<emclass="property">property </em><codeclass="sig-name descname">loop</code><aclass="headerlink"href="#royalnet.commands.Command.loop"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">interface.loop</span></code>.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.commands.Command.name">
<codeclass="sig-name descname">name</code><emclass="property"> = NotImplemented</em><aclass="headerlink"href="#royalnet.commands.Command.name"title="Permalink to this definition">¶</a></dt>
<dd><p>The main name of the command.</p>
<pclass="rubric">Example</p>
<p>To be able to call <codeclass="docutils literal notranslate"><spanclass="pre">/example</span></code> on Telegram, the name should be <codeclass="docutils literal notranslate"><spanclass="pre">"example"</span></code>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.commands.Command.run">
<emclass="property">async </em><codeclass="sig-name descname">run</code><spanclass="sig-paren">(</span><emclass="sig-param">args: royalnet.commands.commandargs.CommandArgs</em>, <emclass="sig-param">data: royalnet.commands.commanddata.CommandData</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.commands.Command.run"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.commands.Command.serf">
<emclass="property">property </em><codeclass="sig-name descname">serf</code><aclass="headerlink"href="#royalnet.commands.Command.serf"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">interface.serf</span></code>.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.commands.Command.syntax">
<codeclass="sig-name descname">syntax</code><emclass="property"> = ''</em><aclass="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 <aclass="reference internal"href="#royalnet.commands.InvalidInputError"title="royalnet.commands.InvalidInputError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">InvalidInputError</span></code></a> is raised,
in the format <codeclass="docutils literal notranslate"><spanclass="pre">(required_arg)</span><spanclass="pre">[optional_arg]</span></code>.</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">CommandData</code><spanclass="sig-paren">(</span><emclass="sig-param">interface: royalnet.commands.commandinterface.CommandInterface</em>, <emclass="sig-param">loop: asyncio.events.AbstractEventLoop</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.CommandData"title="Permalink to this definition">¶</a></dt>
<emclass="property">async </em><codeclass="sig-name descname">delete_invoking</code><spanclass="sig-paren">(</span><emclass="sig-param">error_if_unavailable=False</em><spanclass="sig-paren">)</span>→ None<aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>error_if_unavailable</strong>– if True, raise an exception if the message cannot been deleted.</p>
<emclass="property">async </em><codeclass="sig-name descname">find_user</code><spanclass="sig-paren">(</span><emclass="sig-param">alias: str</em><spanclass="sig-paren">)</span>→ Optional[User]<aclass="headerlink"href="#royalnet.commands.CommandData.find_user"title="Permalink to this definition">¶</a></dt>
<dd><p>Find the User having a specific Alias.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>alias</strong>– the Alias to search for.</p>
<emclass="property">async </em><codeclass="sig-name descname">get_author</code><spanclass="sig-paren">(</span><emclass="sig-param">error_if_none: bool = False</em><spanclass="sig-paren">)</span><aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>error_if_none</strong>– Raise an exception if this is True and the call has no author.</p>
<codeclass="sig-name descname">keyboard</code><spanclass="sig-paren">(</span><emclass="sig-param">text, keys: List[KeyboardKey]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.CommandData.keyboard"title="Permalink to this definition">¶</a></dt>
<emclass="property">async </em><codeclass="sig-name descname">reply</code><spanclass="sig-paren">(</span><emclass="sig-param">text: str</em><spanclass="sig-paren">)</span>→ None<aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>text</strong>– The text to be sent, possibly formatted in the weird undescribed markup that I’m using.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.commands.CommandData.session">
<emclass="property">property </em><codeclass="sig-name descname">session</code><aclass="headerlink"href="#royalnet.commands.CommandData.session"title="Permalink to this definition">¶</a></dt>
<emclass="property">async </em><codeclass="sig-name descname">session_close</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.CommandData.session_close"title="Permalink to this definition">¶</a></dt>
<emclass="property">async </em><codeclass="sig-name descname">session_commit</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.CommandData.session_commit"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">CommandArgs</code><aclass="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>
<codeclass="sig-name descname">__getitem__</code><spanclass="sig-paren">(</span><emclass="sig-param">item</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.CommandArgs.__getitem__"title="Permalink to this definition">¶</a></dt>
<dd><p>Access arguments as if they were a <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#list"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">list</span></code></a>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Raises</dt>
<ddclass="field-odd"><p><aclass="reference internal"href="#royalnet.commands.InvalidInputError"title="royalnet.commands.InvalidInputError"><strong>InvalidInputError</strong></a>– if the requested argument does not exist.</p>
<codeclass="sig-name descname">joined</code><spanclass="sig-paren">(</span><emclass="sig-param">*</em>, <emclass="sig-param">require_at_least=0</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.commands.CommandArgs.joined"title="Permalink to this definition">¶</a></dt>
<dd><p>Get the arguments as a space-joined string.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>require_at_least</strong>– the minimum amount of arguments required.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><aclass="reference internal"href="#royalnet.commands.InvalidInputError"title="royalnet.commands.InvalidInputError"><strong>InvalidInputError</strong></a>– if there are less than <codeclass="docutils literal notranslate"><spanclass="pre">require_at_least</span></code> arguments.</p>
<spanclass="c1"># InvalidInputError: Not enough arguments specified (minimum is 3).</span>
</pre></div>
</div>
</dd></dl>
<dlclass="method">
<dtid="royalnet.commands.CommandArgs.match">
<codeclass="sig-name descname">match</code><spanclass="sig-paren">(</span><emclass="sig-param">pattern: Union[str, Pattern], *flags</em><spanclass="sig-paren">)</span>→ Sequence[AnyStr]<aclass="headerlink"href="#royalnet.commands.CommandArgs.match"title="Permalink to this definition">¶</a></dt>
<dd><p>Match the <aclass="reference internal"href="#royalnet.commands.CommandArgs.joined"title="royalnet.commands.CommandArgs.joined"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">joined()</span></code></a> string to a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">re.Pattern</span></code>-like object.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>pattern</strong>– The regex pattern to be passed to <aclass="reference external"href="https://docs.python.org/3.8/library/re.html#re.match"title="(in Python v3.8)"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">re.match()</span></code></a>.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><aclass="reference internal"href="#royalnet.commands.InvalidInputError"title="royalnet.commands.InvalidInputError"><strong>InvalidInputError</strong></a>– if the pattern doesn’t match.</p>
</dd>
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The matched groups, as returned by <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">re.Match.groups()</span></code>.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.commands.CommandArgs.optional">
<codeclass="sig-name descname">optional</code><spanclass="sig-paren">(</span><emclass="sig-param">index: int</em>, <emclass="sig-param">default=None</em><spanclass="sig-paren">)</span>→ Optional[str]<aclass="headerlink"href="#royalnet.commands.CommandArgs.optional"title="Permalink to this definition">¶</a></dt>
<dd><p>Get the argument at a specific index, but don’t raise an error if nothing is found, instead returning the
<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>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>Either the argument or the <codeclass="docutils literal notranslate"><spanclass="pre">default</span></code> value, defaulting to <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p>
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">CommandError</code><spanclass="sig-paren">(</span><emclass="sig-param">message=''</em><spanclass="sig-paren">)</span><aclass="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>
<dlclass="exception">
<dtid="royalnet.commands.InvalidInputError">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">InvalidInputError</code><spanclass="sig-paren">(</span><emclass="sig-param">message=''</em><spanclass="sig-paren">)</span><aclass="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>
<dlclass="exception">
<dtid="royalnet.commands.UnsupportedError">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">UnsupportedError</code><spanclass="sig-paren">(</span><emclass="sig-param">message=''</em><spanclass="sig-paren">)</span><aclass="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>
<dlclass="exception">
<dtid="royalnet.commands.ConfigurationError">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">ConfigurationError</code><spanclass="sig-paren">(</span><emclass="sig-param">message=''</em><spanclass="sig-paren">)</span><aclass="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>
<dlclass="exception">
<dtid="royalnet.commands.ExternalError">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">ExternalError</code><spanclass="sig-paren">(</span><emclass="sig-param">message=''</em><spanclass="sig-paren">)</span><aclass="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>
<dlclass="exception">
<dtid="royalnet.commands.UserError">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">UserError</code><spanclass="sig-paren">(</span><emclass="sig-param">message=''</em><spanclass="sig-paren">)</span><aclass="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>
<dlclass="exception">
<dtid="royalnet.commands.ProgramError">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">ProgramError</code><spanclass="sig-paren">(</span><emclass="sig-param">message=''</em><spanclass="sig-paren">)</span><aclass="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>
<dlclass="class">
<dtid="royalnet.commands.Event">
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">Event</code><spanclass="sig-paren">(</span><emclass="sig-param">interface: royalnet.commands.commandinterface.CommandInterface</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.Event"title="Permalink to this definition">¶</a></dt>
<dd><p>A remote procedure call triggered by a <aclass="reference internal"href="#module-royalnet.herald"title="royalnet.herald"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">royalnet.herald</span></code></a> request.</p>
<dlclass="method">
<dtid="royalnet.commands.Event.__init__">
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param">interface: royalnet.commands.commandinterface.CommandInterface</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.Event.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Bind the event to a <aclass="reference internal"href="#royalnet.serf.Serf"title="royalnet.serf.Serf"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Serf</span></code></a>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.commands.Event.alchemy">
<emclass="property">property </em><codeclass="sig-name descname">alchemy</code><aclass="headerlink"href="#royalnet.commands.Event.alchemy"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">interface.alchemy</span></code>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.commands.Event.config">
<emclass="property">property </em><codeclass="sig-name descname">config</code><aclass="headerlink"href="#royalnet.commands.Event.config"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">interface.config</span></code>.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.commands.Event.interface">
<codeclass="sig-name descname">interface</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.commands.Event.interface"title="Permalink to this definition">¶</a></dt>
<dd><p>The <aclass="reference internal"href="#royalnet.commands.CommandInterface"title="royalnet.commands.CommandInterface"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">CommandInterface</span></code></a> available to this <aclass="reference internal"href="#royalnet.commands.Event"title="royalnet.commands.Event"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Event</span></code></a>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.commands.Event.loop">
<emclass="property">property </em><codeclass="sig-name descname">loop</code><aclass="headerlink"href="#royalnet.commands.Event.loop"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">interface.loop</span></code>.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.commands.Event.name">
<codeclass="sig-name descname">name</code><emclass="property"> = NotImplemented</em><aclass="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>
<dlclass="method">
<dtid="royalnet.commands.Event.run">
<emclass="property">async </em><codeclass="sig-name descname">run</code><spanclass="sig-paren">(</span><emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.Event.run"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.commands.Event.serf">
<emclass="property">property </em><codeclass="sig-name descname">serf</code><aclass="headerlink"href="#royalnet.commands.Event.serf"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">interface.serf</span></code>.</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.commands.</code><codeclass="sig-name descname">KeyboardKey</code><spanclass="sig-paren">(</span><emclass="sig-param">interface: royalnet.commands.commandinterface.CommandInterface, short: str, text: str, callback: Callable[[royalnet.commands.commanddata.CommandData], Awaitable[None]]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.KeyboardKey"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="method">
<dtid="royalnet.commands.KeyboardKey.press">
<emclass="property">async </em><codeclass="sig-name descname">press</code><spanclass="sig-paren">(</span><emclass="sig-param">data: royalnet.commands.commanddata.CommandData</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.commands.KeyboardKey.press"title="Permalink to this definition">¶</a></dt>
<p>The subpackage providing all functions and classes that handle the webserver and the webpages.</p>
<p>It requires the <codeclass="docutils literal notranslate"><spanclass="pre">constellation</span></code> extra to be installed (<codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">starlette</span></code>).</p>
<dd><p>The class that represents the webserver.</p>
<p>It runs multiple <aclass="reference internal"href="#royalnet.constellation.Star"title="royalnet.constellation.Star"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Star</span></code></a>, which represent the routes of the website.</p>
<p>It also handles the <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Alchemy</span></code> connection, and Herald connections too.</p>
<codeclass="sig-name descname">Interface</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.constellation.Constellation.Interface"title="Permalink to this definition">¶</a></dt>
<dd><p>The <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">CommandInterface</span></code> class of this <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>.</p>
<codeclass="sig-name descname">address</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.constellation.Constellation.address"title="Permalink to this definition">¶</a></dt>
<dd><p>The address that the <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a> will bind to when run.</p>
<codeclass="sig-name descname">alchemy</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.constellation.Constellation.alchemy"title="Permalink to this definition">¶</a></dt>
<dd><p>The <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Alchemy</span></code> of this Constellation.</p>
<codeclass="sig-name descname">events</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.constellation.Constellation.events"title="Permalink to this definition">¶</a></dt>
<dd><p>A dictionary containing all <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Event</span></code> that can be handled by this <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>.</p>
<codeclass="sig-name descname">herald</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.constellation.Constellation.herald"title="Permalink to this definition">¶</a></dt>
<dd><p>The <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Link</span></code> object connecting the <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="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
<aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>, as the event loop won’t be available before that.</p>
<codeclass="sig-name descname">herald_task</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.constellation.Constellation.herald_task"title="Permalink to this definition">¶</a></dt>
<dd><p>A reference to the <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">aio.Task</span></code> that runs the <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">rh.Link</span></code>.</p>
<codeclass="sig-name descname">init_herald</code><spanclass="sig-paren">(</span><emclass="sig-param">herald_cfg: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.constellation.Constellation.init_herald"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">rh.Link</span></code>.</p>
<codeclass="sig-name descname">interface_factory</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ Type[royalnet.commands.commandinterface.CommandInterface]<aclass="headerlink"href="#royalnet.constellation.Constellation.interface_factory"title="Permalink to this definition">¶</a></dt>
<dd><p>Create the <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">rc.CommandInterface</span></code> class for the <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>.</p>
<codeclass="sig-name descname">loop</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.constellation.Constellation.loop"title="Permalink to this definition">¶</a></dt>
<dd><p>The event loop of the <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>.</p>
<p>Because of how <codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">uvicorn</span></code> runs, it will stay <codeclass="xref py py-const docutils literal notranslate"><spanclass="pre">None</span></code> until the first page is requested.</p>
<emclass="property">async </em><codeclass="sig-name descname">network_handler</code><spanclass="sig-paren">(</span><emclass="sig-param">message: Union[royalnet.herald.request.Request, royalnet.herald.broadcast.Broadcast]</em><spanclass="sig-paren">)</span>→ royalnet.herald.response.Response<aclass="headerlink"href="#royalnet.constellation.Constellation.network_handler"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">port</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.constellation.Constellation.port"title="Permalink to this definition">¶</a></dt>
<dd><p>The port on which the <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a> will listen for connection on.</p>
<codeclass="sig-name descname">register_events</code><spanclass="sig-paren">(</span><emclass="sig-param">events: List[Type[royalnet.commands.event.Event]], pack_cfg: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.constellation.Constellation.register_events"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">register_page_stars</code><spanclass="sig-paren">(</span><emclass="sig-param">page_stars: List[Type[royalnet.constellation.pagestar.PageStar]], pack_cfg: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.constellation.Constellation.register_page_stars"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">run_blocking</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.constellation.Constellation.run_blocking"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 <aclass="reference external"href="https://docs.python.org/3.8/library/multiprocessing.html#multiprocessing.Process"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">multiprocessing.Process</span></code></a>.</p>
<codeclass="sig-name descname">running</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.constellation.Constellation.running"title="Permalink to this definition">¶</a></dt>
<dd><p>Is the <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a> server currently running?</p>
<codeclass="sig-name descname">starlette</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.constellation.Constellation.starlette"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">stars</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.constellation.Constellation.stars"title="Permalink to this definition">¶</a></dt>
<dd><p>A list of all the <aclass="reference internal"href="#royalnet.constellation.PageStar"title="royalnet.constellation.PageStar"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">PageStar</span></code></a> registered to this <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>.</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.constellation.</code><codeclass="sig-name descname">Star</code><spanclass="sig-paren">(</span><emclass="sig-param">interface: royalnet.commands.commandinterface.CommandInterface</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.constellation.Star"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">Session</code><aclass="headerlink"href="#royalnet.constellation.Star.Session"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for the <aclass="reference internal"href="#royalnet.alchemy.Alchemy"title="royalnet.alchemy.Alchemy"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Alchemy</span></code></a><aclass="reference internal"href="#royalnet.constellation.Star.Session"title="royalnet.constellation.Star.Session"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Session</span></code></a> of the <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.constellation.Star.alchemy">
<emclass="property">property </em><codeclass="sig-name descname">alchemy</code><aclass="headerlink"href="#royalnet.constellation.Star.alchemy"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for the <aclass="reference internal"href="#royalnet.alchemy.Alchemy"title="royalnet.alchemy.Alchemy"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Alchemy</span></code></a> of the <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>.</p>
<emclass="property">property </em><codeclass="sig-name descname">config</code><aclass="headerlink"href="#royalnet.constellation.Star.config"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for the Pack configuration of the <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>.</p>
<emclass="property">property </em><codeclass="sig-name descname">constellation</code><aclass="headerlink"href="#royalnet.constellation.Star.constellation"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for the <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>.</p>
<emclass="property">async </em><codeclass="sig-name descname">page</code><spanclass="sig-paren">(</span><emclass="sig-param">request: starlette.requests.Request</em><spanclass="sig-paren">)</span>→ starlette.responses.Response<aclass="headerlink"href="#royalnet.constellation.Star.page"title="Permalink to this definition">¶</a></dt>
<dd><p>The function generating the <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Response</span></code> to a web <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Request</span></code>.</p>
<p>If it raises an error, the corresponding <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">ExceptionStar</span></code> will be used to handle the request instead.</p>
<emclass="property">property </em><codeclass="sig-name descname">session_acm</code><aclass="headerlink"href="#royalnet.constellation.Star.session_acm"title="Permalink to this definition">¶</a></dt>
<dd><p>A shortcut for <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">alchemy.session_acm()</span></code> of the <aclass="reference internal"href="#royalnet.constellation.Constellation"title="royalnet.constellation.Constellation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Constellation</span></code></a>.</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.constellation.</code><codeclass="sig-name descname">PageStar</code><spanclass="sig-paren">(</span><emclass="sig-param">interface: royalnet.commands.commandinterface.CommandInterface</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.constellation.PageStar"title="Permalink to this definition">¶</a></dt>
<dd><p>A PageStar is a class representing a single route of the website (for example, <codeclass="docutils literal notranslate"><spanclass="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
<codeclass="sig-name descname">methods</code><emclass="property"> = ['GET']</em><aclass="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 <codeclass="docutils literal notranslate"><spanclass="pre">GET</span></code> method, but more can be added.</p>
<codeclass="sig-name descname">path</code><emclass="property"> = NotImplemented</em><aclass="headerlink"href="#royalnet.constellation.PageStar.path"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">url</code><aclass="headerlink"href="#royalnet.herald.Config.url"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="exception">
<dtid="royalnet.herald.HeraldError">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">HeraldError</code><aclass="headerlink"href="#royalnet.herald.HeraldError"title="Permalink to this definition">¶</a></dt>
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">ConnectionClosedError</code><aclass="headerlink"href="#royalnet.herald.ConnectionClosedError"title="Permalink to this definition">¶</a></dt>
<dd><p>The <aclass="reference internal"href="#royalnet.herald.Link"title="royalnet.herald.Link"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Link</span></code></a>’s connection was closed unexpectedly. The link can’t be used anymore.</p>
</dd></dl>
<dlclass="exception">
<dtid="royalnet.herald.LinkError">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">LinkError</code><aclass="headerlink"href="#royalnet.herald.LinkError"title="Permalink to this definition">¶</a></dt>
<dd><p>An error for something that happened in a <aclass="reference internal"href="#royalnet.herald.Link"title="royalnet.herald.Link"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Link</span></code></a>.</p>
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">InvalidServerResponseError</code><aclass="headerlink"href="#royalnet.herald.InvalidServerResponseError"title="Permalink to this definition">¶</a></dt>
<dd><p>The <aclass="reference internal"href="#royalnet.herald.Server"title="royalnet.herald.Server"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Server</span></code></a> sent invalid data to the <aclass="reference internal"href="#royalnet.herald.Link"title="royalnet.herald.Link"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Link</span></code></a>.</p>
</dd></dl>
<dlclass="exception">
<dtid="royalnet.herald.ServerError">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">ServerError</code><aclass="headerlink"href="#royalnet.herald.ServerError"title="Permalink to this definition">¶</a></dt>
<dd><p>An error for something that happened in a <aclass="reference internal"href="#royalnet.herald.Server"title="royalnet.herald.Server"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Server</span></code></a>.</p>
</dd></dl>
<dlclass="class">
<dtid="royalnet.herald.Link">
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">Link</code><spanclass="sig-paren">(</span><emclass="sig-param">config: royalnet.herald.config.Config</em>, <emclass="sig-param">request_handler</em>, <emclass="sig-param">*</em>, <emclass="sig-param">loop: asyncio.events.AbstractEventLoop = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Link"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="method">
<dtid="royalnet.herald.Link.broadcast">
<emclass="property">async </em><codeclass="sig-name descname">broadcast</code><spanclass="sig-paren">(</span><emclass="sig-param">destination: str</em>, <emclass="sig-param">broadcast: royalnet.herald.broadcast.Broadcast</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.herald.Link.broadcast"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Link.connect">
<emclass="property">async </em><codeclass="sig-name descname">connect</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Link.connect"title="Permalink to this definition">¶</a></dt>
<dd><p>Connect to the <aclass="reference internal"href="#royalnet.herald.Server"title="royalnet.herald.Server"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Server</span></code></a> at <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">config.url</span></code>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Link.identify">
<emclass="property">async </em><codeclass="sig-name descname">identify</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.herald.Link.identify"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Link.receive">
<emclass="property">async </em><codeclass="sig-name descname">receive</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ royalnet.herald.package.Package<aclass="headerlink"href="#royalnet.herald.Link.receive"title="Permalink to this definition">¶</a></dt>
<dd><p>Recieve a <aclass="reference internal"href="#royalnet.herald.Package"title="royalnet.herald.Package"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Package</span></code></a> from the <aclass="reference internal"href="#royalnet.herald.Server"title="royalnet.herald.Server"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Server</span></code></a>.</p>
<emclass="property">async </em><codeclass="sig-name descname">request</code><spanclass="sig-paren">(</span><emclass="sig-param">destination: str</em>, <emclass="sig-param">request: royalnet.herald.request.Request</em><spanclass="sig-paren">)</span>→ royalnet.herald.response.Response<aclass="headerlink"href="#royalnet.herald.Link.request"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Link.run">
<emclass="property">async </em><codeclass="sig-name descname">run</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Link.run"title="Permalink to this definition">¶</a></dt>
<dd><p>Blockingly run the Link.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Link.send">
<emclass="property">async </em><codeclass="sig-name descname">send</code><spanclass="sig-paren">(</span><emclass="sig-param">package: royalnet.herald.package.Package</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Link.send"title="Permalink to this definition">¶</a></dt>
<dd><p>Send a package to the <aclass="reference internal"href="#royalnet.herald.Server"title="royalnet.herald.Server"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Server</span></code></a>.</p>
<dd><p>A data type with which a <aclass="reference internal"href="#royalnet.herald.Link"title="royalnet.herald.Link"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Link</span></code></a> communicates with a <aclass="reference internal"href="#royalnet.herald.Server"title="royalnet.herald.Server"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Server</span></code></a> or
another Link.</p>
<p>Contains info about the source and the destination.</p>
<dlclass="method">
<dtid="royalnet.herald.Package.__init__">
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param">data: dict</em>, <emclass="sig-param">*</em>, <emclass="sig-param">source: str</em>, <emclass="sig-param">destination: str</em>, <emclass="sig-param">source_conv_id: Optional[str] = None</em>, <emclass="sig-param">destination_conv_id: Optional[str] = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Package.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a Package.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>data</strong>– The data that should be sent.</p></li>
<li><p><strong>source</strong>– The <codeclass="docutils literal notranslate"><spanclass="pre">nid</span></code> of the node that created this Package.</p></li>
<li><p><strong>destination</strong>– The <codeclass="docutils literal notranslate"><spanclass="pre">link_type</span></code> of the destination node, or alternatively, the <codeclass="docutils literal notranslate"><spanclass="pre">nid</span></code> of the node.
Can also be the <codeclass="docutils literal notranslate"><spanclass="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>
<dlclass="method">
<dtid="royalnet.herald.Package.from_dict">
<emclass="property">static </em><codeclass="sig-name descname">from_dict</code><spanclass="sig-paren">(</span><emclass="sig-param">d</em><spanclass="sig-paren">)</span>→ royalnet.herald.package.Package<aclass="headerlink"href="#royalnet.herald.Package.from_dict"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <aclass="reference internal"href="#royalnet.herald.Package"title="royalnet.herald.Package"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Package</span></code></a> from a dictionary.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Package.from_json_bytes">
<emclass="property">static </em><codeclass="sig-name descname">from_json_bytes</code><spanclass="sig-paren">(</span><emclass="sig-param">b: bytes</em><spanclass="sig-paren">)</span>→ royalnet.herald.package.Package<aclass="headerlink"href="#royalnet.herald.Package.from_json_bytes"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <aclass="reference internal"href="#royalnet.herald.Package"title="royalnet.herald.Package"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Package</span></code></a> from UTF-8-encoded JSON bytes.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Package.from_json_string">
<emclass="property">static </em><codeclass="sig-name descname">from_json_string</code><spanclass="sig-paren">(</span><emclass="sig-param">string: str</em><spanclass="sig-paren">)</span>→ royalnet.herald.package.Package<aclass="headerlink"href="#royalnet.herald.Package.from_json_string"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <aclass="reference internal"href="#royalnet.herald.Package"title="royalnet.herald.Package"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Package</span></code></a> from a JSON string.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Package.reply">
<codeclass="sig-name descname">reply</code><spanclass="sig-paren">(</span><emclass="sig-param">data</em><spanclass="sig-paren">)</span>→ royalnet.herald.package.Package<aclass="headerlink"href="#royalnet.herald.Package.reply"title="Permalink to this definition">¶</a></dt>
<dd><p>Reply to this <aclass="reference internal"href="#royalnet.herald.Package"title="royalnet.herald.Package"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Package</span></code></a> with another <aclass="reference internal"href="#royalnet.herald.Package"title="royalnet.herald.Package"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Package</span></code></a>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>data</strong>– The data that should be sent. Usually a <aclass="reference internal"href="#royalnet.herald.Request"title="royalnet.herald.Request"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Request</span></code></a>.</p>
<codeclass="sig-name descname">to_dict</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ dict<aclass="headerlink"href="#royalnet.herald.Package.to_dict"title="Permalink to this definition">¶</a></dt>
<dd><p>Convert the <aclass="reference internal"href="#royalnet.herald.Package"title="royalnet.herald.Package"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Package</span></code></a> into a dictionary.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Package.to_json_bytes">
<codeclass="sig-name descname">to_json_bytes</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ bytes<aclass="headerlink"href="#royalnet.herald.Package.to_json_bytes"title="Permalink to this definition">¶</a></dt>
<dd><p>Convert the <aclass="reference internal"href="#royalnet.herald.Package"title="royalnet.herald.Package"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Package</span></code></a> into UTF-8-encoded JSON bytes.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Package.to_json_string">
<codeclass="sig-name descname">to_json_string</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.herald.Package.to_json_string"title="Permalink to this definition">¶</a></dt>
<dd><p>Convert the <aclass="reference internal"href="#royalnet.herald.Package"title="royalnet.herald.Package"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Package</span></code></a> into a JSON string.</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.herald.Request">
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">Request</code><spanclass="sig-paren">(</span><emclass="sig-param">handler: str</em>, <emclass="sig-param">data: dict</em>, <emclass="sig-param">msg_type: Optional[str] = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Request"title="Permalink to this definition">¶</a></dt>
<dd><p>A request sent from a <aclass="reference internal"href="#royalnet.herald.Link"title="royalnet.herald.Link"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Link</span></code></a> to another.</p>
<p>It contains the name of the requested handler, in addition to the data.</p>
<dlclass="method">
<dtid="royalnet.herald.Request.from_dict">
<emclass="property">classmethod </em><codeclass="sig-name descname">from_dict</code><spanclass="sig-paren">(</span><emclass="sig-param">d: dict</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Request.from_dict"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Request.to_dict">
<codeclass="sig-name descname">to_dict</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Request.to_dict"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.herald.Response">
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">Response</code><aclass="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>
<dlclass="method">
<dtid="royalnet.herald.Response.from_dict">
<emclass="property">classmethod </em><codeclass="sig-name descname">from_dict</code><spanclass="sig-paren">(</span><emclass="sig-param">d: dict</em><spanclass="sig-paren">)</span>→ royalnet.herald.response.Response<aclass="headerlink"href="#royalnet.herald.Response.from_dict"title="Permalink to this definition">¶</a></dt>
<dd><p>Recreate the response from a received <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#dict"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">dict</span></code></a>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Response.to_dict">
<codeclass="sig-name descname">to_dict</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ dict<aclass="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 <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#dict"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">dict</span></code></a>.</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.herald.ResponseSuccess">
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">ResponseSuccess</code><spanclass="sig-paren">(</span><emclass="sig-param">data: Optional[dict] = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.ResponseSuccess"title="Permalink to this definition">¶</a></dt>
<dd><p>A response to a successful <aclass="reference internal"href="#royalnet.herald.Request"title="royalnet.herald.Request"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Request</span></code></a>.</p>
</dd></dl>
<dlclass="class">
<dtid="royalnet.herald.ResponseFailure">
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">ResponseFailure</code><spanclass="sig-paren">(</span><emclass="sig-param">name: str</em>, <emclass="sig-param">description: str</em>, <emclass="sig-param">extra_info: Optional[dict] = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.ResponseFailure"title="Permalink to this definition">¶</a></dt>
<dd><p>A response to a invalid <aclass="reference internal"href="#royalnet.herald.Request"title="royalnet.herald.Request"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Request</span></code></a>.</p>
</dd></dl>
<dlclass="class">
<dtid="royalnet.herald.Server">
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">Server</code><spanclass="sig-paren">(</span><emclass="sig-param">config: royalnet.herald.config.Config</em>, <emclass="sig-param">*</em>, <emclass="sig-param">loop: asyncio.events.AbstractEventLoop = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Server"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="method">
<dtid="royalnet.herald.Server.find_client">
<codeclass="sig-name descname">find_client</code><spanclass="sig-paren">(</span><emclass="sig-param">*</em>, <emclass="sig-param">nid: str = None</em>, <emclass="sig-param">link_type: str = None</em><spanclass="sig-paren">)</span>→ List[royalnet.herald.server.ConnectedClient]<aclass="headerlink"href="#royalnet.herald.Server.find_client"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Server.find_destination">
<codeclass="sig-name descname">find_destination</code><spanclass="sig-paren">(</span><emclass="sig-param">package: royalnet.herald.package.Package</em><spanclass="sig-paren">)</span>→ List[royalnet.herald.server.ConnectedClient]<aclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>package</strong>– The package to find the destination of.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>A <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#list"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">list</span></code></a> of <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">ConnectedClient</span></code> to send the package to.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Server.listener">
<emclass="property">async </em><codeclass="sig-name descname">listener</code><spanclass="sig-paren">(</span><emclass="sig-param">websocket: websockets.server.WebSocketServerProtocol</em>, <emclass="sig-param">path</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Server.listener"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Server.route_package">
<emclass="property">async </em><codeclass="sig-name descname">route_package</code><spanclass="sig-paren">(</span><emclass="sig-param">package: royalnet.herald.package.Package</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.herald.Server.route_package"title="Permalink to this definition">¶</a></dt>
<dd><p>Executed every time a <aclass="reference internal"href="#royalnet.herald.Package"title="royalnet.herald.Package"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Package</span></code></a> is received and must be routed somewhere.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Server.run">
<emclass="property">async </em><codeclass="sig-name descname">run</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Server.run"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Server.run_blocking">
<codeclass="sig-name descname">run_blocking</code><spanclass="sig-paren">(</span><emclass="sig-param">logging_cfg: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Server.run_blocking"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Server.serve">
<codeclass="sig-name descname">serve</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Server.serve"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.herald.Broadcast">
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.herald.</code><codeclass="sig-name descname">Broadcast</code><spanclass="sig-paren">(</span><emclass="sig-param">handler: str</em>, <emclass="sig-param">data: dict</em>, <emclass="sig-param">msg_type: Optional[str] = None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Broadcast"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="method">
<dtid="royalnet.herald.Broadcast.from_dict">
<emclass="property">classmethod </em><codeclass="sig-name descname">from_dict</code><spanclass="sig-paren">(</span><emclass="sig-param">d: dict</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Broadcast.from_dict"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.herald.Broadcast.to_dict">
<codeclass="sig-name descname">to_dict</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.herald.Broadcast.to_dict"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<divclass="section"id="module-royalnet.serf">
<spanid="serf"></span><h2>Serf<aclass="headerlink"href="#module-royalnet.serf"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.serf.</code><codeclass="sig-name descname">Serf</code><spanclass="sig-paren">(</span><emclass="sig-param">loop: asyncio.events.AbstractEventLoop, alchemy_cfg: Dict[str, Any], herald_cfg: Dict[str, Any], packs_cfg: Dict[str, Any], **_</em><spanclass="sig-paren">)</span><aclass="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>
<dlclass="attribute">
<dtid="royalnet.serf.Serf.Interface">
<codeclass="sig-name descname">Interface</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.serf.Serf.Interface"title="Permalink to this definition">¶</a></dt>
<dd><p>The <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">CommandInterface</span></code> class of this Serf.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.serf.Serf.alchemy">
<codeclass="sig-name descname">alchemy</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.serf.Serf.alchemy"title="Permalink to this definition">¶</a></dt>
<dd><p>The <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Alchemy</span></code> object connecting this <aclass="reference internal"href="#royalnet.serf.Serf"title="royalnet.serf.Serf"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Serf</span></code></a> to a database.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.serf.Serf.call">
<emclass="property">async </em><codeclass="sig-name descname">call</code><spanclass="sig-paren">(</span><emclass="sig-param">command: royalnet.commands.command.Command, data: royalnet.commands.commanddata.CommandData, parameters: List[str]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.serf.Serf.call"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.serf.Serf.commands">
<codeclass="sig-name descname">commands</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.serf.Serf.commands"title="Permalink to this definition">¶</a></dt>
<dd><p>The <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#dict"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">dict</span></code></a> connecting each command name to its <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Command</span></code> object.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.serf.Serf.events">
<codeclass="sig-name descname">events</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.serf.Serf.events"title="Permalink to this definition">¶</a></dt>
<dd><p>A dictionary containing all <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Event</span></code> that can be handled by this <aclass="reference internal"href="#royalnet.serf.Serf"title="royalnet.serf.Serf"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Serf</span></code></a>.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.serf.Serf.herald">
<codeclass="sig-name descname">herald</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.serf.Serf.herald"title="Permalink to this definition">¶</a></dt>
<dd><p>The <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Link</span></code> object connecting the <aclass="reference internal"href="#royalnet.serf.Serf"title="royalnet.serf.Serf"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Serf</span></code></a> to the rest of the Herald network.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.serf.Serf.herald_task">
<codeclass="sig-name descname">herald_task</code><emclass="property"> = None</em><aclass="headerlink"href="#royalnet.serf.Serf.herald_task"title="Permalink to this definition">¶</a></dt>
<dd><p>A reference to the <aclass="reference external"href="https://docs.python.org/3.8/library/asyncio-task.html#asyncio.Task"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">asyncio.Task</span></code></a> that runs the <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Link</span></code>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.serf.Serf.identity_chain">
<emclass="property">property </em><codeclass="sig-name descname">identity_chain</code><aclass="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>
<dlclass="attribute">
<dtid="royalnet.serf.Serf.identity_table">
<codeclass="sig-name descname">identity_table</code><emclass="property"> = None</em><aclass="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>
<dlclass="method">
<dtid="royalnet.serf.Serf.init_alchemy">
<codeclass="sig-name descname">init_alchemy</code><spanclass="sig-paren">(</span><emclass="sig-param">alchemy_cfg: Dict[str, Any], tables: Set[type]</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.serf.Serf.init_alchemy"title="Permalink to this definition">¶</a></dt>
<dd><p>Create and initialize the <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Alchemy</span></code> with the required tables, and find the link between the master
table and the identity table.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.serf.Serf.init_herald">
<codeclass="sig-name descname">init_herald</code><spanclass="sig-paren">(</span><emclass="sig-param">herald_cfg: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.serf.Serf.init_herald"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Link</span></code> and bind <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Event</span></code>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.serf.Serf.interface_factory">
<codeclass="sig-name descname">interface_factory</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ Type[royalnet.commands.commandinterface.CommandInterface]<aclass="headerlink"href="#royalnet.serf.Serf.interface_factory"title="Permalink to this definition">¶</a></dt>
<dd><p>Create the <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">CommandInterface</span></code> class for the Serf.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.serf.Serf.interface_name">
<codeclass="sig-name descname">interface_name</code><emclass="property"> = NotImplemented</em><aclass="headerlink"href="#royalnet.serf.Serf.interface_name"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.serf.Serf.loop">
<codeclass="sig-name descname">loop</code><emclass="property"> = None</em><aclass="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>
<dlclass="attribute">
<dtid="royalnet.serf.Serf.master_table">
<codeclass="sig-name descname">master_table</code><emclass="property"> = None</em><aclass="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 <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">User</span></code>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.serf.Serf.network_handler">
<emclass="property">async </em><codeclass="sig-name descname">network_handler</code><spanclass="sig-paren">(</span><emclass="sig-param">message: Union[royalnet.herald.request.Request, royalnet.herald.broadcast.Broadcast]</em><spanclass="sig-paren">)</span>→ royalnet.herald.response.Response<aclass="headerlink"href="#royalnet.serf.Serf.network_handler"title="Permalink to this definition">¶</a></dt>
<emclass="property">async </em><codeclass="sig-name descname">press</code><spanclass="sig-paren">(</span><emclass="sig-param">key: royalnet.commands.keyboardkey.KeyboardKey</em>, <emclass="sig-param">data: royalnet.commands.commanddata.CommandData</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.serf.Serf.press"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">register_commands</code><spanclass="sig-paren">(</span><emclass="sig-param">commands: List[Type[royalnet.commands.command.Command]], pack_cfg: Dict[str, Any]</em><spanclass="sig-paren">)</span>→ None<aclass="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>
<dlclass="method">
<dtid="royalnet.serf.Serf.register_events">
<codeclass="sig-name descname">register_events</code><spanclass="sig-paren">(</span><emclass="sig-param">events: List[Type[royalnet.commands.event.Event]], pack_cfg: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.serf.Serf.register_events"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.serf.Serf.run">
<emclass="property">async </em><codeclass="sig-name descname">run</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<dlclass="method">
<dtid="royalnet.serf.Serf.run_process">
<emclass="property">classmethod </em><codeclass="sig-name descname">run_process</code><spanclass="sig-paren">(</span><emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="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 <aclass="reference external"href="https://docs.python.org/3.8/library/multiprocessing.html#multiprocessing.Process"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">multiprocessing.Process</span></code></a>.</p>
</dd></dl>
</dd></dl>
<dlclass="exception">
<dtid="royalnet.serf.SerfError">
<emclass="property">exception </em><codeclass="sig-prename descclassname">royalnet.serf.</code><codeclass="sig-name descname">SerfError</code><aclass="headerlink"href="#royalnet.serf.SerfError"title="Permalink to this definition">¶</a></dt>
<dd><p>Base class for all <aclass="reference internal"href="#module-royalnet.serf"title="royalnet.serf"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">royalnet.serf</span></code></a> errors.</p>
</dd></dl>
</div>
<divclass="section"id="module-royalnet.utils">
<spanid="utils"></span><h2>Utils<aclass="headerlink"href="#module-royalnet.utils"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="royalnet.utils.asyncify">
<emclass="property">async </em><codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">asyncify</code><spanclass="sig-paren">(</span><emclass="sig-param">function: Callable</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">loop: Optional[asyncio.events.AbstractEventLoop] = None</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.asyncify"title="Permalink to this definition">¶</a></dt>
<dd><p>Asyncronously run the function in a executor, allowing it to run asyncronously.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="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 <codeclass="xref py py-const docutils literal notranslate"><spanclass="pre">None</span></code>, run it in in the current event loop.</p></li>
<emclass="property">async </em><codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">sleep_until</code><spanclass="sig-paren">(</span><emclass="sig-param">dt: datetime.datetime</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.utils.sleep_until"title="Permalink to this definition">¶</a></dt>
<dd><p>Sleep until the specified datetime.</p>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>Accurate only to seconds.</p>
</div>
</dd></dl>
<dlclass="function">
<dtid="royalnet.utils.andformat">
<codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">andformat</code><spanclass="sig-paren">(</span><emclass="sig-param">l: Collection[str], middle=', ', final=' and '</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.andformat"title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a iterable (such as a <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#list"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">list</span></code></a>) to a <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#str"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a> by adding <codeclass="docutils literal notranslate"><spanclass="pre">final</span></code> between the last two elements and <codeclass="docutils literal notranslate"><spanclass="pre">middle</span></code> between the others.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>l</strong>– the input iterable.</p></li>
<li><p><strong>middle</strong>– the <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#str"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a> to be added between the middle elements.</p></li>
<li><p><strong>final</strong>– the <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#str"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a> to be added between the last two elements.</p></li>
<spanclass="go">"Steffo, Kappa and Proto"</span>
<spanclass="gp">>>></span><spanclass="n">andformat</span><spanclass="p">([</span><spanclass="s2">"Viktya"</span><spanclass="p">,</span><spanclass="s2">"Sensei"</span><spanclass="p">,</span><spanclass="s2">"Cate"</span><spanclass="p">],</span><spanclass="n">final</span><spanclass="o">=</span><spanclass="s2">" e "</span><spanclass="p">)</span>
<spanclass="go">"Viktya, Sensei e Cate"</span>
<codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">underscorize</code><spanclass="sig-paren">(</span><emclass="sig-param">string: str</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.underscorize"title="Permalink to this definition">¶</a></dt>
<dd><p>Replace all non-word characters in a <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#str"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>string</strong>– the input string.</p>
<codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">ytdldateformat</code><spanclass="sig-paren">(</span><emclass="sig-param">string: Optional[str], separator: str = '-'</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.ytdldateformat"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="simple">
<dt>Convert the date <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#str"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a> returned by <aclass="reference external"href="https://ytdl-org.github.io/youtube-dl/index.html">youtube_dl</a> into</dt><dd><p>the <codeclass="docutils literal notranslate"><spanclass="pre">YYYY-MM-DD</span></code> format.</p>
</dd>
</dl>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>string</strong>– the input <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#str"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a>, in the <codeclass="docutils literal notranslate"><spanclass="pre">YYYYMMDD</span></code> format used by youtube_dl.</p></li>
<li><p><strong>separator</strong>– the <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#str"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a> to add between the years, the months and the days. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">"-"</span></code>.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>The resulting <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#str"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a> in the new format.</p>
<codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">numberemojiformat</code><spanclass="sig-paren">(</span><emclass="sig-param">l: List[str]</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.numberemojiformat"title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#list"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">list</span></code></a> to a Unicode string with one item on every line numbered with emojis.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>l</strong>– the list to convert.</p>
<p>Cannot be displayed, as Sphinx does not render emojis properly.</p>
</dd></dl>
<dlclass="function">
<dtid="royalnet.utils.ordinalformat">
<codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">ordinalformat</code><spanclass="sig-paren">(</span><emclass="sig-param">number: int</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.ordinalformat"title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a <aclass="reference external"href="https://docs.python.org/3.8/library/functions.html#int"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">int</span></code></a> to the corresponding English ordinal <aclass="reference external"href="https://docs.python.org/3.8/library/stdtypes.html#str"title="(in Python v3.8)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>number</strong>– the number to convert.</p>
<codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">to_urluuid</code><spanclass="sig-paren">(</span><emclass="sig-param">uuid: uuid.UUID</em><spanclass="sig-paren">)</span>→ str<aclass="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>
<dlclass="function">
<dtid="royalnet.utils.from_urluuid">
<codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">from_urluuid</code><spanclass="sig-paren">(</span><emclass="sig-param">b: str</em><spanclass="sig-paren">)</span>→ uuid.UUID<aclass="headerlink"href="#royalnet.utils.from_urluuid"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="class">
<dtid="royalnet.utils.MultiLock">
<emclass="property">class </em><codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">MultiLock</code><aclass="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>
<dlclass="method">
<dtid="royalnet.utils.MultiLock.exclusive">
<codeclass="sig-name descname">exclusive</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.MultiLock.exclusive"title="Permalink to this definition">¶</a></dt>
<dd><p>Acquire the lock for exclusive access.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.utils.MultiLock.normal">
<codeclass="sig-name descname">normal</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<dlclass="function">
<dtid="royalnet.utils.init_sentry">
<codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">init_sentry</code><spanclass="sig-paren">(</span><emclass="sig-param">sentry_cfg: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.init_sentry"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="royalnet.utils.sentry_exc">
<codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">sentry_exc</code><spanclass="sig-paren">(</span><emclass="sig-param">exc: Exception</em>, <emclass="sig-param">level: str = 'ERROR'</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.sentry_exc"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="royalnet.utils.init_logging">
<codeclass="sig-prename descclassname">royalnet.utils.</code><codeclass="sig-name descname">init_logging</code><spanclass="sig-paren">(</span><emclass="sig-param">logging_cfg: Dict[str, Any]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.init_logging"title="Permalink to this definition">¶</a></dt>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.