memegen.routes.api_root   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 93.75%

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 34
rs 10
c 0
b 0
f 0
ccs 15
cts 16
cp 0.9375
wmc 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
A get() 0 11 1
A handle_checks() 0 8 1
1 1
from collections import OrderedDict
2
3 1
from flask import Blueprint, current_app
0 ignored issues
show
introduced by
Unable to import 'flask'
Loading history...
4
5 1
from .. import __version__
6
7 1
from ._utils import route
8
9
10 1
blueprint = Blueprint('root', __name__)
11
12
13 1
@blueprint.route("/api/")
14
def get():
15
    """Generate memes from templates."""
16 1
    data = OrderedDict()
17 1
    data['templates'] = route('templates.get', _external=True)
18 1
    data['fonts'] = route('fonts.get', _external=True)
19 1
    data['aliases'] = route('aliases.get', _external=True)
20 1
    data['search'] = route('search.get', _external=True)
21 1
    data['version'] = __version__
22 1
    data['changes'] = current_app.config['CHANGES_URL']
23 1
    return data
24
25
26 1
@blueprint.route("/CHECK")
27
def handle_checks():
28
    """Return CHECK_OK for zero-downtime deployment.
29
30
    See: https://labnotes.org/zero-downtime-deploy-with-dokku
31
32
    """
33
    return "CHECK_OK"
34