<s> """<STR_LIT>""" <EOL> import os <EOL> COV = None <EOL> if os . environ . get ( '<STR_LIT>' ) : <EOL> import coverage <EOL> COV = coverage . coverage ( branch = True , include = '<STR_LIT>' ) <EOL> COV . start ( ) <EOL> """<STR_LIT>""" <EOL> from app import create_app , db <EOL> from app . models import User , Role , Permission , Post , Comment <EOL> from flask . ext . script import Manager , Shell <EOL> from flask . ext . migrate import Migrate , MigrateCommand <EOL> app = create_app ( os . getenv ( '<STR_LIT>' ) or '<STR_LIT:default>' ) <EOL> manager = Manager ( app ) <EOL> migrate = Migrate ( app , db ) <EOL> def make_shell_context ( ) : <EOL> return dict ( app = app , db = db , User = User , Role = Role , Permission = Permission , <EOL> Post = Post , Comment = Comment ) <EOL> manager . add_command ( "<STR_LIT>" , Shell ( make_context = make_shell_context ) ) <EOL> manager . add_command ( '<STR_LIT>' , MigrateCommand ) <EOL> @ manager . command <EOL> def test ( coverage = False ) : <EOL> if coverage and not os . environ . get ( '<STR_LIT>' ) : <EOL> import sys <EOL> os . environ [ '<STR_LIT>' ] = '<STR_LIT:1>' <EOL> os . execvp ( sys . executable , [ sys . executable ] + sys . argv ) <EOL> """<STR_LIT>""" <EOL> import unittest <EOL> tests = unittest . TestLoader ( ) . discover ( '<STR_LIT>' ) <EOL> unittest . TextTestRunner ( verbosity = <NUM_LIT:2> ) . run ( tests ) <EOL> if COV : <EOL> COV . stop ( ) <EOL> COV . save ( ) <EOL> print ( '<STR_LIT>' ) <EOL> COV . report ( ) <EOL> basedir = os . path . abspath ( os . path . dirname ( __file__ ) ) <EOL> covdir = os . path . join ( basedir , '<STR_LIT>' ) <EOL> COV . html_report ( directory = covdir ) <EOL> print ( '<STR_LIT>' % covdir ) <EOL> COV . erase ( ) <EOL> @ manager . command <EOL> def profile ( length = <NUM_LIT> , profile_dir = None ) : <EOL> """<STR_LIT>""" <EOL> from werkzeug . contrib . profiler import ProfilerMiddleware <EOL> app . wsgi_app = ProfilerMiddleware ( app . wsgi_app , restrictions = [ length ] , <EOL> profile_dir = profile_dir ) <EOL> app . run ( ) <EOL> @ manager . command <EOL> def deploy ( ) : <EOL> """<STR_LIT>""" <EOL> from flask . ext . migrate import upgrade <EOL> from app . models import Role , User <EOL> upgrade ( ) <EOL> Role . insert_roles ( ) <EOL> User . add_self_follows ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> manager . run ( ) </s>
