-
Notifications
You must be signed in to change notification settings - Fork 125
chore: solve and remove the testing/tests linting ignores #2228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tonyandrewmeyer
merged 17 commits into
canonical:main
from
tonyandrewmeyer:type-check-scenario-tests
Dec 16, 2025
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d61a163
chore: add copyright notices.
tonyandrewmeyer 327766b
chore: Fix import order.
tonyandrewmeyer 6f36b0d
chore: catch the specific exception that is expected.
tonyandrewmeyer c91fb9b
chore: noqa an unnecessary warning.
tonyandrewmeyer 3e03937
chore: fix long lines.
tonyandrewmeyer 70e6547
ci: remove unnecessary ignore.
tonyandrewmeyer 4acbefe
chore: keep class names in CamelCase.
tonyandrewmeyer 2fb3987
ci: remove unnecessary ignore.
tonyandrewmeyer 80cf009
chore: use a fake path that doesn't look like hardcode /tmp
tonyandrewmeyer 385cd8f
ci: remove unnecessary ignore.
tonyandrewmeyer 909e77b
chore: remove quotes from types.
tonyandrewmeyer 1b2eb3f
chore: add ClassVar[] where appropriate.
tonyandrewmeyer 527c1f3
chore: use next(iter()) rather than [0].
tonyandrewmeyer e1e0147
chore: Use context managers for more timely cleanup.
tonyandrewmeyer c29b527
refactor: use the tmp_path fixture rather than tempfile, per review s…
tonyandrewmeyer 4345d8b
chore: consistently use ops.CharmBase, per review suggestion.
tonyandrewmeyer 93797af
refactor: the expectation with the .META attribute is that the values…
tonyandrewmeyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Copyright 2023 Canonical Ltd. | ||
| # See LICENSE file for licensing details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Copyright 2023 Canonical Ltd. | ||
| # See LICENSE file for licensing details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are improvements on their own, but feel weird given that we still call
tuple(...)on the preceding line. Also unfortunate that we need to dolen(tuple(...instead of justlen(given that these are actually going to befrozenset.I wonder if it would be worth adding custom
__init__methods to the relevant classes (justState?) to correct the mismatch between therelationsarg only needing to beIterable, but therelationsattribute actually always being afrozenset-- should I create an issue for this? Or discuss at daily?In the meantime, if we're open to making some manual improvements in this PR, how about this:
But feel free to reject to minimise the diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this has come up a couple of times before.
We did actually have a version where they all had an
__init__. The primary reason was to support keyword-only arguments in Python 3.8, and we eventually decided that having in one place (the thing with the custom__new__) was superior and ripped them all out. But they did also nicely handle the "you can give me an X but the attribute will always be a Y" case, so we lost that at the same time. Obviously, we have since ripped out the custom solution.I'm definitely not opposed to going back to
__init__. I think if we fix it for one it would be best to fix it for them all. Looking through, that's:And probably lots more (I wouldn't be surprised if it's like 80% of the classes). However, it could also potentially get rid of or incorporate the code we have for doing the copy (for somewhat immutability).
Feel free to open a PR or add to daily.