Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
fix: style update
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Sikora committed Jan 28, 2020
1 parent 7edd6c5 commit de0fe80
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion license_sh/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ def get_npm_license_from_licenses_array(licenses_array):

license_name = UNKNOWN
for license_item in licenses_array:
license_item_type = license_item.get("type", UNKNOWN) if type(license_item) is dict else f"{license_item}"
license_item_type = (
license_item.get("type", UNKNOWN)
if type(license_item) is dict
else f"{license_item}"
)
if license_name != UNKNOWN:
license_name = f"{license_name} AND {license_item_type}"
else:
Expand Down
2 changes: 1 addition & 1 deletion license_sh/runners/runners_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def fetch_concurrent(urls):
try:
output, version = await result
page = json.loads(output)
if ('name') in page:
if ("name") in page:
license_map[f"{page['name']}@{version}"] = extract_npm_license(
page, version
)
Expand Down
4 changes: 2 additions & 2 deletions tests/runners/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def test_extract_npm_license_simple(self):
)
name = extract_npm_license(data, "Unknown")
self.assertEqual(name, "MIT")

def test_extract_npm_licenses_global_single_string(self):
data = json.loads(
"""{
Expand Down Expand Up @@ -425,7 +425,7 @@ def test_get_npm_license_from_licenses_empty(self):
)
name = get_npm_license_from_licenses_array(data.get("licenses"))
self.assertEqual(name, UNKNOWN)


if __name__ == "__main__":
unittest.main()

0 comments on commit de0fe80

Please sign in to comment.