Passed
Branch master (28df20)
by Markus
02:40
created

chaoswg.helpers   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 12
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A format_datetime_custom() 0 4 2
A format_timedelta_custom() 0 5 2
1
from datetime import datetime
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
3
from flask_babel import format_datetime, format_timedelta
4
5
6
def format_datetime_custom(value):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
7
    if value is None:
8
        return 'Not yet'
9
    return format_datetime(value, 'dd.MM.yy HH:mm')
10
11
12
def format_timedelta_custom(value):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
13
    if value is None:
14
        return 'Not yet'
15
    now = datetime.utcnow()
16
    return format_timedelta(value - now, granularity='day', add_direction=True)
17