-
Notifications
You must be signed in to change notification settings - Fork 90
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
Make sure EMAworkbench outcomes and parameter names are valid Python identifiers #274
Comments
@quaquel Since you seem in quite a productive mood, would you like to also resolve this issue before releasing 2.4.1? |
The fix is straightforward. There is a method for it. Main issue is that it will break a lot of existing code (including the final assignment for epa 1361). Would be better off in a 2.5/3.0 release. |
…dentifier First step for solving #274. This covers all outcome and parameter classes. Still remaining are constants and potentially all Point subclasses.
I started working on this in a branch. Constant, parameters, and outcomes now must be valid python identifiers, and this is explicitly checked. There are 2 open questions:
|
if not name.isidentifier():
raise ValueError(f"'{name}' is not a valid Python identifier")
def valid_python_identifier(name):
if not name.isidentifier():
raise ValueError(f"'{name}' is not a valid Python identifier.") And then just check everywhere: class Model:
def __init__(self, model_name, ...):
valid_python_identifier(model_name) If we truly want to check it everywhere, and if we can guarantee / standardize that the second variable always is the name, we could even create a decorator. |
|
Deprecated in 2.5, will be removed in 3.0 (see #337). |
Make sure EMAworkbench outcomes and parameter names are valid Python identifiers
The text was updated successfully, but these errors were encountered: