Added docs for cpl.configuration
This commit is contained in:
parent
4209055d62
commit
cda1fabd4f
BIN
docs/build/doctrees/cpl.application.doctree
vendored
BIN
docs/build/doctrees/cpl.application.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/cpl.configuration.doctree
vendored
BIN
docs/build/doctrees/cpl.configuration.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/cpl.doctree
vendored
BIN
docs/build/doctrees/cpl.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/environment.pickle
vendored
BIN
docs/build/doctrees/environment.pickle
vendored
Binary file not shown.
7
docs/build/html/_sources/cpl.rst.txt
vendored
7
docs/build/html/_sources/cpl.rst.txt
vendored
@ -15,10 +15,3 @@ CPL
|
||||
cpl.time
|
||||
cpl.utils
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: cpl
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
5
docs/build/html/cpl.application.html
vendored
5
docs/build/html/cpl.application.html
vendored
@ -102,7 +102,6 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.mailing.html">cpl.mailing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -243,7 +242,7 @@
|
||||
<dd><p>Sets the custom startup class to use</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
<dt>startup: Type[<a class="reference internal" href="#cpl.application.startup_abc.StartupABC" title="cpl.application.startup_abc.StartupABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.application.startup_abc.StartupABC</span></code></a>]</dt><dd><p>Type of <a class="reference internal" href="#cpl.application.startup_abc.StartupABC" title="cpl.application.startup_abc.StartupABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.application.startup_abc.StartupABC</span></code></a></p>
|
||||
<dt>startup: Type[<a class="reference internal" href="#cpl.application.startup_abc.StartupABC" title="cpl.application.startup_abc.StartupABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.application.startup_abc.StartupABC</span></code></a>]</dt><dd><p>Startup class to use</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
@ -274,7 +273,7 @@
|
||||
<dd><p>Sets the custom startup class to use</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
<dt>startup: Type[<a class="reference internal" href="#cpl.application.startup_abc.StartupABC" title="cpl.application.startup_abc.StartupABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.application.startup_abc.StartupABC</span></code></a>]</dt><dd><p>Type of <a class="reference internal" href="#cpl.application.startup_abc.StartupABC" title="cpl.application.startup_abc.StartupABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.application.startup_abc.StartupABC</span></code></a></p>
|
||||
<dt>startup: Type[<a class="reference internal" href="#cpl.application.startup_abc.StartupABC" title="cpl.application.startup_abc.StartupABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.application.startup_abc.StartupABC</span></code></a>]</dt><dd><p>Startup class to use</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
|
115
docs/build/html/cpl.configuration.html
vendored
115
docs/build/html/cpl.configuration.html
vendored
@ -103,7 +103,6 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.mailing.html">cpl.mailing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -186,45 +185,53 @@
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration.Configuration.add_configuration">
|
||||
<code class="sig-name descname"><span class="pre">add_configuration</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">type</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration.Configuration.add_configuration" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Add configuration object
|
||||
:param key_type:
|
||||
:param value:
|
||||
:return:</p>
|
||||
<dd><p>Add configuration object</p>
|
||||
<blockquote>
|
||||
<div><p>key_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code>]
|
||||
value: <a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a></p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration.Configuration.add_console_argument">
|
||||
<code class="sig-name descname"><span class="pre">add_console_argument</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#cpl.configuration.console_argument.ConsoleArgument" title="cpl.configuration.console_argument.ConsoleArgument"><span class="pre">cpl.configuration.console_argument.ConsoleArgument</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration.Configuration.add_console_argument" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Adds console argument to known console arguments
|
||||
:param argument:
|
||||
:return:</p>
|
||||
<dd><p>Adds console argument to known console arguments</p>
|
||||
<blockquote>
|
||||
<div><p>argument: <code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.console_argument.ConsoleArgument</span></code></p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration.Configuration.add_console_arguments">
|
||||
<code class="sig-name descname"><span class="pre">add_console_arguments</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">error</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration.Configuration.add_console_arguments" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Reads the console arguments
|
||||
:param error: defines is invalid argument error will be shown or not
|
||||
:return:</p>
|
||||
<dd><p>Reads the console arguments</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
<dt>error: <code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></dt><dd><p>Defines is invalid argument error will be shown or not</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration.Configuration.add_environment_variables">
|
||||
<code class="sig-name descname"><span class="pre">add_environment_variables</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prefix</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration.Configuration.add_environment_variables" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Reads the environment variables
|
||||
:param prefix:
|
||||
:return:</p>
|
||||
<dd><p>Reads the environment variables</p>
|
||||
<blockquote>
|
||||
<div><p>prefix: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration.Configuration.add_json_file">
|
||||
<code class="sig-name descname"><span class="pre">add_json_file</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">optional</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">bool</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration.Configuration.add_json_file" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Reads and saves settings from given json file
|
||||
:param name:
|
||||
:param optional:
|
||||
:param output:
|
||||
:param path:
|
||||
:return:</p>
|
||||
<dd><p>Reads and saves settings from given json file</p>
|
||||
<blockquote>
|
||||
<div><p>name (str): Name of the file
|
||||
optional: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>
|
||||
output: <code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>
|
||||
path: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
@ -245,9 +252,13 @@
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration.Configuration.get_configuration">
|
||||
<code class="sig-name descname"><span class="pre">get_configuration</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">search_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> → <span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">collections.abc.Callable</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#cpl.configuration.configuration.Configuration.get_configuration" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns value in configuration by given type
|
||||
:param search_type:
|
||||
:return:</p>
|
||||
<dd><p>Returns value from configuration by given type</p>
|
||||
<blockquote>
|
||||
<div><p>search_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, Type[<a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]]</p>
|
||||
</div></blockquote>
|
||||
<blockquote>
|
||||
<div><p>Object of Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, Callable[<a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]]</p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
@ -261,46 +272,54 @@
|
||||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">abc.ABC</span></code></p>
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration_abc.ConfigurationABC.add_configuration">
|
||||
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_configuration</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">type</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">object</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.add_configuration" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Add configuration object
|
||||
:param key_type:
|
||||
:param value:
|
||||
:return:</p>
|
||||
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_configuration</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">type</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.add_configuration" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Add configuration object</p>
|
||||
<blockquote>
|
||||
<div><p>key_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code>]
|
||||
value: <a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a></p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration_abc.ConfigurationABC.add_console_argument">
|
||||
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_console_argument</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#cpl.configuration.console_argument.ConsoleArgument" title="cpl.configuration.console_argument.ConsoleArgument"><span class="pre">cpl.configuration.console_argument.ConsoleArgument</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.add_console_argument" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Adds console argument to known console arguments
|
||||
:param argument:
|
||||
:return:</p>
|
||||
<dd><p>Adds console argument to known console arguments</p>
|
||||
<blockquote>
|
||||
<div><p>argument: <code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.console.console_argument.ConsoleArgument</span></code></p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration_abc.ConfigurationABC.add_console_arguments">
|
||||
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_console_arguments</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">error</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.add_console_arguments" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Reads the console arguments
|
||||
:param error: defines is invalid argument error will be shown or not
|
||||
:return:</p>
|
||||
<dd><p>Reads the console arguments</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
<dt>error: <code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></dt><dd><p>Defines is invalid argument error will be shown or not</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration_abc.ConfigurationABC.add_environment_variables">
|
||||
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_environment_variables</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prefix</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.add_environment_variables" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Reads the environment variables
|
||||
:param prefix:
|
||||
:return:</p>
|
||||
<dd><p>Reads the environment variables</p>
|
||||
<blockquote>
|
||||
<div><p>prefix: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration_abc.ConfigurationABC.add_json_file">
|
||||
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_json_file</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">optional</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">bool</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.add_json_file" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Reads and saves settings from given json file
|
||||
:param name:
|
||||
:param optional:
|
||||
:param output:
|
||||
:param path:
|
||||
:return:</p>
|
||||
<dd><p>Reads and saves settings from given json file</p>
|
||||
<blockquote>
|
||||
<div><p>name (str): Name of the file
|
||||
optional: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>
|
||||
output: <code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>
|
||||
path: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
@ -321,9 +340,13 @@
|
||||
<dl class="py method">
|
||||
<dt id="cpl.configuration.configuration_abc.ConfigurationABC.get_configuration">
|
||||
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">get_configuration</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">search_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> → <span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">collections.abc.Callable</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#cpl.configuration.configuration_abc.ConfigurationABC.get_configuration" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns value in configuration by given type
|
||||
:param search_type:
|
||||
:return:</p>
|
||||
<dd><p>Returns value from configuration by given type</p>
|
||||
<blockquote>
|
||||
<div><p>search_type: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, Type[<a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]]</p>
|
||||
</div></blockquote>
|
||||
<blockquote>
|
||||
<div><p>Object of Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, Callable[<a class="reference internal" href="#cpl.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]]</p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
1
docs/build/html/cpl.console.html
vendored
1
docs/build/html/cpl.console.html
vendored
@ -103,7 +103,6 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.mailing.html">cpl.mailing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
1
docs/build/html/cpl.database.connection.html
vendored
1
docs/build/html/cpl.database.connection.html
vendored
@ -108,7 +108,6 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.mailing.html">cpl.mailing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
1
docs/build/html/cpl.database.context.html
vendored
1
docs/build/html/cpl.database.context.html
vendored
@ -108,7 +108,6 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.mailing.html">cpl.mailing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
1
docs/build/html/cpl.database.html
vendored
1
docs/build/html/cpl.database.html
vendored
@ -104,7 +104,6 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.mailing.html">cpl.mailing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -104,7 +104,6 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.mailing.html">cpl.mailing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
1
docs/build/html/cpl.environment.html
vendored
1
docs/build/html/cpl.environment.html
vendored
@ -101,7 +101,6 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.mailing.html">cpl.mailing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
45
docs/build/html/cpl.html
vendored
45
docs/build/html/cpl.html
vendored
@ -96,10 +96,6 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.mailing.html">cpl.mailing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#module-cpl">Module contents</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#sh-cpl-sh-edraft-common-python-library">sh_cpl sh-edraft Common Python library</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -257,47 +253,6 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="module-cpl">
|
||||
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-cpl" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="sh-cpl-sh-edraft-common-python-library">
|
||||
<h3>sh_cpl sh-edraft Common Python library<a class="headerlink" href="#sh-cpl-sh-edraft-common-python-library" title="Permalink to this headline">¶</a></h3>
|
||||
<p>sh-edraft Common Python library</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">copyright</dt>
|
||||
<dd class="field-odd"><ol class="loweralpha simple" start="3">
|
||||
<li><p>2020 - 2021 sh-edraft.de</p></li>
|
||||
</ol>
|
||||
</dd>
|
||||
<dt class="field-even">license</dt>
|
||||
<dd class="field-even"><p>MIT, see LICENSE for more details.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="py class">
|
||||
<dt id="cpl.VersionInfo">
|
||||
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">cpl.</span></code><code class="sig-name descname"><span class="pre">VersionInfo</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">major</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">minor</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">micro</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.VersionInfo" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code></p>
|
||||
<dl class="py attribute">
|
||||
<dt id="cpl.VersionInfo.major">
|
||||
<code class="sig-name descname"><span class="pre">major</span></code><a class="headerlink" href="#cpl.VersionInfo.major" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Alias for field number 0</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py attribute">
|
||||
<dt id="cpl.VersionInfo.micro">
|
||||
<code class="sig-name descname"><span class="pre">micro</span></code><a class="headerlink" href="#cpl.VersionInfo.micro" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Alias for field number 2</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py attribute">
|
||||
<dt id="cpl.VersionInfo.minor">
|
||||
<code class="sig-name descname"><span class="pre">minor</span></code><a class="headerlink" href="#cpl.VersionInfo.minor" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Alias for field number 1</p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
1
docs/build/html/cpl.logging.html
vendored
1
docs/build/html/cpl.logging.html
vendored
@ -103,7 +103,6 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.mailing.html">cpl.mailing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
1
docs/build/html/cpl.mailing.html
vendored
1
docs/build/html/cpl.mailing.html
vendored
@ -103,7 +103,6 @@
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
1
docs/build/html/cpl.time.html
vendored
1
docs/build/html/cpl.time.html
vendored
@ -100,7 +100,6 @@
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
1
docs/build/html/cpl.utils.html
vendored
1
docs/build/html/cpl.utils.html
vendored
@ -100,7 +100,6 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="#module-cpl.utils.string">cpl.utils.string</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
19
docs/build/html/genindex.html
vendored
19
docs/build/html/genindex.html
vendored
@ -390,13 +390,6 @@
|
||||
<li><a href="cpl.utils.html#cpl.utils.string.String.convert_to_snake_case">convert_to_snake_case() (cpl.utils.string.String static method)</a>
|
||||
</li>
|
||||
<li>
|
||||
cpl
|
||||
|
||||
<ul>
|
||||
<li><a href="cpl.html#module-cpl">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li>
|
||||
cpl.application.application_abc
|
||||
|
||||
<ul>
|
||||
@ -1050,19 +1043,11 @@
|
||||
</li>
|
||||
</ul></li>
|
||||
<li><a href="cpl.application.html#cpl.application.application_abc.ApplicationABC.main">main() (cpl.application.application_abc.ApplicationABC method)</a>
|
||||
</li>
|
||||
<li><a href="cpl.html#cpl.VersionInfo.major">major (cpl.VersionInfo attribute)</a>
|
||||
</li>
|
||||
<li><a href="cpl.html#cpl.VersionInfo.micro">micro (cpl.VersionInfo attribute)</a>
|
||||
</li>
|
||||
<li><a href="cpl.html#cpl.VersionInfo.minor">minor (cpl.VersionInfo attribute)</a>
|
||||
</li>
|
||||
<li>
|
||||
module
|
||||
|
||||
<ul>
|
||||
<li><a href="cpl.html#module-cpl">cpl</a>
|
||||
</li>
|
||||
<li><a href="cpl.application.html#module-cpl.application.application_abc">cpl.application.application_abc</a>
|
||||
</li>
|
||||
<li><a href="cpl.application.html#module-cpl.application.application_builder">cpl.application.application_builder</a>
|
||||
@ -1389,10 +1374,6 @@
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="cpl.configuration.html#cpl.configuration.console_argument.ConsoleArgument.value_token">value_token() (cpl.configuration.console_argument.ConsoleArgument property)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="cpl.html#cpl.VersionInfo">VersionInfo (class in cpl)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
|
4
docs/build/html/modules.html
vendored
4
docs/build/html/modules.html
vendored
@ -238,10 +238,6 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="cpl.utils.html#module-cpl.utils.string">cpl.utils.string</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="cpl.html#sh-cpl-sh-edraft-common-python-library">sh_cpl sh-edraft Common Python library</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
BIN
docs/build/html/objects.inv
vendored
BIN
docs/build/html/objects.inv
vendored
Binary file not shown.
2
docs/build/html/py-modindex.html
vendored
2
docs/build/html/py-modindex.html
vendored
@ -165,7 +165,7 @@
|
||||
<td><img src="_static/minus.png" class="toggler"
|
||||
id="toggle-1" style="display: none" alt="-" /></td>
|
||||
<td>
|
||||
<a href="cpl.html#module-cpl"><code class="xref">cpl</code></a></td><td>
|
||||
<code class="xref">cpl</code></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-1">
|
||||
<td></td>
|
||||
|
2
docs/build/html/searchindex.js
vendored
2
docs/build/html/searchindex.js
vendored
File diff suppressed because one or more lines are too long
@ -15,10 +15,3 @@ CPL
|
||||
cpl.time
|
||||
cpl.utils
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: cpl
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
@ -19,7 +19,7 @@ class ApplicationBuilderABC(ABC):
|
||||
Parameter
|
||||
---------
|
||||
startup: Type[:class:`cpl.application.startup_abc.StartupABC`]
|
||||
Type of :class:`cpl.application.startup_abc.StartupABC`
|
||||
Startup class to use
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -18,9 +18,7 @@ from cpl.environment.environment_name_enum import EnvironmentNameEnum
|
||||
class Configuration(ConfigurationABC):
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
Representation of configuration
|
||||
"""
|
||||
r"""Representation of configuration"""
|
||||
ConfigurationABC.__init__(self)
|
||||
|
||||
self._application_environment = ApplicationEnvironment()
|
||||
@ -51,11 +49,12 @@ class Configuration(ConfigurationABC):
|
||||
|
||||
@staticmethod
|
||||
def _print_info(name: str, message: str):
|
||||
"""
|
||||
Prints an info message
|
||||
:param name:
|
||||
:param message:
|
||||
:return:
|
||||
r"""Prints an info message
|
||||
|
||||
Parameter
|
||||
---------
|
||||
name: :class:`str`
|
||||
message: :class:`str`
|
||||
"""
|
||||
Console.set_foreground_color(ForegroundColorEnum.green)
|
||||
Console.write_line(f'[{name}] {message}')
|
||||
@ -63,11 +62,12 @@ class Configuration(ConfigurationABC):
|
||||
|
||||
@staticmethod
|
||||
def _print_warn(name: str, message: str):
|
||||
"""
|
||||
Prints a warning
|
||||
:param name:
|
||||
:param message:
|
||||
:return:
|
||||
r"""Prints a warning
|
||||
|
||||
Parameter
|
||||
---------
|
||||
name: :class:`str`
|
||||
message: :class:`str`
|
||||
"""
|
||||
Console.set_foreground_color(ForegroundColorEnum.yellow)
|
||||
Console.write_line(f'[{name}] {message}')
|
||||
@ -75,22 +75,24 @@ class Configuration(ConfigurationABC):
|
||||
|
||||
@staticmethod
|
||||
def _print_error(name: str, message: str):
|
||||
"""
|
||||
Prints an error
|
||||
:param name:
|
||||
:param message:
|
||||
:return:
|
||||
r"""Prints an error
|
||||
|
||||
Parameter
|
||||
---------
|
||||
name: :class:`str`
|
||||
message: :class:`str`
|
||||
"""
|
||||
Console.set_foreground_color(ForegroundColorEnum.red)
|
||||
Console.write_line(f'[{name}] {message}')
|
||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||
|
||||
def _set_variable(self, name: str, value: any):
|
||||
"""
|
||||
Sets variable to given value
|
||||
:param name:
|
||||
:param value:
|
||||
:return:
|
||||
r"""Sets variable to given value
|
||||
|
||||
Parameter
|
||||
---------
|
||||
name: :class:`str`
|
||||
value: :class:`any`
|
||||
"""
|
||||
if name == ConfigurationVariableNameEnum.environment.value:
|
||||
self._application_environment.environment_name = EnvironmentNameEnum(value)
|
||||
@ -106,12 +108,21 @@ class Configuration(ConfigurationABC):
|
||||
|
||||
def _validate_argument_by_argument_type(self, argument: str, argument_type: ConsoleArgument,
|
||||
next_arguments: list[str] = None) -> bool:
|
||||
"""
|
||||
Validate argument by argument type
|
||||
:param argument:
|
||||
:param argument_type:
|
||||
:param next_arguments:
|
||||
:return:
|
||||
r"""Validate argument by argument type
|
||||
|
||||
Parameter
|
||||
---------
|
||||
argument: :class:`str`
|
||||
argument_type: :class:`cpl.configuration.console_argument.ConsoleArgument`
|
||||
next_arguments: list[:class:`str`]
|
||||
|
||||
Returns
|
||||
-------
|
||||
Object of :class:`bool`
|
||||
|
||||
Raises
|
||||
------
|
||||
Exception: An error occurred getting an argument for a command
|
||||
"""
|
||||
argument_name = ''
|
||||
value = ''
|
||||
@ -240,6 +251,33 @@ class Configuration(ConfigurationABC):
|
||||
|
||||
return result
|
||||
|
||||
def _load_json_file(self, file: str, output: bool) -> dict:
|
||||
r"""Reads the json file
|
||||
|
||||
Parameter
|
||||
---------
|
||||
file: :class:`str`
|
||||
Name of the file
|
||||
output: :class:`bool`
|
||||
Specifies whether an output should take place
|
||||
|
||||
Returns
|
||||
-------
|
||||
Object of :class:`dict`
|
||||
"""
|
||||
try:
|
||||
# open config file, create if not exists
|
||||
with open(file, encoding='utf-8') as cfg:
|
||||
# load json
|
||||
json_cfg = json.load(cfg)
|
||||
if output:
|
||||
self._print_info(__name__, f'Loaded config file: {file}')
|
||||
|
||||
return json_cfg
|
||||
except Exception as e:
|
||||
self._print_error(__name__, f'Cannot load config file: {file}! -> {e}')
|
||||
return {}
|
||||
|
||||
def add_environment_variables(self, prefix: str):
|
||||
for variable in ConfigurationVariableNameEnum.to_list():
|
||||
var_name = f'{prefix}{variable}'
|
||||
@ -325,31 +363,11 @@ class Configuration(ConfigurationABC):
|
||||
configuration.from_dict(value)
|
||||
self.add_configuration(sub, configuration)
|
||||
|
||||
def _load_json_file(self, file: str, output: bool) -> dict:
|
||||
"""
|
||||
Reads the json file
|
||||
:param file:
|
||||
:param output:
|
||||
:return:
|
||||
"""
|
||||
try:
|
||||
# open config file, create if not exists
|
||||
with open(file, encoding='utf-8') as cfg:
|
||||
# load json
|
||||
json_cfg = json.load(cfg)
|
||||
if output:
|
||||
self._print_info(__name__, f'Loaded config file: {file}')
|
||||
|
||||
return json_cfg
|
||||
except Exception as e:
|
||||
self._print_error(__name__, f'Cannot load config file: {file}! -> {e}')
|
||||
return {}
|
||||
|
||||
def add_configuration(self, key_type: Union[str, type], value: ConfigurationModelABC):
|
||||
self._config[key_type] = value
|
||||
|
||||
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> Union[
|
||||
str, Callable[ConfigurationModelABC]]:
|
||||
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> \
|
||||
Union[str, Callable[ConfigurationModelABC]]:
|
||||
if type(search_type) is str:
|
||||
if search_type == ConfigurationVariableNameEnum.environment.value:
|
||||
return self._application_environment.environment_name
|
||||
|
@ -11,9 +11,7 @@ class ConfigurationABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self):
|
||||
"""
|
||||
ABC of configuration
|
||||
"""
|
||||
r"""ABC for the :class:`cpl.configuration.configuration.Configuration`"""
|
||||
pass
|
||||
|
||||
@property
|
||||
@ -34,58 +32,73 @@ class ConfigurationABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def add_environment_variables(self, prefix: str):
|
||||
"""
|
||||
Reads the environment variables
|
||||
:param prefix:
|
||||
:return:
|
||||
r"""Reads the environment variables
|
||||
|
||||
Parameter
|
||||
---------
|
||||
prefix: :class:`str`
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def add_console_argument(self, argument: ConsoleArgument):
|
||||
"""
|
||||
Adds console argument to known console arguments
|
||||
:param argument:
|
||||
:return:
|
||||
r"""Adds console argument to known console arguments
|
||||
|
||||
Parameter
|
||||
---------
|
||||
argument: :class:`cpl.configuration.console_argument.ConsoleArgument`
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def add_console_arguments(self, error: bool = None):
|
||||
"""
|
||||
Reads the console arguments
|
||||
:param error: defines is invalid argument error will be shown or not
|
||||
:return:
|
||||
r"""Reads the console arguments
|
||||
|
||||
Parameter
|
||||
---------
|
||||
error: :class:`bool`
|
||||
Defines is invalid argument error will be shown or not
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None):
|
||||
"""
|
||||
Reads and saves settings from given json file
|
||||
:param name:
|
||||
:param optional:
|
||||
:param output:
|
||||
:param path:
|
||||
:return:
|
||||
r"""Reads and saves settings from given json file
|
||||
|
||||
Parameter
|
||||
---------
|
||||
name: :class:`str`
|
||||
Name of the file
|
||||
optional: :class:`str`
|
||||
Specifies whether an error should occur if the file was not found
|
||||
output: :class:`bool`
|
||||
Specifies whether an output should take place
|
||||
path: :class:`str`
|
||||
Path in which the file should be stored
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def add_configuration(self, key_type: Union[str, type], value: object):
|
||||
"""
|
||||
Add configuration object
|
||||
:param key_type:
|
||||
:param value:
|
||||
:return:
|
||||
def add_configuration(self, key_type: Union[str, type], value: ConfigurationModelABC):
|
||||
r"""Add configuration object
|
||||
|
||||
Parameter
|
||||
---------
|
||||
key_type: Union[:class:`str`, :class:`type`]
|
||||
value: :class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> Union[str, Callable[ConfigurationModelABC]]:
|
||||
"""
|
||||
Returns value in configuration by given type
|
||||
:param search_type:
|
||||
:return:
|
||||
r"""Returns value from configuration by given type
|
||||
|
||||
Parameter
|
||||
---------
|
||||
search_type: Union[:class:`str`, Type[:class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`]]
|
||||
|
||||
Returns
|
||||
-------
|
||||
Object of Union[:class:`str`, Callable[:class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`]]
|
||||
"""
|
||||
pass
|
||||
|
@ -5,16 +5,15 @@ class ConfigurationModelABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self):
|
||||
"""
|
||||
ABC for settings representation
|
||||
"""
|
||||
r"""ABC for settings representation"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def from_dict(self, settings: dict):
|
||||
"""
|
||||
Converts attributes to dict
|
||||
:param settings:
|
||||
:return:
|
||||
r"""Converts attributes to dict
|
||||
|
||||
Parameter
|
||||
---------
|
||||
settings: :class:`dict`
|
||||
"""
|
||||
pass
|
||||
|
@ -8,14 +8,16 @@ class ConsoleArgument:
|
||||
is_value_token_optional: bool = None,
|
||||
console_arguments: list['ConsoleArgument'] = None
|
||||
):
|
||||
"""
|
||||
Representation of an console argument
|
||||
:param token:
|
||||
:param name:
|
||||
:param aliases:
|
||||
:param value_token:
|
||||
:param is_value_token_optional:
|
||||
:param console_arguments:
|
||||
r"""Representation of an console argument
|
||||
|
||||
Parameter
|
||||
---------
|
||||
token: :class:`str`
|
||||
name: :class:`str`
|
||||
aliases: list[:class:`str`]
|
||||
value_token: :class:`str`
|
||||
is_value_token_optional: :class:`bool`
|
||||
console_arguments: List[:class:`cpl.configuration.console_argument.ConsoleArgument`]
|
||||
"""
|
||||
self._token = token
|
||||
self._name = name
|
||||
|
Loading…
Reference in New Issue
Block a user