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

All Samples(0)  |  Call(0)  |  Derive(0)  |  Import(0)

        def behave_as(*bases):
    substitute_bases = _load_bases(bases)

    class Liskov(type):
        constraints = tuple()
        def __new__(cls, name, bases, attrs):
            new_bases = _remove_bases_behaviours(substitute_bases, cls.constraints)
            return type.__new__(cls, name, new_bases + bases, attrs)

        @classmethod
        def except_for(cls, *behaviours):
            cls.constraints = behaviours
            return cls

    return Liskov