Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@cython.locals(start=cython.Py_ssize_t, end=cython.Py_ssize_t)
def line_iter(source):
if isinstance(source, basestring):
start = 0
while True:
end = source.find('\n', start)
if end == -1:
yield source[start:]
return
yield source[start:end]
start = end+1
else:
for line in source:
yield line
k=cython.Py_ssize_t, counter=cython.Py_ssize_t, quote_len=cython.Py_ssize_t)
def strip_string_literals(code, prefix='__Pyx_L'):
"""
Normalizes every string literal to be of the form '__Pyx_Lxxx',
returning the normalized code and a mapping of labels to
string literals.
"""
new_code = []
literals = {}
counter = 0
start = q = 0
in_quote = False
hash_mark = single_q = double_q = -1
code_len = len(code)
quote_type = quote_len = None
while True:
single_q=cython.Py_ssize_t, double_q=cython.Py_ssize_t,
hash_mark=cython.Py_ssize_t, end=cython.Py_ssize_t,
k=cython.Py_ssize_t, counter=cython.Py_ssize_t, quote_len=cython.Py_ssize_t)
def strip_string_literals(code, prefix='__Pyx_L'):
"""
Normalizes every string literal to be of the form '__Pyx_Lxxx',
returning the normalized code and a mapping of labels to
string literals.
"""
new_code = []
literals = {}
counter = 0
start = q = 0
in_quote = False
hash_mark = single_q = double_q = -1
code_len = len(code)
quote_type = quote_len = None
start_pos=cython.Py_ssize_t,
pos=cython.Py_ssize_t,
length=cython.Py_ssize_t,
chunks=cython.list,
)
def _consume_quoted_string(css, pos):
"""Return (unescaped_value, new_pos)."""
# http://dev.w3.org/csswg/css-syntax/#consume-a-string-token
quote = css[pos]
assert quote in ('"', "'")
pos += 1
chunks = []
length = len(css)
start_pos = pos
while pos < length:
c = css[pos]
if c == quote:
pos=cython.Py_ssize_t,
length=cython.Py_ssize_t,
chunks=cython.list,
)
def _consume_quoted_string(css, pos):
"""Return (unescaped_value, new_pos)."""
# http://dev.w3.org/csswg/css-syntax/#consume-a-string-token
quote = css[pos]
assert quote in ('"', "'")
pos += 1
chunks = []
length = len(css)
start_pos = pos
while pos < length:
c = css[pos]
if c == quote:
chunks.append(css[start_pos:pos])
column=cython.Py_ssize_t,
newline=cython.Py_ssize_t,
last_newline=cython.Py_ssize_t,
root=cython.list,
tokens=cython.list,
stack=cython.list,
)
def parse_component_value_list(css, preserve_comments=False):
"""The tokenizer and block/function parser.
:param css: A :ref:`string`.
:returns: A list of :ref:`component values`.
"""
css = (css.replace('\0', '\uFFFD')
# This turns out to be faster than a regexp:
.replace('\r\n', '\n').replace('\r', '\n').replace('\f', '\n'))
@cython.locals(start=cython.Py_ssize_t, q=cython.Py_ssize_t,
single_q=cython.Py_ssize_t, double_q=cython.Py_ssize_t,
hash_mark=cython.Py_ssize_t, end=cython.Py_ssize_t,
k=cython.Py_ssize_t, counter=cython.Py_ssize_t, quote_len=cython.Py_ssize_t)
def strip_string_literals(code, prefix='__Pyx_L'):
"""
Normalizes every string literal to be of the form '__Pyx_Lxxx',
returning the normalized code and a mapping of labels to
string literals.
"""
new_code = []
literals = {}
counter = 0
start = q = 0
in_quote = False
hash_mark = single_q = double_q = -1
code_len = len(code)
length=cython.Py_ssize_t,
chunks=cython.list,
)
def _consume_quoted_string(css, pos):
"""Return (unescaped_value, new_pos)."""
# http://dev.w3.org/csswg/css-syntax/#consume-a-string-token
quote = css[pos]
assert quote in ('"', "'")
pos += 1
chunks = []
length = len(css)
start_pos = pos
while pos < length:
c = css[pos]
if c == quote:
chunks.append(css[start_pos:pos])
pos += 1