(self, pretty_printers, name_re, subname_re)
Print a list of pretty-printers.
Print a list of pretty-printers.
Print a list of pretty - printers .
def list_pretty_printers(self, pretty_printers, name_re, subname_re):
        """Print a list of pretty-printers."""
        # A potential enhancement is to provide an option to list printers in
        # "lookup order" (i.e. unsorted).
        sorted_pretty_printers = sorted (copy.copy(pretty_printers),
                                         key = self.printer_name)
        for printer in sorted_pretty_printers:
            name = self.printer_name(printer)
            enabled = self.enabled_string(printer)
            if name_re.match(name):
                print ("  %s%s" % (name, enabled))
                if (hasattr(printer, "subprinters") and
                    printer.subprinters is not None):
                    sorted_subprinters = sorted (copy.copy(printer.subprinters),
                                                 key = self.printer_name)
                    for subprinter in sorted_subprinters:
                        if (not subname_re or
                            subname_re.match(subprinter.name)):
                            print ("    %s%s" %
                                   (subprinter.name,
                                    self.enabled_string(subprinter)))
def list_pretty_printers ( self , pretty_printers , name_re , subname_re ) : # A potential enhancement is to provide an option to list printers in # "lookup order" (i.e. unsorted). sorted_pretty_printers = sorted ( copy . copy ( pretty_printers ) , key = self . printer_name ) for printer in sorted_pretty_printers : name = self . printer_name ( printer ) enabled = self . enabled_string ( printer ) if name_re . match ( name ) : print ( "  %s%s" % ( name , enabled ) ) if ( hasattr ( printer , "subprinters" ) and printer . subprinters is not None ) : sorted_subprinters = sorted ( copy . copy ( printer . subprinters ) , key = self . printer_name ) for subprinter in sorted_subprinters : if ( not subname_re or subname_re . match ( subprinter . name ) ) : print ( "    %s%s" % ( subprinter . name , self . enabled_string ( subprinter ) ) )