MCPcopy Index your code
hub / github.com/numpy/numpy / markinnerspaces

Function markinnerspaces

numpy/f2py/crackfortran.py:1621–1655  ·  view source on GitHub ↗

The function replace all spaces in the input variable line which are surrounded with quotation marks, with the triplet "@_@". For instance, for the input "a 'b c'" the function returns "a 'b@_@c'" Parameters ---------- line : str Returns ------- str

(line)

Source from the content-addressed store, hash-verified

1619
1620
1621def markinnerspaces(line):
1622 """
1623 The function replace all spaces in the input variable line which are
1624 surrounded with quotation marks, with the triplet "@_@".
1625
1626 For instance, for the input "a 'b c'" the function returns "a 'b@_@c'"
1627
1628 Parameters
1629 ----------
1630 line : str
1631
1632 Returns
1633 -------
1634 str
1635
1636 """
1637 fragment = ''
1638 inside = False
1639 current_quote = None
1640 escaped = ''
1641 for c in line:
1642 if escaped == '\\' and c in ['\\', '\'', '"']:
1643 fragment += c
1644 escaped = c
1645 continue
1646 if not inside and c in ['\'', '"']:
1647 current_quote = c
1648 if c == current_quote:
1649 inside = not inside
1650 elif c == ' ' and inside:
1651 fragment += '@_@'
1652 continue
1653 fragment += c
1654 escaped = c # reset to non-backslash
1655 return fragment
1656
1657
1658def updatevars(typespec, selector, attrspec, entitydecl):

Callers 5

updatevarsFunction · 0.85

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…