Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/fontTools/misc/cython.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

10 statements  

1""" Exports a no-op 'cython' namespace similar to 

2https://github.com/cython/cython/blob/master/Cython/Shadow.py 

3 

4This allows to optionally compile @cython decorated functions 

5(when cython is available at built time), or run the same code 

6as pure-python, without runtime dependency on cython module. 

7 

8We only define the symbols that we use. E.g. see fontTools.cu2qu 

9""" 

10 

11from types import SimpleNamespace 

12 

13 

14def _empty_decorator(x): 

15 return x 

16 

17 

18compiled = False 

19 

20for name in ("double", "complex", "int"): 

21 globals()[name] = None 

22 

23for name in ("cfunc", "inline"): 

24 globals()[name] = _empty_decorator 

25 

26locals = lambda **_: _empty_decorator 

27returns = lambda _: _empty_decorator