Skip to content

Changes to allow alternate ConstantParameter and ControlCurveParamete…#13

Merged
pmslavin merged 2 commits intomasterfrom
nexsys_uu
Jul 2, 2025
Merged

Changes to allow alternate ConstantParameter and ControlCurveParamete…#13
pmslavin merged 2 commits intomasterfrom
nexsys_uu

Conversation

@knoxsp
Copy link
Copy Markdown
Collaborator

@knoxsp knoxsp commented Jul 1, 2025

…r definitions

@knoxsp knoxsp requested review from Copilot and pmslavin July 1, 2025 17:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 adjusts validation rules for parameters and timesteppers and hardens parameter removal in the network parser.

  • Removes built-in checks for ConstantParameter and ControlCurveParameter to allow alternative definitions
  • Stubs a new rule_start_before_end in PywrTimestepper
  • Wraps deletion of attached parameters in attach_reference_parameters with a try/except

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
types/timestepper.py Added stubbed rule_start_before_end for enforcing start/end ordering
types/parameter.py Removed rule_constant_has_value and rule_cc_has_controlcurve checks
types/network.py Wrapped deletion of self.parameters[...] in try/except to skip missing keys
Comments suppressed due to low confidence (2)

pywrparser/types/timestepper.py:15

  • Add unit tests for rule_start_before_end to verify the new ordering validation once implemented.
    def rule_start_before_end(self):

pywrparser/types/parameter.py:42

  • The rules enforcing presence of value on constantparameter and control_curve on controlcurveparameter were removed. Confirm this is intentional or introduce alternative validations for those required keys.
    @match("controlcurveparameter")

Comment thread pywrparser/types/timestepper.py
Comment thread pywrparser/types/network.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Owner

@pmslavin pmslavin left a comment

Choose a reason for hiding this comment

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

Rules updates to match common usage for the controlcurveparameter and constantparameter. Note that some rules remain enforced for controlcurveparameter.

@pmslavin pmslavin merged commit 6bd763b into master Jul 2, 2025
4 checks passed
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.

3 participants