for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from flask_restful import Resource, reqparse
flask_restful
This can be caused by one of the following:
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
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.
__init__.py
from flask import url_for
flask
import cf_predict
class Catalogue(Resource):
__init__
def get(self):
"""Show a catalogue of available endpoints."""
return {
"predict_url": url_for("api.predict",
_external=True),
"model_version_url": url_for("api.model",
"api_version": cf_predict.__version__
}
class Model(Resource):
"""Get current model version."""
return {"Version": "1.0"}
def put(self):
"""Load a specific model version into memory from Redis.
Either specifiy the model version or 'latest'.
"""
parser = reqparse.RequestParser()
parser.add_argument("version", type=str, required=True)
args = parser.parse_args()
return args["version"]
class Predict(Resource):
"""Get prediction from model.
Input: Feature array
parser.add_argument("features", type=str, required=True)
return args
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.
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.