Skip to content

Replace bool and istruefalse with getboolean#4

Open
cormacmlynch wants to merge 2 commits into
mainfrom
fix-config-boolean
Open

Replace bool and istruefalse with getboolean#4
cormacmlynch wants to merge 2 commits into
mainfrom
fix-config-boolean

Conversation

@cormacmlynch

Copy link
Copy Markdown

The 'bool' method would not pick up when arguments in the ini file would be set to False.

The istruefalse method works but is fragile (relies on user using 'True'). The getboolean method should be more robust.

The 'bool' method would not pick up when arguments in the ini file would be set to False.

The istruefalse method works but is fragile (relies on user using 'True'). The getboolean method should be more robust.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes boolean parsing from settings.ini by replacing incorrect bool(config.get(...)) and a fragile string comparison helper with ConfigParser.getboolean(), ensuring values like False are correctly interpreted as False.

Changes:

  • Removed the istruefalse lambda that only treated the exact string "True" as true.
  • Replaced bool(config.get(...)) with config.getboolean(...) for multiple settings flags (SWITCH_WITHIN_YEAR_LOOP, mrio_inverse_recalculate, CALIBRATING, ftt_run, WRITE_AT_END).
  • Added a console print showing the parsed ftt_run value.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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