
from sentry.conf import settings
from sentry.utils.imports import import_string
from threading import local


class State(local):
    request = None


def get_buffer(path, options):
    cls = import_string(path)
    return cls(**options)

buffer = get_buffer(settings.BUFFER, settings.BUFFER_OPTIONS)
env = State()


from sentry.conf import settings
from sentry.utils.imports import import_string
from threading import local


class State(local):
    request = None


def get_buffer(path, options):
    cls = import_string(path)
    if cls is None:
        raise ImportError('Unable to find module %s' % path)
    return cls(**options)

buffer = get_buffer(settings.BUFFER, settings.BUFFER_OPTIONS)
env = State()

Raise an import error when import_string fails on get_buffer
Raise an import error when import_string fails on get_buffer

  
  from sentry.conf import settings
  from sentry.utils.imports import import_string
  from threading import local
  
  
  class State(local):
      request = None
  
  
  def get_buffer(path, options):
      cls = import_string(path)
+     if cls is None:
+         raise ImportError('Unable to find module %s' % path)
      return cls(**options)
  
  buffer = get_buffer(settings.BUFFER, settings.BUFFER_OPTIONS)
  env = State()
  
Raise an import error when import_string fails on get_buffer
## Code Before:

from sentry.conf import settings
from sentry.utils.imports import import_string
from threading import local


class State(local):
    request = None


def get_buffer(path, options):
    cls = import_string(path)
    return cls(**options)

buffer = get_buffer(settings.BUFFER, settings.BUFFER_OPTIONS)
env = State()

## Instruction:
Raise an import error when import_string fails on get_buffer
## Code After:

from sentry.conf import settings
from sentry.utils.imports import import_string
from threading import local


class State(local):
    request = None


def get_buffer(path, options):
    cls = import_string(path)
    if cls is None:
        raise ImportError('Unable to find module %s' % path)
    return cls(**options)

buffer = get_buffer(settings.BUFFER, settings.BUFFER_OPTIONS)
env = State()
