How to use the singledispatch._c3_mro function in singledispatch

To help you get started, we’ve selected a few singledispatch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ambv / singledispatch / View on Github external
def test_c3_abc(self):
        c = collections
        mro = functools._c3_mro
        class A(object):
        class B(A):
            def __len__(self):
                return 0   # implies Sized
        class C(object):
        class D(object):
            pass   # unrelated
        class X(D, C, B):
            def __call__(self):
                pass   # implies Callable
        expected = [X, c.Callable, D, C, c.Container, B, c.Sized, A, object]
        for abcs in permutations([c.Sized, c.Callable, c.Container]):
            self.assertEqual(mro(X, abcs=abcs), expected)


Backport functools.singledispatch to older Pythons.

Latest version published 8 months ago

Package Health Score

75 / 100
Full package analysis