Take a block of raw text that will be passed through str.splitlines() to get universal newlines treatment. Return the resulting block of text with normalized `\n` EOL sequences ready to be written to disk using current platform's native EOLs.
(raw_contents)
| 155 | |
| 156 | |
| 157 | def normalize_eols(raw_contents): |
| 158 | """ |
| 159 | Take a block of raw text that will be passed through str.splitlines() to |
| 160 | get universal newlines treatment. |
| 161 | |
| 162 | Return the resulting block of text with normalized `\n` EOL sequences ready |
| 163 | to be written to disk using current platform's native EOLs. |
| 164 | """ |
| 165 | lines_list = raw_contents.splitlines() |
| 166 | # Ensure last line has its EOL |
| 167 | if lines_list and lines_list[-1]: |
| 168 | lines_list.append("") |
| 169 | return "\n".join(lines_list) |
| 170 | |
| 171 | |
| 172 | def write_pot_file(potfile, msgs): |
no test coverage detected