コード例 #1
0
ファイル: api.py プロジェクト: shefalig/Gutenberg
    def __find_implementations():
        """Returns all the concrete subclasses of MetadataExtractor.

        """
        implementations = {}
        for implementation in all_subclasses(MetadataExtractor):
            try:
                implementations[implementation.feature_name()] = implementation
            except NotImplementedError:
                pass
        return implementations
コード例 #2
0
ファイル: api.py プロジェクト: bag-of-projects/Gutenberg
    def __find_implementations():
        """Returns all the concrete subclasses of MetadataExtractor.

        """
        implementations = {}
        for implementation in all_subclasses(MetadataExtractor):
            try:
                implementations[implementation.feature_name()] = implementation
            except NotImplementedError:
                pass
        return implementations
コード例 #3
0
ファイル: test_util.py プロジェクト: shefalig/Gutenberg
    def test_all_subclasses(self):
        class Root(object):
            pass

        class AB(Root):
            pass

        class ABC(AB):
            pass

        class AD(Root):
            pass

        class ABAD(AB, AD):
            pass

        class ABADE(ABAD):
            pass

        self.assertTrue(all_subclasses(Root), set([AB, ABC, AD, ABAD, ABADE]))
        self.assertEqual(all_subclasses(ABADE), set())
コード例 #4
0
    def test_all_subclasses(self):
        class Root(object):
            pass

        class AB(Root):
            pass

        class ABC(AB):
            pass

        class AD(Root):
            pass

        class ABAD(AB, AD):
            pass

        class ABADE(ABAD):
            pass

        self.assertTrue(all_subclasses(Root), set([AB, ABC, AD, ABAD, ABADE]))
        self.assertTrue(all_subclasses(ABADE) == set())
コード例 #5
0
ファイル: test_util.py プロジェクト: ChillarAnand/Gutenberg
    def test_all_subclasses(self):
        class Root(object):
            pass

        class AB(Root):
            pass

        class ABC(AB):
            pass

        class AD(Root):
            pass

        class ABAD(AB, AD):
            pass

        class ABADE(ABAD):
            pass

        self.assertItemsEqual(all_subclasses(Root), [AB, ABC, AD, ABAD, ABADE])
        self.assertSetEqual(all_subclasses(ABADE), set())
コード例 #6
0
ファイル: api.py プロジェクト: Python3pkg/gutenberg
    def _implementations(cls):
        """Returns all the concrete subclasses of MetadataExtractor.

        """
        if cls.__implementations:
            return cls.__implementations

        cls.__implementations = {}
        for implementation in all_subclasses(MetadataExtractor):
            try:
                feature_name = implementation.feature_name()
                cls.__implementations[feature_name] = implementation
            except NotImplementedError:
                pass
        return cls.__implementations
コード例 #7
0
ファイル: api.py プロジェクト: c-w/Gutenberg
    def _implementations(cls):
        """Returns all the concrete subclasses of MetadataExtractor.

        """
        if cls.__implementations:
            return cls.__implementations

        cls.__implementations = {}
        for implementation in all_subclasses(MetadataExtractor):
            try:
                feature_name = implementation.feature_name()
                cls.__implementations[feature_name] = implementation
            except NotImplementedError:
                pass
        return cls.__implementations