From 3ddccd22eb17bd3a8e329a14c28127aa841b0e42 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 | 14 +++++++------- test_db_model.py | 2 +- test_unit.py | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/api/host.py b/api/host.py index 5c6bbda610..0426543219 100644 --- a/api/host.py +++ b/api/host.py @@ -177,7 +177,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( @@ -283,7 +283,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 802e07f9f1..e787dd4cb2 100755 --- a/test_api.py +++ b/test_api.py @@ -302,7 +302,7 @@ def test_create_host_update_with_same_insights_id_and_different_canonical_facts( # Change the canonical facts except for the insights_id host_data.rhel_machine_id = generate_uuid() - host_data.ip_addresses = ["192.168.1.44", "10.0.0.2", ] + host_data.ip_addresses = ["192.168.1.44", "10.0.0.2" ] host_data.subscription_manager_id = generate_uuid() host_data.satellite_id = generate_uuid() host_data.bios_uuid = generate_uuid() @@ -876,7 +876,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", @@ -906,7 +906,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"], @@ -987,7 +987,7 @@ def test_create_host_without_system_profile_then_update_with_system_profile(self mq_message = { "id": original_id, "request_id": None, - "system_profile": system_profile + "system_profile": system_profile, } with self.app.app_context(): msg_handler(mq_message) @@ -1025,7 +1025,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): @@ -1623,7 +1623,7 @@ def _added_hosts_by_display_name_asc(self): self.added_hosts[0], self.added_hosts[1], - self.added_hosts[2] + self.added_hosts[2], ) def _added_hosts_by_display_name_desc(self): @@ -1633,7 +1633,7 @@ def _added_hosts_by_display_name_desc(self): # 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_db_model.py b/test_db_model.py index 5f75901c44..2db4d86de4 100644 --- a/test_db_model.py +++ b/test_db_model.py @@ -24,7 +24,7 @@ def test_create_host_with_canonical_facts_as_None(flask_app_fixture): # Test to make sure canonical facts that are None or '' do # not get inserted into the db invalid_canonical_facts = {"fqdn": None, - "insights_id": '', } + "insights_id": '' } valid_canonical_facts = {"bios_uuid": "1234"} host_dict = {**invalid_canonical_facts, **valid_canonical_facts} diff --git a/test_unit.py b/test_unit.py index d2c567c8f4..9f8af2bac3 100755 --- a/test_unit.py +++ b/test_unit.py @@ -74,7 +74,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): @@ -286,7 +286,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()