MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _splitlines_no_ff

Function _splitlines_no_ff

tools/python-3.11.9-amd64/Lib/ast.py:307–329  ·  view source on GitHub ↗

Split a string into lines ignoring form feed and other chars. This mimics how the Python parser splits source code.

(source)

Source from the content-addressed store, hash-verified

305
306
307def _splitlines_no_ff(source):
308 """Split a string into lines ignoring form feed and other chars.
309
310 This mimics how the Python parser splits source code.
311 """
312 idx = 0
313 lines = []
314 next_line = ''
315 while idx < len(source):
316 c = source[idx]
317 next_line += c
318 idx += 1
319 # Keep \r\n together
320 if c == '\r' and idx < len(source) and source[idx] == '\n':
321 next_line += '\n'
322 idx += 1
323 if c in '\r\n':
324 lines.append(next_line)
325 next_line = ''
326
327 if next_line:
328 lines.append(next_line)
329 return lines
330
331
332def _pad_whitespace(source):

Callers 1

get_source_segmentFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected