Skip to content

Commit

Permalink
Fix trailing commas
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Glutexo authored and dehort committed Jul 29, 2019
1 parent 4a756ef commit fea3822
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions api/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit fea3822

Please sign in to comment.