Repository navigation
[WIP] [pre-commit.ci] pre-commit autoupdate - #467
pre-commit-ci[bot] wants to merge 6 commits into
Conversation
8bc4cd5 to
5766d76
Compare
55b1b0f to
ec3f867
Compare
1adaceb to
34023be
Compare
34023be to
a03e400
Compare
dda690a to
e0ba12a
Compare
ba7cff6 to
08c2278
Compare
369c4ad to
0a260b4
Compare
e2f0324 to
a25a1b8
Compare
updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.22 → v0.16.10](astral-sh/ruff-pre-commit@v0.15.22...v0.16.10)
93927d6 to
aa62a8d
Compare
for more information, see https://pre-commit.ci
| # Run the linter | ||
| - id: ruff-check | ||
| args: [--fix, --exit-non-zero-on-fix] | ||
| args: [--fix, --exit-non-zero-on-fix, "--extend-ignore=ASYNC230,BLE001,SIM117"] |
There was a problem hiding this comment.
These are even less trivial than the other rules fixed in this PR, so I'd suggest that we try to resolve them one by one in separate PRs, if necessary and if possible.
There was a problem hiding this comment.
For example, I think SIM117 (combining with contexts) is a bit in conflict with the trame style we have been using so far, most likely because it is the one used in the trame codebase itself. To be double checked whether they adopted the pattern corresponding to this Ruff rule recently as well.
There was a problem hiding this comment.
I actually see that SIM117 was already applied partially. I may try to redo this manually in a separate PR.
|
Many fixes were applied automatically by Ruff through pre-commit, others were applied one by one, manually, by myself in b33bfa4. I think this PR will benefit from an accurate review. I may put the diff into an LLM to see if it catches any bugs that may have been introduced by mistake, but I definitely encourage you to review it independently as well. This is a good example of a PR where having a comprehesive suite of automated tests could have helped. I think we should work on that sooner or later. |
|
Given the amount of code changes, it may conflict with #439 and we may need to decide in which PR we will prefer to resolve conflicts, before deciding which one we will merge first. |
| expiration = datetime.strptime(credential_client.expiresAt, sfapi_format) | ||
| expiration = datetime.strptime( | ||
| credential_client.expiresAt, sfapi_format | ||
| ).astimezone() | ||
| # if key is not expired, update info, else set to expired/unavailable | ||
| if expiration.replace(tzinfo=None) > datetime.now(): | ||
| if expiration.replace(tzinfo=None) > datetime.now().astimezone(): |
There was a problem hiding this comment.
This is likely to raise a TypeError because there is a conflict between replace(tzinfo=None) and astimezone().
The original code was also subtly wrong, because it stripped the offset and compared against naive local time.
The correct fix should be to compare two aware datetimes:
expiration = datetime.strptime(credential_client.expiresAt, sfapi_format)
if expiration > datetime.now(timezone.utc):|
Replaced by #470. |
updates: