Skip to content
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

Disable newline translation on windows #2

Merged
merged 1 commit into from
Jan 30, 2024
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
4 changes: 2 additions & 2 deletions src/codemanip/code_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def to_camel_case(name: str) -> str:


def read_text_file(filename: str) -> str:
with open(filename) as f:
with open(filename, newline='') as f:
txt = f.read()
return txt

Expand All @@ -259,7 +259,7 @@ def escape_new_lines(code: str) -> str:
def write_text_file(filename: str, content: str) -> None:
old_content = read_text_file(filename)
if content != old_content:
with open(filename, "w") as f:
with open(filename, "w", newline='') as f:
f.write(content)


Expand Down