ClassMaker-0.1
توضیحات
A python module to help with meta classes
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | ClassMaker-0.1 |
| نام | ClassMaker |
| نسخه کتابخانه | 0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Craig Hickman |
| ایمیل نویسنده | craig.hickman@ukaea.uk |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/ClassMaker/ |
| مجوز | - |
A helper class to programaticly build a Meta Class
### Install
```
git clone https://gitlab.com/craigukaea/class-maker.git
cd class-builder
./Install
```
### Use
To build a class equivelent to the following:
```python
class Foo:
def bar():
print("Hello world")
```
Use:
```
maker = ClassMaker()
maker.setClassName('Foo')
maker.addFunction('bar', lambda : print("Hello World!"))
#make the class
foo = maker.makeClass()
##test the functions
foo.__init__()
foo.bar()
```
### Example
```python
from ClassMaker import ClassMaker
if __name__ == "__main__":
maker = ClassMaker()
maker.setClassName('Foo')
maker.addFunction('bar', lambda : print("Hello World!"))
maker.addVariable('baz', 5)
maker.addFunctionToInitialiser(lambda : print("Initialising"))
maker.addFunctionToInitialiser(lambda : print("!"))
foo = maker.makeClass()
foo.__init__()
foo.bar()
print(foo.baz)
```
نحوه نصب
نصب پکیج whl ClassMaker-0.1:
pip install ClassMaker-0.1.whl
نصب پکیج tar.gz ClassMaker-0.1:
pip install ClassMaker-0.1.tar.gz