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

Preserve line break codes #169

Merged
merged 1 commit into from
Jul 25, 2024
Merged

Conversation

ajisaka
Copy link
Contributor

@ajisaka ajisaka commented Jul 3, 2024

Ensure that bump-pydantic command does not change the newline code.

@Kludex
Copy link
Member

Kludex commented Jul 5, 2024

What is happening?

@ajisaka
Copy link
Contributor Author

ajisaka commented Jul 5, 2024

On Linux, when bump-pydantic is run on source code with Windows-style newline code (CRLF), the newline code is rewritten to LF.
Changing newlines is not the expected behavior of this tool.

@ajisaka
Copy link
Contributor Author

ajisaka commented Jul 5, 2024

The reproduction method is as follows

$ echo -n 'from pydantic import BaseModel\r\nclass User(BaseModel):\r\n  name: Optional[str]\r\n' > test.py
$ file test.py
test.py: Python script, ASCII text executable, with CRLF line terminators
$ rye run --pyproject ~/repos/bump-pydantic/pyproject.toml bump-pydantic .
[22:16:37] Start bump-pydantic.                                                                                                                                                                            main.py:67
           Found 1 file to process.                                                                                                                                                                        main.py:82
[22:16:38] Refactored 1 files.                                                                                                                                                                            main.py:150
           Run successfully!                                                                                                                                                                              main.py:160
$ file test.py
test.py: Python script, ASCII text executable

The output result of the file command is different between the first and second times.

@Kludex Kludex merged commit 253e91d into pydantic:main Jul 25, 2024
8 checks passed
@Kludex
Copy link
Member

Kludex commented Jul 25, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants