Skip to content
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

fix: tell type checkers that the config options are strings #97

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

tonyandrewmeyer
Copy link
Contributor

Description

ops<=2.12 wrongly has self.config[x] typed as str, when actually it could be an int, float, bool, or str, depending on the config type. We're fixing this in ops:#1183, but that will break static checking that currently assumes that the config is a str (because ops doesn't validate the schema, so all options will be bool|int|float|str).

This PR adds a typing.cast call where the config values are loaded and used where the type should be str.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation N/A
  • I have added tests that validate the behaviour of the software N/A
  • I validated that new and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules N/A
  • I have bumped the version of the library N/A

@tonyandrewmeyer tonyandrewmeyer requested a review from a team as a code owner April 11, 2024 06:03
@gruyaume gruyaume merged commit 8ab0802 into canonical:main Apr 11, 2024
9 checks passed
@tonyandrewmeyer tonyandrewmeyer deleted the fix-config-types branch April 18, 2024 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants