Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(3)  |  Derive(0)  |  Import(4)

        def get_metaclass_objects(import_namespace, base_class, sort_key=None):
    import_basedir = import_namespace.replace('.', os.sep)
    import_dir = os.path.join(import_root, import_basedir)
    imported = []
    for class_file in os.listdir(import_dir):
        name, ext = os.path.splitext(class_file)
        if ext not in ['.py', '.pyc', '.pyo']:
            continue
        if name in ['__init__']:
            continue
        if name not in imported:
            import_module('%s.%s' % (import_namespace, name))
            imported.append(name)
    rv = [klass() for klass in base_class.__subclasses__()]
    rv.sort(key=sort_key)
    return rv
        


src/p/y/pyoembed-0.1/pyoembed/parsers/__init__.py   pyoembed(Download)
from abc import ABCMeta, abstractmethod, abstractproperty
 
from pyoembed.utils import get_metaclass_objects
 
 
def get_parser(content_type):
    parsers = get_metaclass_objects(__name__, BaseParser, lambda x: x.priority)
    for parser in parsers:
        if parser.content_supported(content_type):
            return parser

src/p/y/pyoembed-0.1/pyoembed/providers/__init__.py   pyoembed(Download)
from urlparse import parse_qsl, urlsplit, urlunsplit
 
from pyoembed.utils import get_metaclass_objects
 
 
def get_provider(url):
    providers = get_metaclass_objects(__name__, BaseProvider,
                                      lambda x: x.priority)
    for provider in providers:
        if provider.url_supported(url):

src/p/y/pyoembed-0.1/pyoembed/data_types/__init__.py   pyoembed(Download)
from abc import ABCMeta, abstractproperty
 
from pyoembed.exceptions import DataTypeException
from pyoembed.utils import get_metaclass_objects
 
def get_data_type(data):
    data_types = get_metaclass_objects(__name__, BaseDataType,
                                       lambda x: x.priority)
    for data_type in data_types:
        if data_type.type_supported(data):

src/p/y/pyoembed-0.1/pyoembed/tests/test_utils.py   pyoembed(Download)
import mock
import unittest
 
from pyoembed.utils import get_metaclass_objects