Skip to content

Commit f90ab50

Browse files
committed
minor qol
1 parent aa3710d commit f90ab50

4 files changed

Lines changed: 12 additions & 11 deletions

File tree

licensecheck/checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def check(
4242
)
4343
failLicensesType = license_matrix.licenseType(ucstr(JOINS.join(fail_licenses)), ignore_licenses)
4444
onlyLicensesType = license_matrix.licenseType(ucstr(JOINS.join(only_licenses)), ignore_licenses)
45-
# licenseType will always return NO_LICENSE when onlyLicenses is empty # noqa: ERA001
45+
# licenseType will always return NO_LICENSE when onlyLicenses is empty
4646
if License.NO_LICENSE in onlyLicensesType:
4747
onlyLicensesType.remove(License.NO_LICENSE)
4848

licensecheck/cli.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def cli() -> None: # pragma: no cover
9999
parser.add_argument(
100100
"--pypi-api",
101101
help="Specify a custom pypi api endpoint, for example if using a custom pypi server",
102-
default="https://pypi.org",
103102
)
104103
parser.add_argument(
105104
"--zero",
@@ -153,7 +152,7 @@ def main(args: dict[str, Any]) -> int:
153152
output_file = (
154153
stdout
155154
if scopedConfig.get("file") in [None, ""]
156-
else Path(scopedConfig.get("file")).open("w", encoding="utf-8")
155+
else Path(scopedConfig.get("file", "")).open("w", encoding="utf-8")
157156
)
158157

159158
# Get my license
@@ -163,7 +162,9 @@ def main(args: dict[str, Any]) -> int:
163162
def getFromConfig(key: str) -> set[types.ucstr]:
164163
return set(map(types.ucstr, scopedConfig.get(key, [])))
165164

166-
package_info_manager = packageinfo.PackageInfoManager(scopedConfig.get("pypi_api"))
165+
package_info_manager = packageinfo.PackageInfoManager(
166+
scopedConfig.get("pypi_api", "https://pypi.org")
167+
)
167168

168169
incompatible, depsWithLicenses = checker.check(
169170
requirements_paths=set(requirements_paths),

licensecheck/license_matrix/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@
100100
}
101101

102102
termToLicense: dict[str, License] = dict(
103-
sorted(
104-
termToLicenseData.items(),
105-
key=lambda item: len(item[0]),
106-
reverse=True,
107-
)
103+
sorted(
104+
termToLicenseData.items(),
105+
key=lambda item: len(item[0]),
106+
reverse=True,
107+
)
108108
)
109109

110110

tests/platform_independent/test_license_matrix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ def test_licenseLookup() -> None:
2626
msgs = []
2727
for x in types.License._member_names_:
2828
if x not in licenses:
29-
msgs.append( f"{x} not in licenses")
29+
msgs.append(f"{x} not in licenses")
3030

31-
if len(msgs):
31+
if msgs:
3232
logger.error(msgs)
3333
raise AssertionError(msgs)
3434

0 commit comments

Comments
 (0)