from os import listdir
from os.path import basename, dirname, join, splitext
import imp
import sys
def bfs10016():
  global bfs10015
  if (not bfs10015):
    if (sys.version_info[0] == 3):
      sys.meta_path.insert(0, bfs10014())

    bfs10015 = True


bfs10015 = False
def terminate():
  global bfs10015
  if bfs10015:
    bfs10017 = [bfs10021 for bfs10021 in sys.meta_path if isinstance(bfs10021, bfs10014) ]
    for bfs10020 in bfs10017:
      sys.meta_path.remove(bfs10020)

    bfs10015 = False


class bfs10014(object):
  def find_module(self, bfs10022, path=None):
    (bfs10023, bfs10024, bfs10026) = bfs10025(bfs10022, path)
    try:
      is_package = (bfs10026[2] == imp.PKG_DIRECTORY)
      if is_package:
        assert bfs10024
        bfs10024 = join(bfs10024, '__init__.py')

      if bfs10024:
        bfs10027 = (dirname(bfs10024) or '.')
        if ((basename(bfs10024) + '3') in listdir(bfs10027)):
          return Py3Loader(bfs10022, (bfs10024 + '3'), bfs10026)


    finally:
      if bfs10023:
        bfs10023.close()




def bfs10025(name, path=None):
  bfs10030 = list(name.split('.'))
  bfs10031 = bfs10030[(-1)]
  bfs10032 = bfs10030[:(-1)]
  bfs10033 = path
  for (i, bfs10035) in enumerate(bfs10032):
    bfs10034 = '.'.join(bfs10032[:(i + 1)])
    try:
      bfs10036 = sys.modules[bfs10034]
    except KeyError:
      bfs10040 = imp.find_module(bfs10035, bfs10033)
      bfs10036 = imp.load_module(bfs10034, *bfs10040)

    bfs10033 = bfs10036.__path__

  return imp.find_module(bfs10031, bfs10033)

if (sys.version_info < (3, 1)):
  class Py3Loader(object):
    def __init__(self, bfs10037, bfs10041, bfs10042):
      self.bfs10037 = bfs10037
      self.bfs10041 = bfs10041
      self.bfs10042 = bfs10042

    def load_module(self, bfs10037):
      if (bfs10037 != self.bfs10037):
        raise ImportError(('This loader cannot load module %s.' % bfs10037))

      bfs10043 = (self.bfs10042[1] or 'r')
      open_file = open(self.bfs10041, bfs10043)
      return imp.load_module(bfs10037, open_file, self.bfs10041, self.bfs10042)


else:
  try:
    from importlib.abc import SourceLoader
  except ImportError:
    from importlib.abc import PyLoader as SourceLoader

  class Py3Loader(SourceLoader):
    def __init__(self, bfs10037, bfs10041, bfs10042):
      super(Py3Loader, self).__init__()
      self.bfs10037 = bfs10037
      self.bfs10041 = bfs10041
      self.bfs10042 = bfs10042

    def get_data(self, file_path):
      return open(file_path, 'U').read()

    def get_filename(self, bfs10037):
      if (bfs10037 != self.bfs10037):
        raise ImportError(('This loader cannot load module %s.' % bfs10037))

      return self.bfs10041

    def source_path(self, bfs10045):
      try:
        return self.get_filename(bfs10045)
      except ImportError:
        return None


    def is_package(self, bfs10044):
      bfs10046 = basename(self.get_filename(bfs10044))
      return (splitext(bfs10046)[0] == '__init__')

    @classmethod
    def module_repr(bfs10047, bfs10051):
      try:
        bfs10050 = (' from %r' % bfs10051.__file__)
      except AttributeError:
        bfs10050 = ''

      return ('<module %r%s>' % (bfs10051.__name__, bfs10050))



