<s> from . core import ( <EOL> abort , override_template , Pecan , Request , Response , load_app , <EOL> redirect , render , request , response <EOL> ) <EOL> from . decorators import expose <EOL> from . hooks import RequestViewerHook <EOL> from . middleware . debug import DebugMiddleware <EOL> from . middleware . errordocument import ErrorDocumentMiddleware <EOL> from . middleware . recursive import RecursiveMiddleware <EOL> from . middleware . static import StaticFileMiddleware <EOL> from . routing import route <EOL> from . configuration import set_config , Config <EOL> from . configuration import _runtime_conf as conf <EOL> from . import middleware <EOL> try : <EOL> from logging . config import dictConfig as load_logging_config <EOL> except ImportError : <EOL> from logutils . dictconfig import dictConfig as load_logging_config <EOL> import warnings <EOL> __all__ = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> ] <EOL> def make_app ( root , ** kw ) : <EOL> '''<STR_LIT>''' <EOL> logging = kw . get ( '<STR_LIT>' , { } ) <EOL> debug = kw . get ( '<STR_LIT>' , False ) <EOL> if logging : <EOL> if debug : <EOL> try : <EOL> from logging import captureWarnings <EOL> captureWarnings ( True ) <EOL> warnings . simplefilter ( "<STR_LIT:default>" , DeprecationWarning ) <EOL> except ImportError : <EOL> pass <EOL> if isinstance ( logging , Config ) : <EOL> logging = logging . to_dict ( ) <EOL> if '<STR_LIT:version>' not in logging : <EOL> logging [ '<STR_LIT:version>' ] = <NUM_LIT:1> <EOL> load_logging_config ( logging ) <EOL> app = Pecan ( root , ** kw ) <EOL> wrap_app = kw . get ( '<STR_LIT>' , None ) <EOL> if wrap_app : <EOL> app = wrap_app ( app ) <EOL> errors = kw . get ( '<STR_LIT>' , getattr ( conf . app , '<STR_LIT>' , { } ) ) <EOL> if errors : <EOL> app = middleware . errordocument . ErrorDocumentMiddleware ( app , errors ) <EOL> app = middleware . recursive . RecursiveMiddleware ( app ) <EOL> static_root = kw . get ( '<STR_LIT>' , None ) <EOL> if debug : <EOL> debug_kwargs = getattr ( conf , '<STR_LIT>' , { } ) <EOL> debug_kwargs . setdefault ( '<STR_LIT>' , [ ] ) . append ( <EOL> lambda environ : { <EOL> '<STR_LIT>' : environ . get ( '<STR_LIT>' , { } ) . get ( '<STR_LIT>' ) <EOL> } <EOL> ) <EOL> app = DebugMiddleware ( <EOL> app , <EOL> ** debug_kwargs <EOL> ) <EOL> if static_root : <EOL> app = middleware . static . StaticFileMiddleware ( app , static_root ) <EOL> elif static_root : <EOL> warnings . warn ( <EOL> "<STR_LIT>" , <EOL> RuntimeWarning <EOL> ) <EOL> if hasattr ( conf , '<STR_LIT>' ) : <EOL> warnings . warn ( '<STR_LIT>' . join ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) , <EOL> DeprecationWarning <EOL> ) <EOL> return app </s>
