Initable is a Python package that helps create DRY-er classes.
Project description
Initable is a Python package that helps create DRY-er classes.
Installation
Initable is available through pip.
pip install initable
Usage
Define an instance method you would like to be able to initialize the class with as well.
from initable import initializable
class Foo(object):
@initializable
def bar(self, arg):
self.baz = do_something(arg)
You can now call that method on the class and receive an initialized instance upon completion:
foo = Foo.bar(arg)
Or call the method on an existing instance:
foo = Foo()
# do stuff...
foo.bar(arg) # `bar()` is called on instance `foo`
Testing
Run the following from the root of the project:
poetry run pytest tests/
Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Code of Conduct
By participating in this project, you agree to abide by the terms of the Code of Conduct.
License
Initable is licensed under the Hippocratic License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file initable-0.2.0.tar.gz
.
File metadata
- Download URL: initable-0.2.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.2 CPython/3.7.6 Darwin/19.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8f013ea1b0a8098eeb0f261b215fd2d09d20bf401371b4085e6db56262b2e3e |
|
MD5 | 043d35fe80add703f74d91993d3845bc |
|
BLAKE2b-256 | 29475f7aeb48b58083c1f9fad1f283e2dc96987039a04b7791af0bc671ba395d |
File details
Details for the file initable-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: initable-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.2 CPython/3.7.6 Darwin/19.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56ee4030eb88787f6b66f90394beff66b024c71e6b9926aa3fde3500298863da |
|
MD5 | afd37640090a6b27ef7413df88a89a0d |
|
BLAKE2b-256 | 543ca382bdd3bb0b06c150fb02d00f66bcdeb5922ee36815435367ae55ee40d1 |