Completed
Pull Request — master (#146)
by Jace
01:53
created

get_javascript()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.125
Metric Value
cc 1
dl 0
loc 3
ccs 1
cts 2
cp 0.5
crap 1.125
rs 10
1 1
from collections import OrderedDict
2
3 1
from flask import Blueprint, Response, render_template
0 ignored issues
show
Configuration introduced by
The import flask could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
4
5 1
from .. import __version__
6
7 1
from ._common import CHANGES_URL, route, get_tid
8
9
10 1
blueprint = Blueprint('root', __name__, url_prefix="/",
11
                      template_folder="../templates")
12
13
14 1
@blueprint.route("")
15
def get_index():
16 1
    return Response(render_template("index.html", ga_tid=get_tid()))
17
18
19 1
@blueprint.route("flask-api/static/js/default.js")
20
def get_javascript():
21
    return Response(render_template("js/default.js", ga_tid=get_tid()))
22
23
24 1
@blueprint.route("api")
25
def get():
26
    """Generate memes from templates."""
27 1
    data = OrderedDict()
28 1
    data['templates'] = route('templates.get', _external=True)
29 1
    data['aliases'] = route('aliases.get', _external=True)
30 1
    data['version'] = __version__
31 1
    data['changes'] = CHANGES_URL
32 1
    return data
33
34
35 1
@blueprint.route("CHECK")
36
def handle_checks():
37
    """Return CHECK_OK for zero-downtime deployment.
38
39
    See: https://labnotes.org/zero-downtime-deploy-with-dokku
40
41
    """
42
    return "CHECK_OK"
43