Skip to content

Commit

Permalink
issue 17: pass newline arg to _swap_temp_with_primary CSVStorage method
Browse files Browse the repository at this point in the history
  • Loading branch information
citrusvanilla committed Nov 8, 2022
1 parent 6c79908 commit 40bdac4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tinyflux/storages.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,15 @@ def __init__(
self._initially_empty = False
self._path = path
self._flush_on_insert = flush_on_insert
self._newline = newline

# Create the file if it doesn't exist and creating is allowed.
if any(i in self._mode for i in ("+", "w", "a")):
create_file(path, create_dirs=create_dirs)

# Open the file for reading/writing
self._handle = open(
path, mode=self._mode, encoding=encoding, newline=newline
path, mode=self._mode, encoding=encoding, newline=self._newline
)

# Open a tempfile.
Expand Down Expand Up @@ -385,7 +386,10 @@ def _swap_temp_with_primary(self) -> None:

# Init a new file object with the initial handle reference.
self._handle = open(
self._path, mode=self._mode, encoding=self._encoding
self._path,
mode=self._mode,
encoding=self._encoding,
newline=self._newline,
)

return
Expand Down

0 comments on commit 40bdac4

Please sign in to comment.