/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2014-07-25 23:00:45 UTC
  • mto: This revision was merged to the branch mainline in revision 724.
  • Revision ID: teddy@recompile.se-20140725230045-94y6ghmwqkb00ffw
Use dictionary comprehensions.

* mandos (Client.start_checker): Use a dictionary comprehension when
                                 creating the "escaped_attrs" mapping.
* mandos-ctl (print_clients): Use a dictionary comprehension when
                              creating keyword arguments to the
                              .format string method.
  (main): Use a dictionary comprehension when creating the "clients"
          mapping.

Show diffs side-by-side

added added

removed removed

Lines of Context:
536
536
            server_settings = {}
537
537
        self.server_settings = server_settings
538
538
        # adding all client settings
539
 
        for setting, value in settings.items():
 
539
        for setting, value in settings.iteritems():
540
540
            setattr(self, setting, value)
541
541
        
542
542
        if self.enabled:
1009
1009
                                              (prop,
1010
1010
                                               "_dbus_annotations",
1011
1011
                                               {}))
1012
 
                        for name, value in annots.items():
 
1012
                        for name, value in annots.iteritems():
1013
1013
                            ann_tag = document.createElement(
1014
1014
                                "annotation")
1015
1015
                            ann_tag.setAttribute("name", name)
1018
1018
                # Add interface annotation tags
1019
1019
                for annotation, value in dict(
1020
1020
                    itertools.chain.from_iterable(
1021
 
                        annotations().items()
 
1021
                        annotations().iteritems()
1022
1022
                        for name, annotations in
1023
1023
                        self._get_all_dbus_things("interface")
1024
1024
                        if name == if_tag.getAttribute("name")
1025
 
                        )).items():
 
1025
                        )).iteritems():
1026
1026
                    ann_tag = document.createElement("annotation")
1027
1027
                    ann_tag.setAttribute("name", annotation)
1028
1028
                    ann_tag.setAttribute("value", value)
1084
1084
    """
1085
1085
    def wrapper(cls):
1086
1086
        for orig_interface_name, alt_interface_name in (
1087
 
            alt_interface_names.items()):
 
1087
            alt_interface_names.iteritems()):
1088
1088
            attr = {}
1089
1089
            interface_names = set()
1090
1090
            # Go though all attributes of the class
2594
2594
                           "EOFError:", exc_info=e)
2595
2595
    
2596
2596
    with PGPEngine() as pgp:
2597
 
        for client_name, client in clients_data.items():
 
2597
        for client_name, client in clients_data.iteritems():
2598
2598
            # Skip removed clients
2599
2599
            if client_name not in client_settings:
2600
2600
                continue
2664
2664
        clients_data[client_name] = client_settings[client_name]
2665
2665
    
2666
2666
    # Create all client objects
2667
 
    for client_name, client in clients_data.items():
 
2667
    for client_name, client in clients_data.iteritems():
2668
2668
        tcp_server.clients[client_name] = client_class(
2669
2669
            name = client_name, settings = client,
2670
2670
            server_settings = server_settings)