MCPcopy
hub / github.com/django/django / normalize_eols

Function normalize_eols

django/core/management/commands/makemessages.py:157–169  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

155
156
157def 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
172def write_pot_file(potfile, msgs):

Callers 2

build_potfilesMethod · 0.85
write_po_fileMethod · 0.85

Calls 2

appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected