Skip to content

Commit 96d25f5

Browse files
committed
Set newline arg in open() to disable universal newlines
1 parent 77d8518 commit 96d25f5

6 files changed

Lines changed: 7 additions & 6 deletions

File tree

fluent.runtime/fluent/runtime/fallback.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ def resources(
133133
path = self.localize_path(os.path.join(root, resource_id), locale)
134134
if not os.path.isfile(path):
135135
continue
136-
content = open(path, "r", encoding="utf-8").read()
136+
with open(path, "r", encoding="utf-8", newline="\n") as file:
137+
content = file.read()
137138
resources.append(FluentParser().parse(content))
138139
if resources:
139140
yield resources

fluent.syntax/tests/syntax/test_reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def read_file(path):
9-
with open(path, "r", encoding="utf-8") as file:
9+
with open(path, "r", encoding="utf-8", newline="\n") as file:
1010
text = file.read()
1111
return text
1212

fluent.syntax/tests/syntax/test_structure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def read_file(path):
9-
with open(path, "r", encoding="utf-8") as file:
9+
with open(path, "r", encoding="utf-8", newline="\n") as file:
1010
text = file.read()
1111
return text
1212

tools/fluentfmt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
def read_file(path):
11-
with open(path, "r", encoding="utf-8") as file:
11+
with open(path, "r", encoding="utf-8", newline="\n") as file:
1212
text = file.read()
1313
return text
1414

tools/parse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
def read_file(path):
12-
with open(path, "r", encoding="utf-8") as file:
12+
with open(path, "r", encoding="utf-8", newline="\n") as file:
1313
text = file.read()
1414
return text
1515

tools/serialize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
def read_json(path):
12-
with open(path, "r", encoding="utf-8") as file:
12+
with open(path, "r", encoding="utf-8", newline="\n") as file:
1313
return json.load(file)
1414

1515

0 commit comments

Comments
 (0)