Auto-generated patch by python-black
[integration/test.git] / tools / distchanges / distcompare.py
index a89e9d7c6d9e94389072f1e218b74f8272f31055..ce6f951cfe3fd0e4991f516f5620bcb37e1aa7cd 100644 (file)
@@ -6,7 +6,6 @@ from changes import Changes
 
 
 class DistCompare(object):
-
     def __init__(self, remote_url):
 
         self.remote_url = remote_url
@@ -26,28 +25,75 @@ class DistCompare(object):
         return projects
         """
         # this hard coded list of projects was taken from Oxygen dependencies.log - late January 2018
-        return ['integration/distribution', 'mdsal', 'alto', 'sfc', 'bier', 'serviceutils',
-                'usc', 'ovsdb', 'lispflowmapping', 'groupbasedpolicy', 'snmp4sdn', 'aaa',
-                'honeycomb/vbd', 'openflowplugin', 'of-config', 'daexim', 'dluxapps', 'coe',
-                'packetcable', 'genius', 'yangtools', 'infrautils', 'netvirt', 'neutron',
-                'snmp', 'bgpcep', 'nemo', 'netconf', 'tsdr', 'sxp', 'jsonrpc', 'p4plugin',
-                'odlparent', 'l2switch', 'dlux', 'controller']
+        return [
+            "integration/distribution",
+            "mdsal",
+            "alto",
+            "sfc",
+            "bier",
+            "serviceutils",
+            "usc",
+            "ovsdb",
+            "lispflowmapping",
+            "groupbasedpolicy",
+            "snmp4sdn",
+            "aaa",
+            "honeycomb/vbd",
+            "openflowplugin",
+            "of-config",
+            "daexim",
+            "dluxapps",
+            "coe",
+            "packetcable",
+            "genius",
+            "yangtools",
+            "infrautils",
+            "netvirt",
+            "neutron",
+            "snmp",
+            "bgpcep",
+            "nemo",
+            "netconf",
+            "tsdr",
+            "sxp",
+            "jsonrpc",
+            "p4plugin",
+            "odlparent",
+            "l2switch",
+            "dlux",
+            "controller",
+        ]
 
     def run_cmd(self):
         query_limit = 100
         num_to_display = 50
-        branch = 'master'
+        branch = "master"
         project_names = self.get_project_names()
-        extracted_distro_locations = {'new': '/tmp/distro_new', 'old': '/tmp/distro_old'}
-
-        new_changes = Changes(branch, extracted_distro_locations['new'], num_to_display,
-                              query_limit, project_names, self.remote_url)
+        extracted_distro_locations = {
+            "new": "/tmp/distro_new",
+            "old": "/tmp/distro_old",
+        }
+
+        new_changes = Changes(
+            branch,
+            extracted_distro_locations["new"],
+            num_to_display,
+            query_limit,
+            project_names,
+            self.remote_url,
+        )
 
         new_projects = new_changes.run_cmd()
         new_changes.pretty_print_projects(new_projects)
 
-        old_changes = Changes(branch, extracted_distro_locations['old'], num_to_display,
-                              query_limit, project_names, self.remote_url)
+        old_changes = Changes(
+            branch,
+            extracted_distro_locations["old"],
+            num_to_display,
+            query_limit,
+            project_names,
+            self.remote_url,
+        )
 
         old_projects = old_changes.run_cmd()
         old_changes.pretty_print_projects(old_projects)
@@ -55,23 +101,34 @@ class DistCompare(object):
         patchset_diff = []
         print("\nPatch differences:\n------------------")
         for project_name, values in new_projects.items():
-            new_gerrits = values['includes']
+            new_gerrits = values["includes"]
             for gerrit in new_gerrits:
-                if gerrit not in old_projects[project_name]['includes']:
+                if gerrit not in old_projects[project_name]["includes"]:
                     patchset_diff.append(gerrit)
-                    print('{:<20}{}\t{}'.format(project_name, gerrit['url'], gerrit['subject']))
+                    print(
+                        "{:<20}{}\t{}".format(
+                            project_name, gerrit["url"], gerrit["subject"]
+                        )
+                    )
 
         print("\n%s different patches between the two distros." % len(patchset_diff))
 
 
 def main():
 
-    parser = argparse.ArgumentParser(description='Returns the list of patches found in the unzipped distribution at '
-                                                 '/tmp/distro_new that are not found in the distribution at '
-                                                 '/tmp/distro_old. This should result in a listing of what new changes '
-                                                 'were made between the two distributions.')
-    parser.add_argument("-r", "--remote", dest="remote_url", default=Changes.REMOTE_URL,
-                        help="git remote url to use for gerrit")
+    parser = argparse.ArgumentParser(
+        description="Returns the list of patches found in the unzipped distribution at "
+        "/tmp/distro_new that are not found in the distribution at "
+        "/tmp/distro_old. This should result in a listing of what new changes "
+        "were made between the two distributions."
+    )
+    parser.add_argument(
+        "-r",
+        "--remote",
+        dest="remote_url",
+        default=Changes.REMOTE_URL,
+        help="git remote url to use for gerrit",
+    )
     options = parser.parse_args()
 
     distc = DistCompare(options.remote_url)