From 5e79a0f2e1ac40f00ea697db87be912808ab6a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Tomsa?= Date: Fri, 19 Jul 2019 15:23:50 +0200 Subject: [PATCH] Fix trailing commas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added trailing commas to the last item of multiline collections, if the ending parenthesis is not of the same line. Removed the comma if the parenthesis is there. This follows Black’s standard on where to put it. Neither moved the parentheses/brackets in any way, nor changed the line count of the expressions. --- api/host.py | 4 ++-- test_api.py | 10 +++++----- test_unit.py | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api/host.py b/api/host.py index 4e5b720f8..b2717a5a6 100644 --- a/api/host.py +++ b/api/host.py @@ -170,7 +170,7 @@ def get_host_list( page=1, per_page=100, order_by=None, - order_how=None + order_how=None, ): if fqdn: query = find_hosts_by_canonical_facts(current_identity.account_number, {"fqdn": fqdn}) @@ -259,7 +259,7 @@ def find_hosts_by_canonical_facts(account_number, canonical_facts): def find_hosts_by_hostname_or_id(account_number, hostname): logger.debug("find_hosts_by_hostname_or_id(%s)", hostname) filter_list = [Host.display_name.comparator.contains(hostname), - Host.canonical_facts["fqdn"].astext.contains(hostname), ] + Host.canonical_facts["fqdn"].astext.contains(hostname) ] try: uuid.UUID(hostname) diff --git a/test_api.py b/test_api.py index 915d26e7a..488f97644 100755 --- a/test_api.py +++ b/test_api.py @@ -802,7 +802,7 @@ def _valid_system_profile(self): "mtu": 1500, "mac_address": "aa:bb:cc:dd:ee:ff", "type": "loopback", - "name": "eth0", }], + "name": "eth0" }], "disk_devices": [{"device": "/dev/sdb1", "label": "home drive", "options": {"uid": "0", @@ -832,7 +832,7 @@ def _valid_system_profile(self): "status": "UP"}, {"name": "jbws", "id": "321", - "status": "DOWN"}, ], + "status": "DOWN"} ], "insights_client_version": "12.0.12", "insights_egg_version": "120.0.1", "installed_packages": ["rpm1", "rpm2"], @@ -939,7 +939,7 @@ def test_create_host_with_system_profile_with_invalid_data(self): # List of tuples (system profile change, expected system profile) system_profiles = [{"infrastructure_type": "i"*101, "infrastructure_vendor": "i"*101, - "cloud_provider": "i"*101, }] + "cloud_provider": "i"*101 }] for system_profile in system_profiles: with self.subTest(system_profile=system_profile): @@ -1501,7 +1501,7 @@ def _added_hosts_by_display_name_asc(self): self.added_hosts[3], self.added_hosts[0], self.added_hosts[1], - self.added_hosts[2] + self.added_hosts[2], ) def _added_hosts_by_display_name_desc(self): @@ -1510,7 +1510,7 @@ def _added_hosts_by_display_name_desc(self): self.added_hosts[1], # Hosts with same display_name are ordered by updated descending self.added_hosts[3], - self.added_hosts[0] + self.added_hosts[0], ) def _assert_host_ids_in_response(self, response, expected_hosts): diff --git a/test_unit.py b/test_unit.py index 761deecf9..a607884c6 100755 --- a/test_unit.py +++ b/test_unit.py @@ -78,7 +78,7 @@ def test_valid(self): identity_data_dicts = [identity_data, # Test with extra data in the identity dict - {**identity_data, **{"extra_data": "value"}}, ] + {**identity_data, **{"extra_data": "value"}} ] for identity_data in identity_data_dicts: with self.subTest(identity_data=identity_data): @@ -287,7 +287,7 @@ def test_order_by_updated_desc(self, modified_on, order_how): @patch("api.host.Host.display_name") def test_default_for_display_name_is_asc(self, display_name, modified_on, order_how): - actual = _params_to_order_by("display_name",) + actual = _params_to_order_by("display_name") expected = (display_name.asc.return_value, modified_on.desc.return_value) self.assertEqual(actual, expected) order_how.assert_not_called()