Skip to content

Commit

Permalink
POC cythonizing of actions and util.
Browse files Browse the repository at this point in the history
  • Loading branch information
ionelmc committed Nov 10, 2018
1 parent 7fb8576 commit 549f236
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*.py[cod]
*.py[co]

# C extensions
*.so
Expand Down
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from distutils.command.build import build
from glob import glob
from itertools import chain
from os.path import basename
from os.path import basename, exists
from os.path import dirname
from os.path import join
from os.path import relpath
Expand Down Expand Up @@ -177,11 +177,14 @@ def _unavailable(self, e):
] if Cython else [],
ext_modules=[
Extension(
splitext(relpath(path, 'src').replace(os.sep, '.'))[0],
sources=[path],
relpath(name, 'src').replace(os.sep, '.'),
sources=[variant],
include_dirs=[dirname(path)]
)
for root, _, _ in os.walk('src')
for path in glob(join(root, '*.pyx' if Cython else '*.c'))
for path in glob(join(root, '*.pyd' if Cython else '*.c'))
for name in [splitext(path)[0]]
for variant in [name + '.pyx', name + '.py']
if exists(variant)
],
)
14 changes: 14 additions & 0 deletions src/hunter/actions.pyd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# from .util cimport rudimentary_repr

cdef class Action(object):
cdef class Debugger(Action):
cdef class Manhole(Action):
cdef class ColorStreamAction(Action):
cpdef str _safe_repr(self, object obj)
cdef class CodePrinter(ColorStreamAction):
cpdef str _safe_source(self, event)
cpdef str _format_filename(self, event)
cdef class CallPrinter(CodePrinter):
cdef class VarsPrinter(ColorStreamAction):
cpdef _iter_symbols(code)

1 change: 1 addition & 0 deletions src/hunter/util.pyd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cpdef str rudimentary_repr(object obj, int maxdepth=3)

0 comments on commit 549f236

Please sign in to comment.