-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: extend File.write()
to accept a rootnode
and foldername
#1308
base: develop
Are you sure you want to change the base?
Conversation
File.write()
to accept a rootnode
and foldername
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.
Looks good already, mostly some cosmetics.
rootnode = self.ensureOwnModuleRootNode() | ||
elif not foldername: | ||
# if rootnode is set and foldername is not, save the file in the root of the rootnode | ||
foldername = [] |
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 like tuples ;)
foldername = [] | |
foldername = () |
if foldername is not None: | ||
foldernames = foldername | ||
if isinstance(foldername, str): | ||
foldernames = foldernames.replace('\\', '/') |
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'm not sure if we should handle this case. What do the others think? @sveneberth?
foldernames = foldername | ||
if isinstance(foldername, str): | ||
foldernames = foldernames.replace('\\', '/') | ||
foldernames = (i for i in foldernames.split('/')) |
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.
foldernames = (i for i in foldernames.split('/')) | |
foldernames = foldernames.split("/") |
if isinstance(foldername, str): | ||
foldernames = foldernames.replace('\\', '/') | ||
foldernames = (i for i in foldernames.split('/')) | ||
foldernames = (i for i in foldernames if i) |
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.
foldernames = (i for i in foldernames if i) | |
foldernames = tuple(foldernames) # ensure tuple, run any iterators |
feat: extend the write()-method of File to accept a rootnode and foldername