Skip to content
Snippets Groups Projects
nopaque.py 1.02 KiB
Newer Older
  • Learn to ignore specific revisions
  • # First things first: apply monkey patch, so that no code gets executed without
    # patched libraries!
    
    Stephan Porada's avatar
    Stephan Porada committed
    import eventlet
    
    from app.models import (
        Corpus,
        CorpusFile,
        Job,
        JobInput,
        JobResult,
        Permission,
        Role,
        TesseractOCRModel,
        User
    )  # noqa
    
    from flask import Flask  # noqa
    from typing import Any, Dict  # noqa
    
    app: Flask = create_app()
    
    @app.context_processor
    def make_context() -> Dict[str, Any]:
        ''' Adds variables to the template context. '''
        return {'Permission': Permission}
    
    
    
    def make_shell_context() -> Dict[str, Any]:
        ''' Adds variables to the shell context. '''
        return {
            'Corpus': Corpus,
            'CorpusFile': CorpusFile,
            'db': db,
            'Job': Job,
            'JobInput': JobInput,
            'JobResult': JobResult,
            'Permission': Permission,
            'Role': Role,