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 committed Jul 19, 2019
1 parent 599bc48 commit 3ddccd2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions api/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test_db_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 3ddccd2

Please sign in to comment.