├── ext_libs ├── rfoo │ ├── utils │ │ └── __init__.py │ ├── marsh.so │ └── __init__.py ├── Cython │ ├── Utility │ │ ├── __init__.py │ │ ├── TestCyUtilityLoader.pyx │ │ ├── TestUtilityLoader.c │ │ ├── Capsule.c │ │ ├── CppSupport.cpp │ │ ├── TestCythonScope.pyx │ │ └── ExtensionTypes.c │ ├── Compiler │ │ ├── __init__.py │ │ ├── Tests │ │ │ ├── __init__.py │ │ │ ├── TestTreeFragment.py │ │ │ ├── TestVisitor.py │ │ │ ├── TestMemView.py │ │ │ ├── TestSignatureMatching.py │ │ │ └── TestUtilityLoad.py │ │ ├── Version.py │ │ ├── Future.py │ │ ├── DebugFlags.py │ │ ├── CodeGeneration.py │ │ ├── Visitor.pxd │ │ ├── Scanning.pxd │ │ ├── Interpreter.py │ │ ├── ParseTreeTransforms.pxd │ │ ├── Code.pxd │ │ └── FlowControl.pxd │ ├── Debugger │ │ ├── __init__.py │ │ ├── Tests │ │ │ ├── __init__.py │ │ │ ├── cfuncs.c │ │ │ └── codefile │ │ ├── DebugWriter.py │ │ └── Cygdb.py │ ├── Runtime │ │ └── __init__.py │ ├── Tests │ │ ├── __init__.py │ │ ├── TestStringIOTree.py │ │ └── TestCodeWriter.py │ ├── Build │ │ ├── Tests │ │ │ ├── __init__.py │ │ │ ├── TestStripLiterals.py │ │ │ └── TestInline.py │ │ └── __init__.py │ ├── Includes │ │ ├── libc │ │ │ ├── __init__.pxd │ │ │ ├── setjmp.pxd │ │ │ ├── stddef.pxd │ │ │ ├── limits.pxd │ │ │ ├── float.pxd │ │ │ ├── locale.pxd │ │ │ ├── signal.pxd │ │ │ ├── string.pxd │ │ │ ├── stdio.pxd │ │ │ ├── math.pxd │ │ │ ├── errno.pxd │ │ │ ├── stdlib.pxd │ │ │ └── stdint.pxd │ │ ├── posix │ │ │ ├── __init__.pxd │ │ │ ├── ioctl.pxd │ │ │ └── fcntl.pxd │ │ ├── libcpp │ │ │ ├── pair.pxd │ │ │ ├── __init__.pxd │ │ │ ├── stack.pxd │ │ │ ├── utility.pxd │ │ │ ├── queue.pxd │ │ │ ├── set.pxd │ │ │ ├── deque.pxd │ │ │ ├── map.pxd │ │ │ ├── list.pxd │ │ │ └── vector.pxd │ │ ├── Deprecated │ │ │ ├── python.pxd │ │ │ ├── stdio.pxd │ │ │ ├── python_exc.pxd │ │ │ ├── python_int.pxd │ │ │ ├── python_mem.pxd │ │ │ ├── python_ref.pxd │ │ │ ├── python_set.pxd │ │ │ ├── stdlib.pxd │ │ │ ├── python_bool.pxd │ │ │ ├── python_bytes.pxd │ │ │ ├── python_dict.pxd │ │ │ ├── python_float.pxd │ │ │ ├── python_list.pxd │ │ │ ├── python_long.pxd │ │ │ ├── python_tuple.pxd │ │ │ ├── python_type.pxd │ │ │ ├── python_buffer.pxd │ │ │ ├── python_cobject.pxd │ │ │ ├── python_complex.pxd │ │ │ ├── python_function.pxd │ │ │ ├── python_getargs.pxd │ │ │ ├── python_instance.pxd │ │ │ ├── python_iterator.pxd │ │ │ ├── python_mapping.pxd │ │ │ ├── python_method.pxd │ │ │ ├── python_module.pxd │ │ │ ├── python_number.pxd │ │ │ ├── python_object.pxd │ │ │ ├── python_sequence.pxd │ │ │ ├── python_string.pxd │ │ │ ├── python_unicode.pxd │ │ │ ├── python_version.pxd │ │ │ ├── python_weakref.pxd │ │ │ ├── python_oldbuffer.pxd │ │ │ ├── python_pycapsule.pxd │ │ │ └── stl.pxd │ │ ├── cpython │ │ │ ├── getargs.pxd │ │ │ ├── version.pxd │ │ │ ├── instance.pxd │ │ │ ├── pythread.pxd │ │ │ ├── iterator.pxd │ │ │ ├── bool.pxd │ │ │ ├── float.pxd │ │ │ ├── cobject.pxd │ │ │ ├── complex.pxd │ │ │ ├── type.pxd │ │ │ ├── weakref.pxd │ │ │ ├── method.pxd │ │ │ ├── ref.pxd │ │ │ ├── function.pxd │ │ │ ├── mapping.pxd │ │ │ ├── oldbuffer.pxd │ │ │ ├── tuple.pxd │ │ │ └── pystate.pxd │ │ └── openmp.pxd │ ├── Distutils │ │ └── __init__.py │ ├── __init__.py │ ├── Plex │ │ ├── Timing.py │ │ ├── Actions.pxd │ │ ├── Errors.py │ │ ├── __init__.py │ │ ├── Scanners.pxd │ │ └── Actions.py │ ├── Debugging.py │ ├── Tempita │ │ └── compat3.py │ └── StringIOTree.py ├── array.so ├── simplejson │ ├── tests │ │ ├── test_default.py │ │ ├── test_pass2.py │ │ ├── test_pass3.py │ │ ├── test_check_circular.py │ │ ├── test_separators.py │ │ ├── test_encode_for_html.py │ │ ├── test_speedups.py │ │ ├── test_item_sort_key.py │ │ ├── test_iterable.py │ │ ├── test_subclass.py │ │ ├── test_float.py │ │ ├── test_errors.py │ │ ├── test_recursion.py │ │ ├── test_tuple.py │ │ ├── test_pass1.py │ │ ├── test_bigint_as_string.py │ │ ├── test_encode_basestring_ascii.py │ │ ├── test_bitsize_int_as_string.py │ │ ├── test_decimal.py │ │ ├── test_indent.py │ │ ├── test_for_json.py │ │ ├── test_tool.py │ │ └── __init__.py │ ├── compat.py │ └── tool.py ├── keyword.py └── site.py ├── README.md ├── .gitignore ├── __init__.py └── LICENSE /ext_libs/rfoo/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ext_libs/Cython/Utility/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/__init__.py: -------------------------------------------------------------------------------- 1 | # empty file 2 | -------------------------------------------------------------------------------- /ext_libs/Cython/Debugger/__init__.py: -------------------------------------------------------------------------------- 1 | # empty file 2 | -------------------------------------------------------------------------------- /ext_libs/Cython/Runtime/__init__.py: -------------------------------------------------------------------------------- 1 | # empty file 2 | -------------------------------------------------------------------------------- /ext_libs/Cython/Tests/__init__.py: -------------------------------------------------------------------------------- 1 | # empty file 2 | -------------------------------------------------------------------------------- /ext_libs/Cython/Build/Tests/__init__.py: -------------------------------------------------------------------------------- 1 | # empty file 2 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Tests/__init__.py: -------------------------------------------------------------------------------- 1 | # empty file 2 | -------------------------------------------------------------------------------- /ext_libs/Cython/Debugger/Tests/__init__.py: -------------------------------------------------------------------------------- 1 | # empty file 2 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/__init__.pxd: -------------------------------------------------------------------------------- 1 | # empty file 2 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/posix/__init__.pxd: -------------------------------------------------------------------------------- 1 | # empty file 2 | -------------------------------------------------------------------------------- /ext_libs/Cython/Build/__init__.py: -------------------------------------------------------------------------------- 1 | from Dependencies import cythonize 2 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libcpp/pair.pxd: -------------------------------------------------------------------------------- 1 | from utility cimport pair 2 | -------------------------------------------------------------------------------- /ext_libs/array.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valsteen/ableton-live-webapi/HEAD/ext_libs/array.so -------------------------------------------------------------------------------- /ext_libs/rfoo/marsh.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valsteen/ableton-live-webapi/HEAD/ext_libs/rfoo/marsh.so -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/stdio.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from libc.stdio cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libcpp/__init__.pxd: -------------------------------------------------------------------------------- 1 | # empty file 2 | 3 | cdef extern from *: 4 | ctypedef bint bool 5 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_exc.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.exc cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_int.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.int cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_mem.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.mem cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_ref.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.ref cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_set.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.set cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/stdlib.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from libc.stdlib cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_bool.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.bool cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_bytes.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.bytes cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_dict.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.dict cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_float.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.float cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_list.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.list cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_long.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.long cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_tuple.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.tuple cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_type.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.type cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_buffer.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.buffer cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_cobject.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.cobject cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_complex.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.complex cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_function.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.function cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_getargs.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.getargs cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_instance.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.instance cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_iterator.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.iterator cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_mapping.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.mapping cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_method.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.method cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_module.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.module cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_number.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.number cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_object.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.object cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_sequence.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.sequence cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_string.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.string cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_unicode.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.unicode cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_version.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.version cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_weakref.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.weakref cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_oldbuffer.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.oldbuffer cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/python_pycapsule.pxd: -------------------------------------------------------------------------------- 1 | # Present for backwards compatability 2 | from cpython.pycapsule cimport * 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Debugger/Tests/cfuncs.c: -------------------------------------------------------------------------------- 1 | void 2 | some_c_function(void) 3 | { 4 | int a, b, c; 5 | 6 | a = 1; 7 | b = 2; 8 | } 9 | -------------------------------------------------------------------------------- /ext_libs/Cython/Distutils/__init__.py: -------------------------------------------------------------------------------- 1 | from Cython.Distutils.build_ext import build_ext 2 | from Cython.Distutils.extension import Extension 3 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/posix/ioctl.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "sys/ioctl.h" nogil: 2 | enum: FIONBIO 3 | 4 | int ioctl(int fd, int request, ...) 5 | -------------------------------------------------------------------------------- /ext_libs/Cython/__init__.py: -------------------------------------------------------------------------------- 1 | from Cython.Shadow import __version__ 2 | 3 | # Void cython.* directives (for case insensitive operating systems). 4 | from Cython.Shadow import * 5 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/setjmp.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "setjmp.h" nogil: 2 | ctypedef struct jmp_buf: 3 | pass 4 | int setjmp(jmp_buf state) 5 | void longjmp(jmp_buf state, int value) 6 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Version.py: -------------------------------------------------------------------------------- 1 | # for backwards compatibility 2 | 3 | from Cython import __version__ as version 4 | 5 | # For generated by string. 6 | 7 | import time 8 | watermark = "%s on %s" % (version, time.asctime()) 9 | -------------------------------------------------------------------------------- /ext_libs/Cython/Utility/TestCyUtilityLoader.pyx: -------------------------------------------------------------------------------- 1 | ########## TestCyUtilityLoader ########## 2 | #@requires: OtherUtility 3 | 4 | test {{cy_loader}} impl 5 | 6 | 7 | ########## OtherUtility ########## 8 | req {{cy_loader}} impl 9 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/stddef.pxd: -------------------------------------------------------------------------------- 1 | # 7.17 Common definitions 2 | 3 | cdef extern from "stddef.h": 4 | 5 | ctypedef signed int ptrdiff_t 6 | 7 | ctypedef unsigned int size_t 8 | 9 | ctypedef int wchar_t 10 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_default.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | 5 | class TestDefault(TestCase): 6 | def test_default(self): 7 | self.assertEqual( 8 | json.dumps(type, default=repr), 9 | json.dumps(repr(type))) 10 | -------------------------------------------------------------------------------- /ext_libs/Cython/Utility/TestUtilityLoader.c: -------------------------------------------------------------------------------- 1 | ////////// TestUtilityLoader.proto ////////// 2 | test {{loader}} prototype 3 | 4 | ////////// TestUtilityLoader ////////// 5 | //@requires: OtherUtility 6 | test {{loader}} impl 7 | 8 | ////////// OtherUtility.proto ////////// 9 | req {{loader}} proto 10 | 11 | ////////// OtherUtility ////////// 12 | req {{loader}} impl 13 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libcpp/stack.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "" namespace "std": 2 | cdef cppclass stack[T]: 3 | stack() nogil except + 4 | stack(stack&) nogil except + 5 | #stack(Container&) 6 | bint empty() nogil 7 | void pop() nogil 8 | void push(T&) nogil 9 | size_t size() nogil 10 | T& top() nogil 11 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_pass2.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | import simplejson as json 3 | 4 | # from http://json.org/JSON_checker/test/pass2.json 5 | JSON = r''' 6 | [[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] 7 | ''' 8 | 9 | class TestPass2(TestCase): 10 | def test_parse(self): 11 | # test in/out equivalence and parsing 12 | res = json.loads(JSON) 13 | out = json.dumps(res) 14 | self.assertEqual(res, json.loads(out)) 15 | -------------------------------------------------------------------------------- /ext_libs/Cython/Plex/Timing.py: -------------------------------------------------------------------------------- 1 | # 2 | # Get time in platform-dependent way 3 | # 4 | 5 | import os 6 | from sys import platform, exit, stderr 7 | 8 | if platform == 'mac': 9 | import MacOS 10 | def time(): 11 | return MacOS.GetTicks() / 60.0 12 | timekind = "real" 13 | elif hasattr(os, 'times'): 14 | def time(): 15 | t = os.times() 16 | return t[0] + t[1] 17 | timekind = "cpu" 18 | else: 19 | stderr.write( 20 | "Don't know how to get time on platform %s\n" % repr(platform)) 21 | exit(1) 22 | 23 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libcpp/utility.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "" namespace "std": 2 | cdef cppclass pair[T, U]: 3 | T first 4 | U second 5 | pair() nogil except + 6 | pair(pair&) nogil except + 7 | pair(T&, U&) nogil except + 8 | bint operator==(pair&, pair&) nogil 9 | bint operator!=(pair&, pair&) nogil 10 | bint operator<(pair&, pair&) nogil 11 | bint operator>(pair&, pair&) nogil 12 | bint operator<=(pair&, pair&) nogil 13 | bint operator>=(pair&, pair&) nogil 14 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_pass3.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | 5 | # from http://json.org/JSON_checker/test/pass3.json 6 | JSON = r''' 7 | { 8 | "JSON Test Pattern pass3": { 9 | "The outermost value": "must be an object or array.", 10 | "In this test": "It is an object." 11 | } 12 | } 13 | ''' 14 | 15 | class TestPass3(TestCase): 16 | def test_parse(self): 17 | # test in/out equivalence and parsing 18 | res = json.loads(JSON) 19 | out = json.dumps(res) 20 | self.assertEqual(res, json.loads(out)) 21 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Future.py: -------------------------------------------------------------------------------- 1 | def _get_feature(name): 2 | import __future__ 3 | # fall back to a unique fake object for earlier Python versions or Python 3 4 | return getattr(__future__, name, object()) 5 | 6 | unicode_literals = _get_feature("unicode_literals") 7 | with_statement = _get_feature("with_statement") 8 | division = _get_feature("division") 9 | print_function = _get_feature("print_function") 10 | absolute_import = _get_feature("absolute_import") 11 | nested_scopes = _get_feature("nested_scopes") # dummy 12 | generators = _get_feature("generators") # dummy 13 | 14 | del _get_feature 15 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/limits.pxd: -------------------------------------------------------------------------------- 1 | # 5.2.4.2.1 Sizes of integer types 2 | 3 | cdef extern from "limits.h": 4 | 5 | enum: CHAR_BIT 6 | enum: MB_LEN_MAX 7 | 8 | enum: CHAR_MIN 9 | enum: CHAR_MAX 10 | 11 | enum: SCHAR_MIN 12 | enum: SCHAR_MAX 13 | enum: UCHAR_MAX 14 | 15 | enum: SHRT_MIN 16 | enum: SHRT_MAX 17 | enum: USHRT_MAX 18 | 19 | enum: INT_MIN 20 | enum: INT_MAX 21 | enum: UINT_MAX 22 | 23 | enum: LONG_MIN 24 | enum: LONG_MAX 25 | enum: ULONG_MAX 26 | 27 | enum: LLONG_MIN 28 | enum: LLONG_MAX 29 | enum: ULLONG_MAX 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ableton-live-webapi 2 | Control surface script for accessing APIs from externals scripts using ZeroMQ. For now, this is pre-alpha release mostly for the sake of sharing the sources and get some feedback about it. There is still some work to make it usable for anyone. 3 | 4 | 5 | ext_libs contains dependencies coming from the standard python library and other packages. Binaries have been compiled on OS X 10.10.5 but should work on any mac that is able to run Ableton Live 9. In a future version this will be removed and replaced by instructions about were to get the specific files, how to build them and hopefully a cross-platform deployment script. 6 | -------------------------------------------------------------------------------- /ext_libs/Cython/Debugging.py: -------------------------------------------------------------------------------- 1 | ############################################### 2 | # 3 | # Odds and ends for debugging 4 | # 5 | ############################################### 6 | 7 | def print_call_chain(*args): 8 | import sys 9 | print(" ".join(map(str, args))) 10 | f = sys._getframe(1) 11 | while f: 12 | name = f.f_code.co_name 13 | s = f.f_locals.get('self', None) 14 | if s: 15 | c = getattr(s, "__class__", None) 16 | if c: 17 | name = "%s.%s" % (c.__name__, name) 18 | print("Called from: %s %s" % (name, f.f_lineno)) 19 | f = f.f_back 20 | print("-" * 70) 21 | -------------------------------------------------------------------------------- /ext_libs/Cython/Utility/Capsule.c: -------------------------------------------------------------------------------- 1 | //////////////// Capsule.proto //////////////// 2 | 3 | /* Todo: wrap the rest of the functionality in similar functions */ 4 | static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); 5 | 6 | //////////////// Capsule //////////////// 7 | 8 | static CYTHON_INLINE PyObject * 9 | __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) 10 | { 11 | PyObject *cobj; 12 | 13 | #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) 14 | cobj = PyCapsule_New(p, sig, NULL); 15 | #else 16 | cobj = PyCObject_FromVoidPtr(p, NULL); 17 | #endif 18 | 19 | return cobj; 20 | } 21 | -------------------------------------------------------------------------------- /ext_libs/Cython/Plex/Actions.pxd: -------------------------------------------------------------------------------- 1 | 2 | cdef class Action: 3 | cdef perform(self, token_stream, text) 4 | cpdef same_as(self, other) 5 | 6 | cdef class Return(Action): 7 | cdef object value 8 | cdef perform(self, token_stream, text) 9 | cpdef same_as(self, other) 10 | 11 | cdef class Call(Action): 12 | cdef object function 13 | cdef perform(self, token_stream, text) 14 | cpdef same_as(self, other) 15 | 16 | cdef class Begin(Action): 17 | cdef object state_name 18 | cdef perform(self, token_stream, text) 19 | cpdef same_as(self, other) 20 | 21 | cdef class Ignore(Action): 22 | cdef perform(self, token_stream, text) 23 | 24 | cdef class Text(Action): 25 | cdef perform(self, token_stream, text) 26 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/DebugFlags.py: -------------------------------------------------------------------------------- 1 | # Can be enabled at the command line with --debug-xxx. 2 | 3 | debug_disposal_code = 0 4 | debug_temp_alloc = 0 5 | debug_coercion = 0 6 | 7 | # Write comments into the C code that show where temporary variables 8 | # are allocated and released. 9 | debug_temp_code_comments = 0 10 | 11 | # Write a call trace of the code generation phase into the C code. 12 | debug_trace_code_generation = 0 13 | 14 | # Do not replace exceptions with user-friendly error messages. 15 | debug_no_exception_intercept = 0 16 | 17 | # Print a message each time a new stage in the pipeline is entered. 18 | debug_verbose_pipeline = 0 19 | 20 | # Raise an exception when an error is encountered. 21 | debug_exception_on_error = 0 22 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libcpp/queue.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "" namespace "std": 2 | cdef cppclass queue[T]: 3 | queue() nogil except + 4 | queue(queue&) nogil except + 5 | #queue(Container&) 6 | T& back() nogil 7 | bint empty() nogil 8 | T& front() nogil 9 | void pop() nogil 10 | void push(T&) nogil 11 | size_t size() nogil 12 | cdef cppclass priority_queue[T]: 13 | priority_queue() nogil except + 14 | priority_queue(priority_queue&) nogil except + 15 | #priority_queue(Container&) 16 | bint empty() nogil 17 | void pop() nogil 18 | void push(T&) nogil 19 | size_t size() nogil 20 | T& top() nogil 21 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/getargs.pxd: -------------------------------------------------------------------------------- 1 | from cpython.ref cimport PyObject 2 | 3 | cdef extern from "Python.h": 4 | ##################################################################### 5 | # 5.5 Parsing arguments and building values 6 | ##################################################################### 7 | ctypedef struct va_list 8 | int PyArg_ParseTuple(object args, char *format, ...) except 0 9 | int PyArg_VaParse(object args, char *format, va_list vargs) except 0 10 | int PyArg_ParseTupleAndKeywords(object args, object kw, char *format, char *keywords[], ...) except 0 11 | int PyArg_VaParseTupleAndKeywords(object args, object kw, char *format, char *keywords[], va_list vargs) except 0 12 | int PyArg_Parse(object args, char *format, ...) except 0 13 | int PyArg_UnpackTuple(object args, char *name, Py_ssize_t min, Py_ssize_t max, ...) except 0 14 | -------------------------------------------------------------------------------- /ext_libs/Cython/Debugger/Tests/codefile: -------------------------------------------------------------------------------- 1 | cdef extern from "stdio.h": 2 | int puts(char *s) 3 | 4 | cdef extern: 5 | void some_c_function() 6 | 7 | import os 8 | 9 | cdef int c_var = 12 10 | python_var = 13 11 | 12 | def spam(a=0): 13 | cdef: 14 | int b, c 15 | 16 | b = c = d = 0 17 | 18 | b = 1 19 | c = 2 20 | int(10) 21 | puts("spam") 22 | os.path.join("foo", "bar") 23 | some_c_function() 24 | 25 | cpdef eggs(): 26 | pass 27 | 28 | cdef ham(): 29 | pass 30 | 31 | cdef class SomeClass(object): 32 | def spam(self): 33 | pass 34 | 35 | def outer(): 36 | cdef object a = "an object" 37 | def inner(): 38 | b = 2 39 | # access closed over variables 40 | print a, b 41 | return inner 42 | 43 | 44 | outer()() 45 | 46 | spam() 47 | print "bye!" 48 | 49 | def use_ham(): 50 | ham() 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | *.egg-info/ 23 | .installed.cfg 24 | *.egg 25 | 26 | # PyInstaller 27 | # Usually these files are written by a python script from a template 28 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 29 | *.manifest 30 | *.spec 31 | 32 | # Installer logs 33 | pip-log.txt 34 | pip-delete-this-directory.txt 35 | 36 | # Unit test / coverage reports 37 | htmlcov/ 38 | .tox/ 39 | .coverage 40 | .coverage.* 41 | .cache 42 | nosetests.xml 43 | coverage.xml 44 | *,cover 45 | 46 | # Translations 47 | *.mo 48 | *.pot 49 | 50 | # Django stuff: 51 | *.log 52 | 53 | # Sphinx documentation 54 | docs/_build/ 55 | 56 | # PyBuilder 57 | target/ 58 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/float.pxd: -------------------------------------------------------------------------------- 1 | # 5.2.4.2.2 Characteristics of floating types 2 | 3 | cdef extern from "float.h": 4 | 5 | enum: FLT_RADIX 6 | 7 | enum: FLT_MANT_DIG 8 | enum: DBL_MANT_DIG 9 | enum: LDBL_MANT_DIG 10 | 11 | enum: DECIMAL_DIG 12 | 13 | enum: FLT_DIG 14 | enum: DBL_DIG 15 | enum: LDBL_DIG 16 | 17 | enum: FLT_MIN_EXP 18 | enum: DBL_MIN_EXP 19 | enum: LDBL_MIN_EXP 20 | 21 | enum: FLT_MIN_10_EXP 22 | enum: DBL_MIN_10_EXP 23 | enum: LDBL_MIN_10_EXP 24 | 25 | enum: FLT_MAX_EXP 26 | enum: DBL_MAX_EXP 27 | enum: LDBL_MAX_EXP 28 | 29 | enum: FLT_MAX_10_EXP 30 | enum: DBL_MAX_10_EXP 31 | enum: LDBL_MAX_10_EXP 32 | 33 | enum: FLT_MAX 34 | enum: DBL_MAX 35 | enum: LDBL_MAX 36 | 37 | enum: FLT_EPSILON 38 | enum: DBL_EPSILON 39 | enum: LDBL_EPSILON 40 | 41 | enum: FLT_MIN 42 | enum: DBL_MIN 43 | enum: LDBL_MIN 44 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | import sys, os, logging 2 | 3 | logger = logging.getLogger("WebAPI") 4 | if not hasattr(logger, "initialized"): 5 | # Live reloads the module, which is bad. Ensure we don't register the logger again and again 6 | logfile = logging.FileHandler(os.path.join(os.path.expanduser('~'), 'abletonwebapi.log')) 7 | logfile.setLevel(logging.DEBUG) 8 | 9 | formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') 10 | logfile.setFormatter(formatter) 11 | 12 | logger.setLevel(logging.DEBUG) 13 | logger.addHandler(logfile) 14 | 15 | logger.initialized = True 16 | 17 | 18 | try: 19 | sys.path.append(os.path.join(os.path.dirname(__file__), "ext_libs")) 20 | from WebAPI import WebAPI 21 | except Exception, e: 22 | logger.exception() 23 | 24 | 25 | def create_instance(c_instance): 26 | try: 27 | from WebAPI import WebAPI 28 | 29 | return WebAPI(c_instance) 30 | except Exception, e: 31 | logger.exception() -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/version.pxd: -------------------------------------------------------------------------------- 1 | # Python version constants 2 | # 3 | # It's better to evaluate these at runtime (i.e. C compile time) using 4 | # 5 | # if PY_MAJOR_VERSION >= 3: 6 | # do_stuff_in_Py3_0_and_later() 7 | # if PY_VERSION_HEX >= 0x02050000: 8 | # do_stuff_in_Py2_5_and_later() 9 | # 10 | # than using the IF/DEF statements, which are evaluated at Cython 11 | # compile time. This will keep your C code portable. 12 | 13 | 14 | cdef extern from *: 15 | # the complete version, e.g. 0x010502B2 == 1.5.2b2 16 | int PY_VERSION_HEX 17 | 18 | # the individual sections as plain numbers 19 | int PY_MAJOR_VERSION 20 | int PY_MINOR_VERSION 21 | int PY_MICRO_VERSION 22 | int PY_RELEASE_LEVEL 23 | int PY_RELEASE_SERIAL 24 | 25 | # Note: PY_RELEASE_LEVEL is one of 26 | # 0xA (alpha) 27 | # 0xB (beta) 28 | # 0xC (release candidate) 29 | # 0xF (final) 30 | 31 | char PY_VERSION[] 32 | char PY_PATCHLEVEL_REVISION[] 33 | -------------------------------------------------------------------------------- /ext_libs/Cython/Tempita/compat3.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | __all__ = ['b', 'basestring_', 'bytes', 'next', 'is_unicode'] 4 | 5 | if sys.version < "3": 6 | b = bytes = str 7 | basestring_ = basestring 8 | else: 9 | 10 | def b(s): 11 | if isinstance(s, str): 12 | return s.encode('latin1') 13 | return bytes(s) 14 | basestring_ = (bytes, str) 15 | bytes = bytes 16 | text = str 17 | 18 | if sys.version < "3": 19 | 20 | def next(obj): 21 | return obj.next() 22 | else: 23 | next = next 24 | 25 | if sys.version < "3": 26 | 27 | def is_unicode(obj): 28 | return isinstance(obj, unicode) 29 | else: 30 | 31 | def is_unicode(obj): 32 | return isinstance(obj, str) 33 | 34 | 35 | def coerce_text(v): 36 | if not isinstance(v, basestring_): 37 | if sys.version < "3": 38 | attr = '__unicode__' 39 | else: 40 | attr = '__str__' 41 | if hasattr(v, attr): 42 | return unicode(v) 43 | else: 44 | return bytes(v) 45 | return v 46 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_check_circular.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | import simplejson as json 3 | 4 | def default_iterable(obj): 5 | return list(obj) 6 | 7 | class TestCheckCircular(TestCase): 8 | def test_circular_dict(self): 9 | dct = {} 10 | dct['a'] = dct 11 | self.assertRaises(ValueError, json.dumps, dct) 12 | 13 | def test_circular_list(self): 14 | lst = [] 15 | lst.append(lst) 16 | self.assertRaises(ValueError, json.dumps, lst) 17 | 18 | def test_circular_composite(self): 19 | dct2 = {} 20 | dct2['a'] = [] 21 | dct2['a'].append(dct2) 22 | self.assertRaises(ValueError, json.dumps, dct2) 23 | 24 | def test_circular_default(self): 25 | json.dumps([set()], default=default_iterable) 26 | self.assertRaises(TypeError, json.dumps, [set()]) 27 | 28 | def test_circular_off_default(self): 29 | json.dumps([set()], default=default_iterable, check_circular=False) 30 | self.assertRaises(TypeError, json.dumps, [set()], check_circular=False) 31 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/instance.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "Python.h": 2 | 3 | ############################################################################ 4 | # 7.5.2 Instance Objects 5 | ############################################################################ 6 | 7 | # PyTypeObject PyInstance_Type 8 | # 9 | # Type object for class instances. 10 | 11 | int PyInstance_Check(object obj) 12 | # Return true if obj is an instance. 13 | 14 | object PyInstance_New(object cls, object arg, object kw) 15 | # Return value: New reference. 16 | # Create a new instance of a specific class. The parameters arg 17 | # and kw are used as the positional and keyword parameters to the 18 | # object's constructor. 19 | 20 | object PyInstance_NewRaw(object cls, object dict) 21 | # Return value: New reference. 22 | # Create a new instance of a specific class without calling its 23 | # constructor. class is the class of new object. The dict 24 | # parameter will be used as the object's __dict__; if NULL, a new 25 | # dictionary will be created for the instance. 26 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_separators.py: -------------------------------------------------------------------------------- 1 | import textwrap 2 | from unittest import TestCase 3 | 4 | import simplejson as json 5 | 6 | 7 | class TestSeparators(TestCase): 8 | def test_separators(self): 9 | h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth', 10 | {'nifty': 87}, {'field': 'yes', 'morefield': False} ] 11 | 12 | expect = textwrap.dedent("""\ 13 | [ 14 | [ 15 | "blorpie" 16 | ] , 17 | [ 18 | "whoops" 19 | ] , 20 | [] , 21 | "d-shtaeou" , 22 | "d-nthiouh" , 23 | "i-vhbjkhnth" , 24 | { 25 | "nifty" : 87 26 | } , 27 | { 28 | "field" : "yes" , 29 | "morefield" : false 30 | } 31 | ]""") 32 | 33 | 34 | d1 = json.dumps(h) 35 | d2 = json.dumps(h, indent=' ', sort_keys=True, separators=(' ,', ' : ')) 36 | 37 | h1 = json.loads(d1) 38 | h2 = json.loads(d2) 39 | 40 | self.assertEqual(h1, h) 41 | self.assertEqual(h2, h) 42 | self.assertEqual(d2, expect) 43 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_encode_for_html.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import simplejson as json 4 | 5 | class TestEncodeForHTML(unittest.TestCase): 6 | 7 | def setUp(self): 8 | self.decoder = json.JSONDecoder() 9 | self.encoder = json.JSONEncoderForHTML() 10 | 11 | def test_basic_encode(self): 12 | self.assertEqual(r'"\u0026"', self.encoder.encode('&')) 13 | self.assertEqual(r'"\u003c"', self.encoder.encode('<')) 14 | self.assertEqual(r'"\u003e"', self.encoder.encode('>')) 15 | 16 | def test_basic_roundtrip(self): 17 | for char in '&<>': 18 | self.assertEqual( 19 | char, self.decoder.decode( 20 | self.encoder.encode(char))) 21 | 22 | def test_prevent_script_breakout(self): 23 | bad_string = '' 24 | self.assertEqual( 25 | r'"\u003c/script\u003e\u003cscript\u003e' 26 | r'alert(\"gotcha\")\u003c/script\u003e"', 27 | self.encoder.encode(bad_string)) 28 | self.assertEqual( 29 | bad_string, self.decoder.decode( 30 | self.encoder.encode(bad_string))) 31 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_speedups.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import unittest 3 | from unittest import TestCase 4 | 5 | from simplejson import encoder, scanner 6 | 7 | 8 | def has_speedups(): 9 | return encoder.c_make_encoder is not None 10 | 11 | 12 | def skip_if_speedups_missing(func): 13 | def wrapper(*args, **kwargs): 14 | if not has_speedups(): 15 | if hasattr(unittest, 'SkipTest'): 16 | raise unittest.SkipTest("C Extension not available") 17 | else: 18 | sys.stdout.write("C Extension not available") 19 | return 20 | return func(*args, **kwargs) 21 | 22 | return wrapper 23 | 24 | 25 | class TestDecode(TestCase): 26 | @skip_if_speedups_missing 27 | def test_make_scanner(self): 28 | self.assertRaises(AttributeError, scanner.c_make_scanner, 1) 29 | 30 | @skip_if_speedups_missing 31 | def test_make_encoder(self): 32 | self.assertRaises( 33 | TypeError, 34 | encoder.c_make_encoder, 35 | None, 36 | ("\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7" 37 | "\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75"), 38 | None 39 | ) 40 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_item_sort_key.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | from operator import itemgetter 5 | 6 | class TestItemSortKey(TestCase): 7 | def test_simple_first(self): 8 | a = {'a': 1, 'c': 5, 'jack': 'jill', 'pick': 'axe', 'array': [1, 5, 6, 9], 'tuple': (83, 12, 3), 'crate': 'dog', 'zeak': 'oh'} 9 | self.assertEqual( 10 | '{"a": 1, "c": 5, "crate": "dog", "jack": "jill", "pick": "axe", "zeak": "oh", "array": [1, 5, 6, 9], "tuple": [83, 12, 3]}', 11 | json.dumps(a, item_sort_key=json.simple_first)) 12 | 13 | def test_case(self): 14 | a = {'a': 1, 'c': 5, 'Jack': 'jill', 'pick': 'axe', 'Array': [1, 5, 6, 9], 'tuple': (83, 12, 3), 'crate': 'dog', 'zeak': 'oh'} 15 | self.assertEqual( 16 | '{"Array": [1, 5, 6, 9], "Jack": "jill", "a": 1, "c": 5, "crate": "dog", "pick": "axe", "tuple": [83, 12, 3], "zeak": "oh"}', 17 | json.dumps(a, item_sort_key=itemgetter(0))) 18 | self.assertEqual( 19 | '{"a": 1, "Array": [1, 5, 6, 9], "c": 5, "crate": "dog", "Jack": "jill", "pick": "axe", "tuple": [83, 12, 3], "zeak": "oh"}', 20 | json.dumps(a, item_sort_key=lambda kv: kv[0].lower())) 21 | -------------------------------------------------------------------------------- /ext_libs/simplejson/compat.py: -------------------------------------------------------------------------------- 1 | """Python 3 compatibility shims 2 | """ 3 | import sys 4 | if sys.version_info[0] < 3: 5 | PY3 = False 6 | def b(s): 7 | return s 8 | def u(s): 9 | return unicode(s, 'unicode_escape') 10 | import cStringIO as StringIO 11 | StringIO = BytesIO = StringIO.StringIO 12 | text_type = unicode 13 | binary_type = str 14 | string_types = (basestring,) 15 | integer_types = (int, long) 16 | unichr = unichr 17 | reload_module = reload 18 | def fromhex(s): 19 | return s.decode('hex') 20 | 21 | else: 22 | PY3 = True 23 | if sys.version_info[:2] >= (3, 4): 24 | from importlib import reload as reload_module 25 | else: 26 | from imp import reload as reload_module 27 | import codecs 28 | def b(s): 29 | return codecs.latin_1_encode(s)[0] 30 | def u(s): 31 | return s 32 | import io 33 | StringIO = io.StringIO 34 | BytesIO = io.BytesIO 35 | text_type = str 36 | binary_type = bytes 37 | string_types = (str,) 38 | integer_types = (int,) 39 | 40 | def unichr(s): 41 | return u(chr(s)) 42 | 43 | def fromhex(s): 44 | return bytes.fromhex(s) 45 | 46 | long_type = integer_types[-1] 47 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/CodeGeneration.py: -------------------------------------------------------------------------------- 1 | from Cython.Compiler.Visitor import VisitorTransform 2 | from Cython.Compiler.Nodes import StatListNode 3 | 4 | class ExtractPxdCode(VisitorTransform): 5 | """ 6 | Finds nodes in a pxd file that should generate code, and 7 | returns them in a StatListNode. 8 | 9 | The result is a tuple (StatListNode, ModuleScope), i.e. 10 | everything that is needed from the pxd after it is processed. 11 | 12 | A purer approach would be to seperately compile the pxd code, 13 | but the result would have to be slightly more sophisticated 14 | than pure strings (functions + wanted interned strings + 15 | wanted utility code + wanted cached objects) so for now this 16 | approach is taken. 17 | """ 18 | 19 | def __call__(self, root): 20 | self.funcs = [] 21 | self.visitchildren(root) 22 | return (StatListNode(root.pos, stats=self.funcs), root.scope) 23 | 24 | def visit_FuncDefNode(self, node): 25 | self.funcs.append(node) 26 | # Do not visit children, nested funcdefnodes will 27 | # also be moved by this action... 28 | return node 29 | 30 | def visit_Node(self, node): 31 | self.visitchildren(node) 32 | return node 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_iterable.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from StringIO import StringIO 3 | 4 | import simplejson as json 5 | 6 | def iter_dumps(obj, **kw): 7 | return ''.join(json.JSONEncoder(**kw).iterencode(obj)) 8 | 9 | def sio_dump(obj, **kw): 10 | sio = StringIO() 11 | json.dumps(obj, **kw) 12 | return sio.getvalue() 13 | 14 | class TestIterable(unittest.TestCase): 15 | def test_iterable(self): 16 | l = [1, 2, 3] 17 | for dumps in (json.dumps, iter_dumps, sio_dump): 18 | expect = dumps(l) 19 | default_expect = dumps(sum(l)) 20 | # Default is False 21 | self.assertRaises(TypeError, dumps, iter(l)) 22 | self.assertRaises(TypeError, dumps, iter(l), iterable_as_array=False) 23 | self.assertEqual(expect, dumps(iter(l), iterable_as_array=True)) 24 | # Ensure that the "default" gets called 25 | self.assertEqual(default_expect, dumps(iter(l), default=sum)) 26 | self.assertEqual(default_expect, dumps(iter(l), iterable_as_array=False, default=sum)) 27 | # Ensure that the "default" does not get called 28 | self.assertEqual( 29 | default_expect, 30 | dumps(iter(l), iterable_as_array=True, default=sum)) 31 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_subclass.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | import simplejson as json 3 | 4 | from decimal import Decimal 5 | 6 | class AlternateInt(int): 7 | def __repr__(self): 8 | return 'invalid json' 9 | __str__ = __repr__ 10 | 11 | 12 | class AlternateFloat(float): 13 | def __repr__(self): 14 | return 'invalid json' 15 | __str__ = __repr__ 16 | 17 | 18 | # class AlternateDecimal(Decimal): 19 | # def __repr__(self): 20 | # return 'invalid json' 21 | 22 | 23 | class TestSubclass(TestCase): 24 | def test_int(self): 25 | self.assertEqual(json.dumps(AlternateInt(1)), '1') 26 | self.assertEqual(json.dumps(AlternateInt(-1)), '-1') 27 | self.assertEqual(json.loads(json.dumps({AlternateInt(1): 1})), {'1': 1}) 28 | 29 | def test_float(self): 30 | self.assertEqual(json.dumps(AlternateFloat(1.0)), '1.0') 31 | self.assertEqual(json.dumps(AlternateFloat(-1.0)), '-1.0') 32 | self.assertEqual(json.loads(json.dumps({AlternateFloat(1.0): 1})), {'1.0': 1}) 33 | 34 | # NOTE: Decimal subclasses are not supported as-is 35 | # def test_decimal(self): 36 | # self.assertEqual(json.dumps(AlternateDecimal('1.0')), '1.0') 37 | # self.assertEqual(json.dumps(AlternateDecimal('-1.0')), '-1.0') 38 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tool.py: -------------------------------------------------------------------------------- 1 | r"""Command-line tool to validate and pretty-print JSON 2 | 3 | Usage:: 4 | 5 | $ echo '{"json":"obj"}' | python -m simplejson.tool 6 | { 7 | "json": "obj" 8 | } 9 | $ echo '{ 1.2:3.4}' | python -m simplejson.tool 10 | Expecting property name: line 1 column 2 (char 2) 11 | 12 | """ 13 | from __future__ import with_statement 14 | import sys 15 | import simplejson as json 16 | 17 | def main(): 18 | if len(sys.argv) == 1: 19 | infile = sys.stdin 20 | outfile = sys.stdout 21 | elif len(sys.argv) == 2: 22 | infile = open(sys.argv[1], 'r') 23 | outfile = sys.stdout 24 | elif len(sys.argv) == 3: 25 | infile = open(sys.argv[1], 'r') 26 | outfile = open(sys.argv[2], 'w') 27 | else: 28 | raise SystemExit(sys.argv[0] + " [infile [outfile]]") 29 | with infile: 30 | try: 31 | obj = json.load(infile, 32 | object_pairs_hook=json.OrderedDict, 33 | use_decimal=True) 34 | except ValueError: 35 | raise SystemExit(sys.exc_info()[1]) 36 | with outfile: 37 | json.dump(obj, outfile, sort_keys=True, indent=' ', use_decimal=True) 38 | outfile.write('\n') 39 | 40 | 41 | if __name__ == '__main__': 42 | main() 43 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/pythread.pxd: -------------------------------------------------------------------------------- 1 | 2 | 3 | cdef extern from "pythread.h": 4 | 5 | ctypedef void *PyThread_type_lock 6 | ctypedef void *PyThread_type_sema 7 | 8 | void PyThread_init_thread() 9 | long PyThread_start_new_thread(void (*)(void *), void *) 10 | void PyThread_exit_thread() 11 | long PyThread_get_thread_ident() 12 | 13 | PyThread_type_lock PyThread_allocate_lock() 14 | void PyThread_free_lock(PyThread_type_lock) 15 | int PyThread_acquire_lock(PyThread_type_lock, int mode) nogil 16 | void PyThread_release_lock(PyThread_type_lock) nogil 17 | 18 | enum: 19 | # 'mode' in PyThread_acquire_lock() 20 | WAIT_LOCK # 1 21 | NOWAIT_LOCK # 0 22 | 23 | ctypedef enum PyLockStatus: 24 | # return values of PyThread_acquire_lock() in CPython 3.2+ 25 | PY_LOCK_FAILURE = 0 26 | PY_LOCK_ACQUIRED = 1 27 | PY_LOCK_INTR 28 | 29 | size_t PyThread_get_stacksize() 30 | int PyThread_set_stacksize(size_t) 31 | 32 | # Thread Local Storage (TLS) API 33 | int PyThread_create_key() 34 | void PyThread_delete_key(int) 35 | int PyThread_set_key_value(int, void *) 36 | void * PyThread_get_key_value(int) 37 | void PyThread_delete_key_value(int key) 38 | 39 | # Cleanup after a fork 40 | void PyThread_ReInitTLS() 41 | -------------------------------------------------------------------------------- /ext_libs/Cython/Plex/Errors.py: -------------------------------------------------------------------------------- 1 | #======================================================================= 2 | # 3 | # Python Lexical Analyser 4 | # 5 | # Exception classes 6 | # 7 | #======================================================================= 8 | 9 | class PlexError(Exception): 10 | message = "" 11 | 12 | class PlexTypeError(PlexError, TypeError): 13 | pass 14 | 15 | class PlexValueError(PlexError, ValueError): 16 | pass 17 | 18 | class InvalidRegex(PlexError): 19 | pass 20 | 21 | class InvalidToken(PlexError): 22 | 23 | def __init__(self, token_number, message): 24 | PlexError.__init__(self, "Token number %d: %s" % (token_number, message)) 25 | 26 | class InvalidScanner(PlexError): 27 | pass 28 | 29 | class AmbiguousAction(PlexError): 30 | message = "Two tokens with different actions can match the same string" 31 | 32 | def __init__(self): 33 | pass 34 | 35 | class UnrecognizedInput(PlexError): 36 | scanner = None 37 | position = None 38 | state_name = None 39 | 40 | def __init__(self, scanner, state_name): 41 | self.scanner = scanner 42 | self.position = scanner.get_position() 43 | self.state_name = state_name 44 | 45 | def __str__(self): 46 | return ("'%s', line %d, char %d: Token not recognised in state %s" 47 | % (self.position + (repr(self.state_name),))) 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/locale.pxd: -------------------------------------------------------------------------------- 1 | # 7.11 Localization 2 | 3 | # deprecated cimport for backwards compatibility: 4 | from libc.string cimport const_char 5 | 6 | 7 | cdef extern from "locale.h" nogil: 8 | 9 | struct lconv: 10 | char *decimal_point 11 | char *thousands_sep 12 | char *grouping 13 | char *mon_decimal_point 14 | char *mon_thousands_sep 15 | char *mon_grouping 16 | char *positive_sign 17 | char *negative_sign 18 | char *currency_symbol 19 | char frac_digits 20 | char p_cs_precedes 21 | char n_cs_precedes 22 | char p_sep_by_space 23 | char n_sep_by_space 24 | char p_sign_posn 25 | char n_sign_posn 26 | char *int_curr_symbol 27 | char int_frac_digits 28 | char int_p_cs_precedes 29 | char int_n_cs_precedes 30 | char int_p_sep_by_space 31 | char int_n_sep_by_space 32 | char int_p_sign_posn 33 | char int_n_sign_posn 34 | 35 | enum: LC_ALL 36 | enum: LC_COLLATE 37 | enum: LC_CTYPE 38 | enum: LC_MONETARY 39 | enum: LC_NUMERIC 40 | enum: LC_TIME 41 | 42 | # 7.11.1 Locale control 43 | char *setlocale (int category, const char *locale) 44 | 45 | # 7.11.2 Numeric formatting convention inquiry 46 | lconv *localeconv () 47 | -------------------------------------------------------------------------------- /ext_libs/Cython/Plex/__init__.py: -------------------------------------------------------------------------------- 1 | #======================================================================= 2 | # 3 | # Python Lexical Analyser 4 | # 5 | #======================================================================= 6 | 7 | """ 8 | The Plex module provides lexical analysers with similar capabilities 9 | to GNU Flex. The following classes and functions are exported; 10 | see the attached docstrings for more information. 11 | 12 | Scanner For scanning a character stream under the 13 | direction of a Lexicon. 14 | 15 | Lexicon For constructing a lexical definition 16 | to be used by a Scanner. 17 | 18 | Str, Any, AnyBut, AnyChar, Seq, Alt, Opt, Rep, Rep1, 19 | Bol, Eol, Eof, Empty 20 | 21 | Regular expression constructors, for building pattern 22 | definitions for a Lexicon. 23 | 24 | State For defining scanner states when creating a 25 | Lexicon. 26 | 27 | TEXT, IGNORE, Begin 28 | 29 | Actions for associating with patterns when 30 | creating a Lexicon. 31 | """ 32 | 33 | from Actions import TEXT, IGNORE, Begin 34 | from Lexicons import Lexicon, State 35 | from Regexps import RE, Seq, Alt, Rep1, Empty, Str, Any, AnyBut, AnyChar, Range 36 | from Regexps import Opt, Rep, Bol, Eol, Eof, Case, NoCase 37 | from Scanners import Scanner 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ext_libs/Cython/Plex/Scanners.pxd: -------------------------------------------------------------------------------- 1 | import cython 2 | 3 | from Cython.Plex.Actions cimport Action 4 | 5 | cdef class Scanner: 6 | 7 | cdef public lexicon 8 | cdef public stream 9 | cdef public name 10 | cdef public unicode buffer 11 | cdef public Py_ssize_t buf_start_pos 12 | cdef public Py_ssize_t next_pos 13 | cdef public Py_ssize_t cur_pos 14 | cdef public Py_ssize_t cur_line 15 | cdef public Py_ssize_t cur_line_start 16 | cdef public Py_ssize_t start_pos 17 | cdef public Py_ssize_t start_line 18 | cdef public Py_ssize_t start_col 19 | cdef public text 20 | cdef public initial_state # int? 21 | cdef public state_name 22 | cdef public list queue 23 | cdef public bint trace 24 | cdef public cur_char 25 | cdef public int input_state 26 | 27 | cdef public level 28 | 29 | @cython.locals(input_state=long) 30 | cdef next_char(self) 31 | @cython.locals(action=Action) 32 | cdef tuple read(self) 33 | cdef tuple scan_a_token(self) 34 | cdef tuple position(self) 35 | 36 | @cython.locals(cur_pos=long, cur_line=long, cur_line_start=long, 37 | input_state=long, next_pos=long, state=dict, 38 | buf_start_pos=long, buf_len=long, buf_index=long, 39 | trace=bint, discard=long, data=unicode, buffer=unicode) 40 | cdef run_machine_inlined(self) 41 | 42 | cdef begin(self, state) 43 | cdef produce(self, value, text = *) 44 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/iterator.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "Python.h": 2 | 3 | ############################################################################ 4 | # 6.5 Iterator Protocol 5 | ############################################################################ 6 | bint PyIter_Check(object o) 7 | # Return true if the object o supports the iterator protocol. 8 | 9 | object PyIter_Next(object o) 10 | # Return value: New reference. 11 | # Return the next value from the iteration o. If the object is an 12 | # iterator, this retrieves the next value from the iteration, and 13 | # returns NULL with no exception set if there are no remaining 14 | # items. If the object is not an iterator, TypeError is raised, or 15 | # if there is an error in retrieving the item, returns NULL and 16 | # passes along the exception. 17 | 18 | # To write a loop which iterates over an iterator, the C code should look something like this: 19 | # PyObject *iterator = PyObject_GetIter(obj); 20 | # PyObject *item; 21 | # if (iterator == NULL) { 22 | # /* propagate error */ 23 | # } 24 | # while (item = PyIter_Next(iterator)) { 25 | # /* do something with item */ 26 | # ... 27 | # /* release reference when done */ 28 | # Py_DECREF(item); 29 | # } 30 | # Py_DECREF(iterator); 31 | # if (PyErr_Occurred()) { 32 | # /* propagate error */ 33 | # } 34 | # else { 35 | # /* continue doing useful work */ 36 | # } 37 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/posix/fcntl.pxd: -------------------------------------------------------------------------------- 1 | # http://www.opengroup.org/onlinepubs/009695399/basedefs/fcntl.h.html 2 | 3 | cdef extern from "fcntl.h" nogil: 4 | 5 | enum: F_DUPFD 6 | enum: F_GETFD 7 | enum: F_SETFD 8 | enum: F_GETFL 9 | enum: F_SETFL 10 | enum: F_GETLK 11 | enum: F_SETLK 12 | enum: F_SETLKW 13 | enum: F_GETOWN 14 | enum: F_SETOWN 15 | 16 | enum: FD_CLOEXEC 17 | 18 | enum: F_RDLCK 19 | enum: F_UNLCK 20 | enum: F_WRLCK 21 | 22 | enum: SEEK_SET 23 | enum: SEEK_CUR 24 | enum: SEEK_END 25 | 26 | enum: O_CREAT 27 | enum: O_EXCL 28 | enum: O_NOCTTY 29 | enum: O_TRUNC 30 | 31 | enum: O_APPEND 32 | enum: O_DSYNC 33 | enum: O_NONBLOCK 34 | enum: O_RSYNC 35 | enum: O_SYNC 36 | 37 | enum: O_ACCMODE # O_RDONLY|O_WRONLY|O_RDWR 38 | 39 | enum: O_RDONLY 40 | enum: O_WRONLY 41 | enum: O_RDWR 42 | 43 | enum: S_IFMT 44 | enum: S_IFBLK 45 | enum: S_IFCHR 46 | enum: S_IFIFO 47 | enum: S_IFREG 48 | enum: S_IFDIR 49 | enum: S_IFLNK 50 | enum: S_IFSOCK 51 | 52 | ctypedef int mode_t 53 | ctypedef signed pid_t 54 | ctypedef signed off_t 55 | 56 | struct flock: 57 | short l_type 58 | short l_whence 59 | off_t l_start 60 | off_t l_len 61 | pid_t l_pid 62 | 63 | int creat(char *, mode_t) 64 | int fcntl(int, int, ...) 65 | int open(char *, int, ...) 66 | #int open (char *, int, mode_t) 67 | 68 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/bool.pxd: -------------------------------------------------------------------------------- 1 | 2 | cdef extern from "Python.h": 3 | 4 | ############################################################################ 5 | # 7.2.2 Boolean Objects 6 | ############################################################################ 7 | 8 | ctypedef class __builtin__.bool [object PyBoolObject]: 9 | pass 10 | 11 | # Booleans in Python are implemented as a subclass of 12 | # integers. There are only two booleans, Py_False and Py_True. As 13 | # such, the normal creation and deletion functions don't apply to 14 | # booleans. The following macros are available, however. 15 | 16 | bint PyBool_Check(object o) 17 | # Return true if o is of type PyBool_Type. 18 | 19 | #PyObject* Py_False 20 | # The Python False object. This object has no methods. It needs to 21 | # be treated just like any other object with respect to reference 22 | # counts. 23 | 24 | #PyObject* Py_True 25 | # The Python True object. This object has no methods. It needs to 26 | # be treated just like any other object with respect to reference 27 | # counts. 28 | 29 | # Py_RETURN_FALSE 30 | # Return Py_False from a function, properly incrementing its reference count. 31 | 32 | # Py_RETURN_TRUE 33 | # Return Py_True from a function, properly incrementing its reference count. 34 | 35 | object PyBool_FromLong(long v) 36 | # Return value: New reference. 37 | # Return a new reference to Py_True or Py_False depending on the truth value of v. 38 | 39 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/signal.pxd: -------------------------------------------------------------------------------- 1 | # 7.14 Signal handling 2 | 3 | ctypedef void (*sighandler_t)(int SIGNUM) nogil 4 | 5 | cdef extern from "signal.h" nogil: 6 | 7 | ctypedef int sig_atomic_t 8 | 9 | enum: SIGABRT 10 | enum: SIGFPE 11 | enum: SIGILL 12 | enum: SIGINT 13 | enum: SIGSEGV 14 | enum: SIGTERM 15 | 16 | sighandler_t SIG_DFL 17 | sighandler_t SIG_IGN 18 | sighandler_t SIG_ERR 19 | 20 | sighandler_t signal (int signum, sighandler_t action) 21 | int raise_"raise" (int signum) 22 | 23 | 24 | cdef extern from "signal.h" nogil: 25 | 26 | # Program Error 27 | enum: SIGFPE 28 | enum: SIGILL 29 | enum: SIGSEGV 30 | enum: SIGBUS 31 | enum: SIGABRT 32 | enum: SIGIOT 33 | enum: SIGTRAP 34 | enum: SIGEMT 35 | enum: SIGSYS 36 | # Termination 37 | enum: SIGTERM 38 | enum: SIGINT 39 | enum: SIGQUIT 40 | enum: SIGKILL 41 | enum: SIGHUP 42 | # Alarm 43 | enum: SIGALRM 44 | enum: SIGVTALRM 45 | enum: SIGPROF 46 | # Asynchronous I/O 47 | enum: SIGIO 48 | enum: SIGURG 49 | enum: SIGPOLL 50 | # Job Control 51 | enum: SIGCHLD 52 | enum: SIGCLD 53 | enum: SIGCONT 54 | enum: SIGSTOP 55 | enum: SIGTSTP 56 | enum: SIGTTIN 57 | enum: SIGTTOU 58 | # Operation Error 59 | enum: SIGPIPE 60 | enum: SIGLOST 61 | enum: SIGXCPU 62 | enum: SIGXFSZ 63 | # Miscellaneous 64 | enum: SIGUSR1 65 | enum: SIGUSR2 66 | enum: SIGWINCH 67 | enum: SIGINFO 68 | 69 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_float.py: -------------------------------------------------------------------------------- 1 | import math 2 | from unittest import TestCase 3 | from simplejson.compat import long_type, text_type 4 | import simplejson as json 5 | from simplejson.decoder import NaN, PosInf, NegInf 6 | 7 | class TestFloat(TestCase): 8 | def test_degenerates_allow(self): 9 | for inf in (PosInf, NegInf): 10 | self.assertEqual(json.loads(json.dumps(inf)), inf) 11 | # Python 2.5 doesn't have math.isnan 12 | nan = json.loads(json.dumps(NaN)) 13 | self.assertTrue((0 + nan) != nan) 14 | 15 | def test_degenerates_ignore(self): 16 | for f in (PosInf, NegInf, NaN): 17 | self.assertEqual(json.loads(json.dumps(f, ignore_nan=True)), None) 18 | 19 | def test_degenerates_deny(self): 20 | for f in (PosInf, NegInf, NaN): 21 | self.assertRaises(ValueError, json.dumps, f, allow_nan=False) 22 | 23 | def test_floats(self): 24 | for num in [1617161771.7650001, math.pi, math.pi**100, 25 | math.pi**-100, 3.1]: 26 | self.assertEqual(float(json.dumps(num)), num) 27 | self.assertEqual(json.loads(json.dumps(num)), num) 28 | self.assertEqual(json.loads(text_type(json.dumps(num))), num) 29 | 30 | def test_ints(self): 31 | for num in [1, long_type(1), 1<<32, 1<<64]: 32 | self.assertEqual(json.dumps(num), str(num)) 33 | self.assertEqual(int(json.dumps(num)), num) 34 | self.assertEqual(json.loads(json.dumps(num)), num) 35 | self.assertEqual(json.loads(text_type(json.dumps(num))), num) 36 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/float.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "Python.h": 2 | 3 | ############################################################################ 4 | # 7.2.3 5 | ############################################################################ 6 | # PyFloatObject 7 | # 8 | # This subtype of PyObject represents a Python floating point object. 9 | 10 | # PyTypeObject PyFloat_Type 11 | # 12 | # This instance of PyTypeObject represents the Python floating 13 | # point type. This is the same object as float and 14 | # types.FloatType. 15 | 16 | bint PyFloat_Check(object p) 17 | # Return true if its argument is a PyFloatObject or a subtype of 18 | # PyFloatObject. 19 | 20 | bint PyFloat_CheckExact(object p) 21 | # Return true if its argument is a PyFloatObject, but not a 22 | # subtype of PyFloatObject. 23 | 24 | object PyFloat_FromString(object str, char **pend) 25 | # Return value: New reference. 26 | # Create a PyFloatObject object based on the string value in str, 27 | # or NULL on failure. The pend argument is ignored. It remains 28 | # only for backward compatibility. 29 | 30 | object PyFloat_FromDouble(double v) 31 | # Return value: New reference. 32 | # Create a PyFloatObject object from v, or NULL on failure. 33 | 34 | double PyFloat_AsDouble(object pyfloat) except? -1 35 | # Return a C double representation of the contents of pyfloat. 36 | 37 | double PyFloat_AS_DOUBLE(object pyfloat) except? -1 38 | # Return a C double representation of the contents of pyfloat, but 39 | # without error checking. 40 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/cobject.pxd: -------------------------------------------------------------------------------- 1 | from cpython.ref cimport PyObject 2 | 3 | cdef extern from "Python.h": 4 | 5 | ########################################################################### 6 | # Warning: 7 | # 8 | # The CObject API is deprecated as of Python 3.1. Please switch to 9 | # the new Capsules API. 10 | ########################################################################### 11 | 12 | int PyCObject_Check(object p) 13 | # Return true if its argument is a PyCObject. 14 | 15 | object PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *)) 16 | # Return value: New reference. 17 | # 18 | # Create a PyCObject from the void * cobj. The destr function will 19 | # be called when the object is reclaimed, unless it is NULL. 20 | 21 | object PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc, void (*destr)(void *, void *)) 22 | # Return value: New reference. 23 | # 24 | # Create a PyCObject from the void * cobj. The destr function will 25 | # be called when the object is reclaimed. The desc argument can be 26 | # used to pass extra callback data for the destructor function. 27 | 28 | void* PyCObject_AsVoidPtr(object self) except? NULL 29 | # Return the object void * that the PyCObject self was created with. 30 | 31 | void* PyCObject_GetDesc(object self) except? NULL 32 | # Return the description void * that the PyCObject self was created with. 33 | 34 | int PyCObject_SetVoidPtr(object self, void* cobj) except 0 35 | # Set the void pointer inside self to cobj. The PyCObject must not 36 | # have an associated destructor. Return true on success, false on 37 | # failure. 38 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_errors.py: -------------------------------------------------------------------------------- 1 | import sys, pickle 2 | from unittest import TestCase 3 | 4 | import simplejson as json 5 | from simplejson.compat import u, b 6 | 7 | class TestErrors(TestCase): 8 | def test_string_keys_error(self): 9 | data = [{'a': 'A', 'b': (2, 4), 'c': 3.0, ('d',): 'D tuple'}] 10 | self.assertRaises(TypeError, json.dumps, data) 11 | 12 | def test_decode_error(self): 13 | err = None 14 | try: 15 | json.loads('{}\na\nb') 16 | except json.JSONDecodeError: 17 | err = sys.exc_info()[1] 18 | else: 19 | self.fail('Expected JSONDecodeError') 20 | self.assertEqual(err.lineno, 2) 21 | self.assertEqual(err.colno, 1) 22 | self.assertEqual(err.endlineno, 3) 23 | self.assertEqual(err.endcolno, 2) 24 | 25 | def test_scan_error(self): 26 | err = None 27 | for t in (u, b): 28 | try: 29 | json.loads(t('{"asdf": "')) 30 | except json.JSONDecodeError: 31 | err = sys.exc_info()[1] 32 | else: 33 | self.fail('Expected JSONDecodeError') 34 | self.assertEqual(err.lineno, 1) 35 | self.assertEqual(err.colno, 10) 36 | 37 | def test_error_is_pickable(self): 38 | err = None 39 | try: 40 | json.loads('{}\na\nb') 41 | except json.JSONDecodeError: 42 | err = sys.exc_info()[1] 43 | else: 44 | self.fail('Expected JSONDecodeError') 45 | s = pickle.dumps(err) 46 | e = pickle.loads(s) 47 | 48 | self.assertEqual(err.msg, e.msg) 49 | self.assertEqual(err.doc, e.doc) 50 | self.assertEqual(err.pos, e.pos) 51 | self.assertEqual(err.end, e.end) 52 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Visitor.pxd: -------------------------------------------------------------------------------- 1 | cimport cython 2 | 3 | cdef class TreeVisitor: 4 | cdef public list access_path 5 | cdef dict dispatch_table 6 | 7 | cpdef visit(self, obj) 8 | cdef _visit(self, obj) 9 | cdef find_handler(self, obj) 10 | cdef _visitchild(self, child, parent, attrname, idx) 11 | cdef dict _visitchildren(self, parent, attrs) 12 | cpdef visitchildren(self, parent, attrs=*) 13 | 14 | cdef class VisitorTransform(TreeVisitor): 15 | cpdef visitchildren(self, parent, attrs=*) 16 | cpdef recurse_to_children(self, node) 17 | 18 | cdef class CythonTransform(VisitorTransform): 19 | cdef public context 20 | cdef public current_directives 21 | 22 | cdef class ScopeTrackingTransform(CythonTransform): 23 | cdef public scope_type 24 | cdef public scope_node 25 | cdef visit_scope(self, node, scope_type) 26 | 27 | cdef class EnvTransform(CythonTransform): 28 | cdef public list env_stack 29 | 30 | cdef class MethodDispatcherTransform(EnvTransform): 31 | @cython.final 32 | cdef _visit_binop_node(self, node) 33 | @cython.final 34 | cdef _find_handler(self, match_name, bint has_kwargs) 35 | @cython.final 36 | cdef _delegate_to_assigned_value(self, node, function, arg_list, kwargs) 37 | @cython.final 38 | cdef _dispatch_to_handler(self, node, function, arg_list, kwargs) 39 | @cython.final 40 | cdef _dispatch_to_method_handler(self, attr_name, self_arg, 41 | is_unbound_method, type_name, 42 | node, function, arg_list, kwargs) 43 | 44 | cdef class RecursiveNodeReplacer(VisitorTransform): 45 | cdef public orig_node 46 | cdef public new_node 47 | 48 | cdef class NodeFinder(TreeVisitor): 49 | cdef node 50 | cdef public bint found 51 | -------------------------------------------------------------------------------- /ext_libs/Cython/Build/Tests/TestStripLiterals.py: -------------------------------------------------------------------------------- 1 | from Cython.Build.Dependencies import strip_string_literals 2 | 3 | from Cython.TestUtils import CythonTest 4 | 5 | class TestStripLiterals(CythonTest): 6 | 7 | def t(self, before, expected): 8 | actual, literals = strip_string_literals(before, prefix="_L") 9 | self.assertEquals(expected, actual) 10 | for key, value in literals.items(): 11 | actual = actual.replace(key, value) 12 | self.assertEquals(before, actual) 13 | 14 | def test_empty(self): 15 | self.t("", "") 16 | 17 | def test_single_quote(self): 18 | self.t("'x'", "'_L1_'") 19 | 20 | def test_double_quote(self): 21 | self.t('"x"', '"_L1_"') 22 | 23 | def test_nested_quotes(self): 24 | self.t(""" '"' "'" """, """ '_L1_' "_L2_" """) 25 | 26 | def test_triple_quote(self): 27 | self.t(" '''a\n''' ", " '''_L1_''' ") 28 | 29 | def test_backslash(self): 30 | self.t(r"'a\'b'", "'_L1_'") 31 | self.t(r"'a\\'", "'_L1_'") 32 | self.t(r"'a\\\'b'", "'_L1_'") 33 | 34 | def test_unicode(self): 35 | self.t("u'abc'", "u'_L1_'") 36 | 37 | def test_raw(self): 38 | self.t(r"r'abc\\'", "r'_L1_'") 39 | 40 | def test_raw_unicode(self): 41 | self.t(r"ru'abc\\'", "ru'_L1_'") 42 | 43 | def test_comment(self): 44 | self.t("abc # foo", "abc #_L1_") 45 | 46 | def test_comment_and_quote(self): 47 | self.t("abc # 'x'", "abc #_L1_") 48 | self.t("'abc#'", "'_L1_'") 49 | 50 | def test_include(self): 51 | self.t("include 'a.pxi' # something here", 52 | "include '_L1_' #_L2_") 53 | 54 | def test_extern(self): 55 | self.t("cdef extern from 'a.h': # comment", 56 | "cdef extern from '_L1_': #_L2_") 57 | 58 | -------------------------------------------------------------------------------- /ext_libs/Cython/Utility/CppSupport.cpp: -------------------------------------------------------------------------------- 1 | /////////////// CppExceptionConversion.proto /////////////// 2 | 3 | #ifndef __Pyx_CppExn2PyErr 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | static void __Pyx_CppExn2PyErr() { 10 | // Catch a handful of different errors here and turn them into the 11 | // equivalent Python errors. 12 | try { 13 | if (PyErr_Occurred()) 14 | ; // let the latest Python exn pass through and ignore the current one 15 | else 16 | throw; 17 | } catch (const std::bad_alloc& exn) { 18 | PyErr_SetString(PyExc_MemoryError, exn.what()); 19 | } catch (const std::bad_cast& exn) { 20 | PyErr_SetString(PyExc_TypeError, exn.what()); 21 | } catch (const std::domain_error& exn) { 22 | PyErr_SetString(PyExc_ValueError, exn.what()); 23 | } catch (const std::invalid_argument& exn) { 24 | PyErr_SetString(PyExc_ValueError, exn.what()); 25 | } catch (const std::ios_base::failure& exn) { 26 | // Unfortunately, in standard C++ we have no way of distinguishing EOF 27 | // from other errors here; be careful with the exception mask 28 | PyErr_SetString(PyExc_IOError, exn.what()); 29 | } catch (const std::out_of_range& exn) { 30 | // Change out_of_range to IndexError 31 | PyErr_SetString(PyExc_IndexError, exn.what()); 32 | } catch (const std::overflow_error& exn) { 33 | PyErr_SetString(PyExc_OverflowError, exn.what()); 34 | } catch (const std::range_error& exn) { 35 | PyErr_SetString(PyExc_ArithmeticError, exn.what()); 36 | } catch (const std::underflow_error& exn) { 37 | PyErr_SetString(PyExc_ArithmeticError, exn.what()); 38 | } catch (const std::exception& exn) { 39 | PyErr_SetString(PyExc_RuntimeError, exn.what()); 40 | } 41 | catch (...) 42 | { 43 | PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); 44 | } 45 | } 46 | #endif 47 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Scanning.pxd: -------------------------------------------------------------------------------- 1 | import cython 2 | 3 | from Cython.Plex.Scanners cimport Scanner 4 | 5 | cdef class Method: 6 | cdef object name 7 | cdef object __name__ 8 | 9 | cdef class CompileTimeScope: 10 | cdef public dict entries 11 | cdef public CompileTimeScope outer 12 | cdef declare(self, name, value) 13 | cdef lookup_here(self, name) 14 | cpdef lookup(self, name) 15 | 16 | cdef class PyrexScanner(Scanner): 17 | cdef public context 18 | cdef public list included_files 19 | cdef public CompileTimeScope compile_time_env 20 | cdef public bint compile_time_eval 21 | cdef public bint compile_time_expr 22 | cdef public bint parse_comments 23 | cdef public bint in_python_file 24 | cdef public source_encoding 25 | cdef set keywords 26 | cdef public list indentation_stack 27 | cdef public indentation_char 28 | cdef public int bracket_nesting_level 29 | cdef public sy 30 | cdef public systring 31 | 32 | cdef long current_level(self) 33 | #cpdef commentline(self, text) 34 | #cpdef open_bracket_action(self, text) 35 | #cpdef close_bracket_action(self, text) 36 | #cpdef newline_action(self, text) 37 | #cpdef begin_string_action(self, text) 38 | #cpdef end_string_action(self, text) 39 | #cpdef unclosed_string_action(self, text) 40 | @cython.locals(current_level=cython.long, new_level=cython.long) 41 | cpdef indentation_action(self, text) 42 | #cpdef eof_action(self, text) 43 | cdef next(self) 44 | cdef peek(self) 45 | #cpdef put_back(self, sy, systring) 46 | #cdef unread(self, token, value) 47 | cdef bint expect(self, what, message = *) except -2 48 | cdef expect_keyword(self, what, message = *) 49 | cdef expected(self, what, message = *) 50 | cdef expect_indent(self) 51 | cdef expect_dedent(self) 52 | cdef expect_newline(self, message = *) 53 | -------------------------------------------------------------------------------- /ext_libs/Cython/Utility/TestCythonScope.pyx: -------------------------------------------------------------------------------- 1 | ########## TestClass ########## 2 | # These utilities are for testing purposes 3 | 4 | cdef extern from *: 5 | cdef object __pyx_test_dep(object) 6 | 7 | @cname('__pyx_TestClass') 8 | cdef class TestClass(object): 9 | cdef public int value 10 | 11 | def __init__(self, int value): 12 | self.value = value 13 | 14 | def __str__(self): 15 | return 'TestClass(%d)' % self.value 16 | 17 | cdef cdef_method(self, int value): 18 | print 'Hello from cdef_method', value 19 | 20 | cpdef cpdef_method(self, int value): 21 | print 'Hello from cpdef_method', value 22 | 23 | def def_method(self, int value): 24 | print 'Hello from def_method', value 25 | 26 | @cname('cdef_cname') 27 | cdef cdef_cname_method(self, int value): 28 | print "Hello from cdef_cname_method", value 29 | 30 | @cname('cpdef_cname') 31 | cpdef cpdef_cname_method(self, int value): 32 | print "Hello from cpdef_cname_method", value 33 | 34 | @cname('def_cname') 35 | def def_cname_method(self, int value): 36 | print "Hello from def_cname_method", value 37 | 38 | @cname('__pyx_test_call_other_cy_util') 39 | cdef test_call(obj): 40 | print 'test_call' 41 | __pyx_test_dep(obj) 42 | 43 | @cname('__pyx_TestClass_New') 44 | cdef _testclass_new(int value): 45 | return TestClass(value) 46 | 47 | ########### TestDep ########## 48 | 49 | @cname('__pyx_test_dep') 50 | cdef test_dep(obj): 51 | print 'test_dep', obj 52 | 53 | ########## TestScope ########## 54 | 55 | @cname('__pyx_testscope') 56 | cdef object _testscope(int value): 57 | return "hello from cython scope, value=%d" % value 58 | 59 | ########## View.TestScope ########## 60 | 61 | @cname('__pyx_view_testscope') 62 | cdef object _testscope(int value): 63 | return "hello from cython.view scope, value=%d" % value 64 | 65 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/openmp.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "omp.h": 2 | ctypedef struct omp_lock_t: 3 | pass 4 | ctypedef struct omp_nest_lock_t: 5 | pass 6 | 7 | ctypedef enum omp_sched_t: 8 | omp_sched_static = 1, 9 | omp_sched_dynamic = 2, 10 | omp_sched_guided = 3, 11 | omp_sched_auto = 4 12 | 13 | extern void omp_set_num_threads(int) nogil 14 | extern int omp_get_num_threads() nogil 15 | extern int omp_get_max_threads() nogil 16 | extern int omp_get_thread_num() nogil 17 | extern int omp_get_num_procs() nogil 18 | 19 | extern int omp_in_parallel() nogil 20 | 21 | extern void omp_set_dynamic(int) nogil 22 | extern int omp_get_dynamic() nogil 23 | 24 | extern void omp_set_nested(int) nogil 25 | extern int omp_get_nested() nogil 26 | 27 | extern void omp_init_lock(omp_lock_t *) nogil 28 | extern void omp_destroy_lock(omp_lock_t *) nogil 29 | extern void omp_set_lock(omp_lock_t *) nogil 30 | extern void omp_unset_lock(omp_lock_t *) nogil 31 | extern int omp_test_lock(omp_lock_t *) nogil 32 | 33 | extern void omp_init_nest_lock(omp_nest_lock_t *) nogil 34 | extern void omp_destroy_nest_lock(omp_nest_lock_t *) nogil 35 | extern void omp_set_nest_lock(omp_nest_lock_t *) nogil 36 | extern void omp_unset_nest_lock(omp_nest_lock_t *) nogil 37 | extern int omp_test_nest_lock(omp_nest_lock_t *) nogil 38 | 39 | extern double omp_get_wtime() nogil 40 | extern double omp_get_wtick() nogil 41 | 42 | void omp_set_schedule(omp_sched_t, int) nogil 43 | void omp_get_schedule(omp_sched_t *, int *) nogil 44 | int omp_get_thread_limit() nogil 45 | void omp_set_max_active_levels(int) nogil 46 | int omp_get_max_active_levels() nogil 47 | int omp_get_level() nogil 48 | int omp_get_ancestor_thread_num(int) nogil 49 | int omp_get_team_size(int) nogil 50 | int omp_get_active_level() nogil 51 | 52 | -------------------------------------------------------------------------------- /ext_libs/Cython/Build/Tests/TestInline.py: -------------------------------------------------------------------------------- 1 | import os, tempfile 2 | from Cython.Shadow import inline 3 | from Cython.Build.Inline import safe_type 4 | from Cython.TestUtils import CythonTest 5 | 6 | try: 7 | import numpy 8 | has_numpy = True 9 | except: 10 | has_numpy = False 11 | 12 | test_kwds = dict(force=True, quiet=True) 13 | 14 | global_value = 100 15 | 16 | class TestInline(CythonTest): 17 | def setUp(self): 18 | CythonTest.setUp(self) 19 | self.test_kwds = dict(test_kwds) 20 | if os.path.isdir('BUILD'): 21 | lib_dir = os.path.join('BUILD','inline') 22 | else: 23 | lib_dir = tempfile.mkdtemp(prefix='cython_inline_') 24 | self.test_kwds['lib_dir'] = lib_dir 25 | 26 | def test_simple(self): 27 | self.assertEquals(inline("return 1+2", **self.test_kwds), 3) 28 | 29 | def test_types(self): 30 | self.assertEquals(inline(""" 31 | cimport cython 32 | return cython.typeof(a), cython.typeof(b) 33 | """, a=1.0, b=[], **self.test_kwds), ('double', 'list object')) 34 | 35 | def test_locals(self): 36 | a = 1 37 | b = 2 38 | self.assertEquals(inline("return a+b", **self.test_kwds), 3) 39 | 40 | def test_globals(self): 41 | self.assertEquals(inline("return global_value + 1", **self.test_kwds), global_value + 1) 42 | 43 | def test_pure(self): 44 | import cython as cy 45 | b = inline(""" 46 | b = cy.declare(float, a) 47 | c = cy.declare(cy.pointer(cy.float), &b) 48 | return b 49 | """, a=3) 50 | self.assertEquals(type(b), float) 51 | 52 | if has_numpy: 53 | 54 | def test_numpy(self): 55 | import numpy 56 | a = numpy.ndarray((10, 20)) 57 | a[0,0] = 10 58 | self.assertEquals(safe_type(a), 'numpy.ndarray[numpy.float64_t, ndim=2]') 59 | self.assertEquals(inline("return a[0,0]", a=a, **self.test_kwds), 10.0) 60 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_recursion.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | 5 | class JSONTestObject: 6 | pass 7 | 8 | 9 | class RecursiveJSONEncoder(json.JSONEncoder): 10 | recurse = False 11 | def default(self, o): 12 | if o is JSONTestObject: 13 | if self.recurse: 14 | return [JSONTestObject] 15 | else: 16 | return 'JSONTestObject' 17 | return json.JSONEncoder.default(o) 18 | 19 | 20 | class TestRecursion(TestCase): 21 | def test_listrecursion(self): 22 | x = [] 23 | x.append(x) 24 | try: 25 | json.dumps(x) 26 | except ValueError: 27 | pass 28 | else: 29 | self.fail("didn't raise ValueError on list recursion") 30 | x = [] 31 | y = [x] 32 | x.append(y) 33 | try: 34 | json.dumps(x) 35 | except ValueError: 36 | pass 37 | else: 38 | self.fail("didn't raise ValueError on alternating list recursion") 39 | y = [] 40 | x = [y, y] 41 | # ensure that the marker is cleared 42 | json.dumps(x) 43 | 44 | def test_dictrecursion(self): 45 | x = {} 46 | x["test"] = x 47 | try: 48 | json.dumps(x) 49 | except ValueError: 50 | pass 51 | else: 52 | self.fail("didn't raise ValueError on dict recursion") 53 | x = {} 54 | y = {"a": x, "b": x} 55 | # ensure that the marker is cleared 56 | json.dumps(y) 57 | 58 | def test_defaultrecursion(self): 59 | enc = RecursiveJSONEncoder() 60 | self.assertEqual(enc.encode(JSONTestObject), '"JSONTestObject"') 61 | enc.recurse = True 62 | try: 63 | enc.encode(JSONTestObject) 64 | except ValueError: 65 | pass 66 | else: 67 | self.fail("didn't raise ValueError on default recursion") 68 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/complex.pxd: -------------------------------------------------------------------------------- 1 | 2 | cdef extern from "Python.h": 3 | 4 | ctypedef struct Py_complex: 5 | double imag 6 | double real 7 | 8 | ############################################################################ 9 | # 7.2.5.2 Complex Numbers as Python Objects 10 | ############################################################################ 11 | 12 | # PyComplexObject 13 | # This subtype of PyObject represents a Python complex number object. 14 | 15 | ctypedef class __builtin__.complex [object PyComplexObject]: 16 | cdef Py_complex cval 17 | # not making these available to keep them read-only: 18 | #cdef double imag "cval.imag" 19 | #cdef double real "cval.real" 20 | 21 | # PyTypeObject PyComplex_Type 22 | # This instance of PyTypeObject represents the Python complex 23 | # number type. It is the same object as complex and 24 | # types.ComplexType. 25 | 26 | bint PyComplex_Check(object p) 27 | # Return true if its argument is a PyComplexObject or a subtype of 28 | # PyComplexObject. 29 | 30 | bint PyComplex_CheckExact(object p) 31 | # Return true if its argument is a PyComplexObject, but not a subtype of PyComplexObject. 32 | 33 | object PyComplex_FromCComplex(Py_complex v) 34 | # Return value: New reference. 35 | # Create a new Python complex number object from a C Py_complex value. 36 | 37 | object PyComplex_FromDoubles(double real, double imag) 38 | # Return value: New reference. 39 | # Return a new PyComplexObject object from real and imag. 40 | 41 | double PyComplex_RealAsDouble(object op) except? -1 42 | # Return the real part of op as a C double. 43 | 44 | double PyComplex_ImagAsDouble(object op) except? -1 45 | # Return the imaginary part of op as a C double. 46 | 47 | Py_complex PyComplex_AsCComplex(object op) 48 | # Return the Py_complex value of the complex number op. 49 | # 50 | # Returns (-1+0i) in case of an error 51 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_tuple.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from simplejson.compat import StringIO 4 | import simplejson as json 5 | 6 | class TestTuples(unittest.TestCase): 7 | def test_tuple_array_dumps(self): 8 | t = (1, 2, 3) 9 | expect = json.dumps(list(t)) 10 | # Default is True 11 | self.assertEqual(expect, json.dumps(t)) 12 | self.assertEqual(expect, json.dumps(t, tuple_as_array=True)) 13 | self.assertRaises(TypeError, json.dumps, t, tuple_as_array=False) 14 | # Ensure that the "default" does not get called 15 | self.assertEqual(expect, json.dumps(t, default=repr)) 16 | self.assertEqual(expect, json.dumps(t, tuple_as_array=True, 17 | default=repr)) 18 | # Ensure that the "default" gets called 19 | self.assertEqual( 20 | json.dumps(repr(t)), 21 | json.dumps(t, tuple_as_array=False, default=repr)) 22 | 23 | def test_tuple_array_dump(self): 24 | t = (1, 2, 3) 25 | expect = json.dumps(list(t)) 26 | # Default is True 27 | sio = StringIO() 28 | json.dump(t, sio) 29 | self.assertEqual(expect, sio.getvalue()) 30 | sio = StringIO() 31 | json.dump(t, sio, tuple_as_array=True) 32 | self.assertEqual(expect, sio.getvalue()) 33 | self.assertRaises(TypeError, json.dump, t, StringIO(), 34 | tuple_as_array=False) 35 | # Ensure that the "default" does not get called 36 | sio = StringIO() 37 | json.dump(t, sio, default=repr) 38 | self.assertEqual(expect, sio.getvalue()) 39 | sio = StringIO() 40 | json.dump(t, sio, tuple_as_array=True, default=repr) 41 | self.assertEqual(expect, sio.getvalue()) 42 | # Ensure that the "default" gets called 43 | sio = StringIO() 44 | json.dump(t, sio, tuple_as_array=False, default=repr) 45 | self.assertEqual( 46 | json.dumps(repr(t)), 47 | sio.getvalue()) 48 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/type.pxd: -------------------------------------------------------------------------------- 1 | 2 | cdef extern from "Python.h": 3 | # The C structure of the objects used to describe built-in types. 4 | 5 | ############################################################################ 6 | # 7.1.1 Type Objects 7 | ############################################################################ 8 | 9 | ctypedef class __builtin__.type [object PyTypeObject]: 10 | pass 11 | 12 | # PyObject* PyType_Type 13 | # This is the type object for type objects; it is the same object 14 | # as type and types.TypeType in the Python layer. 15 | 16 | bint PyType_Check(object o) 17 | # Return true if the object o is a type object, including 18 | # instances of types derived from the standard type object. Return 19 | # false in all other cases. 20 | 21 | bint PyType_CheckExact(object o) 22 | # Return true if the object o is a type object, but not a subtype 23 | # of the standard type object. Return false in all other 24 | # cases. 25 | 26 | bint PyType_HasFeature(object o, int feature) 27 | # Return true if the type object o sets the feature feature. Type 28 | # features are denoted by single bit flags. 29 | 30 | bint PyType_IS_GC(object o) 31 | # Return true if the type object includes support for the cycle 32 | # detector; this tests the type flag Py_TPFLAGS_HAVE_GC. 33 | 34 | bint PyType_IsSubtype(type a, type b) 35 | # Return true if a is a subtype of b. 36 | 37 | object PyType_GenericAlloc(object type, Py_ssize_t nitems) 38 | # Return value: New reference. 39 | 40 | object PyType_GenericNew(type type, object args, object kwds) 41 | # Return value: New reference. 42 | 43 | bint PyType_Ready(type type) except -1 44 | # Finalize a type object. This should be called on all type 45 | # objects to finish their initialization. This function is 46 | # responsible for adding inherited slots from a type's base 47 | # class. Return 0 on success, or return -1 and sets an exception 48 | # on error. 49 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_pass1.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | 5 | # from http://json.org/JSON_checker/test/pass1.json 6 | JSON = r''' 7 | [ 8 | "JSON Test Pattern pass1", 9 | {"object with 1 member":["array with 1 element"]}, 10 | {}, 11 | [], 12 | -42, 13 | true, 14 | false, 15 | null, 16 | { 17 | "integer": 1234567890, 18 | "real": -9876.543210, 19 | "e": 0.123456789e-12, 20 | "E": 1.234567890E+34, 21 | "": 23456789012E66, 22 | "zero": 0, 23 | "one": 1, 24 | "space": " ", 25 | "quote": "\"", 26 | "backslash": "\\", 27 | "controls": "\b\f\n\r\t", 28 | "slash": "/ & \/", 29 | "alpha": "abcdefghijklmnopqrstuvwyz", 30 | "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ", 31 | "digit": "0123456789", 32 | "special": "`1~!@#$%^&*()_+-={':[,]}|;.?", 33 | "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", 34 | "true": true, 35 | "false": false, 36 | "null": null, 37 | "array":[ ], 38 | "object":{ }, 39 | "address": "50 St. James Street", 40 | "url": "http://www.JSON.org/", 41 | "comment": "// /* */": " ", 43 | " s p a c e d " :[1,2 , 3 44 | 45 | , 46 | 47 | 4 , 5 , 6 ,7 ],"compact": [1,2,3,4,5,6,7], 48 | "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", 49 | "quotes": "" \u0022 %22 0x22 034 "", 50 | "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?" 51 | : "A key can be any string" 52 | }, 53 | 0.5 ,98.6 54 | , 55 | 99.44 56 | , 57 | 58 | 1066, 59 | 1e1, 60 | 0.1e1, 61 | 1e-1, 62 | 1e00,2e+00,2e-00 63 | ,"rosebud"] 64 | ''' 65 | 66 | class TestPass1(TestCase): 67 | def test_parse(self): 68 | # test in/out equivalence and parsing 69 | res = json.loads(JSON) 70 | out = json.dumps(res) 71 | self.assertEqual(res, json.loads(out)) 72 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/weakref.pxd: -------------------------------------------------------------------------------- 1 | from cpython.ref cimport PyObject 2 | 3 | cdef extern from "Python.h": 4 | 5 | bint PyWeakref_Check(object ob) 6 | # Return true if ob is either a reference or proxy object. 7 | 8 | bint PyWeakref_CheckRef(object ob) 9 | # Return true if ob is a reference object. 10 | 11 | bint PyWeakref_CheckProxy(ob) 12 | # Return true if *ob* is a proxy object. 13 | 14 | object PyWeakref_NewRef(object ob, object callback) 15 | # Return a weak reference object for the object ob. This will 16 | # always return a new reference, but is not guaranteed to create a 17 | # new object; an existing reference object may be returned. The 18 | # second parameter, callback, can be a callable object that 19 | # receives notification when ob is garbage collected; it should 20 | # accept a single parameter, which will be the weak reference 21 | # object itself. callback may also be None or NULL. If ob is not 22 | # a weakly-referencable object, or if callback is not callable, 23 | # None, or NULL, this will return NULL and raise TypeError. 24 | 25 | object PyWeakref_NewProxy(object ob, object callback) 26 | # Return a weak reference proxy object for the object ob. This 27 | # will always return a new reference, but is not guaranteed to 28 | # create a new object; an existing proxy object may be returned. 29 | # The second parameter, callback, can be a callable object that 30 | # receives notification when ob is garbage collected; it should 31 | # accept a single parameter, which will be the weak reference 32 | # object itself. callback may also be None or NULL. If ob is not 33 | # a weakly-referencable object, or if callback is not callable, 34 | # None, or NULL, this will return NULL and raise TypeError. 35 | 36 | PyObject* PyWeakref_GetObject(object ref) 37 | # Return the referenced object from a weak reference, ref. If the 38 | # referent is no longer live, returns None. 39 | 40 | PyObject* PyWeakref_GET_OBJECT(object ref) 41 | # Similar to PyWeakref_GetObject, but implemented as a macro that 42 | # does no error checking. 43 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/string.pxd: -------------------------------------------------------------------------------- 1 | # 7.21 String handling 2 | 3 | cdef extern from *: 4 | # deprecated backwards compatibility declarations 5 | ctypedef const char const_char "const char" 6 | ctypedef const signed char const_schar "const signed char" 7 | ctypedef const unsigned char const_uchar "const unsigned char" 8 | ctypedef const void const_void "const void" 9 | 10 | cdef extern from "string.h" nogil: 11 | 12 | void *memcpy (void *pto, const void *pfrom, size_t size) 13 | void *memmove (void *pto, const void *pfrom, size_t size) 14 | void *memset (void *block, int c, size_t size) 15 | int memcmp (const void *a1, const void *a2, size_t size) 16 | void *memchr (const void *block, int c, size_t size) 17 | 18 | void *memchr (const void *block, int c, size_t size) 19 | void *memrchr (const void *block, int c, size_t size) 20 | 21 | size_t strlen (const char *s) 22 | char *strcpy (char *pto, const char *pfrom) 23 | char *strncpy (char *pto, const char *pfrom, size_t size) 24 | char *strdup (const char *s) 25 | char *strndup (const char *s, size_t size) 26 | char *strcat (char *pto, const char *pfrom) 27 | char *strncat (char *pto, const char *pfrom, size_t size) 28 | 29 | int strcmp (const char *s1, const char *s2) 30 | int strcasecmp (const char *s1, const char *s2) 31 | int strncmp (const char *s1, const char *s2, size_t size) 32 | int strncasecmp (const char *s1, const char *s2, size_t n) 33 | 34 | int strcoll (const char *s1, const char *s2) 35 | size_t strxfrm (char *pto, const char *pfrom, size_t size) 36 | 37 | char *strerror (int errnum) 38 | 39 | char *strchr (const char *string, int c) 40 | char *strrchr (const char *string, int c) 41 | 42 | char *strstr (const char *haystack, const char *needle) 43 | char *strcasestr (const char *haystack, const char *needle) 44 | 45 | size_t strcspn (const char *string, const char *stopset) 46 | char * strpbrk (const char *string, const char *stopset) 47 | 48 | char *strtok (char *newstring, const char *delimiters) 49 | char *strsep (char **string_ptr, const char *delimiter) 50 | -------------------------------------------------------------------------------- /ext_libs/rfoo/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | rfoo/__init__.py 3 | 4 | Fast RPC server. 5 | 6 | Copyright (c) 2010 Nir Aides and individual contributors. 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without modification, 10 | are permitted provided that the following conditions are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | 2. Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in the 17 | documentation and/or other materials provided with the distribution. 18 | 19 | 3. Neither the name of Nir Aides nor the names of other contributors may 20 | be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 24 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 27 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 30 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | """ 34 | 35 | """ 36 | Example: 37 | 38 | class MyHandler(rfoo.BaseHandler): 39 | def echo(self, str): 40 | return str 41 | 42 | rfoo.InetServer(MyHandler).start() 43 | 44 | --- client--- 45 | 46 | c = InetConnection().connect() 47 | rfoo.Proxy(c).echo('Hello World!') 48 | """ 49 | 50 | 51 | 52 | from rfoo._rfoo import * 53 | 54 | 55 | 56 | __version__ = '1.3.0' 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /ext_libs/Cython/Tests/TestStringIOTree.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from Cython import StringIOTree as stringtree 4 | 5 | code = """ 6 | cdef int spam # line 1 7 | 8 | cdef ham(): 9 | a = 1 10 | b = 2 11 | c = 3 12 | d = 4 13 | 14 | def eggs(): 15 | pass 16 | 17 | cpdef bacon(): 18 | print spam 19 | print 'scotch' 20 | print 'tea?' 21 | print 'or coffee?' # line 16 22 | """ 23 | 24 | linemap = dict(enumerate(code.splitlines())) 25 | 26 | class TestStringIOTree(unittest.TestCase): 27 | 28 | def setUp(self): 29 | self.tree = stringtree.StringIOTree() 30 | 31 | def test_markers(self): 32 | assert not self.tree.allmarkers() 33 | 34 | def test_insertion(self): 35 | self.write_lines((1, 2, 3)) 36 | line_4_to_6_insertion_point = self.tree.insertion_point() 37 | self.write_lines((7, 8)) 38 | line_9_to_13_insertion_point = self.tree.insertion_point() 39 | self.write_lines((14, 15, 16)) 40 | 41 | line_4_insertion_point = line_4_to_6_insertion_point.insertion_point() 42 | self.write_lines((5, 6), tree=line_4_to_6_insertion_point) 43 | 44 | line_9_to_12_insertion_point = ( 45 | line_9_to_13_insertion_point.insertion_point()) 46 | self.write_line(13, tree=line_9_to_13_insertion_point) 47 | 48 | self.write_line(4, tree=line_4_insertion_point) 49 | self.write_line(9, tree=line_9_to_12_insertion_point) 50 | line_10_insertion_point = line_9_to_12_insertion_point.insertion_point() 51 | self.write_line(11, tree=line_9_to_12_insertion_point) 52 | self.write_line(10, tree=line_10_insertion_point) 53 | self.write_line(12, tree=line_9_to_12_insertion_point) 54 | 55 | self.assertEqual(self.tree.allmarkers(), range(1, 17)) 56 | self.assertEqual(code.strip(), self.tree.getvalue().strip()) 57 | 58 | 59 | def write_lines(self, linenos, tree=None): 60 | for lineno in linenos: 61 | self.write_line(lineno, tree=tree) 62 | 63 | def write_line(self, lineno, tree=None): 64 | if tree is None: 65 | tree = self.tree 66 | tree.markers.append(lineno) 67 | tree.write(linemap[lineno] + '\n') 68 | -------------------------------------------------------------------------------- /ext_libs/Cython/Utility/ExtensionTypes.c: -------------------------------------------------------------------------------- 1 | 2 | /////////////// CallNextTpDealloc.proto /////////////// 3 | 4 | static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc); 5 | 6 | /////////////// CallNextTpDealloc /////////////// 7 | 8 | static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) { 9 | PyTypeObject* type = Py_TYPE(obj); 10 | /* try to find the first parent type that has a different tp_dealloc() function */ 11 | while (type && type->tp_dealloc != current_tp_dealloc) 12 | type = type->tp_base; 13 | while (type && type->tp_dealloc == current_tp_dealloc) 14 | type = type->tp_base; 15 | if (type) 16 | type->tp_dealloc(obj); 17 | } 18 | 19 | /////////////// CallNextTpTraverse.proto /////////////// 20 | 21 | static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse); 22 | 23 | /////////////// CallNextTpTraverse /////////////// 24 | 25 | static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) { 26 | PyTypeObject* type = Py_TYPE(obj); 27 | /* try to find the first parent type that has a different tp_traverse() function */ 28 | while (type && type->tp_traverse != current_tp_traverse) 29 | type = type->tp_base; 30 | while (type && type->tp_traverse == current_tp_traverse) 31 | type = type->tp_base; 32 | if (type && type->tp_traverse) 33 | return type->tp_traverse(obj, v, a); 34 | // FIXME: really ignore? 35 | return 0; 36 | } 37 | 38 | /////////////// CallNextTpClear.proto /////////////// 39 | 40 | static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc); 41 | 42 | /////////////// CallNextTpClear /////////////// 43 | 44 | static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { 45 | PyTypeObject* type = Py_TYPE(obj); 46 | /* try to find the first parent type that has a different tp_clear() function */ 47 | while (type && type->tp_clear != current_tp_clear) 48 | type = type->tp_base; 49 | while (type && type->tp_clear == current_tp_clear) 50 | type = type->tp_base; 51 | if (type && type->tp_clear) 52 | type->tp_clear(obj); 53 | } 54 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Interpreter.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module deals with interpreting the parse tree as Python 3 | would have done, in the compiler. 4 | 5 | For now this only covers parse tree to value conversion of 6 | compile-time values. 7 | """ 8 | 9 | from Nodes import * 10 | from ExprNodes import * 11 | from Errors import CompileError 12 | 13 | 14 | class EmptyScope(object): 15 | def lookup(self, name): 16 | return None 17 | 18 | empty_scope = EmptyScope() 19 | 20 | def interpret_compiletime_options(optlist, optdict, type_env=None, type_args=()): 21 | """ 22 | Tries to interpret a list of compile time option nodes. 23 | The result will be a tuple (optlist, optdict) but where 24 | all expression nodes have been interpreted. The result is 25 | in the form of tuples (value, pos). 26 | 27 | optlist is a list of nodes, while optdict is a DictNode (the 28 | result optdict is a dict) 29 | 30 | If type_env is set, all type nodes will be analysed and the resulting 31 | type set. Otherwise only interpretateable ExprNodes 32 | are allowed, other nodes raises errors. 33 | 34 | A CompileError will be raised if there are problems. 35 | """ 36 | 37 | def interpret(node, ix): 38 | if ix in type_args: 39 | if type_env: 40 | type = node.analyse_as_type(type_env) 41 | if not type: 42 | raise CompileError(node.pos, "Invalid type.") 43 | return (type, node.pos) 44 | else: 45 | raise CompileError(node.pos, "Type not allowed here.") 46 | else: 47 | if (sys.version_info[0] >=3 and 48 | isinstance(node, StringNode) and 49 | node.unicode_value is not None): 50 | return (node.unicode_value, node.pos) 51 | return (node.compile_time_value(empty_scope), node.pos) 52 | 53 | if optlist: 54 | optlist = [interpret(x, ix) for ix, x in enumerate(optlist)] 55 | if optdict: 56 | assert isinstance(optdict, DictNode) 57 | new_optdict = {} 58 | for item in optdict.key_value_pairs: 59 | new_key, dummy = interpret(item.key, None) 60 | new_optdict[new_key] = interpret(item.value, item.key.value) 61 | optdict = new_optdict 62 | return (optlist, new_optdict) 63 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/stdio.pxd: -------------------------------------------------------------------------------- 1 | # 7.19 Input/output 2 | 3 | 4 | # deprecated cimports for backwards compatibility: 5 | from libc.string cimport const_char, const_void 6 | 7 | 8 | cdef extern from "stdio.h" nogil: 9 | 10 | ctypedef struct FILE 11 | cdef FILE *stdin 12 | cdef FILE *stdout 13 | cdef FILE *stderr 14 | 15 | enum: FOPEN_MAX 16 | enum: FILENAME_MAX 17 | FILE *fopen (const char *filename, const char *opentype) 18 | FILE *freopen (const char *filename, const char *opentype, FILE *stream) 19 | FILE *fdopen (int fdescriptor, const char *opentype) 20 | int fclose (FILE *stream) 21 | int remove (const char *filename) 22 | int rename (const char *oldname, const char *newname) 23 | FILE *tmpfile () 24 | 25 | enum: _IOFBF 26 | enum: _IOLBF 27 | enum: _IONBF 28 | int setvbuf (FILE *stream, char *buf, int mode, size_t size) 29 | enum: BUFSIZ 30 | void setbuf (FILE *stream, char *buf) 31 | 32 | size_t fread (void *data, size_t size, size_t count, FILE *stream) 33 | size_t fwrite (const void *data, size_t size, size_t count, FILE *stream) 34 | int fflush (FILE *stream) 35 | 36 | enum: EOF 37 | int feof (FILE *stream) 38 | int ferror (FILE *stream) 39 | 40 | enum: SEEK_SET 41 | enum: SEEK_CUR 42 | enum: SEEK_END 43 | int fseek (FILE *stream, long int offset, int whence) 44 | void rewind (FILE *stream) 45 | long int ftell (FILE *stream) 46 | 47 | ctypedef long long int fpos_t 48 | ctypedef const fpos_t const_fpos_t "const fpos_t" 49 | int fgetpos (FILE *stream, fpos_t *position) 50 | int fsetpos (FILE *stream, const fpos_t *position) 51 | 52 | int scanf (const char *template, ...) 53 | int sscanf (const char *s, const char *template, ...) 54 | int fscanf (FILE *stream, const char *template, ...) 55 | 56 | int printf (const char *template, ...) 57 | int sprintf (char *s, const char *template, ...) 58 | int snprintf (char *s, size_t size, const char *template, ...) 59 | int fprintf (FILE *stream, const char *template, ...) 60 | 61 | void perror (const char *message) 62 | 63 | char *gets (char *s) 64 | char *fgets (char *s, int count, FILE *stream) 65 | 66 | int puts (const char *s) 67 | int fputs (const char *s, FILE *stream) 68 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/method.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "Python.h": 2 | ctypedef void PyObject 3 | ############################################################################ 4 | # 7.5.4 Method Objects 5 | ############################################################################ 6 | 7 | # There are some useful functions that are useful for working with method objects. 8 | # PyTypeObject PyMethod_Type 9 | # This instance of PyTypeObject represents the Python method type. This is exposed to Python programs as types.MethodType. 10 | 11 | bint PyMethod_Check(object o) 12 | # Return true if o is a method object (has type 13 | # PyMethod_Type). The parameter must not be NULL. 14 | 15 | object PyMethod_New(object func, object self, object cls) 16 | # Return value: New reference. 17 | # Return a new method object, with func being any callable object; 18 | # this is the function that will be called when the method is 19 | # called. If this method should be bound to an instance, self 20 | # should be the instance and class should be the class of self, 21 | # otherwise self should be NULL and class should be the class 22 | # which provides the unbound method.. 23 | 24 | PyObject* PyMethod_Class(object meth) except NULL 25 | # Return value: Borrowed reference. 26 | # Return the class object from which the method meth was created; 27 | # if this was created from an instance, it will be the class of 28 | # the instance. 29 | 30 | PyObject* PyMethod_GET_CLASS(object meth) 31 | # Return value: Borrowed reference. 32 | # Macro version of PyMethod_Class() which avoids error checking. 33 | 34 | PyObject* PyMethod_Function(object meth) except NULL 35 | # Return value: Borrowed reference. 36 | # Return the function object associated with the method meth. 37 | 38 | PyObject* PyMethod_GET_FUNCTION(object meth) 39 | # Return value: Borrowed reference. 40 | # Macro version of PyMethod_Function() which avoids error checking. 41 | 42 | PyObject* PyMethod_Self(object meth) except? NULL 43 | # Return value: Borrowed reference. 44 | # Return the instance associated with the method meth if it is bound, otherwise return NULL. 45 | 46 | PyObject* PyMethod_GET_SELF(object meth) 47 | # Return value: Borrowed reference. 48 | # Macro version of PyMethod_Self() which avoids error checking. 49 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/math.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "math.h" nogil: 2 | 3 | double M_E 4 | double M_LOG2E 5 | double M_LOG10E 6 | double M_LN2 7 | double M_LN10 8 | double M_PI 9 | double M_PI_2 10 | double M_PI_4 11 | double M_1_PI 12 | double M_2_PI 13 | double M_2_SQRTPI 14 | double M_SQRT2 15 | double M_SQRT1_2 16 | 17 | double acos(double x) 18 | double asin(double x) 19 | double atan(double x) 20 | double atan2(double y, double x) 21 | double cos(double x) 22 | double sin(double x) 23 | double tan(double x) 24 | 25 | double cosh(double x) 26 | double sinh(double x) 27 | double tanh(double x) 28 | double acosh(double x) 29 | double asinh(double x) 30 | double atanh(double x) 31 | 32 | double hypot(double x, double y) 33 | 34 | double exp(double x) 35 | double exp2(double x) 36 | double expm1(double x) 37 | double log(double x) 38 | double logb(double x) 39 | double log2(double x) 40 | double log10(double x) 41 | double log1p(double x) 42 | int ilogb(double x) 43 | 44 | double lgamma(double x) 45 | double tgamma(double x) 46 | 47 | double frexp(double x, int* exponent) 48 | double ldexp(double x, int exponent) 49 | 50 | double modf(double x, double* iptr) 51 | double fmod(double x, double y) 52 | double remainder(double x, double y) 53 | double remquo(double x, double y, int *quot) 54 | double pow(double x, double y) 55 | double sqrt(double x) 56 | double cbrt(double x) 57 | 58 | double fabs(double x) 59 | double ceil(double x) 60 | double floor(double x) 61 | double trunc(double x) 62 | double rint(double x) 63 | double round(double x) 64 | double nearbyint(double x) 65 | double nextafter(double, double) 66 | double nexttoward(double, long double) 67 | 68 | long long llrint(double) 69 | long lrint(double) 70 | long long llround(double) 71 | long lround(double) 72 | 73 | double copysign(double, double) 74 | double erf(double) 75 | double erfc(double) 76 | 77 | double fdim(double x, double y) 78 | double fma(double x, double y) 79 | double fmax(double x, double y) 80 | double fmin(double x, double y) 81 | double scalbln(double x, long n) 82 | double scalbn(double x, int n) 83 | 84 | double nan(char*) # const char* 85 | 86 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/ParseTreeTransforms.pxd: -------------------------------------------------------------------------------- 1 | 2 | cimport cython 3 | 4 | from Cython.Compiler.Visitor cimport ( 5 | CythonTransform, VisitorTransform, TreeVisitor, 6 | ScopeTrackingTransform, EnvTransform) 7 | 8 | cdef class NameNodeCollector(TreeVisitor): 9 | cdef list name_nodes 10 | 11 | cdef class SkipDeclarations: # (object): 12 | pass 13 | 14 | cdef class NormalizeTree(CythonTransform): 15 | cdef bint is_in_statlist 16 | cdef bint is_in_expr 17 | cpdef visit_StatNode(self, node, is_listcontainer=*) 18 | 19 | cdef class PostParse(ScopeTrackingTransform): 20 | cdef dict specialattribute_handlers 21 | cdef size_t lambda_counter 22 | cdef size_t genexpr_counter 23 | cdef _visit_assignment_node(self, node, list expr_list) 24 | 25 | 26 | #def eliminate_rhs_duplicates(list expr_list_list, list ref_node_sequence) 27 | #def sort_common_subsequences(list items) 28 | @cython.locals(starred_targets=Py_ssize_t, lhs_size=Py_ssize_t, rhs_size=Py_ssize_t) 29 | cdef flatten_parallel_assignments(list input, list output) 30 | cdef map_starred_assignment(list lhs_targets, list starred_assignments, list lhs_args, list rhs_args) 31 | 32 | #class PxdPostParse(CythonTransform, SkipDeclarations): 33 | #class InterpretCompilerDirectives(CythonTransform, SkipDeclarations): 34 | #class WithTransform(CythonTransform, SkipDeclarations): 35 | #class DecoratorTransform(CythonTransform, SkipDeclarations): 36 | 37 | #class AnalyseDeclarationsTransform(EnvTransform): 38 | 39 | cdef class AnalyseExpressionsTransform(CythonTransform): 40 | pass 41 | 42 | cdef class ExpandInplaceOperators(EnvTransform): 43 | pass 44 | 45 | cdef class AlignFunctionDefinitions(CythonTransform): 46 | cdef dict directives 47 | cdef scope 48 | 49 | cdef class YieldNodeCollector(TreeVisitor): 50 | cdef public list yields 51 | cdef public list returns 52 | cdef public bint has_return_value 53 | 54 | cdef class MarkClosureVisitor(CythonTransform): 55 | cdef bint needs_closure 56 | 57 | cdef class CreateClosureClasses(CythonTransform): 58 | cdef list path 59 | cdef bint in_lambda 60 | cdef module_scope 61 | cdef generator_class 62 | 63 | cdef class GilCheck(VisitorTransform): 64 | cdef list env_stack 65 | cdef bint nogil 66 | cdef bint nogil_declarator_only 67 | 68 | cdef class TransformBuiltinMethods(EnvTransform): 69 | cdef visit_cython_attribute(self, node) 70 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libcpp/set.pxd: -------------------------------------------------------------------------------- 1 | from pair cimport pair 2 | 3 | cdef extern from "" namespace "std": 4 | cdef cppclass set[T]: 5 | cppclass iterator: 6 | T& operator*() 7 | iterator operator++() nogil 8 | iterator operator--() nogil 9 | bint operator==(iterator) nogil 10 | bint operator!=(iterator) nogil 11 | cppclass reverse_iterator: 12 | T& operator*() nogil 13 | iterator operator++() nogil 14 | iterator operator--() nogil 15 | bint operator==(reverse_iterator) nogil 16 | bint operator!=(reverse_iterator) nogil 17 | #cppclass const_iterator(iterator): 18 | # pass 19 | #cppclass const_reverse_iterator(reverse_iterator): 20 | # pass 21 | set() nogil except + 22 | set(set&) nogil except + 23 | #set(key_compare&) 24 | #set& operator=(set&) 25 | bint operator==(set&, set&) nogil 26 | bint operator!=(set&, set&) nogil 27 | bint operator<(set&, set&) nogil 28 | bint operator>(set&, set&) nogil 29 | bint operator<=(set&, set&) nogil 30 | bint operator>=(set&, set&) nogil 31 | iterator begin() nogil 32 | #const_iterator begin() 33 | void clear() nogil 34 | size_t count(T&) nogil 35 | bint empty() nogil 36 | iterator end() nogil 37 | #const_iterator end() 38 | pair[iterator, iterator] equal_range(T&) nogil 39 | #pair[const_iterator, const_iterator] equal_range(T&) 40 | void erase(iterator) nogil 41 | void erase(iterator, iterator) nogil 42 | size_t erase(T&) nogil 43 | iterator find(T&) nogil 44 | #const_iterator find(T&) 45 | pair[iterator, bint] insert(T&) nogil 46 | iterator insert(iterator, T&) nogil 47 | #void insert(input_iterator, input_iterator) 48 | #key_compare key_comp() 49 | iterator lower_bound(T&) nogil 50 | #const_iterator lower_bound(T&) 51 | size_t max_size() nogil 52 | reverse_iterator rbegin() nogil 53 | #const_reverse_iterator rbegin() 54 | reverse_iterator rend() nogil 55 | #const_reverse_iterator rend() 56 | size_t size() nogil 57 | void swap(set&) nogil 58 | iterator upper_bound(T&) nogil 59 | #const_iterator upper_bound(T&) 60 | #value_compare value_comp() 61 | -------------------------------------------------------------------------------- /ext_libs/keyword.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | """Keywords (from "graminit.c") 4 | 5 | This file is automatically generated; please don't muck it up! 6 | 7 | To update the symbols in this file, 'cd' to the top directory of 8 | the python source tree after building the interpreter and run: 9 | 10 | python Lib/keyword.py 11 | """ 12 | 13 | __all__ = ["iskeyword", "kwlist"] 14 | 15 | kwlist = [ 16 | #--start keywords-- 17 | 'and', 18 | 'as', 19 | 'assert', 20 | 'break', 21 | 'class', 22 | 'continue', 23 | 'def', 24 | 'del', 25 | 'elif', 26 | 'else', 27 | 'except', 28 | 'exec', 29 | 'finally', 30 | 'for', 31 | 'from', 32 | 'global', 33 | 'if', 34 | 'import', 35 | 'in', 36 | 'is', 37 | 'lambda', 38 | 'not', 39 | 'or', 40 | 'pass', 41 | 'print', 42 | 'raise', 43 | 'return', 44 | 'try', 45 | 'while', 46 | 'with', 47 | 'yield', 48 | #--end keywords-- 49 | ] 50 | 51 | iskeyword = frozenset(kwlist).__contains__ 52 | 53 | def main(): 54 | import sys, re 55 | 56 | args = sys.argv[1:] 57 | iptfile = args and args[0] or "Python/graminit.c" 58 | if len(args) > 1: optfile = args[1] 59 | else: optfile = "Lib/keyword.py" 60 | 61 | # scan the source file for keywords 62 | fp = open(iptfile) 63 | strprog = re.compile('"([^"]+)"') 64 | lines = [] 65 | while 1: 66 | line = fp.readline() 67 | if not line: break 68 | if '{1, "' in line: 69 | match = strprog.search(line) 70 | if match: 71 | lines.append(" '" + match.group(1) + "',\n") 72 | fp.close() 73 | lines.sort() 74 | 75 | # load the output skeleton from the target 76 | fp = open(optfile) 77 | format = fp.readlines() 78 | fp.close() 79 | 80 | # insert the lines of keywords 81 | try: 82 | start = format.index("#--start keywords--\n") + 1 83 | end = format.index("#--end keywords--\n") 84 | format[start:end] = lines 85 | except ValueError: 86 | sys.stderr.write("target does not contain format markers\n") 87 | sys.exit(1) 88 | 89 | # write the output file 90 | fp = open(optfile, 'w') 91 | fp.write(''.join(format)) 92 | fp.close() 93 | 94 | if __name__ == "__main__": 95 | main() 96 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Tests/TestTreeFragment.py: -------------------------------------------------------------------------------- 1 | from Cython.TestUtils import CythonTest 2 | from Cython.Compiler.TreeFragment import * 3 | from Cython.Compiler.Nodes import * 4 | from Cython.Compiler.UtilNodes import * 5 | import Cython.Compiler.Naming as Naming 6 | 7 | class TestTreeFragments(CythonTest): 8 | 9 | def test_basic(self): 10 | F = self.fragment(u"x = 4") 11 | T = F.copy() 12 | self.assertCode(u"x = 4", T) 13 | 14 | def test_copy_is_taken(self): 15 | F = self.fragment(u"if True: x = 4") 16 | T1 = F.root 17 | T2 = F.copy() 18 | self.assertEqual("x", T2.stats[0].if_clauses[0].body.lhs.name) 19 | T2.stats[0].if_clauses[0].body.lhs.name = "other" 20 | self.assertEqual("x", T1.stats[0].if_clauses[0].body.lhs.name) 21 | 22 | def test_substitutions_are_copied(self): 23 | T = self.fragment(u"y + y").substitute({"y": NameNode(pos=None, name="x")}) 24 | self.assertEqual("x", T.stats[0].expr.operand1.name) 25 | self.assertEqual("x", T.stats[0].expr.operand2.name) 26 | self.assert_(T.stats[0].expr.operand1 is not T.stats[0].expr.operand2) 27 | 28 | def test_substitution(self): 29 | F = self.fragment(u"x = 4") 30 | y = NameNode(pos=None, name=u"y") 31 | T = F.substitute({"x" : y}) 32 | self.assertCode(u"y = 4", T) 33 | 34 | def test_exprstat(self): 35 | F = self.fragment(u"PASS") 36 | pass_stat = PassStatNode(pos=None) 37 | T = F.substitute({"PASS" : pass_stat}) 38 | self.assert_(isinstance(T.stats[0], PassStatNode), T) 39 | 40 | def test_pos_is_transferred(self): 41 | F = self.fragment(u""" 42 | x = y 43 | x = u * v ** w 44 | """) 45 | T = F.substitute({"v" : NameNode(pos=None, name="a")}) 46 | v = F.root.stats[1].rhs.operand2.operand1 47 | a = T.stats[1].rhs.operand2.operand1 48 | self.assertEquals(v.pos, a.pos) 49 | 50 | def test_temps(self): 51 | TemplateTransform.temp_name_counter = 0 52 | F = self.fragment(u""" 53 | TMP 54 | x = TMP 55 | """) 56 | T = F.substitute(temps=[u"TMP"]) 57 | s = T.body.stats 58 | self.assert_(isinstance(s[0].expr, TempRefNode)) 59 | self.assert_(isinstance(s[1].rhs, TempRefNode)) 60 | self.assert_(s[0].expr.handle is s[1].rhs.handle) 61 | 62 | if __name__ == "__main__": 63 | import unittest 64 | unittest.main() 65 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Tests/TestVisitor.py: -------------------------------------------------------------------------------- 1 | from Cython.Compiler.ModuleNode import ModuleNode 2 | from Cython.Compiler.Symtab import ModuleScope 3 | from Cython.TestUtils import TransformTest 4 | from Cython.Compiler.Visitor import MethodDispatcherTransform 5 | from Cython.Compiler.ParseTreeTransforms import ( 6 | NormalizeTree, AnalyseDeclarationsTransform, 7 | AnalyseExpressionsTransform, InterpretCompilerDirectives) 8 | 9 | 10 | class TestMethodDispatcherTransform(TransformTest): 11 | _tree = None 12 | 13 | def _build_tree(self): 14 | if self._tree is None: 15 | context = None 16 | 17 | def fake_module(node): 18 | scope = ModuleScope('test', None, None) 19 | return ModuleNode(node.pos, doc=None, body=node, 20 | scope=scope, full_module_name='test', 21 | directive_comments={}) 22 | pipeline = [ 23 | fake_module, 24 | NormalizeTree(context), 25 | InterpretCompilerDirectives(context, {}), 26 | AnalyseDeclarationsTransform(context), 27 | AnalyseExpressionsTransform(context), 28 | ] 29 | self._tree = self.run_pipeline(pipeline, u""" 30 | cdef bytes s = b'asdfg' 31 | cdef dict d = {1:2} 32 | x = s * 3 33 | d.get('test') 34 | """) 35 | return self._tree 36 | 37 | def test_builtin_method(self): 38 | calls = [0] 39 | class Test(MethodDispatcherTransform): 40 | def _handle_simple_method_dict_get(self, node, func, args, unbound): 41 | calls[0] += 1 42 | return node 43 | 44 | tree = self._build_tree() 45 | Test(None)(tree) 46 | self.assertEqual(1, calls[0]) 47 | 48 | def test_binop_method(self): 49 | calls = {'bytes': 0, 'object': 0} 50 | class Test(MethodDispatcherTransform): 51 | def _handle_simple_method_bytes___mul__(self, node, func, args, unbound): 52 | calls['bytes'] += 1 53 | return node 54 | def _handle_simple_method_object___mul__(self, node, func, args, unbound): 55 | calls['object'] += 1 56 | return node 57 | 58 | tree = self._build_tree() 59 | Test(None)(tree) 60 | self.assertEqual(1, calls['bytes']) 61 | self.assertEqual(0, calls['object']) 62 | -------------------------------------------------------------------------------- /ext_libs/Cython/Debugger/DebugWriter.py: -------------------------------------------------------------------------------- 1 | from __future__ import with_statement 2 | 3 | import os 4 | import sys 5 | import errno 6 | 7 | try: 8 | from lxml import etree 9 | have_lxml = True 10 | except ImportError: 11 | have_lxml = False 12 | try: 13 | # Python 2.5 14 | from xml.etree import cElementTree as etree 15 | except ImportError: 16 | try: 17 | # Python 2.5 18 | from xml.etree import ElementTree as etree 19 | except ImportError: 20 | try: 21 | # normal cElementTree install 22 | import cElementTree as etree 23 | except ImportError: 24 | try: 25 | # normal ElementTree install 26 | import elementtree.ElementTree as etree 27 | except ImportError: 28 | etree = None 29 | 30 | from Cython.Compiler import Errors 31 | 32 | 33 | class CythonDebugWriter(object): 34 | """ 35 | Class to output debugging information for cygdb 36 | 37 | It writes debug information to cython_debug/cython_debug_info_ 38 | in the build directory. 39 | """ 40 | 41 | def __init__(self, output_dir): 42 | if etree is None: 43 | raise Errors.NoElementTreeInstalledException() 44 | 45 | self.output_dir = os.path.join(output_dir, 'cython_debug') 46 | self.tb = etree.TreeBuilder() 47 | # set by Cython.Compiler.ParseTreeTransforms.DebugTransform 48 | self.module_name = None 49 | self.start('cython_debug', attrs=dict(version='1.0')) 50 | 51 | def start(self, name, attrs=None): 52 | self.tb.start(name, attrs or {}) 53 | 54 | def end(self, name): 55 | self.tb.end(name) 56 | 57 | def serialize(self): 58 | self.tb.end('Module') 59 | self.tb.end('cython_debug') 60 | xml_root_element = self.tb.close() 61 | 62 | try: 63 | os.makedirs(self.output_dir) 64 | except OSError, e: 65 | if e.errno != errno.EEXIST: 66 | raise 67 | 68 | et = etree.ElementTree(xml_root_element) 69 | kw = {} 70 | if have_lxml: 71 | kw['pretty_print'] = True 72 | 73 | fn = "cython_debug_info_" + self.module_name 74 | et.write(os.path.join(self.output_dir, fn), encoding="UTF-8", **kw) 75 | 76 | interpreter_path = os.path.join(self.output_dir, 'interpreter') 77 | with open(interpreter_path, 'w') as f: 78 | f.write(sys.executable) 79 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_bigint_as_string.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | 5 | 6 | class TestBigintAsString(TestCase): 7 | # Python 2.5, at least the one that ships on Mac OS X, calculates 8 | # 2 ** 53 as 0! It manages to calculate 1 << 53 correctly. 9 | values = [(200, 200), 10 | ((1 << 53) - 1, 9007199254740991), 11 | ((1 << 53), '9007199254740992'), 12 | ((1 << 53) + 1, '9007199254740993'), 13 | (-100, -100), 14 | ((-1 << 53), '-9007199254740992'), 15 | ((-1 << 53) - 1, '-9007199254740993'), 16 | ((-1 << 53) + 1, -9007199254740991)] 17 | 18 | options = ( 19 | {"bigint_as_string": True}, 20 | {"int_as_string_bitcount": 53} 21 | ) 22 | 23 | def test_ints(self): 24 | for opts in self.options: 25 | for val, expect in self.values: 26 | self.assertEqual( 27 | val, 28 | json.loads(json.dumps(val))) 29 | self.assertEqual( 30 | expect, 31 | json.loads(json.dumps(val, **opts))) 32 | 33 | def test_lists(self): 34 | for opts in self.options: 35 | for val, expect in self.values: 36 | val = [val, val] 37 | expect = [expect, expect] 38 | self.assertEqual( 39 | val, 40 | json.loads(json.dumps(val))) 41 | self.assertEqual( 42 | expect, 43 | json.loads(json.dumps(val, **opts))) 44 | 45 | def test_dicts(self): 46 | for opts in self.options: 47 | for val, expect in self.values: 48 | val = {'k': val} 49 | expect = {'k': expect} 50 | self.assertEqual( 51 | val, 52 | json.loads(json.dumps(val))) 53 | self.assertEqual( 54 | expect, 55 | json.loads(json.dumps(val, **opts))) 56 | 57 | def test_dict_keys(self): 58 | for opts in self.options: 59 | for val, _ in self.values: 60 | expect = {str(val): 'value'} 61 | val = {val: 'value'} 62 | self.assertEqual( 63 | expect, 64 | json.loads(json.dumps(val))) 65 | self.assertEqual( 66 | expect, 67 | json.loads(json.dumps(val, **opts))) 68 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_encode_basestring_ascii.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson.encoder 4 | from simplejson.compat import b 5 | 6 | CASES = [ 7 | (u'/\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\x08\x0c\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?', '"/\\\\\\"\\ucafe\\ubabe\\uab98\\ufcde\\ubcda\\uef4a\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?"'), 8 | (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'), 9 | (u'controls', '"controls"'), 10 | (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'), 11 | (u'{"object with 1 member":["array with 1 element"]}', '"{\\"object with 1 member\\":[\\"array with 1 element\\"]}"'), 12 | (u' s p a c e d ', '" s p a c e d "'), 13 | (u'\U0001d120', '"\\ud834\\udd20"'), 14 | (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), 15 | (b('\xce\xb1\xce\xa9'), '"\\u03b1\\u03a9"'), 16 | (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), 17 | (b('\xce\xb1\xce\xa9'), '"\\u03b1\\u03a9"'), 18 | (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), 19 | (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), 20 | (u"`1~!@#$%^&*()_+-={':[,]}|;.?", '"`1~!@#$%^&*()_+-={\':[,]}|;.?"'), 21 | (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'), 22 | (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'), 23 | ] 24 | 25 | class TestEncodeBaseStringAscii(TestCase): 26 | def test_py_encode_basestring_ascii(self): 27 | self._test_encode_basestring_ascii(simplejson.encoder.py_encode_basestring_ascii) 28 | 29 | def test_c_encode_basestring_ascii(self): 30 | if not simplejson.encoder.c_encode_basestring_ascii: 31 | return 32 | self._test_encode_basestring_ascii(simplejson.encoder.c_encode_basestring_ascii) 33 | 34 | def _test_encode_basestring_ascii(self, encode_basestring_ascii): 35 | fname = encode_basestring_ascii.__name__ 36 | for input_string, expect in CASES: 37 | result = encode_basestring_ascii(input_string) 38 | #self.assertEqual(result, expect, 39 | # '{0!r} != {1!r} for {2}({3!r})'.format( 40 | # result, expect, fname, input_string)) 41 | self.assertEqual(result, expect, 42 | '%r != %r for %s(%r)' % (result, expect, fname, input_string)) 43 | 44 | def test_sorted_dict(self): 45 | items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)] 46 | s = simplejson.dumps(dict(items), sort_keys=True) 47 | self.assertEqual(s, '{"five": 5, "four": 4, "one": 1, "three": 3, "two": 2}') 48 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libcpp/deque.pxd: -------------------------------------------------------------------------------- 1 | from pair cimport pair 2 | 3 | cdef extern from "" namespace "std": 4 | cdef cppclass deque[T]: 5 | cppclass iterator: 6 | T& operator*() nogil 7 | iterator operator++() nogil 8 | iterator operator--() nogil 9 | bint operator==(iterator) nogil 10 | bint operator!=(iterator) nogil 11 | cppclass reverse_iterator: 12 | T& operator*() nogil 13 | iterator operator++() nogil 14 | iterator operator--() nogil 15 | bint operator==(reverse_iterator) nogil 16 | bint operator!=(reverse_iterator) nogil 17 | #cppclass const_iterator(iterator): 18 | # pass 19 | #cppclass const_reverse_iterator(reverse_iterator): 20 | # pass 21 | deque() nogil except + 22 | deque(deque&) nogil except + 23 | deque(size_t) nogil except + 24 | deque(size_t, T&) nogil except + 25 | #deque[input_iterator](input_iterator, input_iterator) 26 | T& operator[](size_t) nogil 27 | #deque& operator=(deque&) 28 | bint operator==(deque&, deque&) nogil 29 | bint operator!=(deque&, deque&) nogil 30 | bint operator<(deque&, deque&) nogil 31 | bint operator>(deque&, deque&) nogil 32 | bint operator<=(deque&, deque&) nogil 33 | bint operator>=(deque&, deque&) nogil 34 | void assign(size_t, T&) nogil 35 | void assign(input_iterator, input_iterator) nogil 36 | T& at(size_t) nogil 37 | T& back() nogil 38 | iterator begin() nogil 39 | #const_iterator begin() 40 | void clear() nogil 41 | bint empty() nogil 42 | iterator end() nogil 43 | #const_iterator end() 44 | iterator erase(iterator) nogil 45 | iterator erase(iterator, iterator) nogil 46 | T& front() nogil 47 | iterator insert(iterator, T&) nogil 48 | void insert(iterator, size_t, T&) nogil 49 | void insert(iterator, input_iterator, input_iterator) nogil 50 | size_t max_size() nogil 51 | void pop_back() nogil 52 | void pop_front() nogil 53 | void push_back(T&) nogil 54 | void push_front(T&) nogil 55 | reverse_iterator rbegin() nogil 56 | #const_reverse_iterator rbegin() 57 | reverse_iterator rend() nogil 58 | #const_reverse_iterator rend() 59 | void resize(size_t) nogil 60 | void resize(size_t, T&) nogil 61 | size_t size() nogil 62 | void swap(deque&) nogil 63 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/Deprecated/stl.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "" namespace std: 2 | 3 | cdef cppclass vector[TYPE]: 4 | #constructors 5 | __init__() 6 | __init__(vector&) 7 | __init__(int) 8 | __init__(int, TYPE&) 9 | __init__(iterator, iterator) 10 | #operators 11 | TYPE& __getitem__(int) 12 | TYPE& __setitem__(int, TYPE&) 13 | vector __new__(vector&) 14 | bool __eq__(vector&, vector&) 15 | bool __ne__(vector&, vector&) 16 | bool __lt__(vector&, vector&) 17 | bool __gt__(vector&, vector&) 18 | bool __le__(vector&, vector&) 19 | bool __ge__(vector&, vector&) 20 | #others 21 | void assign(int, TYPE) 22 | #void assign(iterator, iterator) 23 | TYPE& at(int) 24 | TYPE& back() 25 | iterator begin() 26 | int capacity() 27 | void clear() 28 | bool empty() 29 | iterator end() 30 | iterator erase(iterator) 31 | iterator erase(iterator, iterator) 32 | TYPE& front() 33 | iterator insert(iterator, TYPE&) 34 | void insert(iterator, int, TYPE&) 35 | void insert(iterator, iterator) 36 | int max_size() 37 | void pop_back() 38 | void push_back(TYPE&) 39 | iterator rbegin() 40 | iterator rend() 41 | void reserve(int) 42 | void resize(int) 43 | void resize(int, TYPE&) #void resize(size_type num, const TYPE& = TYPE()) 44 | int size() 45 | void swap(container&) 46 | 47 | cdef extern from "" namespace std: 48 | 49 | cdef cppclass deque[TYPE]: 50 | #constructors 51 | __init__() 52 | __init__(deque&) 53 | __init__(int) 54 | __init__(int, TYPE&) 55 | __init__(iterator, iterator) 56 | #operators 57 | TYPE& operator[]( size_type index ); 58 | const TYPE& operator[]( size_type index ) const; 59 | deque __new__(deque&); 60 | bool __eq__(deque&, deque&); 61 | bool __ne__(deque&, deque&); 62 | bool __lt__(deque&, deque&); 63 | bool __gt__(deque&, deque&); 64 | bool __le__(deque&, deque&); 65 | bool __ge__(deque&, deque&); 66 | #others 67 | void assign(int, TYPE&) 68 | void assign(iterator, iterator) 69 | TYPE& at(int) 70 | TYPE& back() 71 | iterator begin() 72 | void clear() 73 | bool empty() 74 | iterator end() 75 | iterator erase(iterator) 76 | iterator erase(iterator, iterator) 77 | TYPE& front() 78 | iterator insert(iterator, TYPE&) 79 | void insert(iterator, int, TYPE&) 80 | void insert(iterator, iterator, iterator) 81 | int max_size() 82 | void pop_back() 83 | void pop_front() 84 | void push_back(TYPE&) 85 | void push_front(TYPE&) 86 | iterator rbegin() 87 | iterator rend() 88 | void resize(int) 89 | void resize(int, TYPE&) 90 | int size() 91 | void swap(container&) 92 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libcpp/map.pxd: -------------------------------------------------------------------------------- 1 | from utility cimport pair 2 | 3 | cdef extern from "" namespace "std": 4 | cdef cppclass map[T, U]: 5 | cppclass iterator: 6 | pair[T, U]& operator*() nogil 7 | iterator operator++() nogil 8 | iterator operator--() nogil 9 | bint operator==(iterator) nogil 10 | bint operator!=(iterator) nogil 11 | cppclass reverse_iterator: 12 | pair[T, U]& operator*() nogil 13 | iterator operator++() nogil 14 | iterator operator--() nogil 15 | bint operator==(reverse_iterator) nogil 16 | bint operator!=(reverse_iterator) nogil 17 | #cppclass const_iterator(iterator): 18 | # pass 19 | #cppclass const_reverse_iterator(reverse_iterator): 20 | # pass 21 | map() nogil except + 22 | map(map&) nogil except + 23 | #map(key_compare&) 24 | U& operator[](T&) nogil 25 | #map& operator=(map&) 26 | bint operator==(map&, map&) nogil 27 | bint operator!=(map&, map&) nogil 28 | bint operator<(map&, map&) nogil 29 | bint operator>(map&, map&) nogil 30 | bint operator<=(map&, map&) nogil 31 | bint operator>=(map&, map&) nogil 32 | U& at(T&) nogil 33 | iterator begin() nogil 34 | #const_iterator begin() 35 | void clear() nogil 36 | size_t count(T&) nogil 37 | bint empty() nogil 38 | iterator end() nogil 39 | #const_iterator end() 40 | pair[iterator, iterator] equal_range(T&) nogil 41 | #pair[const_iterator, const_iterator] equal_range(key_type&) 42 | void erase(iterator) nogil 43 | void erase(iterator, iterator) nogil 44 | size_t erase(T&) nogil 45 | iterator find(T&) nogil 46 | #const_iterator find(key_type&) 47 | pair[iterator, bint] insert(pair[T, U]) nogil # XXX pair[T,U]& 48 | iterator insert(iterator, pair[T, U]) nogil # XXX pair[T,U]& 49 | #void insert(input_iterator, input_iterator) 50 | #key_compare key_comp() 51 | iterator lower_bound(T&) nogil 52 | #const_iterator lower_bound(key_type&) 53 | size_t max_size() nogil 54 | reverse_iterator rbegin() nogil 55 | #const_reverse_iterator rbegin() 56 | reverse_iterator rend() nogil 57 | #const_reverse_iterator rend() 58 | size_t size() nogil 59 | void swap(map&) nogil 60 | iterator upper_bound(T&) nogil 61 | #const_iterator upper_bound(key_type&) 62 | #value_compare value_comp() 63 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_bitsize_int_as_string.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | 5 | 6 | class TestBitSizeIntAsString(TestCase): 7 | # Python 2.5, at least the one that ships on Mac OS X, calculates 8 | # 2 ** 31 as 0! It manages to calculate 1 << 31 correctly. 9 | values = [ 10 | (200, 200), 11 | ((1 << 31) - 1, (1 << 31) - 1), 12 | ((1 << 31), str(1 << 31)), 13 | ((1 << 31) + 1, str((1 << 31) + 1)), 14 | (-100, -100), 15 | ((-1 << 31), str(-1 << 31)), 16 | ((-1 << 31) - 1, str((-1 << 31) - 1)), 17 | ((-1 << 31) + 1, (-1 << 31) + 1), 18 | ] 19 | 20 | def test_invalid_counts(self): 21 | for n in ['foo', -1, 0, 1.0]: 22 | self.assertRaises( 23 | TypeError, 24 | json.dumps, 0, int_as_string_bitcount=n) 25 | 26 | def test_ints_outside_range_fails(self): 27 | self.assertNotEqual( 28 | str(1 << 15), 29 | json.loads(json.dumps(1 << 15, int_as_string_bitcount=16)), 30 | ) 31 | 32 | def test_ints(self): 33 | for val, expect in self.values: 34 | self.assertEqual( 35 | val, 36 | json.loads(json.dumps(val))) 37 | self.assertEqual( 38 | expect, 39 | json.loads(json.dumps(val, int_as_string_bitcount=31)), 40 | ) 41 | 42 | def test_lists(self): 43 | for val, expect in self.values: 44 | val = [val, val] 45 | expect = [expect, expect] 46 | self.assertEqual( 47 | val, 48 | json.loads(json.dumps(val))) 49 | self.assertEqual( 50 | expect, 51 | json.loads(json.dumps(val, int_as_string_bitcount=31))) 52 | 53 | def test_dicts(self): 54 | for val, expect in self.values: 55 | val = {'k': val} 56 | expect = {'k': expect} 57 | self.assertEqual( 58 | val, 59 | json.loads(json.dumps(val))) 60 | self.assertEqual( 61 | expect, 62 | json.loads(json.dumps(val, int_as_string_bitcount=31))) 63 | 64 | def test_dict_keys(self): 65 | for val, _ in self.values: 66 | expect = {str(val): 'value'} 67 | val = {val: 'value'} 68 | self.assertEqual( 69 | expect, 70 | json.loads(json.dumps(val))) 71 | self.assertEqual( 72 | expect, 73 | json.loads(json.dumps(val, int_as_string_bitcount=31))) 74 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libcpp/list.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "" namespace "std": 2 | cdef cppclass list[T]: 3 | cppclass iterator: 4 | T& operator*() nogil 5 | iterator operator++() nogil 6 | iterator operator--() nogil 7 | bint operator==(iterator) nogil 8 | bint operator!=(iterator) nogil 9 | cppclass reverse_iterator: 10 | T& operator*() nogil 11 | iterator operator++() nogil 12 | iterator operator--() nogil 13 | bint operator==(reverse_iterator) nogil 14 | bint operator!=(reverse_iterator) nogil 15 | #cppclass const_iterator(iterator): 16 | # pass 17 | #cppclass const_reverse_iterator(reverse_iterator): 18 | # pass 19 | list() nogil except + 20 | list(list&) nogil except + 21 | list(size_t, T&) nogil except + 22 | #list operator=(list&) 23 | bint operator==(list&, list&) nogil 24 | bint operator!=(list&, list&) nogil 25 | bint operator<(list&, list&) nogil 26 | bint operator>(list&, list&) nogil 27 | bint operator<=(list&, list&) nogil 28 | bint operator>=(list&, list&) nogil 29 | void assign(size_t, T&) nogil 30 | T& back() nogil 31 | iterator begin() nogil 32 | #const_iterator begin() 33 | void clear() nogil 34 | bint empty() nogil 35 | iterator end() nogil 36 | #const_iterator end() 37 | iterator erase(iterator) nogil 38 | iterator erase(iterator, iterator) nogil 39 | T& front() nogil 40 | iterator insert(iterator, T&) nogil 41 | void insert(iterator, size_t, T&) nogil 42 | size_t max_size() nogil 43 | void merge(list&) nogil 44 | #void merge(list&, BinPred) 45 | void pop_back() nogil 46 | void pop_front() nogil 47 | void push_back(T&) nogil 48 | void push_front(T&) nogil 49 | reverse_iterator rbegin() nogil 50 | #const_reverse_iterator rbegin() 51 | void remove(T&) nogil 52 | #void remove_if(UnPred) 53 | reverse_iterator rend() nogil 54 | #const_reverse_iterator rend() 55 | void resize(size_t, T&) nogil 56 | void reverse() nogil 57 | size_t size() nogil 58 | void sort() nogil 59 | #void sort(BinPred) 60 | void splice(iterator, list&) nogil 61 | void splice(iterator, list&, iterator) nogil 62 | void splice(iterator, list&, iterator, iterator) nogil 63 | void swap(list&) nogil 64 | void unique() nogil 65 | #void unique(BinPred) 66 | -------------------------------------------------------------------------------- /ext_libs/Cython/Tests/TestCodeWriter.py: -------------------------------------------------------------------------------- 1 | from Cython.TestUtils import CythonTest 2 | 3 | class TestCodeWriter(CythonTest): 4 | # CythonTest uses the CodeWriter heavily, so do some checking by 5 | # roundtripping Cython code through the test framework. 6 | 7 | # Note that this test is dependant upon the normal Cython parser 8 | # to generate the input trees to the CodeWriter. This save *a lot* 9 | # of time; better to spend that time writing other tests than perfecting 10 | # this one... 11 | 12 | # Whitespace is very significant in this process: 13 | # - always newline on new block (!) 14 | # - indent 4 spaces 15 | # - 1 space around every operator 16 | 17 | def t(self, codestr): 18 | self.assertCode(codestr, self.fragment(codestr).root) 19 | 20 | def test_print(self): 21 | self.t(u""" 22 | print x, y 23 | print x + y ** 2 24 | print x, y, z, 25 | """) 26 | 27 | def test_if(self): 28 | self.t(u"if x:\n pass") 29 | 30 | def test_ifelifelse(self): 31 | self.t(u""" 32 | if x: 33 | pass 34 | elif y: 35 | pass 36 | elif z + 34 ** 34 - 2: 37 | pass 38 | else: 39 | pass 40 | """) 41 | 42 | def test_def(self): 43 | self.t(u""" 44 | def f(x, y, z): 45 | pass 46 | def f(x = 34, y = 54, z): 47 | pass 48 | """) 49 | 50 | def test_longness_and_signedness(self): 51 | self.t(u"def f(unsigned long long long long long int y):\n pass") 52 | 53 | def test_signed_short(self): 54 | self.t(u"def f(signed short int y):\n pass") 55 | 56 | def test_typed_args(self): 57 | self.t(u"def f(int x, unsigned long int y):\n pass") 58 | 59 | def test_cdef_var(self): 60 | self.t(u""" 61 | cdef int hello 62 | cdef int hello = 4, x = 3, y, z 63 | """) 64 | 65 | def test_for_loop(self): 66 | self.t(u""" 67 | for x, y, z in f(g(h(34) * 2) + 23): 68 | print x, y, z 69 | else: 70 | print 43 71 | """) 72 | 73 | def test_inplace_assignment(self): 74 | self.t(u"x += 43") 75 | 76 | def test_attribute(self): 77 | self.t(u"a.x") 78 | 79 | if __name__ == "__main__": 80 | import unittest 81 | unittest.main() 82 | 83 | -------------------------------------------------------------------------------- /ext_libs/site.py: -------------------------------------------------------------------------------- 1 | def __boot(): 2 | import sys, imp, os, os.path 3 | PYTHONPATH = os.environ.get('PYTHONPATH') 4 | if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH): 5 | PYTHONPATH = [] 6 | else: 7 | PYTHONPATH = PYTHONPATH.split(os.pathsep) 8 | 9 | pic = getattr(sys,'path_importer_cache',{}) 10 | stdpath = sys.path[len(PYTHONPATH):] 11 | mydir = os.path.dirname(__file__) 12 | #print "searching",stdpath,sys.path 13 | 14 | for item in stdpath: 15 | if item==mydir or not item: 16 | continue # skip if current dir. on Windows, or my own directory 17 | importer = pic.get(item) 18 | if importer is not None: 19 | loader = importer.find_module('site') 20 | if loader is not None: 21 | # This should actually reload the current module 22 | loader.load_module('site') 23 | break 24 | else: 25 | try: 26 | stream, path, descr = imp.find_module('site',[item]) 27 | except ImportError: 28 | continue 29 | if stream is None: 30 | continue 31 | try: 32 | # This should actually reload the current module 33 | imp.load_module('site',stream,path,descr) 34 | finally: 35 | stream.close() 36 | break 37 | else: 38 | raise ImportError("Couldn't find the real 'site' module") 39 | 40 | #print "loaded", __file__ 41 | 42 | known_paths = dict([(makepath(item)[1],1) for item in sys.path]) # 2.2 comp 43 | 44 | oldpos = getattr(sys,'__egginsert',0) # save old insertion position 45 | sys.__egginsert = 0 # and reset the current one 46 | 47 | for item in PYTHONPATH: 48 | addsitedir(item) 49 | 50 | sys.__egginsert += oldpos # restore effective old position 51 | 52 | d,nd = makepath(stdpath[0]) 53 | insert_at = None 54 | new_path = [] 55 | 56 | for item in sys.path: 57 | p,np = makepath(item) 58 | 59 | if np==nd and insert_at is None: 60 | # We've hit the first 'system' path entry, so added entries go here 61 | insert_at = len(new_path) 62 | 63 | if np in known_paths or insert_at is None: 64 | new_path.append(item) 65 | else: 66 | # new path after the insert point, back-insert it 67 | new_path.insert(insert_at, item) 68 | insert_at += 1 69 | 70 | sys.path[:] = new_path 71 | 72 | if __name__=='site': 73 | __boot() 74 | del __boot 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/errno.pxd: -------------------------------------------------------------------------------- 1 | # 7.5 Errors 2 | 3 | cdef extern from "errno.h" nogil: 4 | enum: 5 | EPERM 6 | ENOENT 7 | ESRCH 8 | EINTR 9 | EIO 10 | ENXIO 11 | E2BIG 12 | ENOEXEC 13 | EBADF 14 | ECHILD 15 | EAGAIN 16 | ENOMEM 17 | EACCES 18 | EFAULT 19 | ENOTBLK 20 | EBUSY 21 | EEXIST 22 | EXDEV 23 | ENODEV 24 | ENOTDIR 25 | EISDIR 26 | EINVAL 27 | ENFILE 28 | EMFILE 29 | ENOTTY 30 | ETXTBSY 31 | EFBIG 32 | ENOSPC 33 | ESPIPE 34 | EROFS 35 | EMLINK 36 | EPIPE 37 | EDOM 38 | ERANGE 39 | EDEADLOCK 40 | ENAMETOOLONG 41 | ENOLCK 42 | ENOSYS 43 | ENOTEMPTY 44 | ELOOP 45 | ENOMSG 46 | EIDRM 47 | ECHRNG 48 | EL2NSYNC 49 | EL3HLT 50 | EL3RST 51 | ELNRNG 52 | EUNATCH 53 | ENOCSI 54 | EL2HLT 55 | EBADE 56 | EBADR 57 | EXFULL 58 | ENOANO 59 | EBADRQC 60 | EBADSLT 61 | EBFONT 62 | ENOSTR 63 | ENODATA 64 | ETIME 65 | ENOSR 66 | ENONET 67 | ENOPKG 68 | EREMOTE 69 | ENOLINK 70 | EADV 71 | ESRMNT 72 | ECOMM 73 | EPROTO 74 | EMULTIHOP 75 | EDOTDOT 76 | EBADMSG 77 | EOVERFLOW 78 | ENOTUNIQ 79 | EBADFD 80 | EREMCHG 81 | ELIBACC 82 | ELIBBAD 83 | ELIBSCN 84 | ELIBMAX 85 | ELIBEXEC 86 | EILSEQ 87 | ERESTART 88 | ESTRPIPE 89 | EUSERS 90 | ENOTSOCK 91 | EDESTADDRREQ 92 | EMSGSIZE 93 | EPROTOTYPE 94 | ENOPROTOOPT 95 | EPROTONOSUPPORT 96 | ESOCKTNOSUPPORT 97 | EOPNOTSUPP 98 | EPFNOSUPPORT 99 | EAFNOSUPPORT 100 | EADDRINUSE 101 | EADDRNOTAVAIL 102 | ENETDOWN 103 | ENETUNREACH 104 | ENETRESET 105 | ECONNABORTED 106 | ECONNRESET 107 | ENOBUFS 108 | EISCONN 109 | ENOTCONN 110 | ESHUTDOWN 111 | ETOOMANYREFS 112 | ETIMEDOUT 113 | ECONNREFUSED 114 | EHOSTDOWN 115 | EHOSTUNREACH 116 | EALREADY 117 | EINPROGRESS 118 | ESTALE 119 | EUCLEAN 120 | ENOTNAM 121 | ENAVAIL 122 | EISNAM 123 | EREMOTEIO 124 | EDQUOT 125 | 126 | int errno 127 | 128 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/stdlib.pxd: -------------------------------------------------------------------------------- 1 | # 7.20 General utilities 2 | 3 | # deprecated cimports for backwards compatibility: 4 | from libc.string cimport const_char, const_void 5 | 6 | 7 | cdef extern from "stdlib.h" nogil: 8 | 9 | # 7.20.1 Numeric conversion functions 10 | int atoi (const char *string) 11 | long atol (const char *string) 12 | long long atoll (const char *string) 13 | double atof (const char *string) 14 | long strtol (const char *string, char **tailptr, int base) 15 | unsigned long int strtoul (const char *string, char **tailptr, int base) 16 | long long int strtoll (const char *string, char **tailptr, int base) 17 | unsigned long long int strtoull (const char *string, char **tailptr, int base) 18 | float strtof (const char *string, char **tailptr) 19 | double strtod (const char *string, char **tailptr) 20 | long double strtold (const char *string, char **tailptr) 21 | 22 | # 7.20.2 Pseudo-random sequence generation functions 23 | enum: RAND_MAX 24 | int rand () 25 | void srand (unsigned int seed) 26 | 27 | # 7.20.3 Memory management functions 28 | void *calloc (size_t count, size_t eltsize) 29 | void free (void *ptr) 30 | void *malloc (size_t size) 31 | void *realloc (void *ptr, size_t newsize) 32 | 33 | # 7.20.4 Communication with the environment 34 | enum: EXIT_FAILURE 35 | enum: EXIT_SUCCESS 36 | void exit (int status) 37 | void _exit (int status) 38 | int atexit (void (*function) ()) 39 | void abort () 40 | char *getenv (const char *name) 41 | int system (const char *command) 42 | 43 | #7.20.5 Searching and sorting utilities 44 | void *bsearch (const void *key, const void *array, 45 | size_t count, size_t size, 46 | int (*compare)(const void *, const void *)) 47 | void qsort (void *array, size_t count, size_t size, 48 | int (*compare)(const void *, const void *)) 49 | 50 | # 7.20.6 Integer arithmetic functions 51 | int abs (int number) 52 | long int labs (long int number) 53 | long long int llabs (long long int number) 54 | ctypedef struct div_t: 55 | int quot 56 | int rem 57 | div_t div (int numerator, int denominator) 58 | ctypedef struct ldiv_t: 59 | long int quot 60 | long int rem 61 | ldiv_t ldiv (long int numerator, long int denominator) 62 | ctypedef struct lldiv_t: 63 | long long int quot 64 | long long int rem 65 | lldiv_t lldiv (long long int numerator, long long int denominator) 66 | 67 | 68 | # 7.20.7 Multibyte/wide character conversion functions 69 | # XXX TODO 70 | 71 | # 7.20.8 Multibyte/wide string conversion functions 72 | # XXX TODO 73 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Code.pxd: -------------------------------------------------------------------------------- 1 | 2 | cimport cython 3 | 4 | #cdef class UtilityCodeBase(object): 5 | # cdef public object name 6 | # cdef public object proto 7 | # cdef public object impl 8 | # cdef public object init 9 | # cdef public object cleanup 10 | # cdef public object requires 11 | # cdef public dict _cache 12 | # cdef public list specialize_list 13 | # cdef public object proto_block 14 | # cdef public object file 15 | # 16 | # cpdef format_code(self, code_string, replace_empty_lines=*) 17 | 18 | cdef class FunctionState: 19 | cdef public set names_taken 20 | cdef public object owner 21 | 22 | cdef public object error_label 23 | cdef public size_t label_counter 24 | cdef public set labels_used 25 | cdef public object return_label 26 | cdef public object continue_label 27 | cdef public object break_label 28 | 29 | cdef public object return_from_error_cleanup_label # not used in __init__ ? 30 | 31 | cdef public bint in_try_finally 32 | cdef public object exc_vars 33 | cdef public bint can_trace 34 | 35 | cdef public list temps_allocated 36 | cdef public dict temps_free 37 | cdef public dict temps_used_type 38 | cdef public size_t temp_counter 39 | cdef public list collect_temps_stack 40 | 41 | cdef public object closure_temps 42 | cdef public bint should_declare_error_indicator 43 | 44 | @cython.locals(n=size_t) 45 | cpdef new_label(self, name=*) 46 | cpdef tuple get_loop_labels(self) 47 | cpdef set_loop_labels(self, labels) 48 | cpdef tuple get_all_labels(self) 49 | cpdef set_all_labels(self, labels) 50 | cpdef start_collecting_temps(self) 51 | cpdef stop_collecting_temps(self) 52 | 53 | cpdef list temps_in_use(self) 54 | 55 | cdef class IntConst: 56 | cdef public object cname 57 | cdef public object value 58 | cdef public bint is_long 59 | 60 | cdef class PyObjectConst: 61 | cdef public object cname 62 | cdef public object type 63 | 64 | cdef class StringConst: 65 | cdef public object cname 66 | cdef public object text 67 | cdef public object escaped_value 68 | cdef public dict py_strings 69 | cdef public list py_versions 70 | 71 | @cython.locals(intern=bint, is_str=bint, is_unicode=bint) 72 | cpdef get_py_string_const(self, encoding, identifier=*, is_str=*, py3str_cstring=*) 73 | 74 | ## cdef class PyStringConst: 75 | ## cdef public object cname 76 | ## cdef public object encoding 77 | ## cdef public bint is_str 78 | ## cdef public bint is_unicode 79 | ## cdef public bint intern 80 | 81 | #class GlobalState(object): 82 | 83 | #def funccontext_property(name): 84 | 85 | #class CCodeWriter(object): 86 | 87 | cdef class PyrexCodeWriter: 88 | cdef public object f 89 | cdef public Py_ssize_t level 90 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Tests/TestMemView.py: -------------------------------------------------------------------------------- 1 | from Cython.TestUtils import CythonTest 2 | import Cython.Compiler.Errors as Errors 3 | from Cython.Compiler.Nodes import * 4 | from Cython.Compiler.ParseTreeTransforms import * 5 | from Cython.Compiler.Buffer import * 6 | 7 | 8 | class TestMemviewParsing(CythonTest): 9 | 10 | def parse(self, s): 11 | return self.should_not_fail(lambda: self.fragment(s)).root 12 | 13 | def not_parseable(self, expected_error, s): 14 | e = self.should_fail(lambda: self.fragment(s), Errors.CompileError) 15 | self.assertEqual(expected_error, e.message_only) 16 | 17 | def test_default_1dim(self): 18 | self.parse(u"cdef int[:] x") 19 | self.parse(u"cdef short int[:] x") 20 | 21 | def test_default_ndim(self): 22 | self.parse(u"cdef int[:,:,:,:,:] x") 23 | self.parse(u"cdef unsigned long int[:,:,:,:,:] x") 24 | self.parse(u"cdef unsigned int[:,:,:,:,:] x") 25 | 26 | def test_zero_offset(self): 27 | self.parse(u"cdef long double[0:] x") 28 | self.parse(u"cdef int[0:] x") 29 | 30 | def test_zero_offset_ndim(self): 31 | self.parse(u"cdef int[0:,0:,0:,0:] x") 32 | 33 | def test_def_arg(self): 34 | self.parse(u"def foo(int[:,:] x): pass") 35 | 36 | def test_cdef_arg(self): 37 | self.parse(u"cdef foo(int[:,:] x): pass") 38 | 39 | def test_general_slice(self): 40 | self.parse(u'cdef float[::ptr, ::direct & contig, 0::full & strided] x') 41 | 42 | def test_non_slice_memview(self): 43 | self.not_parseable(u"An axis specification in memoryview declaration does not have a ':'.", 44 | u"cdef double[:foo, bar] x") 45 | self.not_parseable(u"An axis specification in memoryview declaration does not have a ':'.", 46 | u"cdef double[0:foo, bar] x") 47 | 48 | def test_basic(self): 49 | t = self.parse(u"cdef int[:] x") 50 | memv_node = t.stats[0].base_type 51 | self.assert_(isinstance(memv_node, MemoryViewSliceTypeNode)) 52 | 53 | # we also test other similar declarations (buffers, anonymous C arrays) 54 | # since the parsing has to distinguish between them. 55 | 56 | def disable_test_no_buf_arg(self): # TODO 57 | self.not_parseable(u"Expected ']'", 58 | u"cdef extern foo(object[int, ndim=2])") 59 | 60 | def disable_test_parse_sizeof(self): # TODO 61 | self.parse(u"sizeof(int[NN])") 62 | self.parse(u"sizeof(int[])") 63 | self.parse(u"sizeof(int[][NN])") 64 | self.not_parseable(u"Expected an identifier or literal", 65 | u"sizeof(int[:NN])") 66 | self.not_parseable(u"Expected ']'", 67 | u"sizeof(foo[dtype=bar]") 68 | 69 | if __name__ == '__main__': 70 | import unittest 71 | unittest.main() 72 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_decimal.py: -------------------------------------------------------------------------------- 1 | import decimal 2 | from decimal import Decimal 3 | from unittest import TestCase 4 | from simplejson.compat import StringIO, reload_module 5 | 6 | import simplejson as json 7 | 8 | class TestDecimal(TestCase): 9 | NUMS = "1.0", "10.00", "1.1", "1234567890.1234567890", "500" 10 | def dumps(self, obj, **kw): 11 | sio = StringIO() 12 | json.dump(obj, sio, **kw) 13 | res = json.dumps(obj, **kw) 14 | self.assertEqual(res, sio.getvalue()) 15 | return res 16 | 17 | def loads(self, s, **kw): 18 | sio = StringIO(s) 19 | res = json.loads(s, **kw) 20 | self.assertEqual(res, json.load(sio, **kw)) 21 | return res 22 | 23 | def test_decimal_encode(self): 24 | for d in map(Decimal, self.NUMS): 25 | self.assertEqual(self.dumps(d, use_decimal=True), str(d)) 26 | 27 | def test_decimal_decode(self): 28 | for s in self.NUMS: 29 | self.assertEqual(self.loads(s, parse_float=Decimal), Decimal(s)) 30 | 31 | def test_stringify_key(self): 32 | for d in map(Decimal, self.NUMS): 33 | v = {d: d} 34 | self.assertEqual( 35 | self.loads( 36 | self.dumps(v, use_decimal=True), parse_float=Decimal), 37 | {str(d): d}) 38 | 39 | def test_decimal_roundtrip(self): 40 | for d in map(Decimal, self.NUMS): 41 | # The type might not be the same (int and Decimal) but they 42 | # should still compare equal. 43 | for v in [d, [d], {'': d}]: 44 | self.assertEqual( 45 | self.loads( 46 | self.dumps(v, use_decimal=True), parse_float=Decimal), 47 | v) 48 | 49 | def test_decimal_defaults(self): 50 | d = Decimal('1.1') 51 | # use_decimal=True is the default 52 | self.assertRaises(TypeError, json.dumps, d, use_decimal=False) 53 | self.assertEqual('1.1', json.dumps(d)) 54 | self.assertEqual('1.1', json.dumps(d, use_decimal=True)) 55 | self.assertRaises(TypeError, json.dump, d, StringIO(), 56 | use_decimal=False) 57 | sio = StringIO() 58 | json.dump(d, sio) 59 | self.assertEqual('1.1', sio.getvalue()) 60 | sio = StringIO() 61 | json.dump(d, sio, use_decimal=True) 62 | self.assertEqual('1.1', sio.getvalue()) 63 | 64 | def test_decimal_reload(self): 65 | # Simulate a subinterpreter that reloads the Python modules but not 66 | # the C code https://github.com/simplejson/simplejson/issues/34 67 | global Decimal 68 | Decimal = reload_module(decimal).Decimal 69 | import simplejson.encoder 70 | simplejson.encoder.Decimal = Decimal 71 | self.test_decimal_roundtrip() 72 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/ref.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "Python.h": 2 | ctypedef struct PyTypeObject 3 | ctypedef struct PyObject: 4 | Py_ssize_t ob_refcnt 5 | PyTypeObject *ob_type 6 | cdef PyTypeObject *Py_TYPE(object) 7 | 8 | 9 | ##################################################################### 10 | # 3. Reference Counts 11 | ##################################################################### 12 | # The macros in this section are used for managing reference counts of Python objects. 13 | void Py_INCREF(object o) 14 | # Increment the reference count for object o. The object must not 15 | # be NULL; if you aren't sure that it isn't NULL, use 16 | # Py_XINCREF(). 17 | 18 | void Py_XINCREF(PyObject* o) 19 | # Increment the reference count for object o. The object may be NULL, in which case the macro has no effect. 20 | 21 | void Py_DECREF(object o) 22 | # Decrement the reference count for object o. The object must not 23 | # be NULL; if you aren't sure that it isn't NULL, use 24 | # Py_XDECREF(). If the reference count reaches zero, the object's 25 | # type's deallocation function (which must not be NULL) is 26 | # invoked. 27 | 28 | # Warning: The deallocation function can cause arbitrary Python 29 | # code to be invoked (e.g. when a class instance with a __del__() 30 | # method is deallocated). While exceptions in such code are not 31 | # propagated, the executed code has free access to all Python 32 | # global variables. This means that any object that is reachable 33 | # from a global variable should be in a consistent state before 34 | # Py_DECREF() is invoked. For example, code to delete an object 35 | # from a list should copy a reference to the deleted object in a 36 | # temporary variable, update the list data structure, and then 37 | # call Py_DECREF() for the temporary variable. 38 | 39 | void Py_XDECREF(PyObject* o) 40 | # Decrement the reference count for object o. The object may be 41 | # NULL, in which case the macro has no effect; otherwise the 42 | # effect is the same as for Py_DECREF(), and the same warning 43 | # applies. 44 | 45 | void Py_CLEAR(PyObject* o) 46 | # Decrement the reference count for object o. The object may be 47 | # NULL, in which case the macro has no effect; otherwise the 48 | # effect is the same as for Py_DECREF(), except that the argument 49 | # is also set to NULL. The warning for Py_DECREF() does not apply 50 | # with respect to the object passed because the macro carefully 51 | # uses a temporary variable and sets the argument to NULL before 52 | # decrementing its reference count. 53 | # It is a good idea to use this macro whenever decrementing the 54 | # value of a variable that might be traversed during garbage 55 | # collection. 56 | 57 | -------------------------------------------------------------------------------- /ext_libs/Cython/Plex/Actions.py: -------------------------------------------------------------------------------- 1 | #======================================================================= 2 | # 3 | # Python Lexical Analyser 4 | # 5 | # Actions for use in token specifications 6 | # 7 | #======================================================================= 8 | 9 | class Action(object): 10 | 11 | def perform(self, token_stream, text): 12 | pass # abstract 13 | 14 | def same_as(self, other): 15 | return self is other 16 | 17 | 18 | class Return(Action): 19 | """ 20 | Internal Plex action which causes |value| to 21 | be returned as the value of the associated token 22 | """ 23 | 24 | def __init__(self, value): 25 | self.value = value 26 | 27 | def perform(self, token_stream, text): 28 | return self.value 29 | 30 | def same_as(self, other): 31 | return isinstance(other, Return) and self.value == other.value 32 | 33 | def __repr__(self): 34 | return "Return(%s)" % repr(self.value) 35 | 36 | 37 | class Call(Action): 38 | """ 39 | Internal Plex action which causes a function to be called. 40 | """ 41 | 42 | def __init__(self, function): 43 | self.function = function 44 | 45 | def perform(self, token_stream, text): 46 | return self.function(token_stream, text) 47 | 48 | def __repr__(self): 49 | return "Call(%s)" % self.function.__name__ 50 | 51 | def same_as(self, other): 52 | return isinstance(other, Call) and self.function is other.function 53 | 54 | 55 | class Begin(Action): 56 | """ 57 | Begin(state_name) is a Plex action which causes the Scanner to 58 | enter the state |state_name|. See the docstring of Plex.Lexicon 59 | for more information. 60 | """ 61 | 62 | def __init__(self, state_name): 63 | self.state_name = state_name 64 | 65 | def perform(self, token_stream, text): 66 | token_stream.begin(self.state_name) 67 | 68 | def __repr__(self): 69 | return "Begin(%s)" % self.state_name 70 | 71 | def same_as(self, other): 72 | return isinstance(other, Begin) and self.state_name == other.state_name 73 | 74 | 75 | class Ignore(Action): 76 | """ 77 | IGNORE is a Plex action which causes its associated token 78 | to be ignored. See the docstring of Plex.Lexicon for more 79 | information. 80 | """ 81 | def perform(self, token_stream, text): 82 | return None 83 | 84 | def __repr__(self): 85 | return "IGNORE" 86 | 87 | IGNORE = Ignore() 88 | #IGNORE.__doc__ = Ignore.__doc__ 89 | 90 | class Text(Action): 91 | """ 92 | TEXT is a Plex action which causes the text of a token to 93 | be returned as the value of the token. See the docstring of 94 | Plex.Lexicon for more information. 95 | """ 96 | 97 | def perform(self, token_stream, text): 98 | return text 99 | 100 | def __repr__(self): 101 | return "TEXT" 102 | 103 | TEXT = Text() 104 | #TEXT.__doc__ = Text.__doc__ 105 | 106 | 107 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_indent.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | import textwrap 3 | 4 | import simplejson as json 5 | from simplejson.compat import StringIO 6 | 7 | class TestIndent(TestCase): 8 | def test_indent(self): 9 | h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 10 | 'i-vhbjkhnth', 11 | {'nifty': 87}, {'field': 'yes', 'morefield': False} ] 12 | 13 | expect = textwrap.dedent("""\ 14 | [ 15 | \t[ 16 | \t\t"blorpie" 17 | \t], 18 | \t[ 19 | \t\t"whoops" 20 | \t], 21 | \t[], 22 | \t"d-shtaeou", 23 | \t"d-nthiouh", 24 | \t"i-vhbjkhnth", 25 | \t{ 26 | \t\t"nifty": 87 27 | \t}, 28 | \t{ 29 | \t\t"field": "yes", 30 | \t\t"morefield": false 31 | \t} 32 | ]""") 33 | 34 | 35 | d1 = json.dumps(h) 36 | d2 = json.dumps(h, indent='\t', sort_keys=True, separators=(',', ': ')) 37 | d3 = json.dumps(h, indent=' ', sort_keys=True, separators=(',', ': ')) 38 | d4 = json.dumps(h, indent=2, sort_keys=True, separators=(',', ': ')) 39 | 40 | h1 = json.loads(d1) 41 | h2 = json.loads(d2) 42 | h3 = json.loads(d3) 43 | h4 = json.loads(d4) 44 | 45 | self.assertEqual(h1, h) 46 | self.assertEqual(h2, h) 47 | self.assertEqual(h3, h) 48 | self.assertEqual(h4, h) 49 | self.assertEqual(d3, expect.replace('\t', ' ')) 50 | self.assertEqual(d4, expect.replace('\t', ' ')) 51 | # NOTE: Python 2.4 textwrap.dedent converts tabs to spaces, 52 | # so the following is expected to fail. Python 2.4 is not a 53 | # supported platform in simplejson 2.1.0+. 54 | self.assertEqual(d2, expect) 55 | 56 | def test_indent0(self): 57 | h = {3: 1} 58 | def check(indent, expected): 59 | d1 = json.dumps(h, indent=indent) 60 | self.assertEqual(d1, expected) 61 | 62 | sio = StringIO() 63 | json.dump(h, sio, indent=indent) 64 | self.assertEqual(sio.getvalue(), expected) 65 | 66 | # indent=0 should emit newlines 67 | check(0, '{\n"3": 1\n}') 68 | # indent=None is more compact 69 | check(None, '{"3": 1}') 70 | 71 | def test_separators(self): 72 | lst = [1,2,3,4] 73 | expect = '[\n1,\n2,\n3,\n4\n]' 74 | expect_spaces = '[\n1, \n2, \n3, \n4\n]' 75 | # Ensure that separators still works 76 | self.assertEqual( 77 | expect_spaces, 78 | json.dumps(lst, indent=0, separators=(', ', ': '))) 79 | # Force the new defaults 80 | self.assertEqual( 81 | expect, 82 | json.dumps(lst, indent=0, separators=(',', ': '))) 83 | # Added in 2.1.4 84 | self.assertEqual( 85 | expect, 86 | json.dumps(lst, indent=0)) 87 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/function.pxd: -------------------------------------------------------------------------------- 1 | from cpython.ref cimport PyObject 2 | 3 | cdef extern from "Python.h": 4 | 5 | ############################################################################ 6 | # 7.5.3 Function Objects 7 | ############################################################################ 8 | # There are a few functions specific to Python functions. 9 | 10 | # PyFunctionObject 11 | # 12 | # The C structure used for functions. 13 | 14 | # PyTypeObject PyFunction_Type 15 | # 16 | # This is an instance of PyTypeObject and represents the Python 17 | # function type. It is exposed to Python programmers as 18 | # types.FunctionType. 19 | 20 | bint PyFunction_Check(object o) 21 | # Return true if o is a function object (has type 22 | # PyFunction_Type). The parameter must not be NULL. 23 | 24 | object PyFunction_New(object code, object globals) 25 | # Return value: New reference. 26 | # Return a new function object associated with the code object 27 | # code. globals must be a dictionary with the global variables 28 | # accessible to the function. 29 | # The function's docstring, name and __module__ are retrieved from 30 | # the code object, the argument defaults and closure are set to 31 | # NULL. 32 | 33 | PyObject* PyFunction_GetCode(object op) except? NULL 34 | # Return value: Borrowed reference. 35 | # Return the code object associated with the function object op. 36 | 37 | PyObject* PyFunction_GetGlobals(object op) except? NULL 38 | # Return value: Borrowed reference. 39 | # Return the globals dictionary associated with the function object op. 40 | 41 | PyObject* PyFunction_GetModule(object op) except? NULL 42 | # Return value: Borrowed reference. 43 | # Return the __module__ attribute of the function object op. This 44 | # is normally a string containing the module name, but can be set 45 | # to any other object by Python code. 46 | 47 | PyObject* PyFunction_GetDefaults(object op) except? NULL 48 | # Return value: Borrowed reference. 49 | # Return the argument default values of the function object 50 | # op. This can be a tuple of arguments or NULL. 51 | 52 | int PyFunction_SetDefaults(object op, object defaults) except -1 53 | # Set the argument default values for the function object 54 | # op. defaults must be Py_None or a tuple. 55 | # Raises SystemError and returns -1 on failure. 56 | 57 | PyObject* PyFunction_GetClosure(object op) except? NULL 58 | # Return value: Borrowed reference. 59 | # Return the closure associated with the function object op. This 60 | # can be NULL or a tuple of cell objects. 61 | 62 | int PyFunction_SetClosure(object op, object closure) except -1 63 | # Set the closure associated with the function object op. closure 64 | # must be Py_None or a tuple of cell objects. 65 | # Raises SystemError and returns -1 on failure. 66 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/mapping.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "Python.h": 2 | 3 | ############################################################################ 4 | # 6.4 Mapping Protocol 5 | ############################################################################ 6 | 7 | bint PyMapping_Check(object o) 8 | # Return 1 if the object provides mapping protocol, and 0 9 | # otherwise. This function always succeeds. 10 | 11 | Py_ssize_t PyMapping_Length(object o) except -1 12 | # Returns the number of keys in object o on success, and -1 on 13 | # failure. For objects that do not provide mapping protocol, this 14 | # is equivalent to the Python expression "len(o)". 15 | 16 | int PyMapping_DelItemString(object o, char *key) except -1 17 | # Remove the mapping for object key from the object o. Return -1 18 | # on failure. This is equivalent to the Python statement "del 19 | # o[key]". 20 | 21 | int PyMapping_DelItem(object o, object key) except -1 22 | # Remove the mapping for object key from the object o. Return -1 23 | # on failure. This is equivalent to the Python statement "del 24 | # o[key]". 25 | 26 | bint PyMapping_HasKeyString(object o, char *key) 27 | # On success, return 1 if the mapping object has the key key and 0 28 | # otherwise. This is equivalent to the Python expression 29 | # "o.has_key(key)". This function always succeeds. 30 | 31 | bint PyMapping_HasKey(object o, object key) 32 | # Return 1 if the mapping object has the key key and 0 33 | # otherwise. This is equivalent to the Python expression 34 | # "o.has_key(key)". This function always succeeds. 35 | 36 | object PyMapping_Keys(object o) 37 | # Return value: New reference. 38 | # On success, return a list of the keys in object o. On failure, 39 | # return NULL. This is equivalent to the Python expression 40 | # "o.keys()". 41 | 42 | object PyMapping_Values(object o) 43 | # Return value: New reference. 44 | # On success, return a list of the values in object o. On failure, 45 | # return NULL. This is equivalent to the Python expression 46 | # "o.values()". 47 | 48 | object PyMapping_Items(object o) 49 | # Return value: New reference. 50 | # On success, return a list of the items in object o, where each 51 | # item is a tuple containing a key-value pair. On failure, return 52 | # NULL. This is equivalent to the Python expression "o.items()". 53 | 54 | object PyMapping_GetItemString(object o, char *key) 55 | # Return value: New reference. 56 | # Return element of o corresponding to the object key or NULL on 57 | # failure. This is the equivalent of the Python expression 58 | # "o[key]". 59 | 60 | int PyMapping_SetItemString(object o, char *key, object v) except -1 61 | # Map the object key to the value v in object o. Returns -1 on 62 | # failure. This is the equivalent of the Python statement "o[key] 63 | # = v". 64 | 65 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/oldbuffer.pxd: -------------------------------------------------------------------------------- 1 | # Legacy Python 2 buffer interface. 2 | # 3 | # These functions are no longer available in Python 3, use the new 4 | # buffer interface instead. 5 | 6 | cdef extern from "Python.h": 7 | cdef enum _: 8 | Py_END_OF_BUFFER 9 | # This constant may be passed as the size parameter to 10 | # PyBuffer_FromObject() or PyBuffer_FromReadWriteObject(). It 11 | # indicates that the new PyBufferObject should refer to base object 12 | # from the specified offset to the end of its exported 13 | # buffer. Using this enables the caller to avoid querying the base 14 | # object for its length. 15 | 16 | bint PyBuffer_Check(object p) 17 | # Return true if the argument has type PyBuffer_Type. 18 | 19 | object PyBuffer_FromObject(object base, Py_ssize_t offset, Py_ssize_t size) 20 | # Return value: New reference. 21 | # 22 | # Return a new read-only buffer object. This raises TypeError if 23 | # base doesn't support the read-only buffer protocol or doesn't 24 | # provide exactly one buffer segment, or it raises ValueError if 25 | # offset is less than zero. The buffer will hold a reference to the 26 | # base object, and the buffer's contents will refer to the base 27 | # object's buffer interface, starting as position offset and 28 | # extending for size bytes. If size is Py_END_OF_BUFFER, then the 29 | # new buffer's contents extend to the length of the base object's 30 | # exported buffer data. 31 | 32 | object PyBuffer_FromReadWriteObject(object base, Py_ssize_t offset, Py_ssize_t size) 33 | # Return value: New reference. 34 | # 35 | # Return a new writable buffer object. Parameters and exceptions 36 | # are similar to those for PyBuffer_FromObject(). If the base 37 | # object does not export the writeable buffer protocol, then 38 | # TypeError is raised. 39 | 40 | object PyBuffer_FromMemory(void *ptr, Py_ssize_t size) 41 | # Return value: New reference. 42 | # 43 | # Return a new read-only buffer object that reads from a specified 44 | # location in memory, with a specified size. The caller is 45 | # responsible for ensuring that the memory buffer, passed in as 46 | # ptr, is not deallocated while the returned buffer object 47 | # exists. Raises ValueError if size is less than zero. Note that 48 | # Py_END_OF_BUFFER may not be passed for the size parameter; 49 | # ValueError will be raised in that case. 50 | 51 | object PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size) 52 | # Return value: New reference. 53 | # 54 | # Similar to PyBuffer_FromMemory(), but the returned buffer is 55 | # writable. 56 | 57 | object PyBuffer_New(Py_ssize_t size) 58 | # Return value: New reference. 59 | # 60 | # Return a new writable buffer object that maintains its own memory 61 | # buffer of size bytes. ValueError is returned if size is not zero 62 | # or positive. Note that the memory buffer (as returned by 63 | # PyObject_AsWriteBuffer()) is not specifically aligned. 64 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libcpp/vector.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "" namespace "std": 2 | cdef cppclass vector[T]: 3 | cppclass iterator: 4 | T& operator*() nogil 5 | iterator operator++() nogil 6 | iterator operator--() nogil 7 | iterator operator+(size_t) nogil 8 | iterator operator-(size_t) nogil 9 | bint operator==(iterator) nogil 10 | bint operator!=(iterator) nogil 11 | bint operator<(iterator) nogil 12 | bint operator>(iterator) nogil 13 | bint operator<=(iterator) nogil 14 | bint operator>=(iterator) nogil 15 | cppclass reverse_iterator: 16 | T& operator*() nogil 17 | iterator operator++() nogil 18 | iterator operator--() nogil 19 | iterator operator+(size_t) nogil 20 | iterator operator-(size_t) nogil 21 | bint operator==(reverse_iterator) nogil 22 | bint operator!=(reverse_iterator) nogil 23 | bint operator<(reverse_iterator) nogil 24 | bint operator>(reverse_iterator) nogil 25 | bint operator<=(reverse_iterator) nogil 26 | bint operator>=(reverse_iterator) nogil 27 | #cppclass const_iterator(iterator): 28 | # pass 29 | #cppclass const_reverse_iterator(reverse_iterator): 30 | # pass 31 | vector() nogil except + 32 | vector(vector&) nogil except + 33 | vector(size_t) nogil except + 34 | vector(size_t, T&) nogil except + 35 | #vector[input_iterator](input_iterator, input_iterator) 36 | T& operator[](size_t) nogil 37 | #vector& operator=(vector&) 38 | bint operator==(vector&, vector&) nogil 39 | bint operator!=(vector&, vector&) nogil 40 | bint operator<(vector&, vector&) nogil 41 | bint operator>(vector&, vector&) nogil 42 | bint operator<=(vector&, vector&) nogil 43 | bint operator>=(vector&, vector&) nogil 44 | void assign(size_t, T&) nogil 45 | #void assign[input_iterator](input_iterator, input_iterator) 46 | T& at(size_t) nogil 47 | T& back() nogil 48 | iterator begin() nogil 49 | #const_iterator begin() 50 | size_t capacity() nogil 51 | void clear() nogil 52 | bint empty() nogil 53 | iterator end() nogil 54 | #const_iterator end() 55 | iterator erase(iterator) nogil 56 | iterator erase(iterator, iterator) nogil 57 | T& front() nogil 58 | iterator insert(iterator, T&) nogil 59 | void insert(iterator, size_t, T&) nogil 60 | void insert(iterator, iterator, iterator) nogil 61 | size_t max_size() nogil 62 | void pop_back() nogil 63 | void push_back(T&) nogil 64 | reverse_iterator rbegin() nogil 65 | #const_reverse_iterator rbegin() 66 | reverse_iterator rend() nogil 67 | #const_reverse_iterator rend() 68 | void reserve(size_t) nogil 69 | void resize(size_t) nogil 70 | void resize(size_t, T&) nogil 71 | size_t size() nogil 72 | void swap(vector&) nogil 73 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_for_json.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import simplejson as json 3 | 4 | 5 | class ForJson(object): 6 | def for_json(self): 7 | return {'for_json': 1} 8 | 9 | 10 | class NestedForJson(object): 11 | def for_json(self): 12 | return {'nested': ForJson()} 13 | 14 | 15 | class ForJsonList(object): 16 | def for_json(self): 17 | return ['list'] 18 | 19 | 20 | class DictForJson(dict): 21 | def for_json(self): 22 | return {'alpha': 1} 23 | 24 | 25 | class ListForJson(list): 26 | def for_json(self): 27 | return ['list'] 28 | 29 | 30 | class TestForJson(unittest.TestCase): 31 | def assertRoundTrip(self, obj, other, for_json=True): 32 | if for_json is None: 33 | # None will use the default 34 | s = json.dumps(obj) 35 | else: 36 | s = json.dumps(obj, for_json=for_json) 37 | self.assertEqual( 38 | json.loads(s), 39 | other) 40 | 41 | def test_for_json_encodes_stand_alone_object(self): 42 | self.assertRoundTrip( 43 | ForJson(), 44 | ForJson().for_json()) 45 | 46 | def test_for_json_encodes_object_nested_in_dict(self): 47 | self.assertRoundTrip( 48 | {'hooray': ForJson()}, 49 | {'hooray': ForJson().for_json()}) 50 | 51 | def test_for_json_encodes_object_nested_in_list_within_dict(self): 52 | self.assertRoundTrip( 53 | {'list': [0, ForJson(), 2, 3]}, 54 | {'list': [0, ForJson().for_json(), 2, 3]}) 55 | 56 | def test_for_json_encodes_object_nested_within_object(self): 57 | self.assertRoundTrip( 58 | NestedForJson(), 59 | {'nested': {'for_json': 1}}) 60 | 61 | def test_for_json_encodes_list(self): 62 | self.assertRoundTrip( 63 | ForJsonList(), 64 | ForJsonList().for_json()) 65 | 66 | def test_for_json_encodes_list_within_object(self): 67 | self.assertRoundTrip( 68 | {'nested': ForJsonList()}, 69 | {'nested': ForJsonList().for_json()}) 70 | 71 | def test_for_json_encodes_dict_subclass(self): 72 | self.assertRoundTrip( 73 | DictForJson(a=1), 74 | DictForJson(a=1).for_json()) 75 | 76 | def test_for_json_encodes_list_subclass(self): 77 | self.assertRoundTrip( 78 | ListForJson(['l']), 79 | ListForJson(['l']).for_json()) 80 | 81 | def test_for_json_ignored_if_not_true_with_dict_subclass(self): 82 | for for_json in (None, False): 83 | self.assertRoundTrip( 84 | DictForJson(a=1), 85 | {'a': 1}, 86 | for_json=for_json) 87 | 88 | def test_for_json_ignored_if_not_true_with_list_subclass(self): 89 | for for_json in (None, False): 90 | self.assertRoundTrip( 91 | ListForJson(['l']), 92 | ['l'], 93 | for_json=for_json) 94 | 95 | def test_raises_typeerror_if_for_json_not_true_with_object(self): 96 | self.assertRaises(TypeError, json.dumps, ForJson()) 97 | self.assertRaises(TypeError, json.dumps, ForJson(), for_json=False) 98 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/test_tool.py: -------------------------------------------------------------------------------- 1 | from __future__ import with_statement 2 | import os 3 | import sys 4 | import textwrap 5 | import unittest 6 | import subprocess 7 | import tempfile 8 | try: 9 | # Python 3.x 10 | from test.support import strip_python_stderr 11 | except ImportError: 12 | # Python 2.6+ 13 | try: 14 | from test.test_support import strip_python_stderr 15 | except ImportError: 16 | # Python 2.5 17 | import re 18 | def strip_python_stderr(stderr): 19 | return re.sub( 20 | r"\[\d+ refs\]\r?\n?$".encode(), 21 | "".encode(), 22 | stderr).strip() 23 | 24 | class TestTool(unittest.TestCase): 25 | data = """ 26 | 27 | [["blorpie"],[ "whoops" ] , [ 28 | ],\t"d-shtaeou",\r"d-nthiouh", 29 | "i-vhbjkhnth", {"nifty":87}, {"morefield" :\tfalse,"field" 30 | :"yes"} ] 31 | """ 32 | 33 | expect = textwrap.dedent("""\ 34 | [ 35 | [ 36 | "blorpie" 37 | ], 38 | [ 39 | "whoops" 40 | ], 41 | [], 42 | "d-shtaeou", 43 | "d-nthiouh", 44 | "i-vhbjkhnth", 45 | { 46 | "nifty": 87 47 | }, 48 | { 49 | "field": "yes", 50 | "morefield": false 51 | } 52 | ] 53 | """) 54 | 55 | def runTool(self, args=None, data=None): 56 | argv = [sys.executable, '-m', 'simplejson.tool'] 57 | if args: 58 | argv.extend(args) 59 | proc = subprocess.Popen(argv, 60 | stdin=subprocess.PIPE, 61 | stderr=subprocess.PIPE, 62 | stdout=subprocess.PIPE) 63 | out, err = proc.communicate(data) 64 | self.assertEqual(strip_python_stderr(err), ''.encode()) 65 | self.assertEqual(proc.returncode, 0) 66 | return out 67 | 68 | def test_stdin_stdout(self): 69 | self.assertEqual( 70 | self.runTool(data=self.data.encode()), 71 | self.expect.encode()) 72 | 73 | def test_infile_stdout(self): 74 | with tempfile.NamedTemporaryFile() as infile: 75 | infile.write(self.data.encode()) 76 | infile.flush() 77 | self.assertEqual( 78 | self.runTool(args=[infile.name]), 79 | self.expect.encode()) 80 | 81 | def test_infile_outfile(self): 82 | with tempfile.NamedTemporaryFile() as infile: 83 | infile.write(self.data.encode()) 84 | infile.flush() 85 | # outfile will get overwritten by tool, so the delete 86 | # may not work on some platforms. Do it manually. 87 | outfile = tempfile.NamedTemporaryFile() 88 | try: 89 | self.assertEqual( 90 | self.runTool(args=[infile.name, outfile.name]), 91 | ''.encode()) 92 | with open(outfile.name, 'rb') as f: 93 | self.assertEqual(f.read(), self.expect.encode()) 94 | finally: 95 | outfile.close() 96 | if os.path.exists(outfile.name): 97 | os.unlink(outfile.name) 98 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/FlowControl.pxd: -------------------------------------------------------------------------------- 1 | cimport cython 2 | 3 | from Cython.Compiler.Visitor cimport CythonTransform, TreeVisitor 4 | 5 | cdef class ControlBlock: 6 | cdef public set children 7 | cdef public set parents 8 | cdef public set positions 9 | cdef public list stats 10 | cdef public dict gen 11 | cdef public set bounded 12 | cdef public dict input 13 | cdef public dict output 14 | 15 | # Big integer it bitsets 16 | cdef public object i_input 17 | cdef public object i_output 18 | cdef public object i_gen 19 | cdef public object i_kill 20 | cdef public object i_state 21 | 22 | cpdef bint empty(self) 23 | cpdef detach(self) 24 | cpdef add_child(self, block) 25 | 26 | cdef class ExitBlock(ControlBlock): 27 | cpdef bint empty(self) 28 | 29 | cdef class NameAssignment: 30 | cdef public bint is_arg 31 | cdef public bint is_deletion 32 | cdef public object lhs 33 | cdef public object rhs 34 | cdef public object entry 35 | cdef public object pos 36 | cdef public set refs 37 | cdef public object bit 38 | 39 | cdef class AssignmentList: 40 | cdef public object bit 41 | cdef public object mask 42 | cdef public list stats 43 | 44 | cdef class AssignmentCollector(TreeVisitor): 45 | cdef list assignments 46 | 47 | @cython.final 48 | cdef class ControlFlow: 49 | cdef public set blocks 50 | cdef public set entries 51 | cdef public list loops 52 | cdef public list exceptions 53 | 54 | cdef public ControlBlock entry_point 55 | cdef public ExitBlock exit_point 56 | cdef public ControlBlock block 57 | 58 | cdef public dict assmts 59 | 60 | cpdef newblock(self, ControlBlock parent=*) 61 | cpdef nextblock(self, ControlBlock parent=*) 62 | cpdef bint is_tracked(self, entry) 63 | cpdef bint is_statically_assigned(self, entry) 64 | cpdef mark_position(self, node) 65 | cpdef mark_assignment(self, lhs, rhs, entry) 66 | cpdef mark_argument(self, lhs, rhs, entry) 67 | cpdef mark_deletion(self, node, entry) 68 | cpdef mark_reference(self, node, entry) 69 | 70 | @cython.locals(block=ControlBlock, parent=ControlBlock, unreachable=set) 71 | cpdef normalize(self) 72 | 73 | @cython.locals(bit=object, assmts=AssignmentList, 74 | block=ControlBlock) 75 | cpdef initialize(self) 76 | 77 | @cython.locals(assmts=AssignmentList, assmt=NameAssignment) 78 | cpdef set map_one(self, istate, entry) 79 | 80 | @cython.locals(block=ControlBlock, parent=ControlBlock) 81 | cdef reaching_definitions(self) 82 | 83 | cdef class Uninitialized: 84 | pass 85 | 86 | cdef class Unknown: 87 | pass 88 | 89 | @cython.locals(dirty=bint, block=ControlBlock, parent=ControlBlock, 90 | assmt=NameAssignment) 91 | cdef check_definitions(ControlFlow flow, dict compiler_directives) 92 | 93 | @cython.final 94 | cdef class ControlFlowAnalysis(CythonTransform): 95 | cdef object gv_ctx 96 | cdef set reductions 97 | cdef list env_stack 98 | cdef list stack 99 | cdef object env 100 | cdef ControlFlow flow 101 | cdef bint in_inplace_assignment 102 | 103 | cpdef mark_assignment(self, lhs, rhs=*) 104 | cpdef mark_position(self, node) 105 | -------------------------------------------------------------------------------- /ext_libs/Cython/Debugger/Cygdb.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | The Cython debugger 5 | 6 | The current directory should contain a directory named 'cython_debug', or a 7 | path to the cython project directory should be given (the parent directory of 8 | cython_debug). 9 | 10 | Additional gdb args can be provided only if a path to the project directory is 11 | given. 12 | """ 13 | 14 | import os 15 | import sys 16 | import glob 17 | import tempfile 18 | import textwrap 19 | import subprocess 20 | 21 | usage = "Usage: cygdb [PATH [GDB_ARGUMENTS]]" 22 | 23 | def make_command_file(path_to_debug_info, prefix_code='', no_import=False): 24 | if not no_import: 25 | pattern = os.path.join(path_to_debug_info, 26 | 'cython_debug', 27 | 'cython_debug_info_*') 28 | debug_files = glob.glob(pattern) 29 | 30 | if not debug_files: 31 | sys.exit('%s.\nNo debug files were found in %s. Aborting.' % ( 32 | usage, os.path.abspath(path_to_debug_info))) 33 | 34 | fd, tempfilename = tempfile.mkstemp() 35 | f = os.fdopen(fd, 'w') 36 | f.write(prefix_code) 37 | f.write('set breakpoint pending on\n') 38 | f.write("set print pretty on\n") 39 | f.write('python from Cython.Debugger import libcython, libpython\n') 40 | 41 | if no_import: 42 | # don't do this, this overrides file command in .gdbinit 43 | # f.write("file %s\n" % sys.executable) 44 | pass 45 | else: 46 | path = os.path.join(path_to_debug_info, "cython_debug", "interpreter") 47 | interpreter = open(path).read() 48 | f.write("file %s\n" % interpreter) 49 | f.write('\n'.join('cy import %s\n' % fn for fn in debug_files)) 50 | f.write(textwrap.dedent('''\ 51 | python 52 | import sys 53 | try: 54 | gdb.lookup_type('PyModuleObject') 55 | except RuntimeError: 56 | sys.stderr.write( 57 | 'Python was not compiled with debug symbols (or it was ' 58 | 'stripped). Some functionality may not work (properly).\\n') 59 | end 60 | ''')) 61 | 62 | f.close() 63 | 64 | return tempfilename 65 | 66 | def main(path_to_debug_info=None, gdb_argv=None, no_import=False): 67 | """ 68 | Start the Cython debugger. This tells gdb to import the Cython and Python 69 | extensions (libcython.py and libpython.py) and it enables gdb's pending 70 | breakpoints. 71 | 72 | path_to_debug_info is the path to the Cython build directory 73 | gdb_argv is the list of options to gdb 74 | no_import tells cygdb whether it should import debug information 75 | """ 76 | if path_to_debug_info is None: 77 | if len(sys.argv) > 1: 78 | path_to_debug_info = sys.argv[1] 79 | else: 80 | path_to_debug_info = os.curdir 81 | 82 | if gdb_argv is None: 83 | gdb_argv = sys.argv[2:] 84 | 85 | if path_to_debug_info == '--': 86 | no_import = True 87 | 88 | tempfilename = make_command_file(path_to_debug_info, no_import=no_import) 89 | p = subprocess.Popen(['gdb', '-command', tempfilename] + gdb_argv) 90 | while True: 91 | try: 92 | p.wait() 93 | except KeyboardInterrupt: 94 | pass 95 | else: 96 | break 97 | os.remove(tempfilename) 98 | -------------------------------------------------------------------------------- /ext_libs/simplejson/tests/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | import unittest 3 | import doctest 4 | import sys 5 | 6 | 7 | class NoExtensionTestSuite(unittest.TestSuite): 8 | def run(self, result): 9 | import simplejson 10 | simplejson._toggle_speedups(False) 11 | result = unittest.TestSuite.run(self, result) 12 | simplejson._toggle_speedups(True) 13 | return result 14 | 15 | 16 | class TestMissingSpeedups(unittest.TestCase): 17 | def runTest(self): 18 | if hasattr(sys, 'pypy_translation_info'): 19 | "PyPy doesn't need speedups! :)" 20 | elif hasattr(self, 'skipTest'): 21 | self.skipTest('_speedups.so is missing!') 22 | 23 | 24 | def additional_tests(suite=None): 25 | import simplejson 26 | import simplejson.encoder 27 | import simplejson.decoder 28 | if suite is None: 29 | suite = unittest.TestSuite() 30 | for mod in (simplejson, simplejson.encoder, simplejson.decoder): 31 | suite.addTest(doctest.DocTestSuite(mod)) 32 | suite.addTest(doctest.DocFileSuite('../../index.rst')) 33 | return suite 34 | 35 | 36 | def all_tests_suite(): 37 | def get_suite(): 38 | return additional_tests( 39 | unittest.TestLoader().loadTestsFromNames([ 40 | 'simplejson.tests.test_bitsize_int_as_string', 41 | 'simplejson.tests.test_bigint_as_string', 42 | 'simplejson.tests.test_check_circular', 43 | 'simplejson.tests.test_decode', 44 | 'simplejson.tests.test_default', 45 | 'simplejson.tests.test_dump', 46 | 'simplejson.tests.test_encode_basestring_ascii', 47 | 'simplejson.tests.test_encode_for_html', 48 | 'simplejson.tests.test_errors', 49 | 'simplejson.tests.test_fail', 50 | 'simplejson.tests.test_float', 51 | 'simplejson.tests.test_indent', 52 | 'simplejson.tests.test_pass1', 53 | 'simplejson.tests.test_pass2', 54 | 'simplejson.tests.test_pass3', 55 | 'simplejson.tests.test_recursion', 56 | 'simplejson.tests.test_scanstring', 57 | 'simplejson.tests.test_separators', 58 | 'simplejson.tests.test_speedups', 59 | 'simplejson.tests.test_unicode', 60 | 'simplejson.tests.test_decimal', 61 | 'simplejson.tests.test_tuple', 62 | 'simplejson.tests.test_namedtuple', 63 | 'simplejson.tests.test_tool', 64 | 'simplejson.tests.test_for_json', 65 | 'simplejson.tests.test_subclass', 66 | ])) 67 | suite = get_suite() 68 | import simplejson 69 | if simplejson._import_c_make_encoder() is None: 70 | suite.addTest(TestMissingSpeedups()) 71 | else: 72 | suite = unittest.TestSuite([ 73 | suite, 74 | NoExtensionTestSuite([get_suite()]), 75 | ]) 76 | return suite 77 | 78 | 79 | def main(): 80 | runner = unittest.TextTestRunner(verbosity=1 + sys.argv.count('-v')) 81 | suite = all_tests_suite() 82 | raise SystemExit(not runner.run(suite).wasSuccessful()) 83 | 84 | 85 | if __name__ == '__main__': 86 | import os 87 | import sys 88 | sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) 89 | main() 90 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/tuple.pxd: -------------------------------------------------------------------------------- 1 | from cpython.ref cimport PyObject 2 | 3 | cdef extern from "Python.h": 4 | 5 | ############################################################################ 6 | # Tuples 7 | ############################################################################ 8 | 9 | bint PyTuple_Check(object p) 10 | # Return true if p is a tuple object or an instance of a subtype 11 | # of the tuple type. 12 | 13 | bint PyTuple_CheckExact(object p) 14 | # Return true if p is a tuple object, but not an instance of a subtype of the tuple type. 15 | 16 | tuple PyTuple_New(Py_ssize_t len) 17 | # Return value: New reference. 18 | # Return a new tuple object of size len, or NULL on failure. 19 | 20 | tuple PyTuple_Pack(Py_ssize_t n, ...) 21 | # Return value: New reference. 22 | # Return a new tuple object of size n, or NULL on failure. The 23 | # tuple values are initialized to the subsequent n C arguments 24 | # pointing to Python objects. "PyTuple_Pack(2, a, b)" is 25 | # equivalent to "Py_BuildValue("(OO)", a, b)". 26 | 27 | int PyTuple_Size(object p) except -1 28 | # Take a pointer to a tuple object, and return the size of that tuple. 29 | 30 | int PyTuple_GET_SIZE(object p) 31 | # Return the size of the tuple p, which must be non-NULL and point 32 | # to a tuple; no error checking is performed. 33 | 34 | PyObject* PyTuple_GetItem(object p, Py_ssize_t pos) except NULL 35 | # Return value: Borrowed reference. 36 | # Return the object at position pos in the tuple pointed to by 37 | # p. If pos is out of bounds, return NULL and sets an IndexError 38 | # exception. 39 | 40 | PyObject* PyTuple_GET_ITEM(object p, Py_ssize_t pos) 41 | # Return value: Borrowed reference. 42 | # Like PyTuple_GetItem(), but does no checking of its arguments. 43 | 44 | tuple PyTuple_GetSlice(object p, Py_ssize_t low, Py_ssize_t high) 45 | # Return value: New reference. 46 | # Take a slice of the tuple pointed to by p from low to high and return it as a new tuple. 47 | 48 | int PyTuple_SetItem(object p, Py_ssize_t pos, object o) 49 | # Insert a reference to object o at position pos of the tuple 50 | # pointed to by p. Return 0 on success. Note: This function 51 | # ``steals'' a reference to o. 52 | 53 | void PyTuple_SET_ITEM(object p, Py_ssize_t pos, object o) 54 | # Like PyTuple_SetItem(), but does no error checking, and should 55 | # only be used to fill in brand new tuples. Note: This function 56 | # ``steals'' a reference to o. 57 | 58 | int _PyTuple_Resize(PyObject **p, Py_ssize_t newsize) except -1 59 | # Can be used to resize a tuple. newsize will be the new length of 60 | # the tuple. Because tuples are supposed to be immutable, this 61 | # should only be used if there is only one reference to the 62 | # object. Do not use this if the tuple may already be known to 63 | # some other part of the code. The tuple will always grow or 64 | # shrink at the end. Think of this as destroying the old tuple and 65 | # creating a new one, only more efficiently. Returns 0 on 66 | # success. Client code should never assume that the resulting 67 | # value of *p will be the same as before calling this function. If 68 | # the object referenced by *p is replaced, the original *p is 69 | # destroyed. On failure, returns -1 and sets *p to NULL, and 70 | # raises MemoryError or SystemError. 71 | 72 | -------------------------------------------------------------------------------- /ext_libs/Cython/StringIOTree.py: -------------------------------------------------------------------------------- 1 | from cStringIO import StringIO 2 | 3 | class StringIOTree(object): 4 | """ 5 | See module docs. 6 | """ 7 | 8 | def __init__(self, stream=None): 9 | self.prepended_children = [] 10 | if stream is None: 11 | stream = StringIO() 12 | self.stream = stream 13 | self.write = stream.write 14 | self.markers = [] 15 | 16 | def getvalue(self): 17 | content = [x.getvalue() for x in self.prepended_children] 18 | content.append(self.stream.getvalue()) 19 | return "".join(content) 20 | 21 | def copyto(self, target): 22 | """Potentially cheaper than getvalue as no string concatenation 23 | needs to happen.""" 24 | for child in self.prepended_children: 25 | child.copyto(target) 26 | stream_content = self.stream.getvalue() 27 | if stream_content: 28 | target.write(stream_content) 29 | 30 | def commit(self): 31 | # Save what we have written until now so that the buffer 32 | # itself is empty -- this makes it ready for insertion 33 | if self.stream.tell(): 34 | self.prepended_children.append(StringIOTree(self.stream)) 35 | self.prepended_children[-1].markers = self.markers 36 | self.markers = [] 37 | self.stream = StringIO() 38 | self.write = self.stream.write 39 | 40 | def insert(self, iotree): 41 | """ 42 | Insert a StringIOTree (and all of its contents) at this location. 43 | Further writing to self appears after what is inserted. 44 | """ 45 | self.commit() 46 | self.prepended_children.append(iotree) 47 | 48 | def insertion_point(self): 49 | """ 50 | Returns a new StringIOTree, which is left behind at the current position 51 | (it what is written to the result will appear right before whatever is 52 | next written to self). 53 | 54 | Calling getvalue() or copyto() on the result will only return the 55 | contents written to it. 56 | """ 57 | # Save what we have written until now 58 | # This is so that getvalue on the result doesn't include it. 59 | self.commit() 60 | # Construct the new forked object to return 61 | other = StringIOTree() 62 | self.prepended_children.append(other) 63 | return other 64 | 65 | def allmarkers(self): 66 | children = self.prepended_children 67 | return [m for c in children for m in c.allmarkers()] + self.markers 68 | 69 | 70 | __doc__ = r""" 71 | Implements a buffer with insertion points. When you know you need to 72 | "get back" to a place and write more later, simply call insertion_point() 73 | at that spot and get a new StringIOTree object that is "left behind". 74 | 75 | EXAMPLE: 76 | 77 | >>> a = StringIOTree() 78 | >>> a.write('first\n') 79 | >>> b = a.insertion_point() 80 | >>> a.write('third\n') 81 | >>> b.write('second\n') 82 | >>> a.getvalue().split() 83 | ['first', 'second', 'third'] 84 | 85 | >>> c = b.insertion_point() 86 | >>> d = c.insertion_point() 87 | >>> d.write('alpha\n') 88 | >>> b.write('gamma\n') 89 | >>> c.write('beta\n') 90 | >>> b.getvalue().split() 91 | ['second', 'alpha', 'beta', 'gamma'] 92 | >>> i = StringIOTree() 93 | >>> d.insert(i) 94 | >>> i.write('inserted\n') 95 | >>> out = StringIO() 96 | >>> a.copyto(out) 97 | >>> out.getvalue().split() 98 | ['first', 'second', 'alpha', 'inserted', 'beta', 'gamma', 'third'] 99 | """ 100 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Tests/TestSignatureMatching.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from Cython.Compiler import PyrexTypes as pt 4 | from Cython.Compiler.ExprNodes import NameNode 5 | from Cython.Compiler.PyrexTypes import CFuncTypeArg 6 | 7 | def cfunctype(*arg_types): 8 | return pt.CFuncType(pt.c_int_type, 9 | [ CFuncTypeArg("name", arg_type, None) for arg_type in arg_types ]) 10 | 11 | def cppclasstype(name, base_classes): 12 | return pt.CppClassType(name, None, 'CPP_'+name, base_classes) 13 | 14 | class SignatureMatcherTest(unittest.TestCase): 15 | """ 16 | Test the signature matching algorithm for overloaded signatures. 17 | """ 18 | def assertMatches(self, expected_type, arg_types, functions): 19 | args = [ NameNode(None, type=arg_type) for arg_type in arg_types ] 20 | match = pt.best_match(args, functions) 21 | if expected_type is not None: 22 | self.assertNotEqual(None, match) 23 | self.assertEqual(expected_type, match.type) 24 | 25 | def test_cpp_reference_single_arg(self): 26 | function_types = [ 27 | cfunctype(pt.CReferenceType(pt.c_int_type)), 28 | cfunctype(pt.CReferenceType(pt.c_long_type)), 29 | cfunctype(pt.CReferenceType(pt.c_double_type)), 30 | ] 31 | 32 | functions = [ NameNode(None, type=t) for t in function_types ] 33 | self.assertMatches(function_types[0], [pt.c_int_type], functions) 34 | self.assertMatches(function_types[1], [pt.c_long_type], functions) 35 | self.assertMatches(function_types[2], [pt.c_double_type], functions) 36 | 37 | def test_cpp_reference_two_args(self): 38 | function_types = [ 39 | cfunctype( 40 | pt.CReferenceType(pt.c_int_type), pt.CReferenceType(pt.c_long_type)), 41 | cfunctype( 42 | pt.CReferenceType(pt.c_long_type), pt.CReferenceType(pt.c_long_type)), 43 | ] 44 | 45 | functions = [ NameNode(None, type=t) for t in function_types ] 46 | self.assertMatches(function_types[0], [pt.c_int_type, pt.c_long_type], functions) 47 | self.assertMatches(function_types[1], [pt.c_long_type, pt.c_long_type], functions) 48 | self.assertMatches(function_types[1], [pt.c_long_type, pt.c_int_type], functions) 49 | 50 | def test_cpp_reference_cpp_class(self): 51 | classes = [ cppclasstype("Test%d"%i, []) for i in range(2) ] 52 | function_types = [ 53 | cfunctype(pt.CReferenceType(classes[0])), 54 | cfunctype(pt.CReferenceType(classes[1])), 55 | ] 56 | 57 | functions = [ NameNode(None, type=t) for t in function_types ] 58 | self.assertMatches(function_types[0], [classes[0]], functions) 59 | self.assertMatches(function_types[1], [classes[1]], functions) 60 | 61 | def test_cpp_reference_cpp_class_and_int(self): 62 | classes = [ cppclasstype("Test%d"%i, []) for i in range(2) ] 63 | function_types = [ 64 | cfunctype(pt.CReferenceType(classes[0]), pt.c_int_type), 65 | cfunctype(pt.CReferenceType(classes[0]), pt.c_long_type), 66 | cfunctype(pt.CReferenceType(classes[1]), pt.c_int_type), 67 | cfunctype(pt.CReferenceType(classes[1]), pt.c_long_type), 68 | ] 69 | 70 | functions = [ NameNode(None, type=t) for t in function_types ] 71 | self.assertMatches(function_types[0], [classes[0], pt.c_int_type], functions) 72 | self.assertMatches(function_types[1], [classes[0], pt.c_long_type], functions) 73 | self.assertMatches(function_types[2], [classes[1], pt.c_int_type], functions) 74 | self.assertMatches(function_types[3], [classes[1], pt.c_long_type], functions) 75 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/cpython/pystate.pxd: -------------------------------------------------------------------------------- 1 | # Thread and interpreter state structures and their interfaces 2 | 3 | from cpython.ref cimport PyObject 4 | 5 | cdef extern from "Python.h": 6 | 7 | # We make these an opague types. If the user wants specific attributes, 8 | # they can be declared manually. 9 | 10 | ctypedef struct PyInterpreterState: 11 | pass 12 | 13 | ctypedef struct PyThreadState: 14 | pass 15 | 16 | ctypedef struct PyFrameObject: 17 | pass 18 | 19 | # This is not actually a struct, but make sure it can never be coerced to 20 | # an int or used in arithmetic expressions 21 | ctypedef struct PyGILState_STATE 22 | 23 | # The type of the trace function registered using PyEval_SetProfile() and 24 | # PyEval_SetTrace(). 25 | # Py_tracefunc return -1 when raising an exception, or 0 for success. 26 | ctypedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *) 27 | 28 | # The following values are used for 'what' for tracefunc functions 29 | enum: 30 | PyTrace_CALL 31 | PyTrace_EXCEPTION 32 | PyTrace_LINE 33 | PyTrace_RETURN 34 | PyTrace_C_CALL 35 | PyTrace_C_EXCEPTION 36 | PyTrace_C_RETURN 37 | 38 | 39 | PyInterpreterState * PyInterpreterState_New() 40 | void PyInterpreterState_Clear(PyInterpreterState *) 41 | void PyInterpreterState_Delete(PyInterpreterState *) 42 | 43 | PyThreadState * PyThreadState_New(PyInterpreterState *) 44 | void PyThreadState_Clear(PyThreadState *) 45 | void PyThreadState_Delete(PyThreadState *) 46 | 47 | PyThreadState * PyThreadState_Get() 48 | PyThreadState * PyThreadState_Swap(PyThreadState *) 49 | PyObject * PyThreadState_GetDict() 50 | int PyThreadState_SetAsyncExc(long, PyObject *) 51 | 52 | # Ensure that the current thread is ready to call the Python 53 | # C API, regardless of the current state of Python, or of its 54 | # thread lock. This may be called as many times as desired 55 | # by a thread so long as each call is matched with a call to 56 | # PyGILState_Release(). In general, other thread-state APIs may 57 | # be used between _Ensure() and _Release() calls, so long as the 58 | # thread-state is restored to its previous state before the Release(). 59 | # For example, normal use of the Py_BEGIN_ALLOW_THREADS/ 60 | # Py_END_ALLOW_THREADS macros are acceptable. 61 | 62 | # The return value is an opaque "handle" to the thread state when 63 | # PyGILState_Ensure() was called, and must be passed to 64 | # PyGILState_Release() to ensure Python is left in the same state. Even 65 | # though recursive calls are allowed, these handles can *not* be shared - 66 | # each unique call to PyGILState_Ensure must save the handle for its 67 | # call to PyGILState_Release. 68 | 69 | # When the function returns, the current thread will hold the GIL. 70 | 71 | # Failure is a fatal error. 72 | PyGILState_STATE PyGILState_Ensure() 73 | 74 | # Release any resources previously acquired. After this call, Python's 75 | # state will be the same as it was prior to the corresponding 76 | # PyGILState_Ensure() call (but generally this state will be unknown to 77 | # the caller, hence the use of the GILState API.) 78 | 79 | # Every call to PyGILState_Ensure must be matched by a call to 80 | # PyGILState_Release on the same thread. 81 | void PyGILState_Release(PyGILState_STATE) 82 | 83 | # Routines for advanced debuggers, requested by David Beazley. 84 | # Don't use unless you know what you are doing! 85 | PyInterpreterState * PyInterpreterState_Head() 86 | PyInterpreterState * PyInterpreterState_Next(PyInterpreterState *) 87 | PyThreadState * PyInterpreterState_ThreadHead(PyInterpreterState *) 88 | PyThreadState * PyThreadState_Next(PyThreadState *) 89 | -------------------------------------------------------------------------------- /ext_libs/Cython/Compiler/Tests/TestUtilityLoad.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from Cython.Compiler import Code, UtilityCode 4 | 5 | 6 | def strip_2tup(tup): 7 | return tup[0] and tup[0].strip(), tup[1] and tup[1].strip() 8 | 9 | class TestUtilityLoader(unittest.TestCase): 10 | """ 11 | Test loading UtilityCodes 12 | """ 13 | 14 | expected = "test {{loader}} prototype", "test {{loader}} impl" 15 | 16 | required = "req {{loader}} proto", "req {{loader}} impl" 17 | 18 | context = dict(loader='Loader') 19 | 20 | name = "TestUtilityLoader" 21 | filename = "TestUtilityLoader.c" 22 | cls = Code.UtilityCode 23 | 24 | def test_load_as_string(self): 25 | got = strip_2tup(self.cls.load_as_string(self.name)) 26 | self.assertEquals(got, self.expected) 27 | 28 | got = strip_2tup(self.cls.load_as_string(self.name, self.filename)) 29 | self.assertEquals(got, self.expected) 30 | 31 | def test_load(self): 32 | utility = self.cls.load(self.name) 33 | got = strip_2tup((utility.proto, utility.impl)) 34 | self.assertEquals(got, self.expected) 35 | 36 | required, = utility.requires 37 | got = strip_2tup((required.proto, required.impl)) 38 | self.assertEquals(got, self.required) 39 | 40 | utility = self.cls.load(self.name, from_file=self.filename) 41 | got = strip_2tup((utility.proto, utility.impl)) 42 | self.assertEquals(got, self.expected) 43 | 44 | utility = self.cls.load_cached(self.name, from_file=self.filename) 45 | got = strip_2tup((utility.proto, utility.impl)) 46 | self.assertEquals(got, self.expected) 47 | 48 | 49 | class TestTempitaUtilityLoader(TestUtilityLoader): 50 | """ 51 | Test loading UtilityCodes with Tempita substitution 52 | """ 53 | expected_tempita = (TestUtilityLoader.expected[0].replace('{{loader}}', 'Loader'), 54 | TestUtilityLoader.expected[1].replace('{{loader}}', 'Loader')) 55 | 56 | required_tempita = (TestUtilityLoader.required[0].replace('{{loader}}', 'Loader'), 57 | TestUtilityLoader.required[1].replace('{{loader}}', 'Loader')) 58 | 59 | cls = Code.TempitaUtilityCode 60 | 61 | def test_load_as_string(self): 62 | got = strip_2tup(self.cls.load_as_string(self.name, context=self.context)) 63 | self.assertEquals(got, self.expected_tempita) 64 | 65 | def test_load(self): 66 | utility = self.cls.load(self.name, context=self.context) 67 | got = strip_2tup((utility.proto, utility.impl)) 68 | self.assertEquals(got, self.expected_tempita) 69 | 70 | required, = utility.requires 71 | got = strip_2tup((required.proto, required.impl)) 72 | self.assertEquals(got, self.required_tempita) 73 | 74 | utility = self.cls.load(self.name, from_file=self.filename, context=self.context) 75 | got = strip_2tup((utility.proto, utility.impl)) 76 | self.assertEquals(got, self.expected_tempita) 77 | 78 | 79 | class TestCythonUtilityLoader(TestTempitaUtilityLoader): 80 | """ 81 | Test loading CythonUtilityCodes 82 | """ 83 | 84 | # Just change the attributes and run the same tests 85 | expected = None, "test {{cy_loader}} impl" 86 | expected_tempita = None, "test CyLoader impl" 87 | 88 | required = None, "req {{cy_loader}} impl" 89 | required_tempita = None, "req CyLoader impl" 90 | 91 | context = dict(cy_loader='CyLoader') 92 | 93 | name = "TestCyUtilityLoader" 94 | filename = "TestCyUtilityLoader.pyx" 95 | cls = UtilityCode.CythonUtilityCode 96 | 97 | # Small hack to pass our tests above 98 | cls.proto = None 99 | 100 | test_load = TestUtilityLoader.test_load 101 | test_load_tempita = TestTempitaUtilityLoader.test_load 102 | -------------------------------------------------------------------------------- /ext_libs/Cython/Includes/libc/stdint.pxd: -------------------------------------------------------------------------------- 1 | # Longness only used for type promotion. 2 | # Actual compile time size used for conversions. 3 | 4 | # 7.18 Integer types 5 | cdef extern from "stdint.h" nogil: 6 | 7 | # 7.18.1 Integer types 8 | # 7.18.1.1 Exact-width integer types 9 | ctypedef signed char int8_t 10 | ctypedef signed short int16_t 11 | ctypedef signed int int32_t 12 | ctypedef signed long int64_t 13 | ctypedef unsigned char uint8_t 14 | ctypedef unsigned short uint16_t 15 | ctypedef unsigned int uint32_t 16 | ctypedef unsigned long uint64_t 17 | # 7.18.1.2 Minimum-width integer types 18 | ctypedef signed char int_least8_t 19 | ctypedef signed short int_least16_t 20 | ctypedef signed int int_least32_t 21 | ctypedef signed long int_least64_t 22 | ctypedef unsigned char uint_least8_t 23 | ctypedef unsigned short uint_least16_t 24 | ctypedef unsigned int uint_least32_t 25 | ctypedef unsigned long uint_least64_t 26 | # 7.18.1.3 Fastest minimum-width integer types 27 | ctypedef signed char int_fast8_t 28 | ctypedef signed short int_fast16_t 29 | ctypedef signed int int_fast32_t 30 | ctypedef signed long int_fast64_t 31 | ctypedef unsigned char uint_fast8_t 32 | ctypedef unsigned short uint_fast16_t 33 | ctypedef unsigned int uint_fast32_t 34 | ctypedef unsigned long uint_fast64_t 35 | # 7.18.1.4 Integer types capable of holding object pointers 36 | ctypedef ssize_t intptr_t 37 | ctypedef size_t uintptr_t 38 | # 7.18.1.5 Greatest-width integer types 39 | ctypedef signed long long intmax_t 40 | ctypedef unsigned long long uintmax_t 41 | 42 | # 7.18.2 Limits of specified-width integer types 43 | # 7.18.2.1 Limits of exact-width integer types 44 | int8_t INT8_MIN 45 | int16_t INT16_MIN 46 | int32_t INT32_MIN 47 | int64_t INT64_MIN 48 | int8_t INT8_MAX 49 | int16_t INT16_MAX 50 | int32_t INT32_MAX 51 | int64_t INT64_MAX 52 | uint8_t UINT8_MAX 53 | uint16_t UINT16_MAX 54 | uint32_t UINT32_MAX 55 | uint64_t UINT64_MAX 56 | #7.18.2.2 Limits of minimum-width integer types 57 | int_least8_t INT_LEAST8_MIN 58 | int_least16_t INT_LEAST16_MIN 59 | int_least32_t INT_LEAST32_MIN 60 | int_least64_t INT_LEAST64_MIN 61 | int_least8_t INT_LEAST8_MAX 62 | int_least16_t INT_LEAST16_MAX 63 | int_least32_t INT_LEAST32_MAX 64 | int_least64_t INT_LEAST64_MAX 65 | uint_least8_t UINT_LEAST8_MAX 66 | uint_least16_t UINT_LEAST16_MAX 67 | uint_least32_t UINT_LEAST32_MAX 68 | uint_least64_t UINT_LEAST64_MAX 69 | #7.18.2.3 Limits of fastest minimum-width integer types 70 | int_fast8_t INT_FAST8_MIN 71 | int_fast16_t INT_FAST16_MIN 72 | int_fast32_t INT_FAST32_MIN 73 | int_fast64_t INT_FAST64_MIN 74 | int_fast8_t INT_FAST8_MAX 75 | int_fast16_t INT_FAST16_MAX 76 | int_fast32_t INT_FAST32_MAX 77 | int_fast64_t INT_FAST64_MAX 78 | uint_fast8_t UINT_FAST8_MAX 79 | uint_fast16_t UINT_FAST16_MAX 80 | uint_fast32_t UINT_FAST32_MAX 81 | uint_fast64_t UINT_FAST64_MAX 82 | #7.18.2.4 Limits of integer types capable of holding object pointers 83 | enum: INTPTR_MIN 84 | enum: INTPTR_MAX 85 | enum: UINTPTR_MAX 86 | # 7.18.2.5 Limits of greatest-width integer types 87 | enum: INTMAX_MAX 88 | enum: INTMAX_MIN 89 | enum: UINTMAX_MAX 90 | 91 | # 7.18.3 Limits of other integer types 92 | # ptrdiff_t 93 | enum: PTRDIFF_MIN 94 | enum: PTRDIFF_MAX 95 | # sig_atomic_t 96 | enum: SIG_ATOMIC_MIN 97 | enum: SIG_ATOMIC_MAX 98 | # size_t 99 | size_t SIZE_MAX 100 | # wchar_t 101 | enum: WCHAR_MIN 102 | enum: WCHAR_MAX 103 | # wint_t 104 | enum: WINT_MIN 105 | enum: WINT_MAX 106 | --------------------------------------------------------------------------------