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