
from flask import Flask, render_template, g
from flask.ext.appconfig import AppConfig


def create_app(configfile=None):
    app = Flask('massa')
    AppConfig(app, configfile)

    @app.route('/')
    def index():
        return render_template('index.html')

    from .container import build
    sl = build(app.config)

    from .api import bp
    app.register_blueprint(bp, url_prefix='/api')

    @app.before_request
    def globals():
        g.sl = sl

    return app


from flask import Flask, render_template, g
from flask.ext.appconfig import AppConfig
from .container import build
from .api import bp as api


def create_app(configfile=None):
    app = Flask('massa')
    AppConfig(app, configfile)

    @app.route('/')
    def index():
        return render_template('index.html')

    sl = build(app.config)

    app.register_blueprint(api, url_prefix='/api')

    @app.before_request
    def globals():
        g.sl = sl

    return app

Move import statements to the top.
Move import statements to the top.
  
  from flask import Flask, render_template, g
  from flask.ext.appconfig import AppConfig
+ from .container import build
+ from .api import bp as api
  
  
  def create_app(configfile=None):
      app = Flask('massa')
      AppConfig(app, configfile)
  
      @app.route('/')
      def index():
          return render_template('index.html')
  
-     from .container import build
      sl = build(app.config)
  
-     from .api import bp
-     app.register_blueprint(bp, url_prefix='/api')
+     app.register_blueprint(api, url_prefix='/api')
  
      @app.before_request
      def globals():
          g.sl = sl
  
      return app
  
Move import statements to the top.
## Code Before:

from flask import Flask, render_template, g
from flask.ext.appconfig import AppConfig


def create_app(configfile=None):
    app = Flask('massa')
    AppConfig(app, configfile)

    @app.route('/')
    def index():
        return render_template('index.html')

    from .container import build
    sl = build(app.config)

    from .api import bp
    app.register_blueprint(bp, url_prefix='/api')

    @app.before_request
    def globals():
        g.sl = sl

    return app

## Instruction:
Move import statements to the top.
## Code After:

from flask import Flask, render_template, g
from flask.ext.appconfig import AppConfig
from .container import build
from .api import bp as api


def create_app(configfile=None):
    app = Flask('massa')
    AppConfig(app, configfile)

    @app.route('/')
    def index():
        return render_template('index.html')

    sl = build(app.config)

    app.register_blueprint(api, url_prefix='/api')

    @app.before_request
    def globals():
        g.sl = sl

    return app
