Conversation
env_spec.py
Outdated
| comment_regex = r"^(.+)\#(.+)$" | ||
|
|
||
| lines = env_spec_text.split("\n") | ||
| enumerated_list = list(enumerate(lines)) |
There was a problem hiding this comment.
I think we do not have to wrap enumerate(...) in a list, right?
There was a problem hiding this comment.
if I have only enumerated_list = (enumerate(lines)), I will get the enumerated object.
There was a problem hiding this comment.
Won't the enumerated object work like a list in a for ... in loop?
There was a problem hiding this comment.
Yes, it will.My mistake.
env_spec.py
Outdated
| if not is_variable_name_valid: | ||
| raise EnvSpecSyntaxError("SYNTAX ERROR: Invalid variable name.") | ||
| raise EnvSpecSyntaxError( | ||
| "SYNTAX ERROR: Invalid variable name.", line_number |
There was a problem hiding this comment.
Can you change the error message to this please?
Invalid variable name; it should contain only latin alphanumeric characters, underscores and not start with a digit.
env_spec.py
Outdated
| if not choices: | ||
| raise EnvSpecSyntaxError("SYNTAX ERROR: Invalid choices list.") | ||
| raise EnvSpecSyntaxError( | ||
| "SYNTAX ERROR: Invalid choices list.", line_number |
There was a problem hiding this comment.
Can you change the error message to this please?
Invalid restricted choices syntax.
env_spec.py
Outdated
| if default_value not in choices or default_value == "": | ||
| raise EnvSpecSyntaxError("SYNTAX ERROR: Invalid default value.") | ||
| raise EnvSpecSyntaxError( | ||
| "SYNTAX ERROR: Invalid default value.", line_number |
There was a problem hiding this comment.
Can you change the error message to this please?
Invalid default value; it is not included in the provided restricted choices.
env_spec.py
Outdated
|
|
||
| if env_spec_type not in valid_types_list: | ||
| raise EnvSpecSyntaxError("SYNTAX ERROR: Invalid type.") | ||
| raise EnvSpecSyntaxError("SYNTAX ERROR: Invalid type.", line_number) |
There was a problem hiding this comment.
Can you change the error message to this please?
Invalid variable type; it should be one of "bla", "blah", "blah".
P.S.: @krantou do not hardcode the valid types in the error message above, but construct the substring by joining the elements of valid_types_list.
|
|
||
| if not is_variable_name_valid: | ||
| raise EnvSpecSyntaxError("SYNTAX ERROR: Invalid variable name.") | ||
| raise EnvSpecSyntaxError( |
There was a problem hiding this comment.
Can you change the error message to this please?
Invalid variable name; it should contain only latin alphanumeric characters, underscores and not start with a digit.
Also, why are we validating the variable name in two places?
No description provided.