sh_cpl/docs/build/html/cpl.dependency_injection.html

444 lines
34 KiB
HTML

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>cpl.dependency_injection &mdash; Common Python Library documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script type="text/javascript" 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="cpl.environment" href="cpl.environment.html" />
<link rel="prev" title="cpl.database.context" href="cpl.database.context.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="main navigation">
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="cpl.html">CPL</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="cpl.application.html">cpl.application</a></li>
<li class="toctree-l2"><a class="reference internal" href="cpl.configuration.html">cpl.configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="cpl.console.html">cpl.console</a></li>
<li class="toctree-l2"><a class="reference internal" href="cpl.database.html">cpl.database</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">cpl.dependency_injection</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#module-cpl.dependency_injection.service_collection">cpl.dependency_injection.service_collection</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-cpl.dependency_injection.service_collection_abc">cpl.dependency_injection.service_collection_abc</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-cpl.dependency_injection.service_descriptor">cpl.dependency_injection.service_descriptor</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-cpl.dependency_injection.service_lifetime_enum">cpl.dependency_injection.service_lifetime_enum</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-cpl.dependency_injection.service_provider">cpl.dependency_injection.service_provider</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-cpl.dependency_injection.service_provider_abc">cpl.dependency_injection.service_provider_abc</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cpl.environment.html">cpl.environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="cpl.logging.html">cpl.logging</a></li>
<li class="toctree-l2"><a class="reference internal" href="cpl.mailing.html">cpl.mailing</a></li>
<li class="toctree-l2"><a class="reference internal" href="cpl.time.html">cpl.time</a></li>
<li class="toctree-l2"><a class="reference internal" href="cpl.utils.html">cpl.utils</a></li>
<li class="toctree-l2"><a class="reference internal" href="cpl.html#module-cpl">Module contents</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Common Python Library</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
<li><a href="cpl.html">CPL</a> &raquo;</li>
<li>cpl.dependency_injection</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/cpl.dependency_injection.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="cpl-dependency-injection">
<h1>cpl.dependency_injection<a class="headerlink" href="#cpl-dependency-injection" title="Permalink to this headline"></a></h1>
<div class="section" id="module-cpl.dependency_injection.service_collection">
<span id="cpl-dependency-injection-service-collection"></span><h2>cpl.dependency_injection.service_collection<a class="headerlink" href="#module-cpl.dependency_injection.service_collection" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="cpl.dependency_injection.service_collection.ServiceCollection">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">cpl.dependency_injection.service_collection.</span></code><code class="sig-name descname"><span class="pre">ServiceCollection</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">config</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="cpl.configuration.html#cpl.configuration.configuration_abc.ConfigurationABC" title="cpl.configuration.configuration_abc.ConfigurationABC"><span class="pre">cpl.configuration.configuration_abc.ConfigurationABC</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_collection.ServiceCollection" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC" title="cpl.dependency_injection.service_collection_abc.ServiceCollectionABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.dependency_injection.service_collection_abc.ServiceCollectionABC</span></code></a></p>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection.ServiceCollection.add_db_context">
<code class="sig-name descname"><span class="pre">add_db_context</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">db_context_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="cpl.database.context.html#cpl.database.context.database_context_abc.DatabaseContextABC" title="cpl.database.context.database_context_abc.DatabaseContextABC"><span class="pre">cpl.database.context.database_context_abc.DatabaseContextABC</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">db_settings</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="cpl.database.html#cpl.database.database_settings.DatabaseSettings" title="cpl.database.database_settings.DatabaseSettings"><span class="pre">cpl.database.database_settings.DatabaseSettings</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_collection.ServiceCollection.add_db_context" title="Permalink to this definition"></a></dt>
<dd><p>Adds database context
:param db_context:
:param db_settings:
:return:</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection.ServiceCollection.add_logging">
<code class="sig-name descname"><span class="pre">add_logging</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_collection.ServiceCollection.add_logging" title="Permalink to this definition"></a></dt>
<dd><p>Adds the CPL internal logger</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection.ServiceCollection.add_scoped">
<code class="sig-name descname"><span class="pre">add_scoped</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Callable</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_collection.ServiceCollection.add_scoped" title="Permalink to this definition"></a></dt>
<dd><p>Adds a service with scoped lifetime
:param service_type:
:param service:
:return:</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection.ServiceCollection.add_singleton">
<code class="sig-name descname"><span class="pre">add_singleton</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">type</span><span class="p"><span class="pre">,</span> </span><span class="pre">object</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">type</span><span class="p"><span class="pre">,</span> </span><span class="pre">object</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_collection.ServiceCollection.add_singleton" title="Permalink to this definition"></a></dt>
<dd><p>Adds a service with singleton lifetime
:param service_type:
:param service:
:return:</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection.ServiceCollection.add_transient">
<code class="sig-name descname"><span class="pre">add_transient</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">type</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_collection.ServiceCollection.add_transient" title="Permalink to this definition"></a></dt>
<dd><p>Adds a service with transient lifetime
:param service_type:
:param service:
:return:</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection.ServiceCollection.build_service_provider">
<code class="sig-name descname"><span class="pre">build_service_provider</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; <a class="reference internal" href="#cpl.dependency_injection.service_provider_abc.ServiceProviderABC" title="cpl.dependency_injection.service_provider_abc.ServiceProviderABC"><span class="pre">cpl.dependency_injection.service_provider_abc.ServiceProviderABC</span></a><a class="headerlink" href="#cpl.dependency_injection.service_collection.ServiceCollection.build_service_provider" title="Permalink to this definition"></a></dt>
<dd><p>Creates instance of the service provider</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-cpl.dependency_injection.service_collection_abc">
<span id="cpl-dependency-injection-service-collection-abc"></span><h2>cpl.dependency_injection.service_collection_abc<a class="headerlink" href="#module-cpl.dependency_injection.service_collection_abc" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="cpl.dependency_injection.service_collection_abc.ServiceCollectionABC">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">cpl.dependency_injection.service_collection_abc.</span></code><code class="sig-name descname"><span class="pre">ServiceCollectionABC</span></code><a class="headerlink" href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">abc.ABC</span></code></p>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_db_context">
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_db_context</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">db_context</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="cpl.database.context.html#cpl.database.context.database_context_abc.DatabaseContextABC" title="cpl.database.context.database_context_abc.DatabaseContextABC"><span class="pre">cpl.database.context.database_context_abc.DatabaseContextABC</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">db_settings</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="cpl.database.html#cpl.database.database_settings.DatabaseSettings" title="cpl.database.database_settings.DatabaseSettings"><span class="pre">cpl.database.database_settings.DatabaseSettings</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_db_context" title="Permalink to this definition"></a></dt>
<dd><p>Adds database context
:param db_context:
:param db_settings:
:return:</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_logging">
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_logging</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_logging" title="Permalink to this definition"></a></dt>
<dd><p>Adds the CPL internal logger</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_scoped">
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_scoped</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">collections.abc.Callable</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_scoped" title="Permalink to this definition"></a></dt>
<dd><p>Adds a service with scoped lifetime
:param service_type:
:param service:
:return:</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_singleton">
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_singleton</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">collections.abc.Callable</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_singleton" title="Permalink to this definition"></a></dt>
<dd><p>Adds a service with singleton lifetime
:param service_type:
:param service:
:return:</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_transient">
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_transient</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">collections.abc.Callable</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_transient" title="Permalink to this definition"></a></dt>
<dd><p>Adds a service with transient lifetime
:param service_type:
:param service:
:return:</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.build_service_provider">
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">build_service_provider</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; <a class="reference internal" href="#cpl.dependency_injection.service_provider_abc.ServiceProviderABC" title="cpl.dependency_injection.service_provider_abc.ServiceProviderABC"><span class="pre">cpl.dependency_injection.service_provider_abc.ServiceProviderABC</span></a><a class="headerlink" href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.build_service_provider" title="Permalink to this definition"></a></dt>
<dd><p>Creates instance of the service provider</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-cpl.dependency_injection.service_descriptor">
<span id="cpl-dependency-injection-service-descriptor"></span><h2>cpl.dependency_injection.service_descriptor<a class="headerlink" href="#module-cpl.dependency_injection.service_descriptor" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="cpl.dependency_injection.service_descriptor.ServiceDescriptor">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">cpl.dependency_injection.service_descriptor.</span></code><code class="sig-name descname"><span class="pre">ServiceDescriptor</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">implementation</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">type</span><span class="p"><span class="pre">,</span> </span><span class="pre">object</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lifetime</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum" title="cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum"><span class="pre">cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_descriptor.ServiceDescriptor" 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 id="cpl.dependency_injection.service_descriptor.ServiceDescriptor.implementation">
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">implementation</span></code><a class="headerlink" href="#cpl.dependency_injection.service_descriptor.ServiceDescriptor.implementation" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_descriptor.ServiceDescriptor.lifetime">
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">lifetime</span></code><a class="headerlink" href="#cpl.dependency_injection.service_descriptor.ServiceDescriptor.lifetime" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_descriptor.ServiceDescriptor.service_type">
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">service_type</span></code><a class="headerlink" href="#cpl.dependency_injection.service_descriptor.ServiceDescriptor.service_type" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-cpl.dependency_injection.service_lifetime_enum">
<span id="cpl-dependency-injection-service-lifetime-enum"></span><h2>cpl.dependency_injection.service_lifetime_enum<a class="headerlink" href="#module-cpl.dependency_injection.service_lifetime_enum" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">cpl.dependency_injection.service_lifetime_enum.</span></code><code class="sig-name descname"><span class="pre">ServiceLifetimeEnum</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">enum.Enum</span></code></p>
<p>An enumeration.</p>
<dl class="py attribute">
<dt id="cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum.scoped">
<code class="sig-name descname"><span class="pre">scoped</span></code><em class="property"> <span class="pre">=</span> <span class="pre">1</span></em><a class="headerlink" href="#cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum.scoped" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt id="cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum.singleton">
<code class="sig-name descname"><span class="pre">singleton</span></code><em class="property"> <span class="pre">=</span> <span class="pre">0</span></em><a class="headerlink" href="#cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum.singleton" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt id="cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum.transient">
<code class="sig-name descname"><span class="pre">transient</span></code><em class="property"> <span class="pre">=</span> <span class="pre">2</span></em><a class="headerlink" href="#cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum.transient" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-cpl.dependency_injection.service_provider">
<span id="cpl-dependency-injection-service-provider"></span><h2>cpl.dependency_injection.service_provider<a class="headerlink" href="#module-cpl.dependency_injection.service_provider" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="cpl.dependency_injection.service_provider.ServiceProvider">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">cpl.dependency_injection.service_provider.</span></code><code class="sig-name descname"><span class="pre">ServiceProvider</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_descriptors</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">config</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="cpl.configuration.html#cpl.configuration.configuration_abc.ConfigurationABC" title="cpl.configuration.configuration_abc.ConfigurationABC"><span class="pre">cpl.configuration.configuration_abc.ConfigurationABC</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">db_context</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="cpl.database.context.html#cpl.database.context.database_context_abc.DatabaseContextABC" title="cpl.database.context.database_context_abc.DatabaseContextABC"><span class="pre">cpl.database.context.database_context_abc.DatabaseContextABC</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.dependency_injection.service_provider.ServiceProvider" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#cpl.dependency_injection.service_provider_abc.ServiceProviderABC" title="cpl.dependency_injection.service_provider_abc.ServiceProviderABC"><code class="xref py py-class docutils literal notranslate"><span class="pre">cpl.dependency_injection.service_provider_abc.ServiceProviderABC</span></code></a></p>
<dl class="py method">
<dt id="cpl.dependency_injection.service_provider.ServiceProvider.build_service">
<code class="sig-name descname"><span class="pre">build_service</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">type</span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">object</span><a class="headerlink" href="#cpl.dependency_injection.service_provider.ServiceProvider.build_service" title="Permalink to this definition"></a></dt>
<dd><p>Creates instance of given type
:param service_type:
:return:</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_provider.ServiceProvider.get_service">
<code class="sig-name descname"><span class="pre">get_service</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">type</span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">collections.abc.Callable</span><span class="p"><span class="pre">[</span></span><span class="pre">object</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#cpl.dependency_injection.service_provider.ServiceProvider.get_service" title="Permalink to this definition"></a></dt>
<dd><p>Returns instance of given type
:param instance_type:
:return:</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-cpl.dependency_injection.service_provider_abc">
<span id="cpl-dependency-injection-service-provider-abc"></span><h2>cpl.dependency_injection.service_provider_abc<a class="headerlink" href="#module-cpl.dependency_injection.service_provider_abc" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="cpl.dependency_injection.service_provider_abc.ServiceProviderABC">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">cpl.dependency_injection.service_provider_abc.</span></code><code class="sig-name descname"><span class="pre">ServiceProviderABC</span></code><a class="headerlink" href="#cpl.dependency_injection.service_provider_abc.ServiceProviderABC" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">abc.ABC</span></code></p>
<dl class="py method">
<dt id="cpl.dependency_injection.service_provider_abc.ServiceProviderABC.build_service">
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">build_service</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">type</span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">object</span><a class="headerlink" href="#cpl.dependency_injection.service_provider_abc.ServiceProviderABC.build_service" title="Permalink to this definition"></a></dt>
<dd><p>Creates instance of given type
:param service_type:
:return:</p>
</dd></dl>
<dl class="py method">
<dt id="cpl.dependency_injection.service_provider_abc.ServiceProviderABC.get_service">
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">get_service</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">instance_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Type</span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">collections.abc.Callable</span><span class="p"><span class="pre">[</span></span><span class="pre">object</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#cpl.dependency_injection.service_provider_abc.ServiceProviderABC.get_service" title="Permalink to this definition"></a></dt>
<dd><p>Returns instance of given type
:param instance_type:
:return:</p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cpl.environment.html" class="btn btn-neutral float-right" title="cpl.environment" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="cpl.database.context.html" class="btn btn-neutral float-left" title="cpl.database.context" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&#169; Copyright 2021, 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 type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>