2022.12 #133
BIN
docs/build/doctrees/cli.generate.doctree
vendored
BIN
docs/build/doctrees/cli.generate.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/cli.new.doctree
vendored
BIN
docs/build/doctrees/cli.new.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/cpl_core.configuration.doctree
vendored
BIN
docs/build/doctrees/cpl_core.configuration.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/cpl_discord.events.doctree
vendored
BIN
docs/build/doctrees/cpl_discord.events.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/cpl_query.base.doctree
vendored
BIN
docs/build/doctrees/cpl_query.base.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/cpl_query.enumerable.doctree
vendored
BIN
docs/build/doctrees/cpl_query.enumerable.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/cpl_query.iterable.doctree
vendored
BIN
docs/build/doctrees/cpl_query.iterable.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/environment.pickle
vendored
BIN
docs/build/doctrees/environment.pickle
vendored
Binary file not shown.
BIN
docs/build/doctrees/tutorials.appsettings.doctree
vendored
BIN
docs/build/doctrees/tutorials.appsettings.doctree
vendored
Binary file not shown.
Binary file not shown.
BIN
docs/build/doctrees/tutorials.console.doctree
vendored
BIN
docs/build/doctrees/tutorials.console.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/tutorials.create-startup.doctree
vendored
BIN
docs/build/doctrees/tutorials.create-startup.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/tutorials.doctree
vendored
BIN
docs/build/doctrees/tutorials.doctree
vendored
Binary file not shown.
Binary file not shown.
BIN
docs/build/doctrees/tutorials.extend-startup.doctree
vendored
BIN
docs/build/doctrees/tutorials.extend-startup.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/tutorials.logging.doctree
vendored
BIN
docs/build/doctrees/tutorials.logging.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/tutorials.mail.doctree
vendored
BIN
docs/build/doctrees/tutorials.mail.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/tutorials.templating.doctree
vendored
Normal file
BIN
docs/build/doctrees/tutorials.templating.doctree
vendored
Normal file
Binary file not shown.
6
docs/build/html/_sources/cli.generate.md.txt
vendored
6
docs/build/html/_sources/cli.generate.md.txt
vendored
@ -16,6 +16,8 @@ cpl **G** *<schematic>* *<name>*
|
||||
|
||||
Generates files based on a schematic.
|
||||
|
||||
You can define custom schematics by creating templates in a ```.cpl``` folder.
|
||||
|
||||
## Arguments
|
||||
|
||||
| Argument | Description | Value type |
|
||||
@ -27,7 +29,7 @@ Generates files based on a schematic.
|
||||
## Schematics
|
||||
|
||||
| Schematic | Description | Arguments |
|
||||
|-----------------|:-------------------------------------:|:------------:|
|
||||
|-----------------|:--------------------------------------:|:------------:|
|
||||
| ```abc``` | Abstract base class | ```<name>``` |
|
||||
| ```class``` | Class | ```<name>``` |
|
||||
| ```enum``` | Enum class | ```<name>``` |
|
||||
@ -37,3 +39,5 @@ Generates files based on a schematic.
|
||||
| ```test``` | Test class | ```<name>``` |
|
||||
| ```thread``` | Thread class | ```<name>``` |
|
||||
| ```validator``` | Validator class | ```<name>``` |
|
||||
| ```command``` | Discord bot command class | ```<name>``` |
|
||||
| ```event``` | Discord bot event class | ```<name>``` |
|
||||
|
2
docs/build/html/_sources/cli.new.md.txt
vendored
2
docs/build/html/_sources/cli.new.md.txt
vendored
@ -16,6 +16,8 @@ cpl **N** *<type>* *<name>*
|
||||
|
||||
Generates a workspace and initial project or add a project to workspace.
|
||||
|
||||
You can define custom project types by creating templates in a ```.cpl``` folder.
|
||||
|
||||
If the command is running in a CPL workspace, it will add the new project to the workspace.
|
||||
|
||||
| Argument | Description | Value type |
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Using appsettings.json
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Handle console arguments
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Use cpl_core.console.Console
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Create startup class
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Extend application
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Extend startup
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Use builtin logger
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Send mails
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
1
docs/build/html/_sources/tutorials.rst.txt
vendored
1
docs/build/html/_sources/tutorials.rst.txt
vendored
@ -12,3 +12,4 @@ Tutorials
|
||||
tutorials.console
|
||||
tutorials.logging
|
||||
tutorials.mail
|
||||
tutorials.templating
|
181
docs/build/html/_sources/tutorials.templating.md.txt
vendored
Normal file
181
docs/build/html/_sources/tutorials.templating.md.txt
vendored
Normal file
@ -0,0 +1,181 @@
|
||||
# Using cpl g & cpl n templating
|
||||
|
||||
## Contents
|
||||
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Generate schematics](#cpl-generate-scmatics)
|
||||
- [Project types](#cpl-new-project-types)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Create a folder called ```.cpl```
|
||||
|
||||
## cpl generate schematics
|
||||
|
||||
Create a file which begins with ```schematic_your_schematic.py```.
|
||||
A schematic template is detected by starting with ```schematic_``` and endswith ```.py```.
|
||||
|
||||
You should replace ```your_schematic``` with an appropriate name of your schematic. For example, we will choose ```Enum```.
|
||||
Attention: It is important that you do not overwrite templates by creating a file or class with the same name.
|
||||
|
||||
In the template create a class with the name of your schematic. For example:
|
||||
|
||||
```python
|
||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Enum(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
def get_code(self) -> str:
|
||||
import textwrap
|
||||
code = textwrap.dedent("""\
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class $Name(Enum):
|
||||
|
||||
atr = 0
|
||||
""")
|
||||
return self.build_code_str(code, Name=self._class_name)
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'enum',
|
||||
['e', 'E']
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
You can test it by calling ```cpl g --help``` your schematic should be listed as available.
|
||||
|
||||
## cpl new project types
|
||||
|
||||
The project templating is a little more complex and is therefore divided into several files.
|
||||
First of all, for information, it is very important not to overwrite any existing files or classes!
|
||||
|
||||
Template structure explained by the example of the internal type ```console```:
|
||||
|
||||
```
|
||||
- project_console.py
|
||||
- project_file_license.py
|
||||
- project_file_appsettings.py
|
||||
- project_file.py
|
||||
- project_file_readme.py
|
||||
- project_file_code_main.py
|
||||
- project_file_code_startup.py
|
||||
- project_file_code_application.py
|
||||
```
|
||||
|
||||
Here the template ```project_console.py``` defines how a console project has to look like when it is generated. Here is the code to illustrate this:
|
||||
|
||||
```python
|
||||
from cpl_cli.abc.project_type_abc import ProjectTypeABC
|
||||
from cpl_cli.configuration import WorkspaceSettings
|
||||
from cpl_core.utils import String
|
||||
|
||||
|
||||
class Console(ProjectTypeABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
base_path: str,
|
||||
project_name: str,
|
||||
workspace: WorkspaceSettings,
|
||||
use_application_api: bool,
|
||||
use_startup: bool,
|
||||
use_service_providing: bool,
|
||||
use_async: bool,
|
||||
project_file_data: dict,
|
||||
):
|
||||
from project_file import ProjectFile
|
||||
from project_file_appsettings import ProjectFileAppsettings
|
||||
from project_file_code_application import ProjectFileApplication
|
||||
from project_file_code_main import ProjectFileMain
|
||||
from project_file_code_startup import ProjectFileStartup
|
||||
from project_file_readme import ProjectFileReadme
|
||||
from project_file_license import ProjectFileLicense
|
||||
from schematic_init import Init
|
||||
|
||||
ProjectTypeABC.__init__(self, base_path, project_name, workspace, use_application_api, use_startup, use_service_providing, use_async, project_file_data)
|
||||
|
||||
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
|
||||
|
||||
self.add_template(ProjectFile(project_name.split('/')[-1], project_path, project_file_data))
|
||||
if workspace is None:
|
||||
self.add_template(ProjectFileLicense(''))
|
||||
self.add_template(ProjectFileReadme(''))
|
||||
self.add_template(Init('', 'init', f'{base_path}tests/'))
|
||||
|
||||
self.add_template(Init('', 'init', project_path))
|
||||
self.add_template(ProjectFileAppsettings(project_path))
|
||||
|
||||
if use_application_api:
|
||||
self.add_template(ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
|
||||
if use_startup:
|
||||
self.add_template(ProjectFileStartup(project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
|
||||
self.add_template(ProjectFileMain(project_name.split('/')[-1], project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
```
|
||||
|
||||
The class must be named exactly as the project type should be named. It is also checked on the initial letter of the class as alias.
|
||||
Now create a class for normal files which inherits from ```FileTemplateABC``` and a class for code files which inherits from ```CodeFileTemplateABC```.
|
||||
|
||||
For example:
|
||||
|
||||
project_file_code_startup.py:
|
||||
```python
|
||||
from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
|
||||
|
||||
|
||||
class ProjectFileStartup(CodeFileTemplateABC):
|
||||
|
||||
def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
|
||||
CodeFileTemplateABC.__init__(self, 'startup', path, '', use_application_api, use_startup, use_service_providing, use_async)
|
||||
|
||||
def get_code(self) -> str:
|
||||
import textwrap
|
||||
|
||||
return textwrap.dedent("""\
|
||||
from cpl_core.application import StartupABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||
from cpl_core.environment import ApplicationEnvironment
|
||||
|
||||
|
||||
class Startup(StartupABC):
|
||||
|
||||
def __init__(self):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
||||
return configuration
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||
return services.build_service_provider()
|
||||
""")
|
||||
```
|
||||
|
||||
project_file.py:
|
||||
|
||||
```python
|
||||
import json
|
||||
|
||||
from cpl_cli.abc.file_template_abc import FileTemplateABC
|
||||
|
||||
|
||||
class ProjectFile(FileTemplateABC):
|
||||
|
||||
def __init__(self, name: str, path: str, code: dict):
|
||||
FileTemplateABC.__init__(self, '', path, '{}')
|
||||
self._name = f'{name}.json'
|
||||
self._code = code
|
||||
|
||||
def get_code(self) -> str:
|
||||
return json.dumps(self._code, indent=2)
|
||||
```
|
9
docs/build/html/cli.generate.html
vendored
9
docs/build/html/cli.generate.html
vendored
@ -112,6 +112,7 @@ cpl <strong>G</strong> <em><schematic></em> <em><name></em></p>
|
||||
<section id="description">
|
||||
<h2>Description<a class="headerlink" href="#description" title="Permalink to this heading"></a></h2>
|
||||
<p>Generates files based on a schematic.</p>
|
||||
<p>You can define custom schematics by creating templates in a <code class="docutils literal notranslate"><span class="pre">.cpl</span></code> folder.</p>
|
||||
</section>
|
||||
<section id="arguments">
|
||||
<h2>Arguments<a class="headerlink" href="#arguments" title="Permalink to this heading"></a></h2>
|
||||
@ -184,6 +185,14 @@ cpl <strong>G</strong> <em><schematic></em> <em><name></em></p>
|
||||
<td class="text-center"><p>Validator class</p></td>
|
||||
<td class="text-center"><p><code class="docutils literal notranslate"><span class="pre"><name></span></code></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">command</span></code></p></td>
|
||||
<td class="text-center"><p>Discord bot command class</p></td>
|
||||
<td class="text-center"><p><code class="docutils literal notranslate"><span class="pre"><name></span></code></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">event</span></code></p></td>
|
||||
<td class="text-center"><p>Discord bot event class</p></td>
|
||||
<td class="text-center"><p><code class="docutils literal notranslate"><span class="pre"><name></span></code></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
1
docs/build/html/cli.new.html
vendored
1
docs/build/html/cli.new.html
vendored
@ -112,6 +112,7 @@ cpl <strong>N</strong> <em><type></em> <em><name></em></p>
|
||||
<section id="description">
|
||||
<h2>Description<a class="headerlink" href="#description" title="Permalink to this heading"></a></h2>
|
||||
<p>Generates a workspace and initial project or add a project to workspace.</p>
|
||||
<p>You can define custom project types by creating templates in a <code class="docutils literal notranslate"><span class="pre">.cpl</span></code> folder.</p>
|
||||
<p>If the command is running in a CPL workspace, it will add the new project to the workspace.</p>
|
||||
<table class="colwidths-auto docutils align-default">
|
||||
<thead>
|
||||
|
4
docs/build/html/contributing.html
vendored
4
docs/build/html/contributing.html
vendored
@ -20,7 +20,7 @@
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
<link rel="search" title="Search" href="search.html" />
|
||||
<link rel="next" title="CLI reference" href="cpl_cli.html" />
|
||||
<link rel="prev" title="Send mails" href="tutorials.mail.html" />
|
||||
<link rel="prev" title="Using cpl g & cpl n templating" href="tutorials.templating.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
@ -189,7 +189,7 @@ See <a class="reference external" href="https://git.sh-edraft.de/sh-edraft.de/cp
|
||||
</div>
|
||||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||
<a href="tutorials.mail.html" class="btn btn-neutral float-left" title="Send mails" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
<a href="tutorials.templating.html" class="btn btn-neutral float-left" title="Using cpl g & cpl n templating" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
<a href="cpl_cli.html" class="btn btn-neutral float-right" title="CLI reference" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
|
||||
|
12
docs/build/html/cpl_core.configuration.html
vendored
12
docs/build/html/cpl_core.configuration.html
vendored
@ -104,13 +104,13 @@
|
||||
<dd><p>Bases: <a class="reference internal" href="#cpl_core.configuration.configuration_abc.ConfigurationABC" title="cpl_core.configuration.configuration_abc.ConfigurationABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">ConfigurationABC</span></code></a></p>
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_core.configuration.configuration.Configuration.add_configuration">
|
||||
<span class="sig-name descname"><span class="pre">add_configuration</span></span><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="w"> </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="w"> </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="w"> </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="w"> </span><a class="reference internal" href="#cpl_core.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl_core.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_core.configuration.configuration.Configuration.add_configuration" title="Permalink to this definition"></a></dt>
|
||||
<span class="sig-name descname"><span class="pre">add_configuration</span></span><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="w"> </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="w"> </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="w"> </span><span class="n"><span class="pre">any</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_core.configuration.configuration.Configuration.add_configuration" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Add configuration object</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
<dt>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>]</dt><dd><p>Type of the value</p>
|
||||
</dd>
|
||||
<dt>value: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl_core.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl_core.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl_core.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]</dt><dd><p>Object of the value</p>
|
||||
<dt>value: any</dt><dd><p>Object of the value</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
@ -217,7 +217,7 @@
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_core.configuration.configuration.Configuration.get_configuration">
|
||||
<span class="sig-name descname"><span class="pre">get_configuration</span></span><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="w"> </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="w"> </span><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl_core.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl_core.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">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="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></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="w"> </span><a class="reference internal" href="#cpl_core.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl_core.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#cpl_core.configuration.configuration.Configuration.get_configuration" title="Permalink to this definition"></a></dt>
|
||||
<span class="sig-name descname"><span class="pre">get_configuration</span></span><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="w"> </span><span class="n"><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><span class="pre">T</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">T</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#cpl_core.configuration.configuration.Configuration.get_configuration" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Returns value from configuration by given type</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
@ -256,13 +256,13 @@
|
||||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">ABC</span></code></p>
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_core.configuration.configuration_abc.ConfigurationABC.add_configuration">
|
||||
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">add_configuration</span></span><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="w"> </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="w"> </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="w"> </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="w"> </span><a class="reference internal" href="#cpl_core.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl_core.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_core.configuration.configuration_abc.ConfigurationABC.add_configuration" title="Permalink to this definition"></a></dt>
|
||||
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">add_configuration</span></span><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="w"> </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="w"> </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="w"> </span><span class="n"><span class="pre">any</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_core.configuration.configuration_abc.ConfigurationABC.add_configuration" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Add configuration object</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
<dt>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>]</dt><dd><p>Type of the value</p>
|
||||
</dd>
|
||||
<dt>value: Union[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <a class="reference internal" href="#cpl_core.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl_core.configuration.configuration_model_abc.ConfigurationModelABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl_core.configuration.configuration_model_abc.ConfigurationModelABC</span></code></a>]</dt><dd><p>Object of the value</p>
|
||||
<dt>value: any</dt><dd><p>Object of the value</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
@ -369,7 +369,7 @@
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_core.configuration.configuration_abc.ConfigurationABC.get_configuration">
|
||||
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get_configuration</span></span><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="w"> </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="w"> </span><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl_core.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl_core.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">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="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><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="w"> </span><a class="reference internal" href="#cpl_core.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl_core.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">ConfigurationModelABC</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#cpl_core.configuration.configuration_abc.ConfigurationABC.get_configuration" title="Permalink to this definition"></a></dt>
|
||||
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get_configuration</span></span><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="w"> </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="w"> </span><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cpl_core.configuration.configuration_model_abc.ConfigurationModelABC" title="cpl_core.configuration.configuration_model_abc.ConfigurationModelABC"><span class="pre">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="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">T</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#cpl_core.configuration.configuration_abc.ConfigurationABC.get_configuration" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Returns value from configuration by given type</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
|
2
docs/build/html/cpl_discord.events.html
vendored
2
docs/build/html/cpl_discord.events.html
vendored
@ -244,7 +244,7 @@
|
||||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">ABC</span></code></p>
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_discord.events.on_group_join_abc.OnGroupJoinABC.on_group_join">
|
||||
<em class="property"><span class="pre">abstract</span><span class="w"> </span><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">on_group_join</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chhanel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">GroupChannel</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">user</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">User</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_discord.events.on_group_join_abc.OnGroupJoinABC.on_group_join" title="Permalink to this definition"></a></dt>
|
||||
<em class="property"><span class="pre">abstract</span><span class="w"> </span><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">on_group_join</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">GroupChannel</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">user</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">User</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_discord.events.on_group_join_abc.OnGroupJoinABC.on_group_join" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
94
docs/build/html/cpl_query.base.html
vendored
94
docs/build/html/cpl_query.base.html
vendored
@ -51,8 +51,8 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="#module-cpl_query.base.ordered_queryable">cpl_query.base.ordered_queryable</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#module-cpl_query.base.ordered_queryable_abc">cpl_query.base.ordered_queryable_abc</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#module-cpl_query.base.queryable_abc">cpl_query.base.queryable_abc</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#module-cpl_query.base.sequence_abc">cpl_query.base.sequence_abc</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#module-cpl_query.base.sequence_values">cpl_query.base.sequence_values</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#cpl-query-base-sequence-abc">cpl_query.base.sequence_abc</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#cpl-query-base-sequence-values">cpl_query.base.sequence_values</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl_query.enumerable.html">cpl_query.enumerable</a></li>
|
||||
@ -170,7 +170,7 @@
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.queryable_abc.QueryableABC">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cpl_query.base.queryable_abc.</span></span><span class="sig-name descname"><span class="pre">QueryableABC</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">t</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">type</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">values</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">list</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_query.base.queryable_abc.QueryableABC" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Bases: <a class="reference internal" href="#cpl_query.base.sequence_abc.SequenceABC" title="cpl_query.base.sequence_abc.SequenceABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">SequenceABC</span></code></a></p>
|
||||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></p>
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.queryable_abc.QueryableABC.all">
|
||||
<span class="sig-name descname"><span class="pre">all</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">_func</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Callable</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="headerlink" href="#cpl_query.base.queryable_abc.QueryableABC.all" title="Permalink to this definition"></a></dt>
|
||||
@ -603,91 +603,11 @@ Exception: when argument is None or found more than one element</p>
|
||||
</dd></dl>
|
||||
|
||||
</section>
|
||||
<section id="module-cpl_query.base.sequence_abc">
|
||||
<span id="cpl-query-base-sequence-abc"></span><h2>cpl_query.base.sequence_abc<a class="headerlink" href="#module-cpl_query.base.sequence_abc" title="Permalink to this heading"></a></h2>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.sequence_abc.SequenceABC">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cpl_query.base.sequence_abc.</span></span><span class="sig-name descname"><span class="pre">SequenceABC</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">t</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">type</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">values</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">list</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_query.base.sequence_abc.SequenceABC" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">ABC</span></code></p>
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.sequence_abc.SequenceABC.copy">
|
||||
<span class="sig-name descname"><span class="pre">copy</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="#cpl_query.base.sequence_abc.SequenceABC" title="cpl_query.base.sequence_abc.SequenceABC"><span class="pre">SequenceABC</span></a></span></span><a class="headerlink" href="#cpl_query.base.sequence_abc.SequenceABC.copy" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Creates a copy of sequence</p>
|
||||
<blockquote>
|
||||
<div><p>SequenceABC</p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.sequence_abc.SequenceABC.empty">
|
||||
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">empty</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="#cpl_query.base.sequence_abc.SequenceABC" title="cpl_query.base.sequence_abc.SequenceABC"><span class="pre">SequenceABC</span></a></span></span><a class="headerlink" href="#cpl_query.base.sequence_abc.SequenceABC.empty" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Returns an empty sequence</p>
|
||||
<blockquote>
|
||||
<div><p>Sequence object that contains no elements</p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.sequence_abc.SequenceABC.index">
|
||||
<span class="sig-name descname"><span class="pre">index</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">_object</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">object</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#cpl_query.base.sequence_abc.SequenceABC.index" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Returns the index of given element</p>
|
||||
<blockquote>
|
||||
<div><p>Index of object</p>
|
||||
</div></blockquote>
|
||||
<blockquote>
|
||||
<div><p>IndexError if object not in sequence</p>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.sequence_abc.SequenceABC.next">
|
||||
<span class="sig-name descname"><span class="pre">next</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl_query.base.sequence_abc.SequenceABC.next" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.sequence_abc.SequenceABC.range">
|
||||
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">range</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">start</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">length</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="#cpl_query.base.sequence_abc.SequenceABC" title="cpl_query.base.sequence_abc.SequenceABC"><span class="pre">SequenceABC</span></a></span></span><a class="headerlink" href="#cpl_query.base.sequence_abc.SequenceABC.range" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.sequence_abc.SequenceABC.to_list">
|
||||
<span class="sig-name descname"><span class="pre">to_list</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">list</span></span></span><a class="headerlink" href="#cpl_query.base.sequence_abc.SequenceABC.to_list" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Converts :class: <cite>cpl_query.base.sequence_abc.SequenceABC</cite> to :class: <cite>list</cite></p>
|
||||
<blockquote>
|
||||
<div><dl class="field-list simple">
|
||||
<dt class="field-odd">class</dt>
|
||||
<dd class="field-odd"><p><cite>list</cite></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py property">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.sequence_abc.SequenceABC.type">
|
||||
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">type</span></em><a class="headerlink" href="#cpl_query.base.sequence_abc.SequenceABC.type" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<section id="cpl-query-base-sequence-abc">
|
||||
<h2>cpl_query.base.sequence_abc<a class="headerlink" href="#cpl-query-base-sequence-abc" title="Permalink to this heading"></a></h2>
|
||||
</section>
|
||||
<section id="module-cpl_query.base.sequence_values">
|
||||
<span id="cpl-query-base-sequence-values"></span><h2>cpl_query.base.sequence_values<a class="headerlink" href="#module-cpl_query.base.sequence_values" title="Permalink to this heading"></a></h2>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.sequence_values.SequenceValues">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cpl_query.base.sequence_values.</span></span><span class="sig-name descname"><span class="pre">SequenceValues</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_t</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">type</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_query.base.sequence_values.SequenceValues" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.sequence_values.SequenceValues.next">
|
||||
<span class="sig-name descname"><span class="pre">next</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl_query.base.sequence_values.SequenceValues.next" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.base.sequence_values.SequenceValues.reset">
|
||||
<span class="sig-name descname"><span class="pre">reset</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl_query.base.sequence_values.SequenceValues.reset" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<section id="cpl-query-base-sequence-values">
|
||||
<h2>cpl_query.base.sequence_values<a class="headerlink" href="#cpl-query-base-sequence-values" title="Permalink to this heading"></a></h2>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
6
docs/build/html/cpl_query.enumerable.html
vendored
6
docs/build/html/cpl_query.enumerable.html
vendored
@ -103,12 +103,6 @@
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cpl_query.enumerable.enumerable_abc.</span></span><span class="sig-name descname"><span class="pre">EnumerableABC</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">t</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">type</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">values</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">list</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_query.enumerable.enumerable_abc.EnumerableABC" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Bases: <a class="reference internal" href="cpl_query.base.html#cpl_query.base.queryable_abc.QueryableABC" title="cpl_query.base.queryable_abc.QueryableABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">QueryableABC</span></code></a></p>
|
||||
<p>ABC to define functions on list</p>
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.enumerable.enumerable_abc.EnumerableABC.set_remove_error_check">
|
||||
<span class="sig-name descname"><span class="pre">set_remove_error_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">_value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_query.enumerable.enumerable_abc.EnumerableABC.set_remove_error_check" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Set flag to check if element exists before removing</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.enumerable.enumerable_abc.EnumerableABC.to_iterable">
|
||||
<span class="sig-name descname"><span class="pre">to_iterable</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="cpl_query.iterable.html#cpl_query.iterable.iterable_abc.IterableABC" title="cpl_query.iterable.iterable_abc.IterableABC"><span class="pre">IterableABC</span></a></span></span><a class="headerlink" href="#cpl_query.enumerable.enumerable_abc.EnumerableABC.to_iterable" title="Permalink to this definition"></a></dt>
|
||||
|
4
docs/build/html/cpl_query.html
vendored
4
docs/build/html/cpl_query.html
vendored
@ -88,8 +88,8 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl_query.base.html#module-cpl_query.base.ordered_queryable">cpl_query.base.ordered_queryable</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl_query.base.html#module-cpl_query.base.ordered_queryable_abc">cpl_query.base.ordered_queryable_abc</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl_query.base.html#module-cpl_query.base.queryable_abc">cpl_query.base.queryable_abc</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl_query.base.html#module-cpl_query.base.sequence_abc">cpl_query.base.sequence_abc</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl_query.base.html#module-cpl_query.base.sequence_values">cpl_query.base.sequence_values</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl_query.base.html#cpl-query-base-sequence-abc">cpl_query.base.sequence_abc</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl_query.base.html#cpl-query-base-sequence-values">cpl_query.base.sequence_values</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cpl_query.enumerable.html">cpl_query.enumerable</a><ul>
|
||||
|
17
docs/build/html/cpl_query.iterable.html
vendored
17
docs/build/html/cpl_query.iterable.html
vendored
@ -119,7 +119,8 @@ Parameter
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.iterable.iterable_abc.IterableABC.append">
|
||||
<span class="sig-name descname"><span class="pre">append</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">_object</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">object</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_query.iterable.iterable_abc.IterableABC.append" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
<dd><p>Append object to the end of the list.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.iterable.iterable_abc.IterableABC.extend">
|
||||
@ -149,6 +150,20 @@ Parameter
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.iterable.iterable_abc.IterableABC.remove_at">
|
||||
<span class="sig-name descname"><span class="pre">remove_at</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">_index</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl_query.iterable.iterable_abc.IterableABC.remove_at" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Removes element from list
|
||||
Parameter
|
||||
———</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
<dt>_object: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></dt><dd><p>value</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="cpl_query.iterable.iterable_abc.IterableABC.to_enumerable">
|
||||
<span class="sig-name descname"><span class="pre">to_enumerable</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="cpl_query.enumerable.html#cpl_query.enumerable.enumerable_abc.EnumerableABC" title="cpl_query.enumerable.enumerable_abc.EnumerableABC"><span class="pre">EnumerableABC</span></a></span></span><a class="headerlink" href="#cpl_query.iterable.iterable_abc.IterableABC.to_enumerable" title="Permalink to this definition"></a></dt>
|
||||
|
58
docs/build/html/genindex.html
vendored
58
docs/build/html/genindex.html
vendored
@ -388,8 +388,6 @@
|
||||
<li><a href="cpl_core.utils.html#cpl_core.utils.string.String.convert_to_camel_case">convert_to_camel_case() (cpl_core.utils.string.String static method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_core.utils.html#cpl_core.utils.string.String.convert_to_snake_case">convert_to_snake_case() (cpl_core.utils.string.String static method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.sequence_abc.SequenceABC.copy">copy() (cpl_query.base.sequence_abc.SequenceABC method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.queryable_abc.QueryableABC.count">count() (cpl_query.base.queryable_abc.QueryableABC method)</a>
|
||||
</li>
|
||||
@ -1275,20 +1273,6 @@
|
||||
|
||||
<ul>
|
||||
<li><a href="cpl_query.base.html#module-cpl_query.base.queryable_abc">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li>
|
||||
cpl_query.base.sequence_abc
|
||||
|
||||
<ul>
|
||||
<li><a href="cpl_query.base.html#module-cpl_query.base.sequence_abc">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li>
|
||||
cpl_query.base.sequence_values
|
||||
|
||||
<ul>
|
||||
<li><a href="cpl_query.base.html#module-cpl_query.base.sequence_values">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li>
|
||||
@ -1527,8 +1511,6 @@
|
||||
<li><a href="cpl_core.mailing.html#cpl_core.mailing.email_client_settings_name_enum.EMailClientSettingsNameEnum">EMailClientSettingsNameEnum (class in cpl_core.mailing.email_client_settings_name_enum)</a>
|
||||
</li>
|
||||
<li><a href="cpl_discord.container.html#cpl_discord.container.guild.Guild.emojis">emojis (cpl_discord.container.guild.Guild attribute)</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.sequence_abc.SequenceABC.empty">empty() (cpl_query.base.sequence_abc.SequenceABC class method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_core.console.html#cpl_core.console.console.Console.enable">enable() (cpl_core.console.console.Console class method)</a>
|
||||
</li>
|
||||
@ -1775,19 +1757,17 @@
|
||||
</li>
|
||||
</ul></li>
|
||||
<li><a href="cpl_core.dependency_injection.html#cpl_core.dependency_injection.service_descriptor.ServiceDescriptor.implementation">implementation (cpl_core.dependency_injection.service_descriptor.ServiceDescriptor property)</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.sequence_abc.SequenceABC.index">index() (cpl_query.base.sequence_abc.SequenceABC method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_core.logging.html#cpl_core.logging.logging_level_enum.LoggingLevelEnum.INFO">INFO (cpl_core.logging.logging_level_enum.LoggingLevelEnum attribute)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="cpl_core.logging.html#cpl_core.logging.logger_abc.LoggerABC.info">info() (cpl_core.logging.logger_abc.LoggerABC method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="cpl_core.logging.html#cpl_core.logging.logger_service.Logger.info">(cpl_core.logging.logger_service.Logger method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="cpl_discord.service.html#cpl_discord.service.discord_service.DiscordService.init">init() (cpl_discord.service.discord_service.DiscordService method)</a>
|
||||
|
||||
<ul>
|
||||
@ -2171,10 +2151,6 @@
|
||||
<li><a href="cpl_query.base.html#module-cpl_query.base.ordered_queryable_abc">cpl_query.base.ordered_queryable_abc</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#module-cpl_query.base.queryable_abc">cpl_query.base.queryable_abc</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#module-cpl_query.base.sequence_abc">cpl_query.base.sequence_abc</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#module-cpl_query.base.sequence_values">cpl_query.base.sequence_values</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.enumerable.html#module-cpl_query.enumerable.enumerable">cpl_query.enumerable.enumerable</a>
|
||||
</li>
|
||||
@ -2217,12 +2193,6 @@
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.sequence_abc.SequenceABC.next">next() (cpl_query.base.sequence_abc.SequenceABC method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.sequence_values.SequenceValues.next">(cpl_query.base.sequence_values.SequenceValues method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li><a href="cpl_discord.container.html#cpl_discord.container.member.Member.nick">nick (cpl_discord.container.member.Member attribute)</a>
|
||||
</li>
|
||||
<li><a href="cpl_discord.container.html#cpl_discord.container.category_channel.CategoryChannel.nsfw">nsfw (cpl_discord.container.category_channel.CategoryChannel attribute)</a>
|
||||
@ -2846,8 +2816,6 @@
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="cpl_core.utils.html#cpl_core.utils.string.String.random_string">random_string() (cpl_core.utils.string.String static method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.sequence_abc.SequenceABC.range">range() (cpl_query.base.sequence_abc.SequenceABC class method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_core.console.html#cpl_core.console.console.Console.read">read() (cpl_core.console.console.Console class method)</a>
|
||||
</li>
|
||||
@ -2865,12 +2833,12 @@
|
||||
</ul></li>
|
||||
<li><a href="cpl_query.iterable.html#cpl_query.iterable.iterable_abc.IterableABC.remove">remove() (cpl_query.iterable.iterable_abc.IterableABC method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.sequence_values.SequenceValues.reset">reset() (cpl_query.base.sequence_values.SequenceValues method)</a>
|
||||
<li><a href="cpl_query.iterable.html#cpl_query.iterable.iterable_abc.IterableABC.remove_at">remove_at() (cpl_query.iterable.iterable_abc.IterableABC method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_core.console.html#cpl_core.console.console.Console.reset_cursor_position">reset_cursor_position() (cpl_core.console.console.Console class method)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="cpl_core.console.html#cpl_core.console.console.Console.reset_cursor_position">reset_cursor_position() (cpl_core.console.console.Console class method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_core.utils.html#cpl_core.utils.pip.Pip.reset_executable">reset_executable() (cpl_core.utils.pip.Pip class method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.queryable_abc.QueryableABC.reverse">reverse() (cpl_query.base.queryable_abc.QueryableABC method)</a>
|
||||
@ -2929,10 +2897,6 @@
|
||||
<li><a href="cpl_core.mailing.html#cpl_core.mailing.email_client_service.EMailClient.send_mail">(cpl_core.mailing.email_client_service.EMailClient method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.sequence_abc.SequenceABC">SequenceABC (class in cpl_query.base.sequence_abc)</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.sequence_values.SequenceValues">SequenceValues (class in cpl_query.base.sequence_values)</a>
|
||||
</li>
|
||||
<li><a href="cpl_core.database.connection.html#cpl_core.database.connection.database_connection.DatabaseConnection.server">server (cpl_core.database.connection.database_connection.DatabaseConnection property)</a>
|
||||
|
||||
<ul>
|
||||
@ -2977,8 +2941,6 @@
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="cpl_query.enumerable.html#cpl_query.enumerable.enumerable_abc.EnumerableABC.set_remove_error_check">set_remove_error_check() (cpl_query.enumerable.enumerable_abc.EnumerableABC method)</a>
|
||||
</li>
|
||||
<li><a href="cpl_core.environment.html#cpl_core.environment.application_environment.ApplicationEnvironment.set_runtime_directory">set_runtime_directory() (cpl_core.environment.application_environment.ApplicationEnvironment method)</a>
|
||||
|
||||
<ul>
|
||||
@ -3120,11 +3082,7 @@
|
||||
</li>
|
||||
</ul></li>
|
||||
<li><a href="cpl_core.configuration.html#cpl_core.configuration.configuration_variable_name_enum.ConfigurationVariableNameEnum.to_list">to_list() (cpl_core.configuration.configuration_variable_name_enum.ConfigurationVariableNameEnum static method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.sequence_abc.SequenceABC.to_list">(cpl_query.base.sequence_abc.SequenceABC method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="cpl_core.pipes.html#cpl_core.pipes.to_camel_case_pipe.ToCamelCasePipe">ToCamelCasePipe (class in cpl_core.pipes.to_camel_case_pipe)</a>
|
||||
@ -3183,12 +3141,8 @@
|
||||
</li>
|
||||
<li><a href="cpl_translation.html#cpl_translation.translation_settings.TranslationSettings">TranslationSettings (class in cpl_translation.translation_settings)</a>
|
||||
</li>
|
||||
<li><a href="cpl_query.base.html#cpl_query.base.sequence_abc.SequenceABC.type">type (cpl_query.base.sequence_abc.SequenceABC property)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="cpl_query.iterable.html#cpl_query.iterable.iterable_abc.IterableABC.type">(cpl_query.iterable.iterable_abc.IterableABC property)</a>
|
||||
<li><a href="cpl_query.iterable.html#cpl_query.iterable.iterable_abc.IterableABC.type">type (cpl_query.iterable.iterable_abc.IterableABC property)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
|
||||
|
23
docs/build/html/getting_started.html
vendored
23
docs/build/html/getting_started.html
vendored
@ -104,35 +104,42 @@
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="tutorials.html">Tutorials</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.extend-application.html">Extend application</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-application.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-application.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.create-startup.html">Create startup class</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.create-startup.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.create-startup.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.extend-startup.html">Extend startup</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-startup.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-startup.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.appsettings.html">Using appsettings.json</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.appsettings.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.appsettings.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.console-arguments.html">Handle console arguments</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console-arguments.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console-arguments.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.mail.html">Send mails</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html#contents">Contents</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html#prerequisites">Prerequisites</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html#cpl-generate-schematics">cpl generate schematics</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html#cpl-new-project-types">cpl new project types</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
27
docs/build/html/modules.html
vendored
27
docs/build/html/modules.html
vendored
@ -98,35 +98,42 @@
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.html">Tutorials</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-application.html">Extend application</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.extend-application.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.extend-application.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.create-startup.html">Create startup class</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.create-startup.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.create-startup.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-startup.html">Extend startup</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.extend-startup.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.extend-startup.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.appsettings.html">Using appsettings.json</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.appsettings.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.appsettings.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console-arguments.html">Handle console arguments</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.console-arguments.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.console-arguments.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.console.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.console.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.logging.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.logging.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html">Send mails</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.mail.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.mail.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.templating.html#contents">Contents</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.templating.html#prerequisites">Prerequisites</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.templating.html#cpl-generate-schematics">cpl generate schematics</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="tutorials.templating.html#cpl-new-project-types">cpl new project types</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -407,8 +414,8 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="cpl_query.base.html#module-cpl_query.base.ordered_queryable">cpl_query.base.ordered_queryable</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="cpl_query.base.html#module-cpl_query.base.ordered_queryable_abc">cpl_query.base.ordered_queryable_abc</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="cpl_query.base.html#module-cpl_query.base.queryable_abc">cpl_query.base.queryable_abc</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="cpl_query.base.html#module-cpl_query.base.sequence_abc">cpl_query.base.sequence_abc</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="cpl_query.base.html#module-cpl_query.base.sequence_values">cpl_query.base.sequence_values</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="cpl_query.base.html#cpl-query-base-sequence-abc">cpl_query.base.sequence_abc</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="cpl_query.base.html#cpl-query-base-sequence-values">cpl_query.base.sequence_values</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="cpl_query.enumerable.html">cpl_query.enumerable</a><ul>
|
||||
|
BIN
docs/build/html/objects.inv
vendored
BIN
docs/build/html/objects.inv
vendored
Binary file not shown.
10
docs/build/html/py-modindex.html
vendored
10
docs/build/html/py-modindex.html
vendored
@ -731,16 +731,6 @@
|
||||
<td>   
|
||||
<a href="cpl_query.base.html#module-cpl_query.base.queryable_abc"><code class="xref">cpl_query.base.queryable_abc</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-3">
|
||||
<td></td>
|
||||
<td>   
|
||||
<a href="cpl_query.base.html#module-cpl_query.base.sequence_abc"><code class="xref">cpl_query.base.sequence_abc</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-3">
|
||||
<td></td>
|
||||
<td>   
|
||||
<a href="cpl_query.base.html#module-cpl_query.base.sequence_values"><code class="xref">cpl_query.base.sequence_values</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-3">
|
||||
<td></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
7
docs/build/html/tutorials.appsettings.html
vendored
7
docs/build/html/tutorials.appsettings.html
vendored
@ -48,13 +48,14 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.create-startup.html">Create startup class</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-startup.html">Extend startup</a></li>
|
||||
<li class="toctree-l3 current"><a class="current reference internal" href="#">Using appsettings.json</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console-arguments.html">Handle console arguments</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html">Send mails</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -95,8 +96,8 @@
|
||||
|
||||
<section id="using-appsettings-json">
|
||||
<h1>Using appsettings.json<a class="headerlink" href="#using-appsettings-json" title="Permalink to this heading"></a></h1>
|
||||
<section id="comming-soon">
|
||||
<h2>Comming soon<a class="headerlink" href="#comming-soon" title="Permalink to this heading"></a></h2>
|
||||
<section id="coming-soon">
|
||||
<h2>Coming soon<a class="headerlink" href="#coming-soon" title="Permalink to this heading"></a></h2>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -49,12 +49,13 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-startup.html">Extend startup</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.appsettings.html">Using appsettings.json</a></li>
|
||||
<li class="toctree-l3 current"><a class="current reference internal" href="#">Handle console arguments</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html">Send mails</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -95,8 +96,8 @@
|
||||
|
||||
<section id="handle-console-arguments">
|
||||
<h1>Handle console arguments<a class="headerlink" href="#handle-console-arguments" title="Permalink to this heading"></a></h1>
|
||||
<section id="comming-soon">
|
||||
<h2>Comming soon<a class="headerlink" href="#comming-soon" title="Permalink to this heading"></a></h2>
|
||||
<section id="coming-soon">
|
||||
<h2>Coming soon<a class="headerlink" href="#coming-soon" title="Permalink to this heading"></a></h2>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
7
docs/build/html/tutorials.console.html
vendored
7
docs/build/html/tutorials.console.html
vendored
@ -50,11 +50,12 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.appsettings.html">Using appsettings.json</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console-arguments.html">Handle console arguments</a></li>
|
||||
<li class="toctree-l3 current"><a class="current reference internal" href="#">Use cpl_core.console.Console</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html">Send mails</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -95,8 +96,8 @@
|
||||
|
||||
<section id="use-cpl-core-console-console">
|
||||
<h1>Use cpl_core.console.Console<a class="headerlink" href="#use-cpl-core-console-console" title="Permalink to this heading"></a></h1>
|
||||
<section id="comming-soon">
|
||||
<h2>Comming soon<a class="headerlink" href="#comming-soon" title="Permalink to this heading"></a></h2>
|
||||
<section id="coming-soon">
|
||||
<h2>Coming soon<a class="headerlink" href="#coming-soon" title="Permalink to this heading"></a></h2>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
<li class="toctree-l2 current"><a class="reference internal" href="tutorials.html">Tutorials</a><ul class="current">
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-application.html">Extend application</a></li>
|
||||
<li class="toctree-l3 current"><a class="current reference internal" href="#">Create startup class</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-startup.html">Extend startup</a></li>
|
||||
@ -55,6 +55,7 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html">Send mails</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -95,8 +96,8 @@
|
||||
|
||||
<section id="create-startup-class">
|
||||
<h1>Create startup class<a class="headerlink" href="#create-startup-class" title="Permalink to this heading"></a></h1>
|
||||
<section id="comming-soon">
|
||||
<h2>Comming soon<a class="headerlink" href="#comming-soon" title="Permalink to this heading"></a></h2>
|
||||
<section id="coming-soon">
|
||||
<h2>Coming soon<a class="headerlink" href="#coming-soon" title="Permalink to this heading"></a></h2>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="setup.html">Setting up the local environment and workspace</a></li>
|
||||
<li class="toctree-l2 current"><a class="reference internal" href="tutorials.html">Tutorials</a><ul class="current">
|
||||
<li class="toctree-l3 current"><a class="current reference internal" href="#">Extend application</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.create-startup.html">Create startup class</a></li>
|
||||
@ -55,6 +55,7 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html">Send mails</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -95,8 +96,8 @@
|
||||
|
||||
<section id="extend-application">
|
||||
<h1>Extend application<a class="headerlink" href="#extend-application" title="Permalink to this heading"></a></h1>
|
||||
<section id="comming-soon">
|
||||
<h2>Comming soon<a class="headerlink" href="#comming-soon" title="Permalink to this heading"></a></h2>
|
||||
<section id="coming-soon">
|
||||
<h2>Coming soon<a class="headerlink" href="#coming-soon" title="Permalink to this heading"></a></h2>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-application.html">Extend application</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.create-startup.html">Create startup class</a></li>
|
||||
<li class="toctree-l3 current"><a class="current reference internal" href="#">Extend startup</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.appsettings.html">Using appsettings.json</a></li>
|
||||
@ -55,6 +55,7 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html">Send mails</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -95,8 +96,8 @@
|
||||
|
||||
<section id="extend-startup">
|
||||
<h1>Extend startup<a class="headerlink" href="#extend-startup" title="Permalink to this heading"></a></h1>
|
||||
<section id="comming-soon">
|
||||
<h2>Comming soon<a class="headerlink" href="#comming-soon" title="Permalink to this heading"></a></h2>
|
||||
<section id="coming-soon">
|
||||
<h2>Coming soon<a class="headerlink" href="#coming-soon" title="Permalink to this heading"></a></h2>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
24
docs/build/html/tutorials.html
vendored
24
docs/build/html/tutorials.html
vendored
@ -52,6 +52,7 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html">Send mails</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -94,35 +95,42 @@
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="tutorials.extend-application.html">Extend application</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.extend-application.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.extend-application.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="tutorials.create-startup.html">Create startup class</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.create-startup.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.create-startup.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="tutorials.extend-startup.html">Extend startup</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.extend-startup.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.extend-startup.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="tutorials.appsettings.html">Using appsettings.json</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.appsettings.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.appsettings.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="tutorials.console-arguments.html">Handle console arguments</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.console-arguments.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.console-arguments.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.console.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.console.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.logging.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.logging.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="tutorials.mail.html">Send mails</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.mail.html#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.mail.html#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.templating.html#contents">Contents</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.templating.html#prerequisites">Prerequisites</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.templating.html#cpl-generate-schematics">cpl generate schematics</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="tutorials.templating.html#cpl-new-project-types">cpl new project types</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
7
docs/build/html/tutorials.logging.html
vendored
7
docs/build/html/tutorials.logging.html
vendored
@ -51,10 +51,11 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console-arguments.html">Handle console arguments</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a></li>
|
||||
<li class="toctree-l3 current"><a class="current reference internal" href="#">Use builtin logger</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html">Send mails</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -95,8 +96,8 @@
|
||||
|
||||
<section id="use-builtin-logger">
|
||||
<h1>Use builtin logger<a class="headerlink" href="#use-builtin-logger" title="Permalink to this heading"></a></h1>
|
||||
<section id="comming-soon">
|
||||
<h2>Comming soon<a class="headerlink" href="#comming-soon" title="Permalink to this heading"></a></h2>
|
||||
<section id="coming-soon">
|
||||
<h2>Coming soon<a class="headerlink" href="#coming-soon" title="Permalink to this heading"></a></h2>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
11
docs/build/html/tutorials.mail.html
vendored
11
docs/build/html/tutorials.mail.html
vendored
@ -19,7 +19,7 @@
|
||||
<script src="_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
<link rel="search" title="Search" href="search.html" />
|
||||
<link rel="next" title="Contributing to CPL" href="contributing.html" />
|
||||
<link rel="next" title="Using cpl g & cpl n templating" href="tutorials.templating.html" />
|
||||
<link rel="prev" title="Use builtin logger" href="tutorials.logging.html" />
|
||||
</head>
|
||||
|
||||
@ -52,9 +52,10 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a></li>
|
||||
<li class="toctree-l3 current"><a class="current reference internal" href="#">Send mails</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#comming-soon">Comming soon</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#coming-soon">Coming soon</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.templating.html">Using cpl g & cpl n templating</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -95,8 +96,8 @@
|
||||
|
||||
<section id="send-mails">
|
||||
<h1>Send mails<a class="headerlink" href="#send-mails" title="Permalink to this heading"></a></h1>
|
||||
<section id="comming-soon">
|
||||
<h2>Comming soon<a class="headerlink" href="#comming-soon" title="Permalink to this heading"></a></h2>
|
||||
<section id="coming-soon">
|
||||
<h2>Coming soon<a class="headerlink" href="#coming-soon" title="Permalink to this heading"></a></h2>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
@ -105,7 +106,7 @@
|
||||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||
<a href="tutorials.logging.html" class="btn btn-neutral float-left" title="Use builtin logger" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
<a href="contributing.html" class="btn btn-neutral float-right" title="Contributing to CPL" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
<a href="tutorials.templating.html" class="btn btn-neutral float-right" title="Using cpl g & cpl n templating" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
304
docs/build/html/tutorials.templating.html
vendored
Normal file
304
docs/build/html/tutorials.templating.html
vendored
Normal file
@ -0,0 +1,304 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="writer-html5" lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Using cpl g & cpl n templating — Common Python Library documentation</title>
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="_static/js/html5shiv.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
<script src="_static/jquery.js"></script>
|
||||
<script src="_static/underscore.js"></script>
|
||||
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="_static/doctools.js"></script>
|
||||
<script src="_static/js/theme.js"></script>
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
<link rel="search" title="Search" href="search.html" />
|
||||
<link rel="next" title="Contributing to CPL" href="contributing.html" />
|
||||
<link rel="prev" title="Send mails" href="tutorials.mail.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
<div class="wy-grid-for-nav">
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
<a href="index.html" class="icon icon-home"> Common Python Library
|
||||
</a>
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction to the CPL Docs</a></li>
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="getting_started.html">Getting started</a><ul class="current">
|
||||
<li class="toctree-l2"><a class="reference internal" href="quickstart.html">Getting started with CPL</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="setup.html">Setting up the local environment and workspace</a></li>
|
||||
<li class="toctree-l2 current"><a class="reference internal" href="tutorials.html">Tutorials</a><ul class="current">
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-application.html">Extend application</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.create-startup.html">Create startup class</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.extend-startup.html">Extend startup</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.appsettings.html">Using appsettings.json</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console-arguments.html">Handle console arguments</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.console.html">Use cpl_core.console.Console</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.logging.html">Use builtin logger</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="tutorials.mail.html">Send mails</a></li>
|
||||
<li class="toctree-l3 current"><a class="current reference internal" href="#">Using cpl g & cpl n templating</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#contents">Contents</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#prerequisites">Prerequisites</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#cpl-generate-schematics">cpl generate schematics</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#cpl-new-project-types">cpl new project types</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="contributing.html">Contributing to CPL</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cpl_cli.html">CLI reference</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cpl_core.html">API reference</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cpl_discord.html">Discord reference</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cpl_query.html">Query reference</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cpl_translation.html">Translation reference</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="index.html">Common Python Library</a>
|
||||
</nav>
|
||||
|
||||
<div class="wy-nav-content">
|
||||
<div class="rst-content">
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
<li><a href="index.html" class="icon icon-home"></a> »</li>
|
||||
<li><a href="getting_started.html">Getting started</a> »</li>
|
||||
<li><a href="tutorials.html">Tutorials</a> »</li>
|
||||
<li>Using cpl g & cpl n templating</li>
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
<a href="_sources/tutorials.templating.md.txt" rel="nofollow"> View page source</a>
|
||||
</li>
|
||||
</ul>
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<section id="using-cpl-g-cpl-n-templating">
|
||||
<h1>Using cpl g & cpl n templating<a class="headerlink" href="#using-cpl-g-cpl-n-templating" title="Permalink to this heading"></a></h1>
|
||||
<section id="contents">
|
||||
<h2>Contents<a class="headerlink" href="#contents" title="Permalink to this heading"></a></h2>
|
||||
<ul class="simple">
|
||||
<li><p><span class="xref myst">Prerequisites</span></p></li>
|
||||
<li><p><span class="xref myst">Generate schematics</span></p></li>
|
||||
<li><p><span class="xref myst">Project types</span></p></li>
|
||||
</ul>
|
||||
</section>
|
||||
<section id="prerequisites">
|
||||
<h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this heading"></a></h2>
|
||||
<p>Create a folder called <code class="docutils literal notranslate"><span class="pre">.cpl</span></code></p>
|
||||
</section>
|
||||
<section id="cpl-generate-schematics">
|
||||
<h2>cpl generate schematics<a class="headerlink" href="#cpl-generate-schematics" title="Permalink to this heading"></a></h2>
|
||||
<p>Create a file which begins with <code class="docutils literal notranslate"><span class="pre">schematic_your_schematic.py</span></code>.
|
||||
A schematic template is detected by starting with <code class="docutils literal notranslate"><span class="pre">schematic_</span></code> and endswith <code class="docutils literal notranslate"><span class="pre">.py</span></code>.</p>
|
||||
<p>You should replace <code class="docutils literal notranslate"><span class="pre">your_schematic</span></code> with an appropriate name of your schematic. For example, we will choose <code class="docutils literal notranslate"><span class="pre">Enum</span></code>.
|
||||
Attention: It is important that you do not overwrite templates by creating a file or class with the same name.</p>
|
||||
<p>In the template create a class with the name of your schematic. For example:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cpl_cli.abc.generate_schematic_abc</span> <span class="kn">import</span> <span class="n">GenerateSchematicABC</span>
|
||||
|
||||
|
||||
<span class="k">class</span> <span class="nc">Enum</span><span class="p">(</span><span class="n">GenerateSchematicABC</span><span class="p">):</span>
|
||||
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span>
|
||||
<span class="n">GenerateSchematicABC</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">)</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">get_code</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span>
|
||||
<span class="kn">import</span> <span class="nn">textwrap</span>
|
||||
<span class="n">code</span> <span class="o">=</span> <span class="n">textwrap</span><span class="o">.</span><span class="n">dedent</span><span class="p">(</span><span class="s2">"""</span><span class="se">\</span>
|
||||
<span class="s2"> from enum import Enum</span>
|
||||
<span class="s2"> </span>
|
||||
<span class="s2"> </span>
|
||||
<span class="s2"> class $Name(Enum):</span>
|
||||
<span class="s2"> </span>
|
||||
<span class="s2"> atr = 0</span>
|
||||
<span class="s2"> """</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">build_code_str</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">Name</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_class_name</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@classmethod</span>
|
||||
<span class="k">def</span> <span class="nf">register</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span>
|
||||
<span class="n">GenerateSchematicABC</span><span class="o">.</span><span class="n">register</span><span class="p">(</span>
|
||||
<span class="bp">cls</span><span class="p">,</span>
|
||||
<span class="s1">'enum'</span><span class="p">,</span>
|
||||
<span class="p">[</span><span class="s1">'e'</span><span class="p">,</span> <span class="s1">'E'</span><span class="p">]</span>
|
||||
<span class="p">)</span>
|
||||
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You can test it by calling <code class="docutils literal notranslate"><span class="pre">cpl</span> <span class="pre">g</span> <span class="pre">--help</span></code> your schematic should be listed as available.</p>
|
||||
</section>
|
||||
<section id="cpl-new-project-types">
|
||||
<h2>cpl new project types<a class="headerlink" href="#cpl-new-project-types" title="Permalink to this heading"></a></h2>
|
||||
<p>The project templating is a little more complex and is therefore divided into several files.
|
||||
First of all, for information, it is very important not to overwrite any existing files or classes!</p>
|
||||
<p>Template structure explained by the example of the internal type <code class="docutils literal notranslate"><span class="pre">console</span></code>:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">-</span> <span class="n">project_console</span><span class="o">.</span><span class="n">py</span>
|
||||
<span class="o">-</span> <span class="n">project_file_license</span><span class="o">.</span><span class="n">py</span>
|
||||
<span class="o">-</span> <span class="n">project_file_appsettings</span><span class="o">.</span><span class="n">py</span>
|
||||
<span class="o">-</span> <span class="n">project_file</span><span class="o">.</span><span class="n">py</span>
|
||||
<span class="o">-</span> <span class="n">project_file_readme</span><span class="o">.</span><span class="n">py</span>
|
||||
<span class="o">-</span> <span class="n">project_file_code_main</span><span class="o">.</span><span class="n">py</span>
|
||||
<span class="o">-</span> <span class="n">project_file_code_startup</span><span class="o">.</span><span class="n">py</span>
|
||||
<span class="o">-</span> <span class="n">project_file_code_application</span><span class="o">.</span><span class="n">py</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Here the template <code class="docutils literal notranslate"><span class="pre">project_console.py</span></code> defines how a console project has to look like when it is generated. Here is the code to illustrate this:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cpl_cli.abc.project_type_abc</span> <span class="kn">import</span> <span class="n">ProjectTypeABC</span>
|
||||
<span class="kn">from</span> <span class="nn">cpl_cli.configuration</span> <span class="kn">import</span> <span class="n">WorkspaceSettings</span>
|
||||
<span class="kn">from</span> <span class="nn">cpl_core.utils</span> <span class="kn">import</span> <span class="n">String</span>
|
||||
|
||||
|
||||
<span class="k">class</span> <span class="nc">Console</span><span class="p">(</span><span class="n">ProjectTypeABC</span><span class="p">):</span>
|
||||
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span>
|
||||
<span class="bp">self</span><span class="p">,</span>
|
||||
<span class="n">base_path</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span>
|
||||
<span class="n">project_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span>
|
||||
<span class="n">workspace</span><span class="p">:</span> <span class="n">WorkspaceSettings</span><span class="p">,</span>
|
||||
<span class="n">use_application_api</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span>
|
||||
<span class="n">use_startup</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span>
|
||||
<span class="n">use_service_providing</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span>
|
||||
<span class="n">use_async</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span>
|
||||
<span class="n">project_file_data</span><span class="p">:</span> <span class="nb">dict</span><span class="p">,</span>
|
||||
<span class="p">):</span>
|
||||
<span class="kn">from</span> <span class="nn">project_file</span> <span class="kn">import</span> <span class="n">ProjectFile</span>
|
||||
<span class="kn">from</span> <span class="nn">project_file_appsettings</span> <span class="kn">import</span> <span class="n">ProjectFileAppsettings</span>
|
||||
<span class="kn">from</span> <span class="nn">project_file_code_application</span> <span class="kn">import</span> <span class="n">ProjectFileApplication</span>
|
||||
<span class="kn">from</span> <span class="nn">project_file_code_main</span> <span class="kn">import</span> <span class="n">ProjectFileMain</span>
|
||||
<span class="kn">from</span> <span class="nn">project_file_code_startup</span> <span class="kn">import</span> <span class="n">ProjectFileStartup</span>
|
||||
<span class="kn">from</span> <span class="nn">project_file_readme</span> <span class="kn">import</span> <span class="n">ProjectFileReadme</span>
|
||||
<span class="kn">from</span> <span class="nn">project_file_license</span> <span class="kn">import</span> <span class="n">ProjectFileLicense</span>
|
||||
<span class="kn">from</span> <span class="nn">schematic_init</span> <span class="kn">import</span> <span class="n">Init</span>
|
||||
|
||||
<span class="n">ProjectTypeABC</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">base_path</span><span class="p">,</span> <span class="n">project_name</span><span class="p">,</span> <span class="n">workspace</span><span class="p">,</span> <span class="n">use_application_api</span><span class="p">,</span> <span class="n">use_startup</span><span class="p">,</span> <span class="n">use_service_providing</span><span class="p">,</span> <span class="n">use_async</span><span class="p">,</span> <span class="n">project_file_data</span><span class="p">)</span>
|
||||
|
||||
<span class="n">project_path</span> <span class="o">=</span> <span class="sa">f</span><span class="s1">'</span><span class="si">{</span><span class="n">base_path</span><span class="si">}{</span><span class="n">String</span><span class="o">.</span><span class="n">convert_to_snake_case</span><span class="p">(</span><span class="n">project_name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"/"</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span><span class="si">}</span><span class="s1">/'</span>
|
||||
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add_template</span><span class="p">(</span><span class="n">ProjectFile</span><span class="p">(</span><span class="n">project_name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">'/'</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="n">project_path</span><span class="p">,</span> <span class="n">project_file_data</span><span class="p">))</span>
|
||||
<span class="k">if</span> <span class="n">workspace</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add_template</span><span class="p">(</span><span class="n">ProjectFileLicense</span><span class="p">(</span><span class="s1">''</span><span class="p">))</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add_template</span><span class="p">(</span><span class="n">ProjectFileReadme</span><span class="p">(</span><span class="s1">''</span><span class="p">))</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add_template</span><span class="p">(</span><span class="n">Init</span><span class="p">(</span><span class="s1">''</span><span class="p">,</span> <span class="s1">'init'</span><span class="p">,</span> <span class="sa">f</span><span class="s1">'</span><span class="si">{</span><span class="n">base_path</span><span class="si">}</span><span class="s1">tests/'</span><span class="p">))</span>
|
||||
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add_template</span><span class="p">(</span><span class="n">Init</span><span class="p">(</span><span class="s1">''</span><span class="p">,</span> <span class="s1">'init'</span><span class="p">,</span> <span class="n">project_path</span><span class="p">))</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add_template</span><span class="p">(</span><span class="n">ProjectFileAppsettings</span><span class="p">(</span><span class="n">project_path</span><span class="p">))</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">use_application_api</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add_template</span><span class="p">(</span><span class="n">ProjectFileApplication</span><span class="p">(</span><span class="n">project_path</span><span class="p">,</span> <span class="n">use_application_api</span><span class="p">,</span> <span class="n">use_startup</span><span class="p">,</span> <span class="n">use_service_providing</span><span class="p">,</span> <span class="n">use_async</span><span class="p">))</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">use_startup</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add_template</span><span class="p">(</span><span class="n">ProjectFileStartup</span><span class="p">(</span><span class="n">project_path</span><span class="p">,</span> <span class="n">use_application_api</span><span class="p">,</span> <span class="n">use_startup</span><span class="p">,</span> <span class="n">use_service_providing</span><span class="p">,</span> <span class="n">use_async</span><span class="p">))</span>
|
||||
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add_template</span><span class="p">(</span><span class="n">ProjectFileMain</span><span class="p">(</span><span class="n">project_name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">'/'</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="n">project_path</span><span class="p">,</span> <span class="n">use_application_api</span><span class="p">,</span> <span class="n">use_startup</span><span class="p">,</span> <span class="n">use_service_providing</span><span class="p">,</span> <span class="n">use_async</span><span class="p">))</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The class must be named exactly as the project type should be named. It is also checked on the initial letter of the class as alias.
|
||||
Now create a class for normal files which inherits from <code class="docutils literal notranslate"><span class="pre">FileTemplateABC</span></code> and a class for code files which inherits from <code class="docutils literal notranslate"><span class="pre">CodeFileTemplateABC</span></code>.</p>
|
||||
<p>For example:</p>
|
||||
<p>project_file_code_startup.py:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">cpl_cli.abc.code_file_template_abc</span> <span class="kn">import</span> <span class="n">CodeFileTemplateABC</span>
|
||||
|
||||
|
||||
<span class="k">class</span> <span class="nc">ProjectFileStartup</span><span class="p">(</span><span class="n">CodeFileTemplateABC</span><span class="p">):</span>
|
||||
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">use_application_api</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">use_startup</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">use_service_providing</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">use_async</span><span class="p">:</span> <span class="nb">bool</span><span class="p">):</span>
|
||||
<span class="n">CodeFileTemplateABC</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'startup'</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="s1">''</span><span class="p">,</span> <span class="n">use_application_api</span><span class="p">,</span> <span class="n">use_startup</span><span class="p">,</span> <span class="n">use_service_providing</span><span class="p">,</span> <span class="n">use_async</span><span class="p">)</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">get_code</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span>
|
||||
<span class="kn">import</span> <span class="nn">textwrap</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">textwrap</span><span class="o">.</span><span class="n">dedent</span><span class="p">(</span><span class="s2">"""</span><span class="se">\</span>
|
||||
<span class="s2"> from cpl_core.application import StartupABC</span>
|
||||
<span class="s2"> from cpl_core.configuration import ConfigurationABC</span>
|
||||
<span class="s2"> from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC</span>
|
||||
<span class="s2"> from cpl_core.environment import ApplicationEnvironment</span>
|
||||
<span class="s2"> </span>
|
||||
<span class="s2"> </span>
|
||||
<span class="s2"> class Startup(StartupABC):</span>
|
||||
<span class="s2"> </span>
|
||||
<span class="s2"> def __init__(self):</span>
|
||||
<span class="s2"> StartupABC.__init__(self)</span>
|
||||
<span class="s2"> </span>
|
||||
<span class="s2"> def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:</span>
|
||||
<span class="s2"> return configuration</span>
|
||||
<span class="s2"> </span>
|
||||
<span class="s2"> def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:</span>
|
||||
<span class="s2"> return services.build_service_provider()</span>
|
||||
<span class="s2"> """</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>project_file.py:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">json</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">cpl_cli.abc.file_template_abc</span> <span class="kn">import</span> <span class="n">FileTemplateABC</span>
|
||||
|
||||
|
||||
<span class="k">class</span> <span class="nc">ProjectFile</span><span class="p">(</span><span class="n">FileTemplateABC</span><span class="p">):</span>
|
||||
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">code</span><span class="p">:</span> <span class="nb">dict</span><span class="p">):</span>
|
||||
<span class="n">FileTemplateABC</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">''</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="s1">'</span><span class="si">{}</span><span class="s1">'</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_name</span> <span class="o">=</span> <span class="sa">f</span><span class="s1">'</span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s1">.json'</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_code</span> <span class="o">=</span> <span class="n">code</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">get_code</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_code</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||
<a href="tutorials.mail.html" class="btn btn-neutral float-left" title="Send mails" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
<a href="contributing.html" class="btn btn-neutral float-right" title="Contributing to CPL" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>© Copyright 2021 - 2023, Sven Heidemann.</p>
|
||||
</div>
|
||||
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<script>
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -16,6 +16,8 @@ cpl **G** *<schematic>* *<name>*
|
||||
|
||||
Generates files based on a schematic.
|
||||
|
||||
You can define custom schematics by creating templates in a ```.cpl``` folder.
|
||||
|
||||
## Arguments
|
||||
|
||||
| Argument | Description | Value type |
|
||||
@ -27,7 +29,7 @@ Generates files based on a schematic.
|
||||
## Schematics
|
||||
|
||||
| Schematic | Description | Arguments |
|
||||
|-----------------|:-------------------------------------:|:------------:|
|
||||
|-----------------|:--------------------------------------:|:------------:|
|
||||
| ```abc``` | Abstract base class | ```<name>``` |
|
||||
| ```class``` | Class | ```<name>``` |
|
||||
| ```enum``` | Enum class | ```<name>``` |
|
||||
@ -37,3 +39,5 @@ Generates files based on a schematic.
|
||||
| ```test``` | Test class | ```<name>``` |
|
||||
| ```thread``` | Thread class | ```<name>``` |
|
||||
| ```validator``` | Validator class | ```<name>``` |
|
||||
| ```command``` | Discord bot command class | ```<name>``` |
|
||||
| ```event``` | Discord bot event class | ```<name>``` |
|
||||
|
@ -16,6 +16,8 @@ cpl **N** *<type>* *<name>*
|
||||
|
||||
Generates a workspace and initial project or add a project to workspace.
|
||||
|
||||
You can define custom project types by creating templates in a ```.cpl``` folder.
|
||||
|
||||
If the command is running in a CPL workspace, it will add the new project to the workspace.
|
||||
|
||||
| Argument | Description | Value type |
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Using appsettings.json
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Handle console arguments
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Use cpl_core.console.Console
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Create startup class
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Extend application
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Extend startup
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Use builtin logger
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -1,3 +1,3 @@
|
||||
# Send mails
|
||||
|
||||
## Comming soon
|
||||
## Coming soon
|
@ -12,3 +12,4 @@ Tutorials
|
||||
tutorials.console
|
||||
tutorials.logging
|
||||
tutorials.mail
|
||||
tutorials.templating
|
181
docs/source/tutorials.templating.md
Normal file
181
docs/source/tutorials.templating.md
Normal file
@ -0,0 +1,181 @@
|
||||
# Using cpl g & cpl n templating
|
||||
|
||||
## Contents
|
||||
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Generate schematics](#cpl-generate-scmatics)
|
||||
- [Project types](#cpl-new-project-types)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Create a folder called ```.cpl```
|
||||
|
||||
## cpl generate schematics
|
||||
|
||||
Create a file which begins with ```schematic_your_schematic.py```.
|
||||
A schematic template is detected by starting with ```schematic_``` and endswith ```.py```.
|
||||
|
||||
You should replace ```your_schematic``` with an appropriate name of your schematic. For example, we will choose ```Enum```.
|
||||
Attention: It is important that you do not overwrite templates by creating a file or class with the same name.
|
||||
|
||||
In the template create a class with the name of your schematic. For example:
|
||||
|
||||
```python
|
||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Enum(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
def get_code(self) -> str:
|
||||
import textwrap
|
||||
code = textwrap.dedent("""\
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class $Name(Enum):
|
||||
|
||||
atr = 0
|
||||
""")
|
||||
return self.build_code_str(code, Name=self._class_name)
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'enum',
|
||||
['e', 'E']
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
You can test it by calling ```cpl g --help``` your schematic should be listed as available.
|
||||
|
||||
## cpl new project types
|
||||
|
||||
The project templating is a little more complex and is therefore divided into several files.
|
||||
First of all, for information, it is very important not to overwrite any existing files or classes!
|
||||
|
||||
Template structure explained by the example of the internal type ```console```:
|
||||
|
||||
```
|
||||
- project_console.py
|
||||
- project_file_license.py
|
||||
- project_file_appsettings.py
|
||||
- project_file.py
|
||||
- project_file_readme.py
|
||||
- project_file_code_main.py
|
||||
- project_file_code_startup.py
|
||||
- project_file_code_application.py
|
||||
```
|
||||
|
||||
Here the template ```project_console.py``` defines how a console project has to look like when it is generated. Here is the code to illustrate this:
|
||||
|
||||
```python
|
||||
from cpl_cli.abc.project_type_abc import ProjectTypeABC
|
||||
from cpl_cli.configuration import WorkspaceSettings
|
||||
from cpl_core.utils import String
|
||||
|
||||
|
||||
class Console(ProjectTypeABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
base_path: str,
|
||||
project_name: str,
|
||||
workspace: WorkspaceSettings,
|
||||
use_application_api: bool,
|
||||
use_startup: bool,
|
||||
use_service_providing: bool,
|
||||
use_async: bool,
|
||||
project_file_data: dict,
|
||||
):
|
||||
from project_file import ProjectFile
|
||||
from project_file_appsettings import ProjectFileAppsettings
|
||||
from project_file_code_application import ProjectFileApplication
|
||||
from project_file_code_main import ProjectFileMain
|
||||
from project_file_code_startup import ProjectFileStartup
|
||||
from project_file_readme import ProjectFileReadme
|
||||
from project_file_license import ProjectFileLicense
|
||||
from schematic_init import Init
|
||||
|
||||
ProjectTypeABC.__init__(self, base_path, project_name, workspace, use_application_api, use_startup, use_service_providing, use_async, project_file_data)
|
||||
|
||||
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
|
||||
|
||||
self.add_template(ProjectFile(project_name.split('/')[-1], project_path, project_file_data))
|
||||
if workspace is None:
|
||||
self.add_template(ProjectFileLicense(''))
|
||||
self.add_template(ProjectFileReadme(''))
|
||||
self.add_template(Init('', 'init', f'{base_path}tests/'))
|
||||
|
||||
self.add_template(Init('', 'init', project_path))
|
||||
self.add_template(ProjectFileAppsettings(project_path))
|
||||
|
||||
if use_application_api:
|
||||
self.add_template(ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
|
||||
if use_startup:
|
||||
self.add_template(ProjectFileStartup(project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
|
||||
self.add_template(ProjectFileMain(project_name.split('/')[-1], project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
```
|
||||
|
||||
The class must be named exactly as the project type should be named. It is also checked on the initial letter of the class as alias.
|
||||
Now create a class for normal files which inherits from ```FileTemplateABC``` and a class for code files which inherits from ```CodeFileTemplateABC```.
|
||||
|
||||
For example:
|
||||
|
||||
project_file_code_startup.py:
|
||||
```python
|
||||
from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
|
||||
|
||||
|
||||
class ProjectFileStartup(CodeFileTemplateABC):
|
||||
|
||||
def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
|
||||
CodeFileTemplateABC.__init__(self, 'startup', path, '', use_application_api, use_startup, use_service_providing, use_async)
|
||||
|
||||
def get_code(self) -> str:
|
||||
import textwrap
|
||||
|
||||
return textwrap.dedent("""\
|
||||
from cpl_core.application import StartupABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||
from cpl_core.environment import ApplicationEnvironment
|
||||
|
||||
|
||||
class Startup(StartupABC):
|
||||
|
||||
def __init__(self):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
||||
return configuration
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||
return services.build_service_provider()
|
||||
""")
|
||||
```
|
||||
|
||||
project_file.py:
|
||||
|
||||
```python
|
||||
import json
|
||||
|
||||
from cpl_cli.abc.file_template_abc import FileTemplateABC
|
||||
|
||||
|
||||
class ProjectFile(FileTemplateABC):
|
||||
|
||||
def __init__(self, name: str, path: str, code: dict):
|
||||
FileTemplateABC.__init__(self, '', path, '{}')
|
||||
self._name = f'{name}.json'
|
||||
self._code = code
|
||||
|
||||
def get_code(self) -> str:
|
||||
return json.dumps(self._code, indent=2)
|
||||
```
|
@ -1,5 +1,3 @@
|
||||
import os
|
||||
|
||||
from cpl_cli.abc.project_type_abc import ProjectTypeABC
|
||||
from cpl_cli.configuration import WorkspaceSettings
|
||||
from cpl_core.utils import String
|
||||
|
@ -18,7 +18,6 @@ class ProjectFileAppsettings(FileTemplateABC):
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/",
|
||||
"Filename": "log_$start_time.log",
|
||||
|
@ -1,10 +1,14 @@
|
||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
from cpl_core.utils import String
|
||||
|
||||
|
||||
class ABC(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
def __init__(self, name: str, schematic: str, path: str):
|
||||
GenerateSchematicABC.__init__(self, name, schematic, path)
|
||||
self._class_name = name
|
||||
if name != '':
|
||||
self._class_name = f'{String.first_to_upper(name.replace(schematic, ""))}ABC'
|
||||
|
||||
def get_code(self) -> str:
|
||||
code = """\
|
||||
|
@ -1,5 +1,3 @@
|
||||
import textwrap
|
||||
|
||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
@ -9,16 +7,16 @@ class Enum(GenerateSchematicABC):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
def get_code(self) -> str:
|
||||
code = """\
|
||||
import textwrap
|
||||
code = textwrap.dedent("""\
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class $Name(Enum):
|
||||
|
||||
atr = 0
|
||||
"""
|
||||
x = self.build_code_str(code, Name=self._class_name)
|
||||
return x
|
||||
""")
|
||||
return self.build_code_str(code, Name=self._class_name)
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
|
@ -1,3 +1,4 @@
|
||||
import importlib
|
||||
import os
|
||||
import sys
|
||||
import textwrap
|
||||
@ -7,6 +8,7 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
from cpl_cli.command_abc import CommandABC
|
||||
from cpl_cli.configuration import WorkspaceSettings
|
||||
from cpl_cli.configuration.schematic_collection import SchematicCollection
|
||||
from cpl_cli.helper.dependencies import Dependencies
|
||||
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||
from cpl_core.console.console import Console
|
||||
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||
@ -33,13 +35,23 @@ class GenerateService(CommandABC):
|
||||
self._env = self._config.environment
|
||||
self._schematics = {}
|
||||
|
||||
self._read_custom_schematics_from_path(self._env.runtime_directory)
|
||||
for package_name in Dependencies.get_cpl_packages():
|
||||
package = importlib.import_module(String.convert_to_snake_case(package_name[0]))
|
||||
self._read_custom_schematics_from_path(os.path.dirname(package.__file__))
|
||||
|
||||
self._read_custom_schematics_from_path(self._env.working_directory)
|
||||
|
||||
if len(GenerateSchematicABC.__subclasses__()) == 0:
|
||||
Console.error(f'No schematics found in template directory: .cpl')
|
||||
sys.exit()
|
||||
|
||||
known_schematics = []
|
||||
for schematic in GenerateSchematicABC.__subclasses__():
|
||||
if schematic.__name__ in known_schematics:
|
||||
Console.error(f'Duplicate of schematic {schematic.__name__} found!')
|
||||
sys.exit()
|
||||
|
||||
known_schematics.append(schematic.__name__)
|
||||
schematic.register()
|
||||
|
||||
self._schematics = SchematicCollection.get_schematics()
|
||||
|
@ -1,3 +1,4 @@
|
||||
import importlib
|
||||
import os
|
||||
import sys
|
||||
import textwrap
|
||||
@ -18,6 +19,7 @@ from cpl_cli.configuration.project_type_enum import ProjectTypeEnum
|
||||
from cpl_cli.configuration.venv_helper_service import VenvHelper
|
||||
from cpl_cli.configuration.version_settings_name_enum import VersionSettingsNameEnum
|
||||
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
|
||||
from cpl_cli.helper.dependencies import Dependencies
|
||||
from cpl_cli.source_creator.template_builder import TemplateBuilder
|
||||
from cpl_core.configuration.configuration_abc import ConfigurationABC
|
||||
from cpl_core.console.console import Console
|
||||
@ -103,9 +105,9 @@ class NewService(CommandABC):
|
||||
|
||||
self._project.from_dict(self._project_dict)
|
||||
|
||||
def _create_build_settings(self, project_type: ProjectTypeEnum):
|
||||
def _create_build_settings(self, project_type: str):
|
||||
self._build_dict = {
|
||||
BuildSettingsNameEnum.project_type.value: project_type.value,
|
||||
BuildSettingsNameEnum.project_type.value: project_type,
|
||||
BuildSettingsNameEnum.source_path.value: '',
|
||||
BuildSettingsNameEnum.output_path.value: '../../dist',
|
||||
BuildSettingsNameEnum.main.value: f'{String.convert_to_snake_case(self._project.name)}.main',
|
||||
@ -209,14 +211,35 @@ class NewService(CommandABC):
|
||||
Console.error(str(e), traceback.format_exc())
|
||||
sys.exit(-1)
|
||||
|
||||
def _create_project(self, project_type: ProjectTypeEnum):
|
||||
self._read_custom_project_types_from_path(self._env.runtime_directory)
|
||||
def _create_project(self, project_type: str):
|
||||
for package_name in Dependencies.get_cpl_packages():
|
||||
package = importlib.import_module(String.convert_to_snake_case(package_name[0]))
|
||||
self._read_custom_project_types_from_path(os.path.dirname(package.__file__))
|
||||
|
||||
self._read_custom_project_types_from_path(self._env.working_directory)
|
||||
|
||||
if len(ProjectTypeABC.__subclasses__()) == 0:
|
||||
Console.error(f'No project types found in template directory: .cpl')
|
||||
sys.exit()
|
||||
|
||||
project_class = None
|
||||
known_project_types = []
|
||||
for p in ProjectTypeABC.__subclasses__():
|
||||
if p.__name__ in known_project_types:
|
||||
Console.error(f'Duplicate of project type {p.__name__} found!')
|
||||
sys.exit()
|
||||
|
||||
known_project_types.append(p.__name__)
|
||||
if p.__name__.lower() != project_type and p.__name__.lower()[0] != project_type[0]:
|
||||
continue
|
||||
|
||||
project_class = p
|
||||
|
||||
if project_class is None:
|
||||
Console.error(f'Project type {project_type} not found in template directory: .cpl/')
|
||||
sys.exit()
|
||||
|
||||
project_type = String.convert_to_snake_case(project_class.__name__)
|
||||
self._create_project_settings()
|
||||
self._create_build_settings(project_type)
|
||||
self._create_project_json()
|
||||
@ -229,17 +252,6 @@ class NewService(CommandABC):
|
||||
if self._rel_path != '':
|
||||
project_name = f'{self._rel_path}/{project_name}'
|
||||
|
||||
project_class = None
|
||||
for p in ProjectTypeABC.__subclasses__():
|
||||
if p.__name__.lower() != project_type.value and p.__name__.lower()[0] != project_type.value[0]:
|
||||
continue
|
||||
|
||||
project_class = p
|
||||
|
||||
if project_class is None:
|
||||
Console.error(f'Project type {project_type.value} not found in template directory: .cpl/')
|
||||
sys.exit()
|
||||
|
||||
base = 'src/'
|
||||
split_project_name = project_name.split('/')
|
||||
if self._use_base and len(split_project_name) > 0:
|
||||
@ -336,22 +348,10 @@ class NewService(CommandABC):
|
||||
self._use_base = True
|
||||
args.remove('base')
|
||||
|
||||
console = self._config.get_configuration(ProjectTypeEnum.console.value)
|
||||
library = self._config.get_configuration(ProjectTypeEnum.library.value)
|
||||
unittest = self._config.get_configuration(ProjectTypeEnum.unittest.value)
|
||||
if console is not None and library is None and unittest is None:
|
||||
self._name = console
|
||||
self._create_project(ProjectTypeEnum.console)
|
||||
|
||||
elif console is None and library is not None and unittest is None:
|
||||
self._name = library
|
||||
self._create_project(ProjectTypeEnum.library)
|
||||
|
||||
elif console is None and library is None and unittest is not None:
|
||||
self._name = unittest
|
||||
self._create_project(ProjectTypeEnum.unittest)
|
||||
|
||||
else:
|
||||
if len(args) <= 1:
|
||||
Console.error(f'Project type not found')
|
||||
Console.write_line(self.help_message)
|
||||
return
|
||||
|
||||
self._name = args[1]
|
||||
self._create_project(args[0])
|
||||
|
@ -5,6 +5,7 @@ import pkg_resources
|
||||
import textwrap
|
||||
|
||||
import cpl_cli
|
||||
from cpl_cli.helper.dependencies import Dependencies
|
||||
from cpl_core.console.console import Console
|
||||
from cpl_core.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl_cli.command_abc import CommandABC
|
||||
@ -31,16 +32,6 @@ class VersionService(CommandABC):
|
||||
:param args:
|
||||
:return:
|
||||
"""
|
||||
packages = []
|
||||
cpl_packages = []
|
||||
dependencies = dict(tuple(str(ws).split()) for ws in pkg_resources.working_set)
|
||||
for p in dependencies:
|
||||
if str(p).startswith('cpl-'):
|
||||
cpl_packages.append([p, dependencies[p]])
|
||||
continue
|
||||
|
||||
packages.append([p, dependencies[p]])
|
||||
|
||||
Console.set_foreground_color(ForegroundColorEnum.yellow)
|
||||
Console.banner('CPL CLI')
|
||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||
@ -52,6 +43,6 @@ class VersionService(CommandABC):
|
||||
Console.write(f'{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}')
|
||||
Console.write_line(f'OS: {platform.system()} {platform.processor()}')
|
||||
Console.write_line('\nCPL packages:')
|
||||
Console.table(['Name', 'Version'], cpl_packages)
|
||||
Console.table(['Name', 'Version'], Dependencies.get_cpl_packages())
|
||||
Console.write_line('\nPython packages:')
|
||||
Console.table(['Name', 'Version'], packages)
|
||||
Console.table(['Name', 'Version'], Dependencies.get_packages())
|
||||
|
0
src/cpl_cli/helper/__init__.py
Normal file
0
src/cpl_cli/helper/__init__.py
Normal file
22
src/cpl_cli/helper/dependencies.py
Normal file
22
src/cpl_cli/helper/dependencies.py
Normal file
@ -0,0 +1,22 @@
|
||||
import pkg_resources
|
||||
|
||||
|
||||
class Dependencies:
|
||||
_packages = []
|
||||
_cpl_packages = []
|
||||
|
||||
_dependencies = dict(tuple(str(ws).split()) for ws in pkg_resources.working_set)
|
||||
for p in _dependencies:
|
||||
if str(p).startswith('cpl-'):
|
||||
_cpl_packages.append([p, _dependencies[p]])
|
||||
continue
|
||||
|
||||
_packages.append([p, _dependencies[p]])
|
||||
|
||||
@classmethod
|
||||
def get_cpl_packages(cls) -> list[list]:
|
||||
return cls._cpl_packages
|
||||
|
||||
@classmethod
|
||||
def get_packages(cls) -> list[list]:
|
||||
return cls._packages
|
@ -38,9 +38,6 @@ class StartupArgumentExtension(StartupExtensionABC):
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-exp', ['ce', 'CE']) \
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-dev', ['cd', 'CD'])
|
||||
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'new', ['n', 'N'], NewService, True) \
|
||||
.add_console_argument(ArgumentTypeEnum.Variable, '', 'console', ['c', 'C'], ' ') \
|
||||
.add_console_argument(ArgumentTypeEnum.Variable, '', 'library', ['l', 'L'], ' ') \
|
||||
.add_console_argument(ArgumentTypeEnum.Variable, '', 'unittest', ['ut', 'UT'], ' ') \
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'async', ['a', 'A']) \
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'application-base', ['ab', 'AB']) \
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'startup', ['s', 'S']) \
|
||||
|
@ -22,7 +22,7 @@ from cpl_core.dependency_injection.service_provider_abc import ServiceProviderAB
|
||||
from cpl_core.environment.application_environment import ApplicationEnvironment
|
||||
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||
from cpl_core.environment.environment_name_enum import EnvironmentNameEnum
|
||||
from cpl_core.typing import T
|
||||
from cpl_core.type import T
|
||||
|
||||
|
||||
class Configuration(ConfigurationABC):
|
||||
|
@ -6,7 +6,7 @@ from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||
from cpl_core.configuration.argument_abc import ArgumentABC
|
||||
from cpl_core.configuration.argument_type_enum import ArgumentTypeEnum
|
||||
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||
from cpl_core.typing import T
|
||||
from cpl_core.type import T
|
||||
|
||||
|
||||
class ConfigurationABC(ABC):
|
||||
|
@ -16,22 +16,23 @@
|
||||
"LicenseName": "MIT",
|
||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||
"Dependencies": [
|
||||
"art==5.7",
|
||||
"colorama==0.4.5",
|
||||
"art==5.8",
|
||||
"colorama==0.4.6",
|
||||
"mysql-connector==2.2.9",
|
||||
"psutil==5.9.2",
|
||||
"packaging==21.3",
|
||||
"psutil==5.9.4",
|
||||
"packaging==22.0",
|
||||
"pynput==1.7.6",
|
||||
"setuptools==65.3.0",
|
||||
"tabulate==0.8.10",
|
||||
"termcolor==1.1.0",
|
||||
"watchdog==2.1.9",
|
||||
"wheel==0.37.1"
|
||||
"setuptools==65.6.3",
|
||||
"tabulate==0.9.0",
|
||||
"termcolor==2.1.1",
|
||||
"watchdog==2.2.0",
|
||||
"wheel==0.38.4"
|
||||
],
|
||||
"DevDependencies": [
|
||||
"sphinx==5.0.2",
|
||||
"sphinx_rtd_theme==1.0.0",
|
||||
"myst_parser==0.18.0"
|
||||
"Sphinx==5.0.2",
|
||||
"sphinx-rtd-theme==1.0.0",
|
||||
"myst-parser==0.18.0",
|
||||
"twine==4.0.2"
|
||||
],
|
||||
"PythonVersion": ">=3.10",
|
||||
"PythonPath": {},
|
||||
|
@ -65,7 +65,7 @@ class Pip:
|
||||
"""
|
||||
result = None
|
||||
with suppress(Exception):
|
||||
args = [cls._executable, "-m", "pip", "freeze"]
|
||||
args = [cls._executable, "-m", "pip", "freeze", "--all"]
|
||||
|
||||
result = subprocess.check_output(
|
||||
args,
|
||||
|
0
src/cpl_discord/.cpl/__init__.py
Normal file
0
src/cpl_discord/.cpl/__init__.py
Normal file
54
src/cpl_discord/.cpl/project_discord_bot.py
Normal file
54
src/cpl_discord/.cpl/project_discord_bot.py
Normal file
@ -0,0 +1,54 @@
|
||||
import os
|
||||
|
||||
from cpl_cli.abc.project_type_abc import ProjectTypeABC
|
||||
from cpl_cli.configuration import WorkspaceSettings
|
||||
from cpl_core.utils import String
|
||||
|
||||
|
||||
class DiscordBot(ProjectTypeABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
base_path: str,
|
||||
project_name: str,
|
||||
workspace: WorkspaceSettings,
|
||||
use_application_api: bool,
|
||||
use_startup: bool,
|
||||
use_service_providing: bool,
|
||||
use_async: bool,
|
||||
project_file_data: dict,
|
||||
):
|
||||
from project_file_discord import DiscordBotProjectFile
|
||||
from project_file_discord_appsettings import DiscordBotProjectFileAppsettings
|
||||
from project_file_discord_code_application import DiscordBotProjectFileApplication
|
||||
from project_file_discord_code_main import DiscordBotProjectFileMain
|
||||
from project_file_discord_code_startup import DiscordBotProjectFileStartup
|
||||
from project_file_discord_readme import DiscordBotProjectFileReadme
|
||||
from project_file_discord_license import DiscordBotProjectFileLicense
|
||||
from schematic_discord_init import DiscordBotInit
|
||||
from schematic_discord_event import Event
|
||||
from schematic_discord_command import Command
|
||||
|
||||
use_application_api, use_startup, use_service_providing, use_async = True, True, True, True
|
||||
|
||||
ProjectTypeABC.__init__(self, base_path, project_name, workspace, use_application_api, use_startup, use_service_providing, use_async, project_file_data)
|
||||
|
||||
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
|
||||
|
||||
self.add_template(DiscordBotProjectFile(project_name.split('/')[-1], project_path, project_file_data))
|
||||
if workspace is None:
|
||||
self.add_template(DiscordBotProjectFileLicense(''))
|
||||
self.add_template(DiscordBotProjectFileReadme(''))
|
||||
self.add_template(DiscordBotInit('', 'init', f'{base_path}tests/'))
|
||||
|
||||
self.add_template(DiscordBotInit('', 'init', project_path))
|
||||
self.add_template(DiscordBotProjectFileAppsettings(project_path))
|
||||
|
||||
self.add_template(DiscordBotInit('', 'init', f'{project_path}events/'))
|
||||
self.add_template(Event('OnReady', 'event', f'{project_path}events/'))
|
||||
self.add_template(DiscordBotInit('', 'init', f'{project_path}commands/'))
|
||||
self.add_template(Command('Ping', 'command', f'{project_path}commands/'))
|
||||
|
||||
self.add_template(DiscordBotProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
self.add_template(DiscordBotProjectFileStartup(project_name.split('/')[-1], project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
self.add_template(DiscordBotProjectFileMain(project_name.split('/')[-1], project_path, use_application_api, use_startup, use_service_providing, use_async))
|
14
src/cpl_discord/.cpl/project_file_discord.py
Normal file
14
src/cpl_discord/.cpl/project_file_discord.py
Normal file
@ -0,0 +1,14 @@
|
||||
import json
|
||||
|
||||
from cpl_cli.abc.file_template_abc import FileTemplateABC
|
||||
|
||||
|
||||
class DiscordBotProjectFile(FileTemplateABC):
|
||||
|
||||
def __init__(self, name: str, path: str, code: dict):
|
||||
FileTemplateABC.__init__(self, '', path, '{}')
|
||||
self._name = f'{name}.json'
|
||||
self._code = code
|
||||
|
||||
def get_code(self) -> str:
|
||||
return json.dumps(self._code, indent=2)
|
34
src/cpl_discord/.cpl/project_file_discord_appsettings.py
Normal file
34
src/cpl_discord/.cpl/project_file_discord_appsettings.py
Normal file
@ -0,0 +1,34 @@
|
||||
import textwrap
|
||||
|
||||
from cpl_cli.abc.file_template_abc import FileTemplateABC
|
||||
|
||||
|
||||
class DiscordBotProjectFileAppsettings(FileTemplateABC):
|
||||
|
||||
def __init__(self, path: str):
|
||||
FileTemplateABC.__init__(self, '', path, '{}')
|
||||
self._name = 'appsettings.json'
|
||||
|
||||
def get_code(self) -> str:
|
||||
return textwrap.dedent("""\
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/",
|
||||
"Filename": "log_$start_time.log",
|
||||
"ConsoleLogLevel": "ERROR",
|
||||
"FileLogLevel": "WARN"
|
||||
},
|
||||
|
||||
"DiscordBotSettings": {
|
||||
"Token": "",
|
||||
"Prefix": "!bot "
|
||||
}
|
||||
}
|
||||
""")
|
@ -0,0 +1,53 @@
|
||||
from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
|
||||
|
||||
|
||||
class DiscordBotProjectFileApplication(CodeFileTemplateABC):
|
||||
|
||||
def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
|
||||
CodeFileTemplateABC.__init__(self, 'application', path, '', use_application_api, use_startup, use_service_providing, use_async)
|
||||
|
||||
def get_code(self) -> str:
|
||||
import textwrap
|
||||
|
||||
return textwrap.dedent("""\
|
||||
from cpl_core.application import ApplicationABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.console import Console
|
||||
from cpl_core.dependency_injection import ServiceProviderABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.application.discord_bot_application_abc import DiscordBotApplicationABC
|
||||
from cpl_discord.configuration.discord_bot_settings import DiscordBotSettings
|
||||
from cpl_discord.service.discord_bot_service import DiscordBotService
|
||||
from cpl_discord.service.discord_bot_service_abc import DiscordBotServiceABC
|
||||
|
||||
|
||||
class Application(DiscordBotApplicationABC):
|
||||
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
ApplicationABC.__init__(self, config, services)
|
||||
|
||||
self._bot: DiscordBotServiceABC = services.get_service(DiscordBotServiceABC)
|
||||
self._logger: LoggerABC = services.get_service(LoggerABC)
|
||||
self._bot_settings: DiscordBotSettings = config.get_configuration(DiscordBotSettings)
|
||||
|
||||
async def configure(self):
|
||||
pass
|
||||
|
||||
async def main(self):
|
||||
try:
|
||||
self._logger.debug(__name__, f'Starting...\\n')
|
||||
self._logger.trace(__name__, f'Try to start {DiscordBotService.__name__}')
|
||||
await self._bot.start_async()
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, 'Start failed', e)
|
||||
|
||||
async def stop_async(self):
|
||||
try:
|
||||
self._logger.trace(__name__, f'Try to stop {DiscordBotService.__name__}')
|
||||
await self._bot.close()
|
||||
self._logger.trace(__name__, f'Stopped {DiscordBotService.__name__}')
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, 'stop failed', e)
|
||||
|
||||
Console.write_line()
|
||||
""")
|
47
src/cpl_discord/.cpl/project_file_discord_code_main.py
Normal file
47
src/cpl_discord/.cpl/project_file_discord_code_main.py
Normal file
@ -0,0 +1,47 @@
|
||||
from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
|
||||
from cpl_core.utils import String
|
||||
|
||||
|
||||
class DiscordBotProjectFileMain(CodeFileTemplateABC):
|
||||
|
||||
def __init__(self, name: str, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
|
||||
CodeFileTemplateABC.__init__(self, 'main', path, '', use_application_api, use_startup, use_service_providing, use_async)
|
||||
|
||||
import textwrap
|
||||
|
||||
import_pkg = f'{String.convert_to_snake_case(name)}.'
|
||||
|
||||
self._main_with_application_host_and_startup = textwrap.dedent(f"""\
|
||||
import asyncio
|
||||
from typing import Optional
|
||||
|
||||
from cpl_core.application import ApplicationBuilder, ApplicationABC
|
||||
from {import_pkg}application import Application
|
||||
from {import_pkg}startup import Startup
|
||||
|
||||
|
||||
class Program:
|
||||
|
||||
def __init__(self):
|
||||
self._app: Optional[Application] = None
|
||||
|
||||
async def main(self):
|
||||
app_builder = ApplicationBuilder(Application)
|
||||
app_builder.use_startup(Startup)
|
||||
self._app: ApplicationABC = await app_builder.build_async()
|
||||
await self._app.run_async()
|
||||
|
||||
async def stop(self):
|
||||
await self._app.stop_async()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
program = Program()
|
||||
try:
|
||||
asyncio.run(program.main())
|
||||
except KeyboardInterrupt:
|
||||
asyncio.run(program.stop())
|
||||
""")
|
||||
|
||||
def get_code(self) -> str:
|
||||
return self._main_with_application_host_and_startup
|
47
src/cpl_discord/.cpl/project_file_discord_code_startup.py
Normal file
47
src/cpl_discord/.cpl/project_file_discord_code_startup.py
Normal file
@ -0,0 +1,47 @@
|
||||
from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
|
||||
from cpl_core.utils import String
|
||||
|
||||
|
||||
class DiscordBotProjectFileStartup(CodeFileTemplateABC):
|
||||
|
||||
def __init__(self, project_name: str, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
|
||||
CodeFileTemplateABC.__init__(self, 'startup', path, '', use_application_api, use_startup, use_service_providing, use_async)
|
||||
self._project_name = project_name
|
||||
|
||||
def get_code(self) -> str:
|
||||
import textwrap
|
||||
|
||||
import_pkg = f'{String.convert_to_snake_case(self._project_name)}.'
|
||||
|
||||
return textwrap.dedent(f"""\
|
||||
from cpl_core.application import StartupABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||
from cpl_core.environment import ApplicationEnvironment
|
||||
from cpl_discord import get_discord_collection
|
||||
from cpl_discord.discord_event_types_enum import DiscordEventTypesEnum
|
||||
from {import_pkg}commands.ping_command import PingCommand
|
||||
from {import_pkg}events.on_ready_event import OnReadyEvent
|
||||
|
||||
|
||||
class Startup(StartupABC):
|
||||
|
||||
def __init__(self):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
||||
configuration.add_json_file('appsettings.json', optional=False)
|
||||
configuration.add_environment_variables('CPL_')
|
||||
configuration.add_environment_variables('DISCORD_')
|
||||
|
||||
return configuration
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||
services.add_logging()
|
||||
services.add_discord()
|
||||
dc_collection = get_discord_collection(services)
|
||||
dc_collection.add_event(DiscordEventTypesEnum.on_ready.value, OnReadyEvent)
|
||||
dc_collection.add_command(PingCommand)
|
||||
|
||||
return services.build_service_provider()
|
||||
""")
|
11
src/cpl_discord/.cpl/project_file_discord_license.py
Normal file
11
src/cpl_discord/.cpl/project_file_discord_license.py
Normal file
@ -0,0 +1,11 @@
|
||||
from cpl_cli.abc.file_template_abc import FileTemplateABC
|
||||
|
||||
|
||||
class DiscordBotProjectFileLicense(FileTemplateABC):
|
||||
|
||||
def __init__(self, path: str):
|
||||
FileTemplateABC.__init__(self, '', path, '')
|
||||
self._name = 'LICENSE'
|
||||
|
||||
def get_code(self) -> str:
|
||||
return self._code
|
11
src/cpl_discord/.cpl/project_file_discord_readme.py
Normal file
11
src/cpl_discord/.cpl/project_file_discord_readme.py
Normal file
@ -0,0 +1,11 @@
|
||||
from cpl_cli.abc.file_template_abc import FileTemplateABC
|
||||
|
||||
|
||||
class DiscordBotProjectFileReadme(FileTemplateABC):
|
||||
|
||||
def __init__(self, path: str):
|
||||
FileTemplateABC.__init__(self, '', path, '')
|
||||
self._name = 'README.md'
|
||||
|
||||
def get_code(self) -> str:
|
||||
return self._code
|
44
src/cpl_discord/.cpl/schematic_discord_command.py
Normal file
44
src/cpl_discord/.cpl/schematic_discord_command.py
Normal file
@ -0,0 +1,44 @@
|
||||
import textwrap
|
||||
|
||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Command(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
def get_code(self) -> str:
|
||||
code = """\
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.command import DiscordCommandABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
|
||||
class $Name(DiscordCommandABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
logger: LoggerABC,
|
||||
bot: DiscordBotServiceABC
|
||||
):
|
||||
DiscordCommandABC.__init__(self)
|
||||
|
||||
self._logger = logger
|
||||
self._bot = bot
|
||||
|
||||
@commands.hybrid_command()
|
||||
async def ping(self, ctx: Context):
|
||||
await ctx.send('Pong')
|
||||
"""
|
||||
return self.build_code_str(code, Name=self._class_name)
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'command',
|
||||
[]
|
||||
)
|
69
src/cpl_discord/.cpl/schematic_discord_event.py
Normal file
69
src/cpl_discord/.cpl/schematic_discord_event.py
Normal file
@ -0,0 +1,69 @@
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
from cpl_core.console import Console
|
||||
from cpl_core.utils import String
|
||||
|
||||
|
||||
class Event(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, name: str, schematic: str, path: str):
|
||||
GenerateSchematicABC.__init__(self, name, schematic, path)
|
||||
|
||||
event = None
|
||||
|
||||
from cpl_discord.discord_event_types_enum import DiscordEventTypesEnum
|
||||
for event_type in DiscordEventTypesEnum:
|
||||
event_name = event_type.value.__name__.replace("ABC", '')
|
||||
|
||||
if event_name in name:
|
||||
name = name.replace(event_name, "")
|
||||
event = event_name
|
||||
break
|
||||
|
||||
if event is None:
|
||||
Console.error(f'No valid event found in name {name}')
|
||||
Console.write_line('Available events:')
|
||||
for event_type in DiscordEventTypesEnum:
|
||||
Console.write_line(f'\t{event_type.value.__name__.replace("ABC", "")}')
|
||||
sys.exit()
|
||||
|
||||
self._event_class = f'{event}ABC'
|
||||
self._name = f'{String.convert_to_snake_case(self._event_class.replace("ABC", ""))}_{schematic}.py'
|
||||
self._class_name = f'{self._event_class.replace("ABC", "")}{String.first_to_upper(schematic)}'
|
||||
if name != '':
|
||||
self._name = f'{String.convert_to_snake_case(name)}_{self._name}'
|
||||
self._class_name = f'{String.first_to_upper(name)}{self._class_name}'
|
||||
|
||||
def get_code(self) -> str:
|
||||
code = """\
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.events import $EventClass
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
|
||||
|
||||
class $Name($EventClass):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
logger: LoggerABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
):
|
||||
OnReadyABC.__init__(self)
|
||||
|
||||
self._logger = logger
|
||||
self._bot = bot
|
||||
|
||||
async def on_ready(self):
|
||||
pass
|
||||
"""
|
||||
return self.build_code_str(code, Name=self._class_name, EventClass=self._event_class)
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'event',
|
||||
[]
|
||||
)
|
24
src/cpl_discord/.cpl/schematic_discord_init.py
Normal file
24
src/cpl_discord/.cpl/schematic_discord_init.py
Normal file
@ -0,0 +1,24 @@
|
||||
import textwrap
|
||||
|
||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class DiscordBotInit(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
self._name = f'__init__.py'
|
||||
|
||||
def get_code(self) -> str:
|
||||
code = """\
|
||||
# imports
|
||||
"""
|
||||
return self.build_code_str(code, Name=self._class_name)
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'init',
|
||||
[]
|
||||
)
|
@ -9,4 +9,4 @@ class OnGroupJoinABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def on_group_join(
|
||||
self, chhanel: discord.GroupChannel, user: discord.User): pass
|
||||
self, channel: discord.GroupChannel, user: discord.User): pass
|
||||
|
@ -1 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
discord-bot
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
:copyright: (c)
|
||||
:license:
|
||||
|
||||
"""
|
||||
|
||||
__title__ = 'discord_bot'
|
||||
__author__ = ''
|
||||
__license__ = ''
|
||||
__copyright__ = 'Copyright (c) '
|
||||
__version__ = '0.0.0'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='0', minor='0', micro='0')
|
||||
|
@ -16,10 +16,10 @@
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"cpl-core>=2022.7.0"
|
||||
"cpl-core==2022.12.0"
|
||||
],
|
||||
"DevDependencies": [
|
||||
"cpl-cli>=2022.7.0"
|
||||
"cpl-cli==2022.12.0"
|
||||
],
|
||||
"PythonVersion": ">=3.10.4",
|
||||
"PythonPath": {},
|
||||
@ -39,6 +39,8 @@
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {},
|
||||
"ProjectReferences": []
|
||||
"ProjectReferences": [
|
||||
"../modules/hello_world/hello-world.json"
|
||||
]
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ from discord_bot.application import Application
|
||||
from discord_bot.startup import Startup
|
||||
|
||||
|
||||
class Main:
|
||||
class Program:
|
||||
|
||||
def __init__(self):
|
||||
self._app: Optional[Application] = None
|
||||
@ -23,8 +23,8 @@ class Main:
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main = Main()
|
||||
program = Program()
|
||||
try:
|
||||
asyncio.run(main.main())
|
||||
asyncio.run(program.main())
|
||||
except KeyboardInterrupt:
|
||||
asyncio.run(main.stop())
|
||||
asyncio.run(program.stop())
|
||||
|
@ -1,5 +1,6 @@
|
||||
from cpl_core.application import StartupABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.console import Console
|
||||
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||
from cpl_core.environment import ApplicationEnvironment
|
||||
from cpl_discord import get_discord_collection
|
||||
@ -16,7 +17,7 @@ class Startup(StartupABC):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
||||
configuration.add_json_file('appsettings.json', optional=True)
|
||||
configuration.add_json_file('appsettings.json', optional=False)
|
||||
configuration.add_environment_variables('CPL_')
|
||||
configuration.add_environment_variables('DISCORD_')
|
||||
|
||||
|
@ -1 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
discord-bot
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
:copyright: (c)
|
||||
:license:
|
||||
|
||||
"""
|
||||
|
||||
__title__ = 'modules.hello_world'
|
||||
__author__ = ''
|
||||
__license__ = ''
|
||||
__copyright__ = 'Copyright (c) '
|
||||
__version__ = '0.0.0'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='0', minor='0', micro='0')
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user