Open julian-goettingen opened 1 year ago
A shorter example popped up in my code:
before remove logger:
ICE = open_pickle_file(fullfile_path_w_ending=working_file, # new (GIANNAM, 2022-01-13, 14:08)
settings='rb',
logger=self.logger)
after remove logger:
ICE = open_pickle_file(working_file, # new (GIANNAM, 2022-01-13, 14='rb')
expected:
ICE = open_pickle_file(fullfile_path_w_ending=working_file, # new (GIANNAM, 2022-01-13, 14:08)
settings='rb')
I have discovered an example where the refactoring breaks syntax directly at the definition-site, also related to comments:
removing the logger_obj from this:
def __init__(self,
name=None,
save_into_timers_classdict=False,
# text="Elapsed time_: {:0.8f} seconds",
logger_obj=None,
):
yields this:
def __init__(self, , name=None, # text="Elapsed time_=None):
I think there seems to be a general problem with how comments are treated - I realize it is not easy because comments have no ast-equivalent and no c-style /*line-comments*/ exist
Hi @julian-goettingen, thanks for the report.
Yes, dealing with comments are generally rather tricky to get all the corner cases right, though this one seems to be more on the code generation side.
Squashing everything into a single line here is likely not the appropriate behavior here in any case.
Describe the bug When removing an argument from a function, the code at the callsite goes into syntax errors if comments exist at the callsite.
To Reproduce Steps to reproduce the behavior:
Code before refactoring: at the callsite:
Describe the refactoring you want to do
remove Argument - logger (on the function definition, not the callsite)
The code gets compressed into one line with the comments mixed in.
Editor information (please complete the following information):
Additional context still fantastic library thanks a lot