Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

decofhak is a library of the decarators of @hakancelik96

Project description

### Install
```python
pip install decofhak
```

### How to use

#### transform

```python
from decofhak import transform

@transform(int)
def x():
return "2"
# type(x()) == int

@transform()
def x() -> int:
return 2
# type(x()) == int

@transform()
def x() -> str:
return 2
# type(x()) == str

@transform(str)
def x():
return 2
# type(x()) == str

@transform(int)
def x():
return dict(a=1, b="2", c="0")
# x() == dict(a=1, b=2, c=0)

@transform()
def x() -> list:
return dict(a=1, b="2", c="0")
# x() == dict(a=[1], b=['2'], c=['0'])

@transform(str)
def x() -> int:
return 2
# type(x()) == int
```

#### dictobj

```python
from decofhak import dictobj

@dictobj
def x():
return dict(a=1, b="2", c="0")

>>> x().a
1
>>> x().b
"2"
>>> x().c
"0"

@dictobj
def x():
return 2
>>> x()
2

```

All
```python

@dictobj
@transform(list)
@transform(int)
def x():
return dict(a=(1, 2, 3), b="2", c="0")
# {'a': [1, 2, 3], 'b': [2], 'c': [0]}

@dictobj
@transform(list)
@transform(int)
def x():
return dict(a=(1, 2, 3), b="2", c="0")

# x().a -> [1, 2, 3]
```

Project details


Release history Release notifications

This version

0.0.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for decofhak, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size decofhak-0.0.3.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page