# Path: bibliopixel/project/importer.py
# def import_module(typename, python_path=None):
#     return _import(typename, python_path, loader=load.module)
# 
# def import_symbol(typename, python_path=None):
#     return _import(typename, python_path)
# 
# def make_object(*args, typename=None, python_path=None, datatype=None, **kwds):
#     """Make an object from a symbol."""
#     datatype = datatype or import_symbol(typename, python_path)
#     field_types = getattr(datatype, 'FIELD_TYPES', fields.FIELD_TYPES)
#     return datatype(*args, **fields.component(kwds, field_types))
# 
# Path: bibliopixel/project/importer.py
# MINIMUM_VERSIONS = {'serial': '2.7'}
# INSTALL_NAMES = {
#     'BiblioPixelAnimations': 'BiblioPixelAnimations',
#     'flask': 'flask',
#     'noise': 'noise',
#     'serial': 'pyserial',
# }
# VERSION_MESSAGE = """
# You have version %s of module '%s' but you need version %s.
# 
# Please upgrade at the command line with:
# 
#     $ pip install %s --upgrade
# """
# MISSING_MESSAGE = """
# You are missing module '%s'.
# 
# Please install it at the command line with:
# 
#     $ pip install %s
# """
# SERIAL_IS_INSTALLED_NOT_PYSERIAL_MESSAGE = """
# You have the module `serial` installed, but you need the package `pyserial`
# instead.  Sorry, it's not our fault that there are two packages whose names are
# so close!
# 
# To uninstall that module and install the correct one from the command line:
# 
#     $ pip uninstall -y serial
#     $ pip install pyserial
# """
# def _validate_typename(typename):
# def _import(typename, python_path=None, loader=load.code):
# def import_symbol(typename, python_path=None):
# def import_module(typename, python_path=None):
# def make_object(*args, typename=None, python_path=None, datatype=None, **kwds):


import unittest
        import datetime
from bibliopixel.project.importer import (
    import_module, import_symbol, make_object)
from bibliopixel.project import importer
from test.bibliopixel import patch
            import_symbol('math12.log')

        with self.assertRaises(ImportError):
            import_symbol('math.log12')

        with self.assertRaises(ImportError):
            import_symbol('bibliopixel.log12')

    def test_longer(self):
        self.assertEqual(
            import_module('bibliopixel.project.importer'), importer)
        self.assertEqual(
            import_symbol('bibliopixel.project.importer.import_symbol'),
            import_symbol)

    def test_make_object(self):
        td = make_object(5, 23, typename='datetime.timedelta', milliseconds=35)
        self.assertEqual(td, datetime.timedelta(5, 23, milliseconds=35))

    def test_aliasing(self):
        import_symbol('bibliopixel.drivers.SimPixel.SimPixel')

    def test_exception_unknown(self):
        with self.assertRaises(ImportError) as cm:
            import_symbol('nonexistent')
        e = str(cm.exception)
        self.assertFalse('pip install' in e)
        self.assertEqual("Cannot import symbol 'nonexistent'", e)

    def test_exception_known(self):

# Path: bibliopixel/project/importer.py
# def import_module(typename, python_path=None):
#     return _import(typename, python_path, loader=load.module)
# 
# def import_symbol(typename, python_path=None):
#     return _import(typename, python_path)
# 
# def make_object(*args, typename=None, python_path=None, datatype=None, **kwds):
#     """Make an object from a symbol."""
#     datatype = datatype or import_symbol(typename, python_path)
#     field_types = getattr(datatype, 'FIELD_TYPES', fields.FIELD_TYPES)
#     return datatype(*args, **fields.component(kwds, field_types))
# 
# Path: bibliopixel/project/importer.py
# MINIMUM_VERSIONS = {'serial': '2.7'}
# INSTALL_NAMES = {
#     'BiblioPixelAnimations': 'BiblioPixelAnimations',
#     'flask': 'flask',
#     'noise': 'noise',
#     'serial': 'pyserial',
# }
# VERSION_MESSAGE = """
# You have version %s of module '%s' but you need version %s.
# 
# Please upgrade at the command line with:
# 
#     $ pip install %s --upgrade
# """
# MISSING_MESSAGE = """
# You are missing module '%s'.
# 
# Please install it at the command line with:
# 
#     $ pip install %s
# """
# SERIAL_IS_INSTALLED_NOT_PYSERIAL_MESSAGE = """
# You have the module `serial` installed, but you need the package `pyserial`
# instead.  Sorry, it's not our fault that there are two packages whose names are
# so close!
# 
# To uninstall that module and install the correct one from the command line:
# 
#     $ pip uninstall -y serial
#     $ pip install pyserial
# """
# def _validate_typename(typename):
# def _import(typename, python_path=None, loader=load.code):
# def import_symbol(typename, python_path=None):
# def import_module(typename, python_path=None):
# def make_object(*args, typename=None, python_path=None, datatype=None, **kwds):


# Path: test/bibliopixel/project/importer_test.py
import unittest
        import datetime
from bibliopixel.project.importer import (
    import_module, import_symbol, make_object)
from bibliopixel.project import importer
from test.bibliopixel import patch

            import_symbol('math12.log')

        with self.assertRaises(ImportError):
            import_symbol('math.log12')

        with self.assertRaises(ImportError):
            import_symbol('bibliopixel.log12')

    def test_longer(self):
        self.assertEqual(
            import_module('bibliopixel.project.importer'), importer)
        self.assertEqual(
            import_symbol('bibliopixel.project.importer.import_symbol'),
            import_symbol)

    def test_make_object(self):
        td = make_object(5, 23, typename='datetime.timedelta', milliseconds=35)
        self.assertEqual(td, datetime.timedelta(5, 23, milliseconds=35))

    def test_aliasing(self):
        import_symbol('bibliopixel.drivers.SimPixel.SimPixel')

    def test_exception_unknown(self):
        with self.assertRaises(ImportError) as cm:
            import_symbol('nonexistent')
        e = str(cm.exception)
        self.assertFalse('pip install' in e)
        self.assertEqual("Cannot import symbol 'nonexistent'", e)

    def test_exception_known(self):

        names = dict(importer.INSTALL_NAMES, nonexistent='pynone')