Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
efff5dd5
Commit
efff5dd5
authored
Nov 12, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include FusedNode.py and StringIOTree.py in compiled modules.
parent
6cc0a3a7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
34 deletions
+55
-34
Cython/StringIOTree.pxd
Cython/StringIOTree.pxd
+17
-0
Cython/StringIOTree.py
Cython/StringIOTree.py
+36
-33
setup.py
setup.py
+2
-1
No files found.
Cython/StringIOTree.pxd
0 → 100644
View file @
efff5dd5
cimport
cython
cdef
class
StringIOTree
:
cdef
public
list
prepended_children
cdef
public
object
stream
cdef
public
object
write
cdef
public
list
markers
@
cython
.
locals
(
x
=
StringIOTree
)
cpdef
getvalue
(
self
)
@
cython
.
locals
(
child
=
StringIOTree
)
cpdef
copyto
(
self
,
target
)
cpdef
commit
(
self
)
#def insert(self, iotree)
#def insertion_point(self)
@
cython
.
locals
(
c
=
StringIOTree
)
cpdef
allmarkers
(
self
)
Cython/StringIOTree.py
View file @
efff5dd5
r"""
Implements a buffer with insertion points. When you know you need to
"get back" to a place and write more later, simply call insertion_point()
at that spot and get a new StringIOTree object that is "left behind".
EXAMPLE:
>>> a = StringIOTree()
>>> _= a.write('first\n')
>>> b = a.insertion_point()
>>> _= a.write('third\n')
>>> _= b.write('second\n')
>>> a.getvalue().split()
['first', 'second', 'third']
>>> c = b.insertion_point()
>>> d = c.insertion_point()
>>> _= d.write('alpha\n')
>>> _= b.write('gamma\n')
>>> _= c.write('beta\n')
>>> b.getvalue().split()
['second', 'alpha', 'beta', 'gamma']
>>> i = StringIOTree()
>>> d.insert(i)
>>> _= i.write('inserted\n')
>>> out = StringIO()
>>> a.copyto(out)
>>> out.getvalue().split()
['first', 'second', 'alpha', 'inserted', 'beta', 'gamma', 'third']
"""
from
__future__
import
absolute_import
,
unicode_literals
try
:
# Prefer cStringIO since io.StringIO() does not support writing 'str' in Py2.
from
cStringIO
import
StringIO
except
ImportError
:
from
io
import
StringIO
# does not support writing 'str' in Py2
from
io
import
StringIO
class
StringIOTree
(
object
):
...
...
@@ -69,35 +104,3 @@ class StringIOTree(object):
def
allmarkers
(
self
):
children
=
self
.
prepended_children
return
[
m
for
c
in
children
for
m
in
c
.
allmarkers
()]
+
self
.
markers
__doc__
=
r"""
Implements a buffer with insertion points. When you know you need to
"get back" to a place and write more later, simply call insertion_point()
at that spot and get a new StringIOTree object that is "left behind".
EXAMPLE:
>>> a = StringIOTree()
>>> _= a.write('first\n')
>>> b = a.insertion_point()
>>> _= a.write('third\n')
>>> _= b.write('second\n')
>>> a.getvalue().split()
['first', 'second', 'third']
>>> c = b.insertion_point()
>>> d = c.insertion_point()
>>> _= d.write('alpha\n')
>>> _= b.write('gamma\n')
>>> _= c.write('beta\n')
>>> b.getvalue().split()
['second', 'alpha', 'beta', 'gamma']
>>> i = StringIOTree()
>>> d.insert(i)
>>> _= i.write('inserted\n')
>>> out = StringIO()
>>> a.copyto(out)
>>> out.getvalue().split()
['first', 'second', 'alpha', 'inserted', 'beta', 'gamma', 'third']
"""
setup.py
View file @
efff5dd5
...
...
@@ -93,8 +93,9 @@ def compile_cython_modules(profile=False, compile_more=False, cython_with_refnan
"Cython.Compiler.FlowControl"
,
"Cython.Compiler.Code"
,
"Cython.Runtime.refnanny"
,
#
"Cython.Compiler.FusedNode",
"Cython.Compiler.FusedNode"
,
"Cython.Tempita._tempita"
,
"Cython.StringIOTree"
,
]
if
compile_more
:
compiled_modules
.
extend
([
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment