Closed eLvErDe closed 5 years ago
I thought this was fixed in #89. See https://github.com/berkerpeksag/astor/issues/89#issuecomment-386336336 for more details. Could you please try to run astor.rtrip
against https://github.com/python/cpython/blob/3.6/Lib/netrc.py?
python3 -m astor.rtrip /tmp/netrc.py
Trashing tmp_rtrip
Converting /tmp/netrc.py
calculating dump -- bad
Files failed to round-trip to AST:
/tmp/netrc.py
Here's the generated code:
def __repr__(self):
"""Dump the class data in the format of a .netrc file."""
- rep = ""
+ rep = ''
for host in self.hosts.keys():
attrs = self.hosts[host]
- rep += f"machine {host}\n\tlogin {attrs[0]}\n"
+ rep += f'machine {host}\n\tlogin {attrs[0]}\n '
if attrs[1]:
- rep += f"\taccount {attrs[1]}\n"
- rep += f"\tpassword {attrs[2]}\n"
+ rep += f'\taccount {attrs[1]}\n '
+ rep += f'\tpassword {attrs[2]}\n '
for macro in self.macros.keys():
- rep += f"macdef {macro}\n"
+ rep += f'macdef {macro}\n '
for line in self.macros[macro]:
rep += line
- rep += "\n"
+ rep += '\n'
Is anybody working on this currently?
@rickardcronholm I don't work on this at the moment and I don't recall anybody has said they'd want to work on this as well. Feel free to submit a PR! :)
Hopefully this will be fixed by https://github.com/berkerpeksag/astor/pull/123