Skip to content
This repository was archived by the owner on Jul 16, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions atomicwrites/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,13 @@ def _open(self, get_fileobject):
except Exception:
pass

def get_fileobject(self, dir=None, **kwargs):
def get_fileobject(self, suffix="", prefix=tempfile.template, dir=None,
**kwargs):
'''Return the temporary file to use.'''
if dir is None:
dir = os.path.normpath(os.path.dirname(self._path))
descriptor, name = tempfile.mkstemp(dir=dir)
descriptor, name = tempfile.mkstemp(suffix=suffix, prefix=prefix,
dir=dir)
# io.open() will take either the descriptor or the name, but we need
# the name later for commit()/replace_atomic() and couldn't find a way
# to get the filename from the descriptor.
Expand Down