| Conditions | 3 |
| Total Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | 1 | from voluptuous import Invalid |
|
| 37 | 1 | def Date(value): |
|
| 38 | 1 | fmt = '%d/%m/%Y' |
|
| 39 | 1 | try: |
|
| 40 | 1 | if isinstance(value, int): |
|
| 41 | 1 | value = datetime.date.today() + datetime.timedelta(value) |
|
| 42 | |||
| 43 | 1 | return value.strftime(fmt) |
|
| 44 | 1 | except Exception: |
|
| 45 | raise Invalid("Should be an instance of datetime.datetime") |
||
| 46 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.