Check if variable is already a bool before converting it#3232
Closed
tshirtman wants to merge 1 commit into
Closed
Conversation
Author
|
Hm, seems i was not up to date, closing and reassessing. edit: yep, works now, i guess vim-plug didn't update because it still though the |
Collaborator
|
No worries, glad you could sort out your issue in the end! :) |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
I had issue running Black in vim after recent updates (notably using vim > 9, linked against python 3.10.4), getting error:
TypeError: bool object expected; got int
after some tinkering i found that the values defined (or not) in pyproject.toml were the culprit. But even adding
in the black block of pyproject.toml, didn't help, as it was trying to convert a bool to a bool, as if it was a string,
AttributeError: 'bool' object has no attribute 'lower'
but even adding quotes around the values still got me the original "bool object expected; got int", error.
So i replaced the usage of
strtoboolwith something more robust, usingConfigParser.BOOLEAN_STATES.getand falling back on False.Checklist - did you ...
Not sure any of these are necessary, for the vim plugin.