<s> from functools import wraps <EOL> from flask import jsonify <EOL> from . . helpers import JSONEncoder <EOL> from . . import factory <EOL> def create_app ( settings_override = None ) : <EOL> """<STR_LIT>""" <EOL> app = factory . create_app ( __name__ , __path__ , settings_override ) <EOL> app . json_encoder = JSONEncoder <EOL> app . errorhandler ( <NUM_LIT> ) ( on_404 ) <EOL> return app <EOL> def route ( bp , * args , ** kwargs ) : <EOL> kwargs . setdefault ( '<STR_LIT>' , False ) <EOL> def decorator ( f ) : <EOL> @ bp . route ( * args , ** kwargs ) <EOL> @ wraps ( f ) <EOL> def wrapper ( * args , ** kwargs ) : <EOL> sc = <NUM_LIT:200> <EOL> rv = f ( * args , ** kwargs ) <EOL> if isinstance ( rv , tuple ) : <EOL> sc = rv [ <NUM_LIT:1> ] <EOL> rv = rv [ <NUM_LIT:0> ] <EOL> return jsonify ( dict ( data = rv ) ) , sc <EOL> return f <EOL> return decorator <EOL> def on_404 ( e ) : <EOL> return jsonify ( dict ( error = '<STR_LIT>' ) ) , <NUM_LIT> </s>
