[fix]:461 fixed with a utility function that checks for booealn inter…#493
Open
thisismeamir wants to merge 7 commits intoHEP-FCC:masterfrom
Open
[fix]:461 fixed with a utility function that checks for booealn inter…#493thisismeamir wants to merge 7 commits intoHEP-FCC:masterfrom
thisismeamir wants to merge 7 commits intoHEP-FCC:masterfrom
Conversation
…pretation fo string and integer content. Raises error to the user otherwise
kjvbrt
reviewed
Dec 10, 2025
python/utils.py
Outdated
| return ''.join(random.choices(string.ascii_letters + string.digits, | ||
| k=length)) | ||
|
|
||
| def boolean_of(input, context: str) -> bool : |
Contributor
There was a problem hiding this comment.
can you also make the function not sensitive to case? For example, "nO" or "trUe" should work as well.
Author
There was a problem hiding this comment.
I was thinking to make the users go to a typesafe region over time that's why I raised the error
kjvbrt
reviewed
Dec 10, 2025
python/utils.py
Outdated
| elif input in booleanDictionary["trueStatements"]: | ||
| return True | ||
| else | ||
| raise Exception(f"In ${context} you provided ${input} which cannot be considered a boolean in our source-code please use: False : ${booleanDictionary["falseStatements"]} and True: ${booleanDictionary["trueStatements"]}.") |
Contributor
There was a problem hiding this comment.
Can you instead of exception issue a warning? using the LOGGER?
Author
|
how's it now? |
kjvbrt
reviewed
Dec 10, 2025
python/utils.py
Outdated
| elif statement.lower() in booleanDictionary["trueStatements"]: | ||
| return True | ||
| else: | ||
| LOGGER.warning(f"In ${context} you provided ${input} which cannot be considered a boolean in our source-code please use: False : ${booleanDictionary["falseStatements"]} and True: ${booleanDictionary["trueStatements"]}.") |
Contributor
There was a problem hiding this comment.
You need to escape the double quotes ". or use single quotes '.
Contributor
There was a problem hiding this comment.
Nice, can you remove in our source-code from the warning message?
kjvbrt
reviewed
Dec 10, 2025
| LOGGER: logging.Logger | ||
|
|
||
| def generate_graph(dframe, args, suffix: str | None = None) -> None: ... | ||
| def boolean_of(): ... |
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.
The #461 opened the possibility that the user might un-intentionally enter string values instead of boolean for some inputs, resulting in an always
Truecase.I've added a utility function after the discussion with @kjvbrt about it and fixed the related histogram logarithmic scale bug with it as well.