1*e1fe3e4aSElliott Hughes""" Exports a no-op 'cython' namespace similar to 2*e1fe3e4aSElliott Hugheshttps://github.com/cython/cython/blob/master/Cython/Shadow.py 3*e1fe3e4aSElliott Hughes 4*e1fe3e4aSElliott HughesThis allows to optionally compile @cython decorated functions 5*e1fe3e4aSElliott Hughes(when cython is available at built time), or run the same code 6*e1fe3e4aSElliott Hughesas pure-python, without runtime dependency on cython module. 7*e1fe3e4aSElliott Hughes 8*e1fe3e4aSElliott HughesWe only define the symbols that we use. E.g. see fontTools.cu2qu 9*e1fe3e4aSElliott Hughes""" 10*e1fe3e4aSElliott Hughes 11*e1fe3e4aSElliott Hughesfrom types import SimpleNamespace 12*e1fe3e4aSElliott Hughes 13*e1fe3e4aSElliott Hughes 14*e1fe3e4aSElliott Hughesdef _empty_decorator(x): 15*e1fe3e4aSElliott Hughes return x 16*e1fe3e4aSElliott Hughes 17*e1fe3e4aSElliott Hughes 18*e1fe3e4aSElliott Hughescompiled = False 19*e1fe3e4aSElliott Hughes 20*e1fe3e4aSElliott Hughesfor name in ("double", "complex", "int"): 21*e1fe3e4aSElliott Hughes globals()[name] = None 22*e1fe3e4aSElliott Hughes 23*e1fe3e4aSElliott Hughesfor name in ("cfunc", "inline"): 24*e1fe3e4aSElliott Hughes globals()[name] = _empty_decorator 25*e1fe3e4aSElliott Hughes 26*e1fe3e4aSElliott Hugheslocals = lambda **_: _empty_decorator 27*e1fe3e4aSElliott Hughesreturns = lambda _: _empty_decorator 28