Library for creating Dependency Injection Pattern
Usage
from nttinjector import dependency_inject, Injector
class Model:
count = 0
def __init__(self, strName: str = "") -> None:
self._strName = strName
self.CreateNewModel()
def __repr__(self) -> str:
return f"<Model name=\"{self._strName}\" />"
@classmethod
def CreateNewModel(cls):
cls.count += 1
@classmethod
def GetModelInstances(cls):
return cls.count
@dependency_inject(Model)
class ViewModel:
count = 0
def __init__(self, mModel: Model, strName: str = "") -> None:
self._mModel = mModel
self._strName = strName
self.CreateNewModel()
@classmethod
def CreateNewModel(cls):
cls.count += 1
@classmethod
def GetModelInstances(cls):
return cls.count
def __repr__(self) -> str:
return f"<ViewModel name=\"{self._strName}\" />"
@dependency_inject(ViewModel, Model)
class View:
def __init__(self, viewModel: ViewModel, mModel: Model, strName: str = "") -> None:
self._viewModel = viewModel
self._model = mModel
self._strName = strName
def __repr__(self) -> str:
return f"<View name=\"{self._strName}\" />"
Then use the View as normal
view = View()
print(view._model)
Metadata
Release files for ntt-injector 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ntt-injector-1.1.0.tar.gz | 2.6 kB | Without provenance | Details for ntt-injector-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ntt_injector-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for ntt_injector-1.1.0-py3-none-any.whl |
Total release size: 6.1 kB
Release files / ntt-injector-1.1.0.tar.gz
| Download URL | ntt-injector-1.1.0.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e58653fd832f47ce50e4ab6b1bc472b2e6871cb61629025d4dda81efe2f9c52f
|
|
BLAKE2b-256 checksum How to use checksums |
fa69e84ad4af2d5a5b41da032a2d2b5b966521ead774cc2b7aabd5cef98711d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Release files / ntt_injector-1.1.0-py3-none-any.whl
| Download URL | ntt_injector-1.1.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fb757968869e6009a1ddce0bad74d8be551d7639cccb59d4f8649f1ede81e38
|
|
BLAKE2b-256 checksum How to use checksums |
f485f9d6fb98429d4aece9641be11bc7fbad92a986a06e3960e48d7a49992fec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.7
|
Security for ntt-injector 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.