Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/fontTools/misc/cython.py: 100%
10 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:33 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:33 +0000
1""" Exports a no-op 'cython' namespace similar to
2https://github.com/cython/cython/blob/master/Cython/Shadow.py
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.
8We only define the symbols that we use. E.g. see fontTools.cu2qu
9"""
11from types import SimpleNamespace
14def _empty_decorator(x):
15 return x
18compiled = False
20for name in ("double", "complex", "int"):
21 globals()[name] = None
23for name in ("cfunc", "inline"):
24 globals()[name] = _empty_decorator
26locals = lambda **_: _empty_decorator
27returns = lambda _: _empty_decorator