-
Notifications
You must be signed in to change notification settings - Fork 203
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
Preserve comments in dump() method #1327
Conversation
Automatic reply from Jenkins: Can I test this? |
header = True | ||
|
||
i = 0 | ||
while i<len(raw): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use a for loop?
precompute len(raw) so it's not computed on every itteration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not a for loop because the counter needs to be incremented more if there are multiline comments (the nested loop on line 164)
jenkins: ok to test |
Refer to this link for build results (access rights to CI server needed): This pull request is now ready for review/testing. Please try and find someone who can tackle this; contact @boegel if you're not sure what to do. |
Refer to this link for build results (access rights to CI server needed): This pull request is now ready for review/testing. Please try and find someone who can tackle this; contact @boegel if you're not sure what to do. |
printed_keys.append(key) | ||
printed = True | ||
if printed: | ||
ebtxt.append('') | ||
|
||
def add_key_and_comments(key, val): | ||
""" Adds key, value pair and comments (if there are any) to the dump file """ | ||
if key in self.comments['inline']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ugly to use the self from the outer scope,
can't you make this a private method instead of an inner method, and pass self along?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'outer scope' is overstating things a bit, this inner function (in a method) is just referring to a 'variable' that's available in that methods scope, which is fine
moving that function out of the method, either as private method or a stand-alone function, would be messier imho (since it'll be split of from its context)
Refer to this link for build results (access rights to CI server needed): See https://jenkins1.ugent.be/job/easybuild-framework-pr-builder/1930/console for more details. Please fix the reported issues by pushing additional commits to the branch corresponding with this pull request; contact @boegel if you're not sure what to do. |
… may be a problem for format v2 easyconfigs
dance around issue with get_config_dict triggering a (re)parse, which…
Refer to this link for build results (access rights to CI server needed): This pull request is now ready for review/testing. Please try and find someone who can tackle this; contact @boegel if you're not sure what to do. |
going in, follow-up in #1330 |
Preserve comments in dump() method
At the moment, there's no support for comments on lines that do not contain keys because for that to work, dump's indentation needs to be fixed first
for example, right now, the comment in
will be ignored. This will have to be fixed when I take care of the indentation.