Skip to content

Commit

Permalink
Reformat with ruff>=0.9 (#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem authored Jan 10, 2025
1 parent d4ee906 commit 99581a7
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ dev-dependencies = [
"pytest-mock>=1.13.0",
"pytest>=8.1.1",
"respx>=0.20.2",
"ruff>=0.7.3",
"ruff>=0.9.0",
"types-mock>=5.1.0.20240425",
# NOTE: some weird interaction between existing `vcrpy` snapshots and the way
# `oauth2` / `minio` deal with requests forces us to downgrade `urllib3`:
Expand Down
6 changes: 3 additions & 3 deletions shared/django_apps/utils/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def __init__(

def __set_name__(self, owner, name):
# Validate that the owner class has the methods we need
assert issubclass(
owner, ArchiveFieldInterface
), "Missing some required methods to use AchiveField"
assert issubclass(owner, ArchiveFieldInterface), (
"Missing some required methods to use AchiveField"
)
self.public_name = name
self.db_field_name = "_" + name
self.archive_field_name = "_" + name + "_storage_path"
Expand Down
2 changes: 1 addition & 1 deletion shared/encryption/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def encode_token(token: OauthConsumerToken) -> str:
string_to_save = (
token["key"]
+ f":{token['secret'] if token.get('secret') else ' '}"
+ (f':{token["refresh_token"]}' if token.get("refresh_token") else "")
+ (f":{token['refresh_token']}" if token.get("refresh_token") else "")
)
return string_to_save

Expand Down
4 changes: 2 additions & 2 deletions shared/license/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def startup_license_logging():
current_license = get_current_license()
is_valid = current_license.is_valid
statements_to_print.append(
f" License is {"valid" if is_valid else "INVALID"}"
f" License is {'valid' if is_valid else 'INVALID'}"
)

if current_license.message:
statements_to_print.append(f" Warning: {current_license.message}")

exp_date = current_license.expires
statements_to_print.append(
f" License expires {datetime.strftime(exp_date, "%Y-%m-%d %H:%M:%S") if exp_date else "NOT FOUND"} <=="
f" License expires {datetime.strftime(exp_date, '%Y-%m-%d %H:%M:%S') if exp_date else 'NOT FOUND'} <=="
)
statements_to_print.append("") # padding

Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ async def test_get_commit_diff(self, valid_handler, codecov_vcr):
"-> This repo is used for CI "
"Testing. Enjoy this gif as a "
"reward!",
"+> This repo is used for CI " "Testing",
"+> This repo is used for CI Testing",
"+",
"+",
"+| [https://codecov.io/][1] "
Expand All @@ -301,10 +301,10 @@ async def test_get_commit_diff(self, valid_handler, codecov_vcr):
"+",
"+",
"+[1]: https://codecov.io/",
"+[2]: " "https://twitter.com/codecov",
"+[3]: " "mailto:[email protected]",
"+[2]: https://twitter.com/codecov",
"+[3]: mailto:[email protected]",
" ",
"-![i can do " "that](http://gph.is/17cvPc4)",
"-![i can do that](http://gph.is/17cvPc4)",
],
}
],
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/bundle_analysis/test_bundle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,18 +848,18 @@ def load_and_test_report(
report.ingest(report_path)
bundle_report = report.bundle_report("sample")
asset_reports = list(bundle_report.asset_reports())
assert (
bundle_report.total_size() == expected_total_size
), f"Version {version}: Total size mismatch"
assert bundle_report.total_size() == expected_total_size, (
f"Version {version}: Total size mismatch"
)

total_js_size = sum(
asset.size
for asset in asset_reports
if asset.asset_type == AssetType.JAVASCRIPT
)
assert (
total_js_size == expected_js_size
), f"Version {version}: JS size mismatch"
assert total_js_size == expected_js_size, (
f"Version {version}: JS size mismatch"
)
finally:
report.cleanup()

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_license.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_startup_license_logging_invalid(
"",
"==> Checking License",
" License is INVALID",
f" Warning: {LICENSE_ERRORS_MESSAGES["no-license"]}",
f" Warning: {LICENSE_ERRORS_MESSAGES['no-license']}",
" License expires NOT FOUND <==",
"",
]
Expand Down
44 changes: 22 additions & 22 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 99581a7

Please sign in to comment.