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

All Samples(1)  |  Call(0)  |  Derive(0)  |  Import(1)
Adds a __repr__ method that returns a sensible representation based on
*attrs*.

        def repr_attrs(attrs):
    """
    Adds a __repr__ method that returns a sensible representation based on
    *attrs*.
    """
    def wrap(cl):
        def repr_(self):
            return "<{0}({1})>".format(
                self.__class__.__name__,
                ", ".join(a + "=" + repr(getattr(self, a)) for a in attrs)
            )

        cl.__repr__ = repr_
        return cl

    return wrap
        


src/s/e/service_identity-0.2/tests/test_attrs.py   service_identity(Download)
from __future__ import absolute_import, division, print_function
 
from OpenSSL.test.util import TestCase
 
from service_identity._attrs import eq_attrs, repr_attrs