52
52
53
53
54
54
# Utility functions {{{1
55
- # convert_returns {{{2
56
- def convert_returns (text ):
55
+ # convert_line_terminators {{{2
56
+ def convert_line_terminators (text ):
57
57
return text .replace ("\r \n " , "\n " ).replace ("\r " , "\n " )
58
58
59
59
@@ -1320,7 +1320,7 @@ def loads(
1320
1320
'''
1321
1321
1322
1322
# code {{{3
1323
- lines = convert_returns (content ).split ("\n " )
1323
+ lines = convert_line_terminators (content ).split ("\n " )
1324
1324
loader = NestedTextLoader (
1325
1325
lines , top , source , on_dup , keymap , normalize_key , dialect
1326
1326
)
@@ -1407,7 +1407,7 @@ def load(
1407
1407
# code {{{3
1408
1408
# Do not invoke the read method as that would read in the entire contents of
1409
1409
# the file, possibly consuming a lot of memory. Instead pass the file
1410
- # pointer into _read_all() , it will iterate through the lines, discarding
1410
+ # pointer into loader , it will iterate through the lines, discarding
1411
1411
# them once they are no longer needed, which reduces the memory usage.
1412
1412
1413
1413
if isinstance (f , collections .abc .Iterator ):
@@ -1527,7 +1527,7 @@ def render_key(self, key, keys):
1527
1527
raise NestedTextError (
1528
1528
key , template = "keys must be strings." , culprit = keys
1529
1529
) from None
1530
- return convert_returns (key )
1530
+ return convert_line_terminators (key )
1531
1531
1532
1532
# render_dict_item {{{3
1533
1533
def render_dict_item (self , key , value , keys , values ):
@@ -1546,7 +1546,7 @@ def render_dict_item(self, key, value, keys, values):
1546
1546
return key + self .render_value (value , keys , values )
1547
1547
if is_str (value ):
1548
1548
# force use of multiline value with multiline keys
1549
- value = convert_returns (value )
1549
+ value = convert_line_terminators (value )
1550
1550
else :
1551
1551
value = self .render_value (value , keys , values )
1552
1552
return key + "\n " + add_leader (value , self .indent * " " + "> " )
@@ -1674,7 +1674,7 @@ def render_value(self, obj, keys, values):
1674
1674
content = "\n " .join (content )
1675
1675
1676
1676
elif self .is_a_str (obj ):
1677
- text = convert_returns (obj )
1677
+ text = convert_line_terminators (obj )
1678
1678
if "\n " in text or level == 0 :
1679
1679
content = add_leader (text , "> " )
1680
1680
need_indented_block = True
0 commit comments