memegen.routes.api_root.handle_checks()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.125

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 0
dl 0
loc 8
rs 10
c 0
b 0
f 0
ccs 1
cts 2
cp 0.5
crap 1.125
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