summaryrefslogtreecommitdiffstats
path: root/pre_commit/commands/autoupdate.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-04-28 05:31:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-04-28 05:31:37 +0000
commitd48befde4a798ba4da4f30010e9d0105b1f23d8b (patch)
treeec2b561add30ebe20d451f863de6b5319d8fc099 /pre_commit/commands/autoupdate.py
parentAdding upstream version 2.2.0. (diff)
downloadpre-commit-d48befde4a798ba4da4f30010e9d0105b1f23d8b.tar.xz
pre-commit-d48befde4a798ba4da4f30010e9d0105b1f23d8b.zip
Adding upstream version 2.3.0.upstream/2.3.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/commands/autoupdate.py')
-rw-r--r--pre_commit/commands/autoupdate.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pre_commit/commands/autoupdate.py b/pre_commit/commands/autoupdate.py
index 5a9a988..8c9fdd7 100644
--- a/pre_commit/commands/autoupdate.py
+++ b/pre_commit/commands/autoupdate.py
@@ -93,7 +93,7 @@ def _original_lines(
retry: bool = False,
) -> Tuple[List[str], List[int]]:
"""detect `rev:` lines or reformat the file"""
- with open(path) as f:
+ with open(path, newline='') as f:
original = f.read()
lines = original.splitlines(True)
@@ -126,7 +126,7 @@ def _write_new_config(path: str, rev_infos: List[Optional[RevInfo]]) -> None:
comment = match[4]
lines[idx] = f'{match[1]}rev:{match[2]}{new_rev}{comment}{match[5]}'
- with open(path, 'w') as f:
+ with open(path, 'w', newline='') as f:
f.write(''.join(lines))