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

Normalize newlines in verbatim_text #4850

Merged
merged 2 commits into from
Jun 5, 2023
Merged

Conversation

MichaReiser
Copy link
Member

Summary

The printer requires that text elements only use '\n' line endings.
This PR ensures that verbatim_text properly escapes \r or \r\n.

Test Plan

@MichaReiser
Copy link
Member Author

MichaReiser commented Jun 4, 2023

@github-actions
Copy link
Contributor

github-actions bot commented Jun 4, 2023

PR Check Results

Ecosystem

ℹ️ ecosystem check detected changes. (+4, -0, 0 error(s))

typeshed (+4, -0)

+ stdlib/builtins.pyi:108:9: PYI029 [*] Defining `__str__` in a stub is almost always redundant
+ stdlib/builtins.pyi:109:9: PYI029 [*] Defining `__repr__` in a stub is almost always redundant
+ stdlib/distutils/version.pyi:26:9: PYI029 [*] Defining `__str__` in a stub is almost always redundant
+ stdlib/distutils/version.pyi:35:9: PYI029 [*] Defining `__str__` in a stub is almost always redundant

Rules changed: 1
Rule Changes Additions Removals
PYI029 4 4 0

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00      7.0±0.67ms     5.8 MB/sec    1.00      7.0±0.43ms     5.8 MB/sec
formatter/numpy/ctypeslib.py               1.00  1438.8±39.15µs    11.6 MB/sec    1.02  1462.6±77.19µs    11.4 MB/sec
formatter/numpy/globals.py                 1.01    168.4±9.05µs    17.5 MB/sec    1.00    166.2±5.91µs    17.8 MB/sec
formatter/pydantic/types.py                1.00      3.0±0.10ms     8.4 MB/sec    1.04      3.1±0.11ms     8.1 MB/sec
linter/all-rules/large/dataset.py          1.05     18.3±0.52ms     2.2 MB/sec    1.00     17.4±0.65ms     2.3 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.04      4.3±0.13ms     3.9 MB/sec    1.00      4.1±0.15ms     4.1 MB/sec
linter/all-rules/numpy/globals.py          1.00   525.6±14.42µs     5.6 MB/sec    1.00   524.3±26.26µs     5.6 MB/sec
linter/all-rules/pydantic/types.py         1.05      7.5±0.19ms     3.4 MB/sec    1.00      7.2±0.34ms     3.6 MB/sec
linter/default-rules/large/dataset.py      1.01      8.3±0.16ms     4.9 MB/sec    1.00      8.2±0.21ms     5.0 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1762.0±36.35µs     9.5 MB/sec    1.01  1778.5±61.58µs     9.4 MB/sec
linter/default-rules/numpy/globals.py      1.00    207.6±6.14µs    14.2 MB/sec    1.00    207.9±9.18µs    14.2 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.7±0.10ms     7.0 MB/sec    1.02      3.7±0.13ms     6.8 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.08      8.8±0.32ms     4.6 MB/sec    1.00      8.1±0.25ms     5.0 MB/sec
formatter/numpy/ctypeslib.py               1.04  1785.9±86.96µs     9.3 MB/sec    1.00  1723.3±75.72µs     9.7 MB/sec
formatter/numpy/globals.py                 1.04   199.1±14.19µs    14.8 MB/sec    1.00   191.5±21.12µs    15.4 MB/sec
formatter/pydantic/types.py                1.04      3.8±0.12ms     6.7 MB/sec    1.00      3.6±0.13ms     7.0 MB/sec
linter/all-rules/large/dataset.py          1.00     21.1±0.61ms  1973.1 KB/sec    1.01     21.3±0.62ms  1952.1 KB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      5.2±0.15ms     3.2 MB/sec    1.01      5.2±0.17ms     3.2 MB/sec
linter/all-rules/numpy/globals.py          1.02   616.5±22.77µs     4.8 MB/sec    1.00   606.0±29.94µs     4.9 MB/sec
linter/all-rules/pydantic/types.py         1.02      8.9±0.33ms     2.9 MB/sec    1.00      8.8±0.31ms     2.9 MB/sec
linter/default-rules/large/dataset.py      1.02     10.3±0.36ms     3.9 MB/sec    1.00     10.1±0.28ms     4.0 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.06      2.2±0.10ms     7.6 MB/sec    1.00      2.1±0.10ms     8.0 MB/sec
linter/default-rules/numpy/globals.py      1.06   248.8±17.00µs    11.9 MB/sec    1.00   234.7±12.24µs    12.6 MB/sec
linter/default-rules/pydantic/types.py     1.02      4.7±0.24ms     5.5 MB/sec    1.00      4.6±0.16ms     5.6 MB/sec

Base automatically changed from format-while-statement to main June 5, 2023 08:24
@MichaReiser MichaReiser added internal An internal refactor or improvement formatter Related to the formatter labels Jun 5, 2023
@MichaReiser MichaReiser enabled auto-merge (squash) June 5, 2023 19:25
@MichaReiser MichaReiser merged commit 913b9d1 into main Jun 5, 2023
@MichaReiser MichaReiser deleted the normalize-verbatim-newlines branch June 5, 2023 19:30
konstin pushed a commit that referenced this pull request Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter internal An internal refactor or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants