# Path: starterpyth/core.py
# def load_module(modulename):
#     parents = modulename.split('.')
#     path = sys.path
#     module = None
#     abs_module_name = ''
#     cwd = os.getcwd()
#     for module_name in parents:
#         (file_, pathname, description) = imp.find_module(module_name, path)
#         name_to_import = abs_module_name + module_name
#         if name_to_import in sys.modules:
#             module = sys.modules[name_to_import]
#         else:
#             module = imp.load_module(name_to_import, file_, pathname, description)
#         path = [os.path.dirname(module.__file__)]
#         abs_module_name += module_name + '.'
#     os.chdir(cwd)
#     return module
# 
# Path: starterpyth/translation.py
# def __find(domain, locale_module, localedir='locale', languages=None):
# def translation(domain, locale_module, localedir='locale', languages=None, class_=None, fallback=False):
# __TRANS = translation(parent_package, parent_package, fallback=True)


import codecs
import fnmatch
import logging
import os
import shutil
    import doctest
from setuptools import find_packages
from starterpyth.core import load_module
from distutils.core import Command
    from jinja2 import Environment, PackageLoader
from starterpyth.translation import gettext as _
            :param context: context
            :type context: :class:`dict`
            """
            dirname = os.path.dirname(path)
            if not os.path.isdir(dirname):
                os.makedirs(dirname)
            if not os.path.isfile(path) or self.overwrite:
                tpl_fd = codecs.open(path, 'w', encoding='utf-8')
                tpl_fd.write(template_.render(context))
                tpl_fd.close()
                logging.info('writing %s' % path)
        src_module_names = find_packages()
        if self.pre_rm and os.path.isdir(self.api_dir):
            logging.info('removing %s' % self.api_dir)
            shutil.rmtree(self.api_dir)
        module_names = []
        excluded_module_names = set([x.strip() for x in self.modules_to_exclude.split(',') if x.strip()])

        for module_name in src_module_names:
            module = load_module(module_name)
            logging.warning('Processing %s.' % module_name)
            if not any(fnmatch.fnmatch(module_name, x) for x in excluded_module_names):
                module_names.append(module_name)
            module_root = os.path.dirname(module.__file__)
            for filename in os.listdir(module_root):
                basename, sep, ext = filename.rpartition('.')
                if ext not in ('pyx', 'py', 'so') or filename == '__init__.py':
                    continue
                submodule_name = '%s.%s' % (module_name, basename)
                try:

# Path: starterpyth/core.py
# def load_module(modulename):
#     parents = modulename.split('.')
#     path = sys.path
#     module = None
#     abs_module_name = ''
#     cwd = os.getcwd()
#     for module_name in parents:
#         (file_, pathname, description) = imp.find_module(module_name, path)
#         name_to_import = abs_module_name + module_name
#         if name_to_import in sys.modules:
#             module = sys.modules[name_to_import]
#         else:
#             module = imp.load_module(name_to_import, file_, pathname, description)
#         path = [os.path.dirname(module.__file__)]
#         abs_module_name += module_name + '.'
#     os.chdir(cwd)
#     return module
# 
# Path: starterpyth/translation.py
# def __find(domain, locale_module, localedir='locale', languages=None):
# def translation(domain, locale_module, localedir='locale', languages=None, class_=None, fallback=False):
# __TRANS = translation(parent_package, parent_package, fallback=True)


# Path: starterpyth/commands/gen_doc_api.py
import codecs
import fnmatch
import logging
import os
import shutil
    import doctest
from setuptools import find_packages
from starterpyth.core import load_module
from distutils.core import Command
    from jinja2 import Environment, PackageLoader
from starterpyth.translation import gettext as _

            :param context: context
            :type context: :class:`dict`
            """
            dirname = os.path.dirname(path)
            if not os.path.isdir(dirname):
                os.makedirs(dirname)
            if not os.path.isfile(path) or self.overwrite:
                tpl_fd = codecs.open(path, 'w', encoding='utf-8')
                tpl_fd.write(template_.render(context))
                tpl_fd.close()
                logging.info('writing %s' % path)
        src_module_names = find_packages()
        if self.pre_rm and os.path.isdir(self.api_dir):
            logging.info('removing %s' % self.api_dir)
            shutil.rmtree(self.api_dir)
        module_names = []
        excluded_module_names = set([x.strip() for x in self.modules_to_exclude.split(',') if x.strip()])

        for module_name in src_module_names:
            module = load_module(module_name)
            logging.warning('Processing %s.' % module_name)
            if not any(fnmatch.fnmatch(module_name, x) for x in excluded_module_names):
                module_names.append(module_name)
            module_root = os.path.dirname(module.__file__)
            for filename in os.listdir(module_root):
                basename, sep, ext = filename.rpartition('.')
                if ext not in ('pyx', 'py', 'so') or filename == '__init__.py':
                    continue
                submodule_name = '%s.%s' % (module_name, basename)
                try:

                    load_module(submodule_name)