pymtbl-0.4.1/0000755002364700236470000000000013135453410012724 5ustar reedreed00000000000000pymtbl-0.4.1/README.md0000644002364700236470000000244513121024350014200 0ustar reedreed00000000000000pymtbl: Python bindings for the mtbl sorted string table library ---------------------------------------------------------------- `pymtbl` provides a simple Pythonic wrapper for [mtbl](https://github.com/farsightsec/mtbl)'s reader, writer, sorter, and merger interfaces. The `examples/` directory contains scripts demonstrating each of these interfaces. The following transcript shows the basic reader and writer interfaces: >>> import mtbl >>> w = mtbl.writer('example.mtbl', compression=mtbl.COMPRESSION_SNAPPY) >>> w['key1'] = 'val1' >>> w['key17'] = 'val17' >>> w['key2'] = 'val2' >>> w['key23'] = 'val23' >>> w['key3'] = 'val3' >>> w['key4'] = 'val4' >>> w['key05'] = 'val05' Traceback (most recent call last): File "", line 1, in File "mtbl.pyx", line 361, in mtbl.writer.__setitem__ (mtbl.c:4108) mtbl.KeyOrderError >>> w.close() >>> r = mtbl.reader('example.mtbl', verify_checksums=True) >>> for k,v in r.get_range('key19', 'key23'): print k,v ... key2 val2 key23 val23 >>> for k,v in r.get_prefix('key2'): print k,v ... key2 val2 key23 val23 >>> for k,v in r.iteritems(): print k, v ... key1 val1 key17 val17 key2 val2 key23 val23 key3 val3 key4 val4 >>> pymtbl-0.4.1/LICENSE0000644002364700236470000002613613121024350013731 0ustar reedreed00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. pymtbl-0.4.1/mtbl.pyx0000644002364700236470000005100113122230635014417 0ustar reedreed00000000000000include "mtbl.pxi" import threading DEFAULT_SORTER_TEMP_DIR = '/var/tmp' DEFAULT_SORTER_MEMORY = 1073741824 COMPRESSION_NONE = MTBL_COMPRESSION_NONE COMPRESSION_SNAPPY = MTBL_COMPRESSION_SNAPPY COMPRESSION_ZLIB = MTBL_COMPRESSION_ZLIB COMPRESSION_LZ4 = MTBL_COMPRESSION_LZ4 COMPRESSION_LZ4HC = MTBL_COMPRESSION_LZ4HC class KeyOrderError(Exception): pass class TableClosedException(Exception): pass class UnknownCompressionTypeException(Exception): pass class UninitializedException(Exception): pass class VarintDecodingError(Exception): pass ImmutableError = TypeError('object does not support mutation') def varint_length(uint64_t value): """varint_length(v) -> number of bytes the integer v would require in varint encoding.""" return mtbl_varint_length(value) def varint_length_packed(bytes py_buf): """varint_length_packed(b) -> number of varint-packed bytes at the start of b.""" cdef uint8_t *buf cdef Py_ssize_t len_buf cdef size_t sz PyString_AsStringAndSize(py_buf, &buf, &len_buf) with nogil: sz = mtbl_varint_length_packed(buf, len_buf) if sz == 0: raise VarintDecodingError return sz def varint_encode(long v): """varint_encode(v) -> encode integer v using packed variable-width encoding.""" cdef uint8_t buf[10] cdef size_t sz with nogil: sz = mtbl_varint_encode64(buf, v) return PyString_FromStringAndSize( buf, sz) def varint_decode(bytes py_buf): """varint_decode(b) -> decode variable-width packed integer from b""" cdef uint64_t val cdef uint8_t *buf cdef Py_ssize_t len_buf cdef size_t bytes_read PyString_AsStringAndSize(py_buf, &buf, &len_buf) if mtbl_varint_length_packed(buf, len_buf) == 0: raise VarintDecodingError with nogil: mtbl_varint_decode64(buf, &val) return val @cython.internal cdef class iterkeys(object): cdef mtbl_iter *_instance cdef object _parent def __cinit__(self): self._instance = NULL def __init__(self, object _parent): self._parent = _parent def __dealloc__(self): with nogil: mtbl_iter_destroy(&self._instance) def __iter__(self): return self def __next__(self): cdef mtbl_res res cdef uint8_t *key cdef uint8_t *val cdef size_t len_key cdef size_t len_val if self._instance == NULL: raise StopIteration with nogil: res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) if res == mtbl_res_failure: raise StopIteration return PyString_FromStringAndSize( key, len_key) @cython.internal cdef class itervalues(object): cdef mtbl_iter *_instance cdef object _parent def __cinit__(self): self._instance = NULL def __init__(self, object _parent): self._parent = _parent def __dealloc__(self): with nogil: mtbl_iter_destroy(&self._instance) def __iter__(self): return self def __next__(self): cdef mtbl_res res cdef uint8_t *key cdef uint8_t *val cdef size_t len_key cdef size_t len_val if self._instance == NULL: raise StopIteration with nogil: res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) if res == mtbl_res_failure: raise StopIteration return PyString_FromStringAndSize( val, len_val) @cython.internal cdef class iteritems(object): cdef mtbl_iter *_instance cdef object _parent def __cinit__(self): self._instance = NULL def __init__(self, object _parent): self._parent = _parent def __dealloc__(self): with nogil: mtbl_iter_destroy(&self._instance) def __iter__(self): return self def __next__(self): cdef mtbl_res res cdef uint8_t *key cdef uint8_t *val cdef size_t len_key cdef size_t len_val if self._instance == NULL: raise StopIteration with nogil: res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) if res == mtbl_res_failure: raise StopIteration return (PyString_FromStringAndSize( key, len_key), PyString_FromStringAndSize( val, len_val)) cdef get_iterkeys(parent, mtbl_iter *instance): it = iterkeys(parent) it._instance = instance return it cdef get_itervalues(parent, mtbl_iter *instance): it = itervalues(parent) it._instance = instance return it cdef get_iteritems(parent, mtbl_iter *instance): it = iteritems(parent) it._instance = instance return it @cython.internal cdef class DictMixin(object): def __iter__(self): return self.iterkeys() def iter(self): return self.iterkeys() def items(self): """D.items() -> list of D's (key, value) pairs, as 2-tuples""" return [ (k, v) for k, v in self.iteritems() ] def keys(self): """D.keys() -> list of D's keys""" return [ k for k in self.iterkeys() ] def values(self): """D.values() -> list of D's values""" return [ v for v in self.itervalues() ] def __delitem__(self, key): """will raise ImmutableError""" raise ImmutableError def __setitem__(self, key, value): """will raise ImmutableError""" raise ImmutableError def pop(self, *a, **b): """will raise ImmutableError""" raise ImmutableError def popitem(self): """will raise ImmutableError""" raise ImmutableError def update(self, *a, **b): """will raise ImmutableError""" raise ImmutableError cdef class reader(DictMixin): """ reader(fname) -> new MTBL reader initialized from file fname Keyword arguments: verify_checksums -- whether to verify data block checksums (default False) """ cdef mtbl_reader *_instance def __cinit__(self): self._instance = NULL def __dealloc__(self): with nogil: mtbl_reader_destroy(&self._instance) def __init__(self, char * fname, bool verify_checksums=False): cdef mtbl_reader_options *opt with nogil: opt = mtbl_reader_options_init() mtbl_reader_options_set_verify_checksums(opt, verify_checksums) self._instance = mtbl_reader_init(fname, opt) mtbl_reader_options_destroy(&opt) if (self._instance == NULL): raise IOError("unable to open file: '%s'" % fname) cdef check_initialized(self): if self._instance == NULL: raise UninitializedException def iterkeys(self): """R.iterkeys() -> an iterator over the keys of R.""" self.check_initialized() return get_iterkeys(self, mtbl_source_iter(mtbl_reader_source(self._instance))) def itervalues(self): """R.itervalues() -> an iterator over the values of R.""" self.check_initialized() return get_itervalues(self, mtbl_source_iter(mtbl_reader_source(self._instance))) def iteritems(self): """R.iteritems() -> an iterator over the (key, value) items of R.""" self.check_initialized() return get_iteritems(self, mtbl_source_iter(mtbl_reader_source(self._instance))) def __contains__(self, bytes py_key): """R.__contains__(k) -> True if R has a key k, else False""" try: self.__getitem__(py_key) return True except KeyError: pass return False def has_key(self, bytes py_key): """R.has_key(k) -> True if R has a key k, else False.""" return self.__contains__(py_key) def get(self, bytes py_key, default=None): """R.get(k[,d]) -> R[k] if k in R, else d. d defaults to None.""" try: return self.__getitem__(py_key) except KeyError: pass return default def get_range(self, bytes py_key0, bytes py_key1): """ R.get_range(key0, key1) -> an iterator over all (key, value) items in R where key is between key0 and key1 inclusive. """ cdef mtbl_res res cdef uint8_t *key0 cdef uint8_t *key1 cdef size_t len_key0 cdef size_t len_key1 self.check_initialized() key0 = PyString_AsString(py_key0) key1 = PyString_AsString(py_key1) len_key0 = PyString_Size(py_key0) len_key1 = PyString_Size(py_key1) return get_iteritems(self, mtbl_source_get_range( mtbl_reader_source(self._instance), key0, len_key0, key1, len_key1)) def get_prefix(self, bytes py_key): """ R.get_prefix(key_prefix) -> an iterator over all (key, value) items in R where key begins with key_prefix. """ cdef mtbl_res res cdef uint8_t *key cdef size_t len_key self.check_initialized() key = PyString_AsString(py_key) len_key = PyString_Size(py_key) return get_iteritems(self, mtbl_source_get_prefix( mtbl_reader_source(self._instance), key, len_key)) def __getitem__(self, bytes py_key): cdef mtbl_iter *it cdef mtbl_res res cdef uint8_t *key cdef uint8_t *val cdef size_t len_key cdef size_t len_val self.check_initialized() key = PyString_AsString(py_key) len_key = PyString_Size(py_key) items = [] with nogil: it = mtbl_source_get(mtbl_reader_source(self._instance), key, len_key) if it == NULL: raise KeyError(py_key) while True: with nogil: res = mtbl_iter_next(it, &key, &len_key, &val, &len_val) if res == mtbl_res_failure: break items.append(PyString_FromStringAndSize( val, len_val)) with nogil: mtbl_iter_destroy(&it) if not items: raise KeyError(py_key) return items cdef class writer(object): """ writer(fname) -> new MTBL writer, output to file fname Keyword arguments: compression -- compression type (default COMPRESSION_NONE) block_size -- maximum data block size in bytes (default 8192) block_restart_interval -- how frequently to restart key prefix compression (default 16) """ cdef mtbl_writer *_instance cdef _lock def __cinit__(self): self._instance = NULL def __dealloc__(self): with nogil: mtbl_writer_destroy(&self._instance) def __init__(self, char * fname, mtbl_compression_type compression=COMPRESSION_NONE, size_t block_size=8192, size_t block_restart_interval=16): if not (compression == COMPRESSION_NONE or compression == COMPRESSION_SNAPPY or compression == COMPRESSION_ZLIB or compression == COMPRESSION_LZ4 or compression == COMPRESSION_LZ4HC): raise UnknownCompressionTypeException self._lock = threading.Semaphore() cdef mtbl_writer_options *opt with nogil: opt = mtbl_writer_options_init() mtbl_writer_options_set_compression(opt, compression) mtbl_writer_options_set_block_size(opt, block_size) mtbl_writer_options_set_block_restart_interval(opt, block_restart_interval) self._instance = mtbl_writer_init(fname, opt) mtbl_writer_options_destroy(&opt) if self._instance == NULL: raise IOError("unable to initialize file: '%s'" % fname) def close(self): """W.close() -- finalize and close the writer""" with self._lock: with nogil: mtbl_writer_destroy(&self._instance) def __setitem__(self, bytes py_key, bytes py_val): """ W.__setitem__(key, value) <==> W[key] = value Adds a new (key, value) entry to the writer. key and value must be byte strings, and key must be lexicographically greater than any previously written key. """ cdef mtbl_res res cdef uint8_t *key cdef uint8_t *val cdef size_t len_key cdef size_t len_val if self._instance == NULL: raise TableClosedException key = PyString_AsString(py_key) val = PyString_AsString(py_val) len_key = PyString_Size(py_key) len_val = PyString_Size(py_val) with self._lock: with nogil: res = mtbl_writer_add(self._instance, key, len_key, val, len_val) if res == mtbl_res_failure: raise KeyOrderError def __delitem__(self, key): """will raise ImmutableError""" raise ImmutableError cdef void merge_func_wrapper(void *clos, uint8_t *key, size_t len_key, uint8_t *val0, size_t len_val0, uint8_t *val1, size_t len_val1, uint8_t **merged_val, size_t *len_merged_val) with gil: cdef str py_key cdef str py_val0 cdef str py_val1 cdef str py_merged_val py_key = PyString_FromStringAndSize( key, len_key) py_val0 = PyString_FromStringAndSize( val0, len_val0) py_val1 = PyString_FromStringAndSize( val1, len_val1) py_merged_val = ( clos)(py_key, py_val0, py_val1) len_merged_val[0] = PyString_Size(py_merged_val) merged_val[0] = malloc(len_merged_val[0]) memcpy(merged_val[0], PyString_AsString(py_merged_val), len_merged_val[0]) cdef class merger(object): """ merger(merge_func) -> new MTBL merger merge_func is the user-supplied value merging function: merge_func(key, val0, val1) -> merged_val all parameters are byte strings, and the return value must be a byte string. """ cdef mtbl_merger *_instance cdef set _references cdef _lock cdef object merge_func def __cinit__(self): self._instance = NULL def __dealloc__(self): with nogil: mtbl_merger_destroy(&self._instance) def __init__(self, object merge_func): cdef mtbl_merger_options *opt self.merge_func = merge_func opt = mtbl_merger_options_init() mtbl_merger_options_set_merge_func(opt, merge_func_wrapper, merge_func) self._instance = mtbl_merger_init(opt) mtbl_merger_options_destroy(&opt) self._references = set() self._lock = threading.Semaphore() def add_reader(self, reader r): """M.add_reader(mtbl.reader) -- add a reader object as a merge input""" with self._lock: with nogil: mtbl_merger_add_source(self._instance, mtbl_reader_source(r._instance)) self._references.add(r) def write(self, writer w): """M.write(mtbl.writer) -- dump merged output to writer""" cdef mtbl_res res with w._lock: with nogil: res = mtbl_source_write(mtbl_merger_source(self._instance), w._instance) if res != mtbl_res_success: raise RuntimeError def __iter__(self): return self.iterkeys() def iterkeys(self): """M.iterkeys() -> an iterator over the merged keys of M.""" return get_iterkeys(self, mtbl_source_iter(mtbl_merger_source(self._instance))) def itervalues(self): """M.itervalues() -> an iterator over the merged values of M.""" return get_itervalues(self, mtbl_source_iter(mtbl_merger_source(self._instance))) def iteritems(self): """M.iteritems() -> an iterator over the merged (key, value) items of M.""" return get_iteritems(self, mtbl_source_iter(mtbl_merger_source(self._instance))) def get(self, bytes py_key): """ M.get(key) -> an iterator over all (key, value) items in M which match key. """ cdef mtbl_res res cdef uint8_t *key cdef size_t len_key key = PyString_AsString(py_key) len_key = PyString_Size(py_key) return get_iteritems(self, mtbl_source_get(mtbl_merger_source(self._instance), key, len_key)) def get_range(self, bytes py_key0, bytes py_key1): """ M.get_range(key0, key1) -> an iterator over all (key, value) items in M where key is between key0 and key1 inclusive. """ cdef mtbl_res res cdef uint8_t *key0 cdef uint8_t *key1 cdef size_t len_key0 cdef size_t len_key1 key0 = PyString_AsString(py_key0) key1 = PyString_AsString(py_key1) len_key0 = PyString_Size(py_key0) len_key1 = PyString_Size(py_key1) return get_iteritems(self, mtbl_source_get_range( mtbl_merger_source(self._instance), key0, len_key0, key1, len_key1)) def get_prefix(self, bytes py_key): """ M.get_prefix(key_prefix) -> an iterator over all (key, value) items in M where key begins with key_prefix. """ cdef mtbl_res res cdef uint8_t *key cdef size_t len_key key = PyString_AsString(py_key) len_key = PyString_Size(py_key) return get_iteritems(self, mtbl_source_get_prefix( mtbl_merger_source(self._instance), key, len_key)) cdef class sorter(object): """ sorter(merge_func) -> new MTBL sorter merge_func is the user-supplied value merging function: merge_func(key, val0, val1) -> merged_val all parameters are byte strings, and the return value must be a byte string. Keyword arguments: temp_dir -- temporary directory (default "/var/tmp") max_memory -- maxmimum amount of memory for in-memory sorting in bytes (default 1 GB) """ cdef mtbl_sorter *_instance cdef _lock def __cinit__(self): self._instance = NULL def __dealloc__(self): with nogil: mtbl_sorter_destroy(&self._instance) def __init__(self, object merge_func, bytes temp_dir=DEFAULT_SORTER_TEMP_DIR, size_t max_memory=DEFAULT_SORTER_MEMORY): cdef mtbl_sorter_options *opt self._lock = threading.Semaphore() with nogil: opt = mtbl_sorter_options_init() mtbl_sorter_options_set_merge_func(opt, merge_func_wrapper, merge_func) mtbl_sorter_options_set_temp_dir(opt, temp_dir) mtbl_sorter_options_set_max_memory(opt, max_memory) with nogil: self._instance = mtbl_sorter_init(opt) mtbl_sorter_options_destroy(&opt) def write(self, writer w): """S.write(mtbl.writer) -- dump sorted output to writer""" cdef mtbl_res res with w._lock: with nogil: res = mtbl_sorter_write(self._instance, w._instance) if res != mtbl_res_success: raise RuntimeError def __setitem__(self, bytes py_key, bytes py_val): """ S.__setitem__(key, value) <==> S[key] = value Adds a new (key, value) item to the sorter. If the key already exists, the user-supplied merge function will be called to merge the conflicting values. """ cdef mtbl_res res cdef uint8_t *key cdef uint8_t *val cdef size_t len_key cdef size_t len_val if self._instance == NULL: raise RuntimeError key = PyString_AsString(py_key) val = PyString_AsString(py_val) len_key = PyString_Size(py_key) len_val = PyString_Size(py_val) with self._lock: with nogil: res = mtbl_sorter_add(self._instance, key, len_key, val, len_val) if res == mtbl_res_failure: raise KeyOrderError def __delitem__(self, key): """will raise ImmutableError""" raise ImmutableError def __iter__(self): return self.iterkeys() def iterkeys(self): """S.iterkeys() -> an iterator over the sorted keys of R.""" return get_iterkeys(self, mtbl_sorter_iter(self._instance)) def itervalues(self): """S.itervalues() -> an iterator over the sorted values of R.""" return get_itervalues(self, mtbl_sorter_iter(self._instance)) def iteritems(self): """S.iteritems() -> an iterator over the sorted (key, value) items of R.""" return get_iteritems(self, mtbl_sorter_iter(self._instance)) pymtbl-0.4.1/examples/0000755002364700236470000000000013135453410014542 5ustar reedreed00000000000000pymtbl-0.4.1/examples/wf/0000755002364700236470000000000013135453410015156 5ustar reedreed00000000000000pymtbl-0.4.1/examples/wf/README0000644002364700236470000000326113121024350016030 0ustar reedreed00000000000000Simple word frequency example using pymtbl ------------------------------------------ This directory shows a simple "word frequency" application of the pymtbl module. It is driven by a Makefile which downloads several English language texts and invokes Python scripts to analyze, merge, and decode data. Each text is analyzed individually and the results are combined to generate an overall word frequency table. Running "make" in this directory should generate an output file "wf.txt". It will also generate a file "wf.mtbl" containing the combined word frequencies from all of the downloaded texts, as well as several intermediate ".mtbl" files containing word frequencies for the individual texts. This example stores the frequency for each word in MTBL SSTable files where each key is a word and its associated value is a varint-encoded integer indicating the number of times the word occurred. Scripts: * pymtbl_wf_analyze.py: reads an ASCII formatted Project Gutenberg etext (.txt) and generates an MTBL SSTable file (.mtbl) containing words and their frequencies. * pymtbl_wf_merge.py: reads one or more MTBL SSTable files and merges the key-value entries in the input files into a single output. For instance, merging the following two input tables: Key Value "and" 1 "or" 2 "the" 3 (Input table #1) Key Value "and" 2 "the" 4 (Input table #2) Will result in the following merged output table: Key Value "and" 3 "or" 2 "the" 7 (Output table) * pymtbl_wf_dump.py: decodes the word frequency key-value entries in an MTBL file and prints them to stdout. pymtbl-0.4.1/examples/wf/pymtbl_wf_analyze.py0000755002364700236470000000214313121024350021251 0ustar reedreed00000000000000#!/usr/bin/env python import string import sys import mtbl def merge_func(key, val0, val1): i0 = mtbl.varint_decode(val0) i1 = mtbl.varint_decode(val1) return mtbl.varint_encode(i0 + i1) def main(txt_fname, mtbl_fname): txt = open(txt_fname) sorter = mtbl.sorter(merge_func) writer = mtbl.writer(mtbl_fname, compression=mtbl.COMPRESSION_SNAPPY) # trim header while True: line = txt.readline() if line.startswith('*** START OF THIS PROJECT GUTENBERG EBOOK'): break for x in range(0, 5): txt.readline() for line in txt: if line.startswith('End of the Project Gutenberg EBook') or \ line.startswith('*** END OF THIS PROJECT GUTENBERG EBOOK'): break for tok in line.strip().split(): word = tok.strip(string.punctuation).lower() sorter[word] = mtbl.varint_encode(1) sorter.write(writer) if __name__ == '__main__': if not len(sys.argv) == 3: sys.stderr.write('Usage: %s \n' % sys.argv[0]) sys.exit(1) main(sys.argv[1], sys.argv[2]) pymtbl-0.4.1/examples/wf/pymtbl_wf_merge.py0000755002364700236470000000132113121024350020702 0ustar reedreed00000000000000#!/usr/bin/env python import string import struct import sys import mtbl def merge_func(key, val0, val1): i0 = mtbl.varint_decode(val0) i1 = mtbl.varint_decode(val1) return mtbl.varint_encode(i0 + i1) def main(input_fnames, output_fname): merger = mtbl.merger(merge_func) writer = mtbl.writer(output_fname, compression=mtbl.COMPRESSION_SNAPPY) for fname in input_fnames: reader = mtbl.reader(fname) merger.add_reader(reader) merger.write(writer) if __name__ == '__main__': if len(sys.argv) < 3: sys.stderr.write('Usage: %s [...] \n' % sys.argv[0]) sys.exit(1) main(sys.argv[1:-1], sys.argv[-1]) pymtbl-0.4.1/examples/wf/pymtbl_wf_dump.py0000755002364700236470000000063613121024350020560 0ustar reedreed00000000000000#!/usr/bin/env python import string import sys import mtbl def main(mtbl_fname): reader = mtbl.reader(mtbl_fname) for k, v in reader.items(): word = k count = mtbl.varint_decode(v) print '%s\t%s' % (count, word) if __name__ == '__main__': if not len(sys.argv) == 2: sys.stderr.write('Usage: %s \n' % sys.argv[0]) sys.exit(1) main(sys.argv[1]) pymtbl-0.4.1/examples/wf/Makefile0000644002364700236470000000077013121024350016612 0ustar reedreed00000000000000EBOOKS = 2814 4217 4300 BOOK_FILES = $(foreach ebook,$(EBOOKS),$(ebook).txt) MTBL_FILES = $(foreach ebook,$(EBOOKS),$(ebook).mtbl) %.txt: @wget -O $@ http://www.gutenberg.org/files/$(shell basename $@ .txt)/$@ %.mtbl: %.txt rm -f $@ ./pymtbl_wf_analyze.py $< $@ wf.txt: wf.mtbl $(BOOK_FILES) ./pymtbl_wf_dump.py wf.mtbl | sort -rn > wf.txt wf.mtbl: $(MTBL_FILES) $(BOOK_FILES) rm -f wf.mtbl ./pymtbl_wf_merge.py $(MTBL_FILES) wf.mtbl clean: rm -f wf.mtbl wf.txt $(MTBL_FILES) .PHONY: clean pymtbl-0.4.1/examples/pymtbl_merge_tables.py0000755002364700236470000000137513121024350021135 0ustar reedreed00000000000000#!/usr/bin/env python import sys import mtbl def merge_func(key, val0, val1): return val0 + ' ' + val1 def main(output_fname, input_fnames): merger = mtbl.merger(merge_func) writer = mtbl.writer(output_fname, compression=mtbl.COMPRESSION_SNAPPY) for fname in input_fnames: reader = mtbl.reader(fname) merger.add_reader(reader) for k, v in merger.iteritems(): writer[k] = v writer.close() def usage(): sys.stderr.write('Usage: %s [...]\n' % sys.argv[0]) sys.exit(1) if __name__ == '__main__': if len(sys.argv) < 3: usage() try: output_fname = sys.argv[1] input_fnames = sys.argv[2:] except: usage() main(output_fname, input_fnames) pymtbl-0.4.1/examples/pymtbl_search_random_table.py0000755002364700236470000000334413121024350022456 0ustar reedreed00000000000000#!/usr/bin/env python import locale import random import sys import time import mtbl report_interval = 10000 def main(fname, num_keys, num_iters): reader = mtbl.reader(fname) a = time.time() last = a num_found = 0 count = 0 while count < num_iters: key = '%010d' % random.randint(0, num_keys) if reader.has_key(key): val = reader[key] num_found += 1 count += 1 if (count % report_interval) == 0: b = time.time() last_secs = b - last last = b sys.stderr.write('%s lookups, %s keys found in %s seconds, %s lookups/second\n' % ( locale.format('%d', count, grouping=True), locale.format('%d', num_found, grouping=True), locale.format('%f', last_secs, grouping=True), locale.format('%d', report_interval / last_secs, grouping=True) ) ) b = time.time() total_secs = b - a sys.stderr.write('%s total lookups, %s keys found in %s seconds, %s lookups/second\n' % ( locale.format('%d', count, grouping=True), locale.format('%d', num_found, grouping=True), locale.format('%f', total_secs, grouping=True), locale.format('%d', count / total_secs, grouping=True) ) ) def usage(): sys.stderr.write('Usage: %s \n' % sys.argv[0]) sys.exit(1) if __name__ == '__main__': locale.setlocale(locale.LC_ALL, '') if len(sys.argv) != 4: usage() try: fname = sys.argv[1] num_keys = int(sys.argv[2]) num_iters = int(sys.argv[3]) except: usage() main(fname, num_keys, num_iters) pymtbl-0.4.1/examples/pymtbl_make_random_table_2.py0000755002364700236470000000373513121024350022353 0ustar reedreed00000000000000#!/usr/bin/env python import locale import random import string import sys import time import mtbl report_interval = 100000 megabyte = 1048576.0 def merge_func(key, val0, val1): return val0 + val1 def main(fname, num_keys): sorter = mtbl.sorter(merge_func) writer = mtbl.writer(fname, compression=mtbl.COMPRESSION_SNAPPY) a = time.time() last = a total_bytes = 0 count = 0 while count < num_keys: count += 1 key = '%020d' % random.randint(0, sys.maxint) val = random.choice(string.ascii_lowercase) * random.randint(1, 50) sorter[key] = val total_bytes += len(key) + len(val) if (count % report_interval) == 0: b = time.time() last_secs = b - last last = b sys.stderr.write('generated %s entries (%s MB) in %s seconds, %s entries/second\n' % ( locale.format('%d', count, grouping=True), locale.format('%d', total_bytes / megabyte, grouping=True), locale.format('%f', last_secs, grouping=True), locale.format('%d', report_interval / last_secs, grouping=True) ) ) sys.stderr.write('writing to output file %s\n' % fname) sorter.write(writer) b = time.time() total_secs = b - a sys.stderr.write('wrote %s total entries (%s MB) in %s seconds, %s entries/second\n' % ( locale.format('%d', count, grouping=True), locale.format('%d', total_bytes / megabyte, grouping=True), locale.format('%f', total_secs, grouping=True), locale.format('%d', count / total_secs, grouping=True) ) ) def usage(): sys.stderr.write('Usage: %s \n' % sys.argv[0]) sys.exit(1) if __name__ == '__main__': locale.setlocale(locale.LC_ALL, '') if len(sys.argv) != 3: usage() try: fname = sys.argv[1] num_keys = int(sys.argv[2]) except: usage() main(fname, num_keys) pymtbl-0.4.1/examples/pymtbl_make_random_table.py0000755002364700236470000000355413121024350022131 0ustar reedreed00000000000000#!/usr/bin/env python import locale import random import string import sys import time import mtbl report_interval = 10000000 megabyte = 1048576.0 def main(fname, num_keys): writer = mtbl.writer(fname, compression=mtbl.COMPRESSION_SNAPPY) a = time.time() last = a total_bytes = 0 count = 0 total = 0 while count < num_keys: count += 1 if random.random() >= 0.5: total += 1 key = '%010d' % count val = random.choice(string.ascii_lowercase) * random.randint(1, 50) writer[key] = val total_bytes += len(key) + len(val) if (count % report_interval) == 0: b = time.time() last_secs = b - last last = b sys.stderr.write('wrote %s entries (%s MB) in %s seconds, %s entries/second\n' % ( locale.format('%d', total, grouping=True), locale.format('%d', total_bytes / megabyte, grouping=True), locale.format('%f', last_secs, grouping=True), locale.format('%d', report_interval / last_secs, grouping=True) ) ) b = time.time() total_secs = b - a sys.stderr.write('wrote %s total entries (%s MB) in %s seconds, %s entries/second\n' % ( locale.format('%d', total, grouping=True), locale.format('%d', total_bytes / megabyte, grouping=True), locale.format('%f', total_secs, grouping=True), locale.format('%d', total / total_secs, grouping=True) ) ) def usage(): sys.stderr.write('Usage: %s \n' % sys.argv[0]) sys.exit(1) if __name__ == '__main__': locale.setlocale(locale.LC_ALL, '') if len(sys.argv) != 3: usage() try: fname = sys.argv[1] num_keys = int(sys.argv[2]) except: usage() main(fname, num_keys) pymtbl-0.4.1/examples/pymtbl_merge_tables_2.py0000755002364700236470000000133413121024350021351 0ustar reedreed00000000000000#!/usr/bin/env python import sys import mtbl def merge_func(key, val0, val1): return val0 + ' ' + val1 def main(output_fname, input_fnames): merger = mtbl.merger(merge_func) writer = mtbl.writer(output_fname, compression=mtbl.COMPRESSION_SNAPPY) for fname in input_fnames: reader = mtbl.reader(fname) merger.add_reader(reader) merger.write(writer) writer.close() def usage(): sys.stderr.write('Usage: %s [...]\n' % sys.argv[0]) sys.exit(1) if __name__ == '__main__': if len(sys.argv) < 3: usage() try: output_fname = sys.argv[1] input_fnames = sys.argv[2:] except: usage() main(output_fname, input_fnames) pymtbl-0.4.1/mtbl.c0000644002364700236470000153334513135451203014042 0ustar reedreed00000000000000/* Generated by Cython 0.15.1 on Mon Jul 24 20:03:15 2017 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__mtbl #define __PYX_HAVE_API__mtbl #include "stdio.h" #include "pythread.h" #include "stddef.h" #include "stdint.h" #include "stdlib.h" #include "string.h" #include "mtbl.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif /* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif /* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || defined(__INTEL_COMPILER) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "mtbl.pyx", "bool.pxd", "complex.pxd", }; /*--- Type declarations ---*/ struct __pyx_obj_4mtbl_DictMixin; struct __pyx_obj_4mtbl_merger; struct __pyx_obj_4mtbl_writer; struct __pyx_obj_4mtbl_iterkeys; struct __pyx_obj_4mtbl_sorter; struct __pyx_obj_4mtbl_itervalues; struct __pyx_obj_4mtbl_reader; struct __pyx_obj_4mtbl_iteritems; /* "mtbl.pyx":188 * * @cython.internal * cdef class DictMixin(object): # <<<<<<<<<<<<<< * def __iter__(self): * return self.iterkeys() */ struct __pyx_obj_4mtbl_DictMixin { PyObject_HEAD }; /* "mtbl.pyx":463 * memcpy(merged_val[0], PyString_AsString(py_merged_val), len_merged_val[0]) * * cdef class merger(object): # <<<<<<<<<<<<<< * """ * merger(merge_func) -> new MTBL merger */ struct __pyx_obj_4mtbl_merger { PyObject_HEAD struct mtbl_merger *_instance; PyObject *_references; PyObject *_lock; PyObject *merge_func; }; /* "mtbl.pyx":363 * return items * * cdef class writer(object): # <<<<<<<<<<<<<< * """ * writer(fname) -> new MTBL writer, output to file fname */ struct __pyx_obj_4mtbl_writer { PyObject_HEAD struct mtbl_writer *_instance; PyObject *_lock; }; /* "mtbl.pyx":68 * * @cython.internal * cdef class iterkeys(object): # <<<<<<<<<<<<<< * cdef mtbl_iter *_instance * cdef object _parent */ struct __pyx_obj_4mtbl_iterkeys { PyObject_HEAD struct mtbl_iter *_instance; PyObject *_parent; }; /* "mtbl.pyx":577 * mtbl_merger_source(self._instance), key, len_key)) * * cdef class sorter(object): # <<<<<<<<<<<<<< * """ * sorter(merge_func) -> new MTBL sorter */ struct __pyx_obj_4mtbl_sorter { PyObject_HEAD struct mtbl_sorter *_instance; PyObject *_lock; }; /* "mtbl.pyx":102 * * @cython.internal * cdef class itervalues(object): # <<<<<<<<<<<<<< * cdef mtbl_iter *_instance * cdef object _parent */ struct __pyx_obj_4mtbl_itervalues { PyObject_HEAD struct mtbl_iter *_instance; PyObject *_parent; }; /* "mtbl.pyx":227 * raise ImmutableError * * cdef class reader(DictMixin): # <<<<<<<<<<<<<< * """ * reader(fname) -> new MTBL reader initialized from file fname */ struct __pyx_obj_4mtbl_reader { struct __pyx_obj_4mtbl_DictMixin __pyx_base; struct __pyx_vtabstruct_4mtbl_reader *__pyx_vtab; struct mtbl_reader *_instance; }; /* "mtbl.pyx":136 * * @cython.internal * cdef class iteritems(object): # <<<<<<<<<<<<<< * cdef mtbl_iter *_instance * cdef object _parent */ struct __pyx_obj_4mtbl_iteritems { PyObject_HEAD struct mtbl_iter *_instance; PyObject *_parent; }; /* "mtbl.pyx":227 * raise ImmutableError * * cdef class reader(DictMixin): # <<<<<<<<<<<<<< * """ * reader(fname) -> new MTBL reader initialized from file fname */ struct __pyx_vtabstruct_4mtbl_reader { PyObject *(*check_initialized)(struct __pyx_obj_4mtbl_reader *); }; static struct __pyx_vtabstruct_4mtbl_reader *__pyx_vtabptr_4mtbl_reader; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ #ifndef __PYX_FORCE_INIT_THREADS #if PY_VERSION_HEX < 0x02040200 #define __PYX_FORCE_INIT_THREADS 1 #else #define __PYX_FORCE_INIT_THREADS 0 #endif #endif #if PY_VERSION_HEX < 0x02050000 #ifndef PyAnySet_CheckExact #define PyAnySet_CheckExact(ob) \ ((ob)->ob_type == &PySet_Type || \ (ob)->ob_type == &PyFrozenSet_Type) #define PySet_New(iterable) \ PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL) #define Pyx_PyFrozenSet_New(iterable) \ PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL) #define PySet_Size(anyset) \ PyObject_Size((anyset)) #define PySet_Contains(anyset, key) \ PySequence_Contains((anyset), (key)) #define PySet_Pop(set) \ PyObject_CallMethod(set, (char *)"pop", NULL) static CYTHON_INLINE int PySet_Clear(PyObject *set) { PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL); if (!ret) return -1; Py_DECREF(ret); return 0; } static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) { PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key); if (!ret) return -1; Py_DECREF(ret); return 0; } static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) { PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key); if (!ret) return -1; Py_DECREF(ret); return 0; } #endif /* PyAnySet_CheckExact (<= Py2.4) */ #if PY_VERSION_HEX < 0x02040000 #ifndef Py_SETOBJECT_H #define Py_SETOBJECT_H static PyTypeObject *__Pyx_PySet_Type = NULL; static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL; #define PySet_Type (*__Pyx_PySet_Type) #define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type) #define PyAnySet_Check(ob) \ (PyAnySet_CheckExact(ob) || \ PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \ PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type)) #define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type) static int __Pyx_Py23SetsImport(void) { PyObject *sets=0, *Set=0, *ImmutableSet=0; sets = PyImport_ImportModule((char *)"sets"); if (!sets) goto bad; Set = PyObject_GetAttrString(sets, (char *)"Set"); if (!Set) goto bad; ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet"); if (!ImmutableSet) goto bad; Py_DECREF(sets); __Pyx_PySet_Type = (PyTypeObject*) Set; __Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet; return 0; bad: Py_XDECREF(sets); Py_XDECREF(Set); Py_XDECREF(ImmutableSet); return -1; } #else static int __Pyx_Py23SetsImport(void) { return 0; } #endif /* !Py_SETOBJECT_H */ #endif /* < Py2.4 */ #endif /* < Py2.5 */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, PyObject *modname); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint64_t(uint64_t); static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject *); static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename); /*proto*/ static int __Pyx_check_binary_version(void); static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cython.cython.view' */ /* Module declarations from 'cython' */ /* Module declarations from 'cpython.version' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'cpython.exc' */ /* Module declarations from 'cpython.module' */ /* Module declarations from 'cpython.mem' */ /* Module declarations from 'cpython.tuple' */ /* Module declarations from 'cpython.list' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'cpython.sequence' */ /* Module declarations from 'cpython.mapping' */ /* Module declarations from 'cpython.iterator' */ /* Module declarations from 'cpython.type' */ /* Module declarations from 'cpython.number' */ /* Module declarations from 'cpython.int' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.bool' */ static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; /* Module declarations from 'cpython.long' */ /* Module declarations from 'cpython.float' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.complex' */ static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; /* Module declarations from 'cpython.string' */ /* Module declarations from 'cpython.unicode' */ /* Module declarations from 'cpython.dict' */ /* Module declarations from 'cpython.instance' */ /* Module declarations from 'cpython.function' */ /* Module declarations from 'cpython.method' */ /* Module declarations from 'cpython.weakref' */ /* Module declarations from 'cpython.getargs' */ /* Module declarations from 'cpython.pythread' */ /* Module declarations from 'cpython.pystate' */ /* Module declarations from 'cpython.cobject' */ /* Module declarations from 'cpython.oldbuffer' */ /* Module declarations from 'cpython.set' */ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.bytes' */ /* Module declarations from 'cpython.pycapsule' */ /* Module declarations from 'cpython' */ /* Module declarations from 'libc.stddef' */ /* Module declarations from 'libc.stdint' */ /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'mtbl' */ static PyTypeObject *__pyx_ptype_4mtbl_iterkeys = 0; static PyTypeObject *__pyx_ptype_4mtbl_itervalues = 0; static PyTypeObject *__pyx_ptype_4mtbl_iteritems = 0; static PyTypeObject *__pyx_ptype_4mtbl_DictMixin = 0; static PyTypeObject *__pyx_ptype_4mtbl_reader = 0; static PyTypeObject *__pyx_ptype_4mtbl_writer = 0; static PyTypeObject *__pyx_ptype_4mtbl_merger = 0; static PyTypeObject *__pyx_ptype_4mtbl_sorter = 0; static PyObject *__pyx_f_4mtbl_get_iterkeys(PyObject *, struct mtbl_iter *); /*proto*/ static PyObject *__pyx_f_4mtbl_get_itervalues(PyObject *, struct mtbl_iter *); /*proto*/ static PyObject *__pyx_f_4mtbl_get_iteritems(PyObject *, struct mtbl_iter *); /*proto*/ static void __pyx_f_4mtbl_merge_func_wrapper(void *, uint8_t *, size_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t **, size_t *); /*proto*/ #define __Pyx_MODULE_NAME "mtbl" int __pyx_module_is_main_mtbl = 0; /* Implementation of 'mtbl' */ static PyObject *__pyx_builtin_Exception; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_StopIteration; static PyObject *__pyx_builtin_IOError; static PyObject *__pyx_builtin_KeyError; static PyObject *__pyx_builtin_RuntimeError; static char __pyx_k_2[] = "unable to open file: '%s'"; static char __pyx_k_3[] = "UninitializedException"; static char __pyx_k_4[] = "block_restart_interval"; static char __pyx_k_6[] = "UnknownCompressionTypeException"; static char __pyx_k_7[] = "unable to initialize file: '%s'"; static char __pyx_k_9[] = "TableClosedException"; static char __pyx_k_17[] = "/var/tmp"; static char __pyx_k_18[] = "DEFAULT_SORTER_TEMP_DIR"; static char __pyx_k_19[] = "DEFAULT_SORTER_MEMORY"; static char __pyx_k_20[] = "object does not support mutation"; static char __pyx_k_22[] = "varint_length_packed"; static char __pyx_k__mtbl[] = "mtbl"; static char __pyx_k__fname[] = "fname"; static char __pyx_k__py_key[] = "py_key"; static char __pyx_k__IOError[] = "IOError"; static char __pyx_k___parent[] = "_parent"; static char __pyx_k__default[] = "default"; static char __pyx_k__py_key0[] = "py_key0"; static char __pyx_k__py_key1[] = "py_key1"; static char __pyx_k__KeyError[] = "KeyError"; static char __pyx_k____exit__[] = "__exit__"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__iterkeys[] = "iterkeys"; static char __pyx_k__temp_dir[] = "temp_dir"; static char __pyx_k__Exception[] = "Exception"; static char __pyx_k__Semaphore[] = "Semaphore"; static char __pyx_k__TypeError[] = "TypeError"; static char __pyx_k____enter__[] = "__enter__"; static char __pyx_k__iteritems[] = "iteritems"; static char __pyx_k__threading[] = "threading"; static char __pyx_k__block_size[] = "block_size"; static char __pyx_k__itervalues[] = "itervalues"; static char __pyx_k__max_memory[] = "max_memory"; static char __pyx_k__merge_func[] = "merge_func"; static char __pyx_k____getitem__[] = "__getitem__"; static char __pyx_k__compression[] = "compression"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k____contains__[] = "__contains__"; static char __pyx_k__KeyOrderError[] = "KeyOrderError"; static char __pyx_k__StopIteration[] = "StopIteration"; static char __pyx_k__varint_decode[] = "varint_decode"; static char __pyx_k__varint_encode[] = "varint_encode"; static char __pyx_k__varint_length[] = "varint_length"; static char __pyx_k__ImmutableError[] = "ImmutableError"; static char __pyx_k__COMPRESSION_LZ4[] = "COMPRESSION_LZ4"; static char __pyx_k__COMPRESSION_NONE[] = "COMPRESSION_NONE"; static char __pyx_k__COMPRESSION_ZLIB[] = "COMPRESSION_ZLIB"; static char __pyx_k__verify_checksums[] = "verify_checksums"; static char __pyx_k__COMPRESSION_LZ4HC[] = "COMPRESSION_LZ4HC"; static char __pyx_k__COMPRESSION_SNAPPY[] = "COMPRESSION_SNAPPY"; static char __pyx_k__VarintDecodingError[] = "VarintDecodingError"; static PyObject *__pyx_kp_s_17; static PyObject *__pyx_n_s_18; static PyObject *__pyx_n_s_19; static PyObject *__pyx_kp_s_2; static PyObject *__pyx_kp_s_20; static PyObject *__pyx_n_s_22; static PyObject *__pyx_n_s_3; static PyObject *__pyx_n_s_4; static PyObject *__pyx_n_s_6; static PyObject *__pyx_kp_s_7; static PyObject *__pyx_n_s_9; static PyObject *__pyx_n_s__COMPRESSION_LZ4; static PyObject *__pyx_n_s__COMPRESSION_LZ4HC; static PyObject *__pyx_n_s__COMPRESSION_NONE; static PyObject *__pyx_n_s__COMPRESSION_SNAPPY; static PyObject *__pyx_n_s__COMPRESSION_ZLIB; static PyObject *__pyx_n_s__Exception; static PyObject *__pyx_n_s__IOError; static PyObject *__pyx_n_s__ImmutableError; static PyObject *__pyx_n_s__KeyError; static PyObject *__pyx_n_s__KeyOrderError; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__Semaphore; static PyObject *__pyx_n_s__StopIteration; static PyObject *__pyx_n_s__TypeError; static PyObject *__pyx_n_s__VarintDecodingError; static PyObject *__pyx_n_s____contains__; static PyObject *__pyx_n_s____enter__; static PyObject *__pyx_n_s____exit__; static PyObject *__pyx_n_s____getitem__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s___parent; static PyObject *__pyx_n_s__block_size; static PyObject *__pyx_n_s__compression; static PyObject *__pyx_n_s__default; static PyObject *__pyx_n_s__fname; static PyObject *__pyx_n_s__iteritems; static PyObject *__pyx_n_s__iterkeys; static PyObject *__pyx_n_s__itervalues; static PyObject *__pyx_n_s__max_memory; static PyObject *__pyx_n_s__merge_func; static PyObject *__pyx_n_s__mtbl; static PyObject *__pyx_n_s__py_key; static PyObject *__pyx_n_s__py_key0; static PyObject *__pyx_n_s__py_key1; static PyObject *__pyx_n_s__temp_dir; static PyObject *__pyx_n_s__threading; static PyObject *__pyx_n_s__varint_decode; static PyObject *__pyx_n_s__varint_encode; static PyObject *__pyx_n_s__varint_length; static PyObject *__pyx_n_s__verify_checksums; static PyObject *__pyx_int_1073741824; static PyBoolObject *__pyx_k_1; static mtbl_compression_type __pyx_k_5; static PyObject *__pyx_k_13; static size_t __pyx_k_14; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_11; static PyObject *__pyx_k_tuple_12; static PyObject *__pyx_k_tuple_15; static PyObject *__pyx_k_tuple_16; static PyObject *__pyx_k_tuple_21; /* "mtbl.pyx":30 * ImmutableError = TypeError('object does not support mutation') * * def varint_length(uint64_t value): # <<<<<<<<<<<<<< * """varint_length(v) -> number of bytes the integer v would require in varint encoding.""" * return mtbl_varint_length(value) */ static PyObject *__pyx_pf_4mtbl_varint_length(PyObject *__pyx_self, PyObject *__pyx_arg_value); /*proto*/ static char __pyx_doc_4mtbl_varint_length[] = "varint_length(v) -> number of bytes the integer v would require in varint encoding."; static PyMethodDef __pyx_mdef_4mtbl_varint_length = {__Pyx_NAMESTR("varint_length"), (PyCFunction)__pyx_pf_4mtbl_varint_length, METH_O, __Pyx_DOCSTR(__pyx_doc_4mtbl_varint_length)}; static PyObject *__pyx_pf_4mtbl_varint_length(PyObject *__pyx_self, PyObject *__pyx_arg_value) { uint64_t __pyx_v_value; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("varint_length"); __pyx_self = __pyx_self; assert(__pyx_arg_value); { __pyx_v_value = __Pyx_PyInt_from_py_uint64_t(__pyx_arg_value); if (unlikely((__pyx_v_value == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("mtbl.varint_length", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "mtbl.pyx":32 * def varint_length(uint64_t value): * """varint_length(v) -> number of bytes the integer v would require in varint encoding.""" * return mtbl_varint_length(value) # <<<<<<<<<<<<<< * * def varint_length_packed(bytes py_buf): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyLong_FromUnsignedLong(mtbl_varint_length(__pyx_v_value)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.varint_length", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":34 * return mtbl_varint_length(value) * * def varint_length_packed(bytes py_buf): # <<<<<<<<<<<<<< * """varint_length_packed(b) -> number of varint-packed bytes at the start of b.""" * cdef uint8_t *buf */ static PyObject *__pyx_pf_4mtbl_1varint_length_packed(PyObject *__pyx_self, PyObject *__pyx_v_py_buf); /*proto*/ static char __pyx_doc_4mtbl_1varint_length_packed[] = "varint_length_packed(b) -> number of varint-packed bytes at the start of b."; static PyMethodDef __pyx_mdef_4mtbl_1varint_length_packed = {__Pyx_NAMESTR("varint_length_packed"), (PyCFunction)__pyx_pf_4mtbl_1varint_length_packed, METH_O, __Pyx_DOCSTR(__pyx_doc_4mtbl_1varint_length_packed)}; static PyObject *__pyx_pf_4mtbl_1varint_length_packed(PyObject *__pyx_self, PyObject *__pyx_v_py_buf) { uint8_t *__pyx_v_buf; Py_ssize_t __pyx_v_len_buf; size_t __pyx_v_sz; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("varint_length_packed"); __pyx_self = __pyx_self; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_buf), (&PyBytes_Type), 1, "py_buf", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":39 * cdef Py_ssize_t len_buf * cdef size_t sz * PyString_AsStringAndSize(py_buf, &buf, &len_buf) # <<<<<<<<<<<<<< * with nogil: * sz = mtbl_varint_length_packed(buf, len_buf) */ __pyx_t_1 = PyString_AsStringAndSize(((PyObject *)__pyx_v_py_buf), ((char **)(&__pyx_v_buf)), (&__pyx_v_len_buf)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":40 * cdef size_t sz * PyString_AsStringAndSize(py_buf, &buf, &len_buf) * with nogil: # <<<<<<<<<<<<<< * sz = mtbl_varint_length_packed(buf, len_buf) * if sz == 0: */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":41 * PyString_AsStringAndSize(py_buf, &buf, &len_buf) * with nogil: * sz = mtbl_varint_length_packed(buf, len_buf) # <<<<<<<<<<<<<< * if sz == 0: * raise VarintDecodingError */ __pyx_v_sz = mtbl_varint_length_packed(__pyx_v_buf, __pyx_v_len_buf); } /* "mtbl.pyx":40 * cdef size_t sz * PyString_AsStringAndSize(py_buf, &buf, &len_buf) * with nogil: # <<<<<<<<<<<<<< * sz = mtbl_varint_length_packed(buf, len_buf) * if sz == 0: */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":42 * with nogil: * sz = mtbl_varint_length_packed(buf, len_buf) * if sz == 0: # <<<<<<<<<<<<<< * raise VarintDecodingError * return sz */ __pyx_t_2 = (__pyx_v_sz == 0); if (__pyx_t_2) { /* "mtbl.pyx":43 * sz = mtbl_varint_length_packed(buf, len_buf) * if sz == 0: * raise VarintDecodingError # <<<<<<<<<<<<<< * return sz * */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__VarintDecodingError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "mtbl.pyx":44 * if sz == 0: * raise VarintDecodingError * return sz # <<<<<<<<<<<<<< * * def varint_encode(long v): */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_sz); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("mtbl.varint_length_packed", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":46 * return sz * * def varint_encode(long v): # <<<<<<<<<<<<<< * """varint_encode(v) -> encode integer v using packed variable-width encoding.""" * cdef uint8_t buf[10] */ static PyObject *__pyx_pf_4mtbl_2varint_encode(PyObject *__pyx_self, PyObject *__pyx_arg_v); /*proto*/ static char __pyx_doc_4mtbl_2varint_encode[] = "varint_encode(v) -> encode integer v using packed variable-width encoding."; static PyMethodDef __pyx_mdef_4mtbl_2varint_encode = {__Pyx_NAMESTR("varint_encode"), (PyCFunction)__pyx_pf_4mtbl_2varint_encode, METH_O, __Pyx_DOCSTR(__pyx_doc_4mtbl_2varint_encode)}; static PyObject *__pyx_pf_4mtbl_2varint_encode(PyObject *__pyx_self, PyObject *__pyx_arg_v) { long __pyx_v_v; uint8_t __pyx_v_buf[10]; size_t __pyx_v_sz; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("varint_encode"); __pyx_self = __pyx_self; assert(__pyx_arg_v); { __pyx_v_v = __Pyx_PyInt_AsLong(__pyx_arg_v); if (unlikely((__pyx_v_v == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("mtbl.varint_encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "mtbl.pyx":50 * cdef uint8_t buf[10] * cdef size_t sz * with nogil: # <<<<<<<<<<<<<< * sz = mtbl_varint_encode64(buf, v) * return PyString_FromStringAndSize( buf, sz) */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":51 * cdef size_t sz * with nogil: * sz = mtbl_varint_encode64(buf, v) # <<<<<<<<<<<<<< * return PyString_FromStringAndSize( buf, sz) * */ __pyx_v_sz = mtbl_varint_encode64(__pyx_v_buf, __pyx_v_v); } /* "mtbl.pyx":50 * cdef uint8_t buf[10] * cdef size_t sz * with nogil: # <<<<<<<<<<<<<< * sz = mtbl_varint_encode64(buf, v) * return PyString_FromStringAndSize( buf, sz) */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":52 * with nogil: * sz = mtbl_varint_encode64(buf, v) * return PyString_FromStringAndSize( buf, sz) # <<<<<<<<<<<<<< * * def varint_decode(bytes py_buf): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyString_FromStringAndSize(((char *)__pyx_v_buf), __pyx_v_sz); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.varint_encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":54 * return PyString_FromStringAndSize( buf, sz) * * def varint_decode(bytes py_buf): # <<<<<<<<<<<<<< * """varint_decode(b) -> decode variable-width packed integer from b""" * cdef uint64_t val */ static PyObject *__pyx_pf_4mtbl_3varint_decode(PyObject *__pyx_self, PyObject *__pyx_v_py_buf); /*proto*/ static char __pyx_doc_4mtbl_3varint_decode[] = "varint_decode(b) -> decode variable-width packed integer from b"; static PyMethodDef __pyx_mdef_4mtbl_3varint_decode = {__Pyx_NAMESTR("varint_decode"), (PyCFunction)__pyx_pf_4mtbl_3varint_decode, METH_O, __Pyx_DOCSTR(__pyx_doc_4mtbl_3varint_decode)}; static PyObject *__pyx_pf_4mtbl_3varint_decode(PyObject *__pyx_self, PyObject *__pyx_v_py_buf) { uint64_t __pyx_v_val; uint8_t *__pyx_v_buf; Py_ssize_t __pyx_v_len_buf; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("varint_decode"); __pyx_self = __pyx_self; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_buf), (&PyBytes_Type), 1, "py_buf", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":60 * cdef Py_ssize_t len_buf * cdef size_t bytes_read * PyString_AsStringAndSize(py_buf, &buf, &len_buf) # <<<<<<<<<<<<<< * if mtbl_varint_length_packed(buf, len_buf) == 0: * raise VarintDecodingError */ __pyx_t_1 = PyString_AsStringAndSize(((PyObject *)__pyx_v_py_buf), ((char **)(&__pyx_v_buf)), (&__pyx_v_len_buf)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":61 * cdef size_t bytes_read * PyString_AsStringAndSize(py_buf, &buf, &len_buf) * if mtbl_varint_length_packed(buf, len_buf) == 0: # <<<<<<<<<<<<<< * raise VarintDecodingError * with nogil: */ __pyx_t_2 = (mtbl_varint_length_packed(__pyx_v_buf, __pyx_v_len_buf) == 0); if (__pyx_t_2) { /* "mtbl.pyx":62 * PyString_AsStringAndSize(py_buf, &buf, &len_buf) * if mtbl_varint_length_packed(buf, len_buf) == 0: * raise VarintDecodingError # <<<<<<<<<<<<<< * with nogil: * mtbl_varint_decode64(buf, &val) */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__VarintDecodingError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "mtbl.pyx":63 * if mtbl_varint_length_packed(buf, len_buf) == 0: * raise VarintDecodingError * with nogil: # <<<<<<<<<<<<<< * mtbl_varint_decode64(buf, &val) * return val */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":64 * raise VarintDecodingError * with nogil: * mtbl_varint_decode64(buf, &val) # <<<<<<<<<<<<<< * return val * */ mtbl_varint_decode64(__pyx_v_buf, (&__pyx_v_val)); } /* "mtbl.pyx":63 * if mtbl_varint_length_packed(buf, len_buf) == 0: * raise VarintDecodingError * with nogil: # <<<<<<<<<<<<<< * mtbl_varint_decode64(buf, &val) * return val */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":65 * with nogil: * mtbl_varint_decode64(buf, &val) * return val # <<<<<<<<<<<<<< * * @cython.internal */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyInt_to_py_uint64_t(__pyx_v_val); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("mtbl.varint_decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":72 * cdef object _parent * * def __cinit__(self): # <<<<<<<<<<<<<< * self._instance = NULL * */ static int __pyx_pf_4mtbl_8iterkeys___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_8iterkeys___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__"); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; /* "mtbl.pyx":73 * * def __cinit__(self): * self._instance = NULL # <<<<<<<<<<<<<< * * def __init__(self, object _parent): */ ((struct __pyx_obj_4mtbl_iterkeys *)__pyx_v_self)->_instance = NULL; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":75 * self._instance = NULL * * def __init__(self, object _parent): # <<<<<<<<<<<<<< * self._parent = _parent * */ static int __pyx_pf_4mtbl_8iterkeys_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_8iterkeys_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v__parent = 0; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___parent,0}; __Pyx_RefNannySetupContext("__init__"); { PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___parent); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v__parent = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("mtbl.iterkeys.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; /* "mtbl.pyx":76 * * def __init__(self, object _parent): * self._parent = _parent # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __Pyx_INCREF(__pyx_v__parent); __Pyx_GIVEREF(__pyx_v__parent); __Pyx_GOTREF(((struct __pyx_obj_4mtbl_iterkeys *)__pyx_v_self)->_parent); __Pyx_DECREF(((struct __pyx_obj_4mtbl_iterkeys *)__pyx_v_self)->_parent); ((struct __pyx_obj_4mtbl_iterkeys *)__pyx_v_self)->_parent = __pyx_v__parent; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":78 * self._parent = _parent * * def __dealloc__(self): # <<<<<<<<<<<<<< * with nogil: * mtbl_iter_destroy(&self._instance) */ static void __pyx_pf_4mtbl_8iterkeys_2__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_4mtbl_8iterkeys_2__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__"); /* "mtbl.pyx":79 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_iter_destroy(&self._instance) * */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":80 * def __dealloc__(self): * with nogil: * mtbl_iter_destroy(&self._instance) # <<<<<<<<<<<<<< * * def __iter__(self): */ mtbl_iter_destroy((&((struct __pyx_obj_4mtbl_iterkeys *)__pyx_v_self)->_instance)); } /* "mtbl.pyx":79 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_iter_destroy(&self._instance) * */ /*finally:*/ { Py_BLOCK_THREADS } } __Pyx_RefNannyFinishContext(); } /* "mtbl.pyx":82 * mtbl_iter_destroy(&self._instance) * * def __iter__(self): # <<<<<<<<<<<<<< * return self * */ static PyObject *__pyx_pf_4mtbl_8iterkeys_3__iter__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_4mtbl_8iterkeys_3__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__"); /* "mtbl.pyx":83 * * def __iter__(self): * return self # <<<<<<<<<<<<<< * * def __next__(self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self); __pyx_r = __pyx_v_self; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":85 * return self * * def __next__(self): # <<<<<<<<<<<<<< * cdef mtbl_res res * cdef uint8_t *key */ static PyObject *__pyx_pf_4mtbl_8iterkeys_4__next__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_4mtbl_8iterkeys_4__next__(PyObject *__pyx_v_self) { mtbl_res __pyx_v_res; uint8_t *__pyx_v_key; uint8_t *__pyx_v_val; size_t __pyx_v_len_key; size_t __pyx_v_len_val; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__next__"); /* "mtbl.pyx":92 * cdef size_t len_val * * if self._instance == NULL: # <<<<<<<<<<<<<< * raise StopIteration * */ __pyx_t_1 = (((struct __pyx_obj_4mtbl_iterkeys *)__pyx_v_self)->_instance == NULL); if (__pyx_t_1) { /* "mtbl.pyx":93 * * if self._instance == NULL: * raise StopIteration # <<<<<<<<<<<<<< * * with nogil: */ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "mtbl.pyx":95 * raise StopIteration * * with nogil: # <<<<<<<<<<<<<< * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":96 * * with nogil: * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) # <<<<<<<<<<<<<< * if res == mtbl_res_failure: * raise StopIteration */ __pyx_v_res = mtbl_iter_next(((struct __pyx_obj_4mtbl_iterkeys *)__pyx_v_self)->_instance, (&__pyx_v_key), (&__pyx_v_len_key), (&__pyx_v_val), (&__pyx_v_len_val)); } /* "mtbl.pyx":95 * raise StopIteration * * with nogil: # <<<<<<<<<<<<<< * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":97 * with nogil: * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: # <<<<<<<<<<<<<< * raise StopIteration * return PyString_FromStringAndSize( key, len_key) */ __pyx_t_1 = (__pyx_v_res == mtbl_res_failure); if (__pyx_t_1) { /* "mtbl.pyx":98 * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: * raise StopIteration # <<<<<<<<<<<<<< * return PyString_FromStringAndSize( key, len_key) * */ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L9; } __pyx_L9:; /* "mtbl.pyx":99 * if res == mtbl_res_failure: * raise StopIteration * return PyString_FromStringAndSize( key, len_key) # <<<<<<<<<<<<<< * * @cython.internal */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyString_FromStringAndSize(((char *)__pyx_v_key), __pyx_v_len_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.iterkeys.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":106 * cdef object _parent * * def __cinit__(self): # <<<<<<<<<<<<<< * self._instance = NULL * */ static int __pyx_pf_4mtbl_10itervalues___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_10itervalues___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__"); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; /* "mtbl.pyx":107 * * def __cinit__(self): * self._instance = NULL # <<<<<<<<<<<<<< * * def __init__(self, object _parent): */ ((struct __pyx_obj_4mtbl_itervalues *)__pyx_v_self)->_instance = NULL; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":109 * self._instance = NULL * * def __init__(self, object _parent): # <<<<<<<<<<<<<< * self._parent = _parent * */ static int __pyx_pf_4mtbl_10itervalues_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_10itervalues_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v__parent = 0; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___parent,0}; __Pyx_RefNannySetupContext("__init__"); { PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___parent); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v__parent = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("mtbl.itervalues.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; /* "mtbl.pyx":110 * * def __init__(self, object _parent): * self._parent = _parent # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __Pyx_INCREF(__pyx_v__parent); __Pyx_GIVEREF(__pyx_v__parent); __Pyx_GOTREF(((struct __pyx_obj_4mtbl_itervalues *)__pyx_v_self)->_parent); __Pyx_DECREF(((struct __pyx_obj_4mtbl_itervalues *)__pyx_v_self)->_parent); ((struct __pyx_obj_4mtbl_itervalues *)__pyx_v_self)->_parent = __pyx_v__parent; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":112 * self._parent = _parent * * def __dealloc__(self): # <<<<<<<<<<<<<< * with nogil: * mtbl_iter_destroy(&self._instance) */ static void __pyx_pf_4mtbl_10itervalues_2__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_4mtbl_10itervalues_2__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__"); /* "mtbl.pyx":113 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_iter_destroy(&self._instance) * */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":114 * def __dealloc__(self): * with nogil: * mtbl_iter_destroy(&self._instance) # <<<<<<<<<<<<<< * * def __iter__(self): */ mtbl_iter_destroy((&((struct __pyx_obj_4mtbl_itervalues *)__pyx_v_self)->_instance)); } /* "mtbl.pyx":113 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_iter_destroy(&self._instance) * */ /*finally:*/ { Py_BLOCK_THREADS } } __Pyx_RefNannyFinishContext(); } /* "mtbl.pyx":116 * mtbl_iter_destroy(&self._instance) * * def __iter__(self): # <<<<<<<<<<<<<< * return self * */ static PyObject *__pyx_pf_4mtbl_10itervalues_3__iter__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_4mtbl_10itervalues_3__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__"); /* "mtbl.pyx":117 * * def __iter__(self): * return self # <<<<<<<<<<<<<< * * def __next__(self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self); __pyx_r = __pyx_v_self; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":119 * return self * * def __next__(self): # <<<<<<<<<<<<<< * cdef mtbl_res res * cdef uint8_t *key */ static PyObject *__pyx_pf_4mtbl_10itervalues_4__next__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_4mtbl_10itervalues_4__next__(PyObject *__pyx_v_self) { mtbl_res __pyx_v_res; uint8_t *__pyx_v_key; uint8_t *__pyx_v_val; size_t __pyx_v_len_key; size_t __pyx_v_len_val; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__next__"); /* "mtbl.pyx":126 * cdef size_t len_val * * if self._instance == NULL: # <<<<<<<<<<<<<< * raise StopIteration * */ __pyx_t_1 = (((struct __pyx_obj_4mtbl_itervalues *)__pyx_v_self)->_instance == NULL); if (__pyx_t_1) { /* "mtbl.pyx":127 * * if self._instance == NULL: * raise StopIteration # <<<<<<<<<<<<<< * * with nogil: */ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "mtbl.pyx":129 * raise StopIteration * * with nogil: # <<<<<<<<<<<<<< * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":130 * * with nogil: * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) # <<<<<<<<<<<<<< * if res == mtbl_res_failure: * raise StopIteration */ __pyx_v_res = mtbl_iter_next(((struct __pyx_obj_4mtbl_itervalues *)__pyx_v_self)->_instance, (&__pyx_v_key), (&__pyx_v_len_key), (&__pyx_v_val), (&__pyx_v_len_val)); } /* "mtbl.pyx":129 * raise StopIteration * * with nogil: # <<<<<<<<<<<<<< * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":131 * with nogil: * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: # <<<<<<<<<<<<<< * raise StopIteration * return PyString_FromStringAndSize( val, len_val) */ __pyx_t_1 = (__pyx_v_res == mtbl_res_failure); if (__pyx_t_1) { /* "mtbl.pyx":132 * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: * raise StopIteration # <<<<<<<<<<<<<< * return PyString_FromStringAndSize( val, len_val) * */ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L9; } __pyx_L9:; /* "mtbl.pyx":133 * if res == mtbl_res_failure: * raise StopIteration * return PyString_FromStringAndSize( val, len_val) # <<<<<<<<<<<<<< * * @cython.internal */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyString_FromStringAndSize(((char *)__pyx_v_val), __pyx_v_len_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.itervalues.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":140 * cdef object _parent * * def __cinit__(self): # <<<<<<<<<<<<<< * self._instance = NULL * */ static int __pyx_pf_4mtbl_9iteritems___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_9iteritems___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__"); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; /* "mtbl.pyx":141 * * def __cinit__(self): * self._instance = NULL # <<<<<<<<<<<<<< * * def __init__(self, object _parent): */ ((struct __pyx_obj_4mtbl_iteritems *)__pyx_v_self)->_instance = NULL; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":143 * self._instance = NULL * * def __init__(self, object _parent): # <<<<<<<<<<<<<< * self._parent = _parent * */ static int __pyx_pf_4mtbl_9iteritems_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_9iteritems_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v__parent = 0; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___parent,0}; __Pyx_RefNannySetupContext("__init__"); { PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___parent); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v__parent = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("mtbl.iteritems.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; /* "mtbl.pyx":144 * * def __init__(self, object _parent): * self._parent = _parent # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __Pyx_INCREF(__pyx_v__parent); __Pyx_GIVEREF(__pyx_v__parent); __Pyx_GOTREF(((struct __pyx_obj_4mtbl_iteritems *)__pyx_v_self)->_parent); __Pyx_DECREF(((struct __pyx_obj_4mtbl_iteritems *)__pyx_v_self)->_parent); ((struct __pyx_obj_4mtbl_iteritems *)__pyx_v_self)->_parent = __pyx_v__parent; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":146 * self._parent = _parent * * def __dealloc__(self): # <<<<<<<<<<<<<< * with nogil: * mtbl_iter_destroy(&self._instance) */ static void __pyx_pf_4mtbl_9iteritems_2__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_4mtbl_9iteritems_2__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__"); /* "mtbl.pyx":147 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_iter_destroy(&self._instance) * */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":148 * def __dealloc__(self): * with nogil: * mtbl_iter_destroy(&self._instance) # <<<<<<<<<<<<<< * * def __iter__(self): */ mtbl_iter_destroy((&((struct __pyx_obj_4mtbl_iteritems *)__pyx_v_self)->_instance)); } /* "mtbl.pyx":147 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_iter_destroy(&self._instance) * */ /*finally:*/ { Py_BLOCK_THREADS } } __Pyx_RefNannyFinishContext(); } /* "mtbl.pyx":150 * mtbl_iter_destroy(&self._instance) * * def __iter__(self): # <<<<<<<<<<<<<< * return self * */ static PyObject *__pyx_pf_4mtbl_9iteritems_3__iter__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_4mtbl_9iteritems_3__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__"); /* "mtbl.pyx":151 * * def __iter__(self): * return self # <<<<<<<<<<<<<< * * def __next__(self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self); __pyx_r = __pyx_v_self; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":153 * return self * * def __next__(self): # <<<<<<<<<<<<<< * cdef mtbl_res res * cdef uint8_t *key */ static PyObject *__pyx_pf_4mtbl_9iteritems_4__next__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_4mtbl_9iteritems_4__next__(PyObject *__pyx_v_self) { mtbl_res __pyx_v_res; uint8_t *__pyx_v_key; uint8_t *__pyx_v_val; size_t __pyx_v_len_key; size_t __pyx_v_len_val; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__next__"); /* "mtbl.pyx":160 * cdef size_t len_val * * if self._instance == NULL: # <<<<<<<<<<<<<< * raise StopIteration * */ __pyx_t_1 = (((struct __pyx_obj_4mtbl_iteritems *)__pyx_v_self)->_instance == NULL); if (__pyx_t_1) { /* "mtbl.pyx":161 * * if self._instance == NULL: * raise StopIteration # <<<<<<<<<<<<<< * * with nogil: */ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "mtbl.pyx":163 * raise StopIteration * * with nogil: # <<<<<<<<<<<<<< * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) * */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":164 * * with nogil: * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) # <<<<<<<<<<<<<< * * if res == mtbl_res_failure: */ __pyx_v_res = mtbl_iter_next(((struct __pyx_obj_4mtbl_iteritems *)__pyx_v_self)->_instance, (&__pyx_v_key), (&__pyx_v_len_key), (&__pyx_v_val), (&__pyx_v_len_val)); } /* "mtbl.pyx":163 * raise StopIteration * * with nogil: # <<<<<<<<<<<<<< * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) * */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":166 * res = mtbl_iter_next(self._instance, &key, &len_key, &val, &len_val) * * if res == mtbl_res_failure: # <<<<<<<<<<<<<< * raise StopIteration * */ __pyx_t_1 = (__pyx_v_res == mtbl_res_failure); if (__pyx_t_1) { /* "mtbl.pyx":167 * * if res == mtbl_res_failure: * raise StopIteration # <<<<<<<<<<<<<< * * return (PyString_FromStringAndSize( key, len_key), */ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L9; } __pyx_L9:; /* "mtbl.pyx":169 * raise StopIteration * * return (PyString_FromStringAndSize( key, len_key), # <<<<<<<<<<<<<< * PyString_FromStringAndSize( val, len_val)) * */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyString_FromStringAndSize(((char *)__pyx_v_key), __pyx_v_len_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); /* "mtbl.pyx":170 * * return (PyString_FromStringAndSize( key, len_key), * PyString_FromStringAndSize( val, len_val)) # <<<<<<<<<<<<<< * * cdef get_iterkeys(parent, mtbl_iter *instance): */ __pyx_t_3 = PyString_FromStringAndSize(((char *)__pyx_v_val), __pyx_v_len_val); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_r = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("mtbl.iteritems.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":172 * PyString_FromStringAndSize( val, len_val)) * * cdef get_iterkeys(parent, mtbl_iter *instance): # <<<<<<<<<<<<<< * it = iterkeys(parent) * it._instance = instance */ static PyObject *__pyx_f_4mtbl_get_iterkeys(PyObject *__pyx_v_parent, struct mtbl_iter *__pyx_v_instance) { struct __pyx_obj_4mtbl_iterkeys *__pyx_v_it = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_iterkeys"); /* "mtbl.pyx":173 * * cdef get_iterkeys(parent, mtbl_iter *instance): * it = iterkeys(parent) # <<<<<<<<<<<<<< * it._instance = instance * return it */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_parent); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_parent); __Pyx_GIVEREF(__pyx_v_parent); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4mtbl_iterkeys)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_v_it = ((struct __pyx_obj_4mtbl_iterkeys *)__pyx_t_2); __pyx_t_2 = 0; /* "mtbl.pyx":174 * cdef get_iterkeys(parent, mtbl_iter *instance): * it = iterkeys(parent) * it._instance = instance # <<<<<<<<<<<<<< * return it * */ __pyx_v_it->_instance = __pyx_v_instance; /* "mtbl.pyx":175 * it = iterkeys(parent) * it._instance = instance * return it # <<<<<<<<<<<<<< * * cdef get_itervalues(parent, mtbl_iter *instance): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_it)); __pyx_r = ((PyObject *)__pyx_v_it); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.get_iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_it); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":177 * return it * * cdef get_itervalues(parent, mtbl_iter *instance): # <<<<<<<<<<<<<< * it = itervalues(parent) * it._instance = instance */ static PyObject *__pyx_f_4mtbl_get_itervalues(PyObject *__pyx_v_parent, struct mtbl_iter *__pyx_v_instance) { struct __pyx_obj_4mtbl_itervalues *__pyx_v_it = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_itervalues"); /* "mtbl.pyx":178 * * cdef get_itervalues(parent, mtbl_iter *instance): * it = itervalues(parent) # <<<<<<<<<<<<<< * it._instance = instance * return it */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_parent); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_parent); __Pyx_GIVEREF(__pyx_v_parent); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4mtbl_itervalues)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_v_it = ((struct __pyx_obj_4mtbl_itervalues *)__pyx_t_2); __pyx_t_2 = 0; /* "mtbl.pyx":179 * cdef get_itervalues(parent, mtbl_iter *instance): * it = itervalues(parent) * it._instance = instance # <<<<<<<<<<<<<< * return it * */ __pyx_v_it->_instance = __pyx_v_instance; /* "mtbl.pyx":180 * it = itervalues(parent) * it._instance = instance * return it # <<<<<<<<<<<<<< * * cdef get_iteritems(parent, mtbl_iter *instance): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_it)); __pyx_r = ((PyObject *)__pyx_v_it); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.get_itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_it); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":182 * return it * * cdef get_iteritems(parent, mtbl_iter *instance): # <<<<<<<<<<<<<< * it = iteritems(parent) * it._instance = instance */ static PyObject *__pyx_f_4mtbl_get_iteritems(PyObject *__pyx_v_parent, struct mtbl_iter *__pyx_v_instance) { struct __pyx_obj_4mtbl_iteritems *__pyx_v_it = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_iteritems"); /* "mtbl.pyx":183 * * cdef get_iteritems(parent, mtbl_iter *instance): * it = iteritems(parent) # <<<<<<<<<<<<<< * it._instance = instance * return it */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_parent); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_parent); __Pyx_GIVEREF(__pyx_v_parent); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4mtbl_iteritems)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_v_it = ((struct __pyx_obj_4mtbl_iteritems *)__pyx_t_2); __pyx_t_2 = 0; /* "mtbl.pyx":184 * cdef get_iteritems(parent, mtbl_iter *instance): * it = iteritems(parent) * it._instance = instance # <<<<<<<<<<<<<< * return it * */ __pyx_v_it->_instance = __pyx_v_instance; /* "mtbl.pyx":185 * it = iteritems(parent) * it._instance = instance * return it # <<<<<<<<<<<<<< * * @cython.internal */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_it)); __pyx_r = ((PyObject *)__pyx_v_it); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.get_iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_it); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":189 * @cython.internal * cdef class DictMixin(object): * def __iter__(self): # <<<<<<<<<<<<<< * return self.iterkeys() * */ static PyObject *__pyx_pf_4mtbl_9DictMixin___iter__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_4mtbl_9DictMixin___iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__"); /* "mtbl.pyx":190 * cdef class DictMixin(object): * def __iter__(self): * return self.iterkeys() # <<<<<<<<<<<<<< * * def iter(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__iterkeys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.DictMixin.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":192 * return self.iterkeys() * * def iter(self): # <<<<<<<<<<<<<< * return self.iterkeys() * */ static PyObject *__pyx_pf_4mtbl_9DictMixin_1iter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_4mtbl_9DictMixin_1iter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("iter"); /* "mtbl.pyx":193 * * def iter(self): * return self.iterkeys() # <<<<<<<<<<<<<< * * def items(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__iterkeys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.DictMixin.iter", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":195 * return self.iterkeys() * * def items(self): # <<<<<<<<<<<<<< * """D.items() -> list of D's (key, value) pairs, as 2-tuples""" * return [ (k, v) for k, v in self.iteritems() ] */ static PyObject *__pyx_pf_4mtbl_9DictMixin_2items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_9DictMixin_2items[] = "D.items() -> list of D's (key, value) pairs, as 2-tuples"; static PyObject *__pyx_pf_4mtbl_9DictMixin_2items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_v_k = NULL; PyObject *__pyx_v_v = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *(*__pyx_t_9)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("items"); /* "mtbl.pyx":197 * def items(self): * """D.items() -> list of D's (key, value) pairs, as 2-tuples""" * return [ (k, v) for k, v in self.iteritems() ] # <<<<<<<<<<<<<< * * def keys(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; } else if (PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_3); } if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { PyObject* sequence = __pyx_t_3; if (likely(PyTuple_CheckExact(sequence))) { if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); } else { if (unlikely(PyList_GET_SIZE(sequence) != 2)) { if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L8_unpacking_done; __pyx_L7_unpacking_failed:; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L8_unpacking_done:; } __Pyx_XDECREF(__pyx_v_k); __pyx_v_k = __pyx_t_6; __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_v_v); __pyx_v_v = __pyx_t_7; __pyx_t_7 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_k); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_k); __Pyx_GIVEREF(__pyx_v_k); __Pyx_INCREF(__pyx_v_v); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_v); __Pyx_GIVEREF(__pyx_v_v); if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("mtbl.DictMixin.items", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_k); __Pyx_XDECREF(__pyx_v_v); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":199 * return [ (k, v) for k, v in self.iteritems() ] * * def keys(self): # <<<<<<<<<<<<<< * """D.keys() -> list of D's keys""" * return [ k for k in self.iterkeys() ] */ static PyObject *__pyx_pf_4mtbl_9DictMixin_3keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_9DictMixin_3keys[] = "D.keys() -> list of D's keys"; static PyObject *__pyx_pf_4mtbl_9DictMixin_3keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_v_k = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("keys"); /* "mtbl.pyx":201 * def keys(self): * """D.keys() -> list of D's keys""" * return [ k for k in self.iterkeys() ] # <<<<<<<<<<<<<< * * def values(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__iterkeys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; } else if (PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_XDECREF(__pyx_v_k); __pyx_v_k = __pyx_t_3; __pyx_t_3 = 0; if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_k))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("mtbl.DictMixin.keys", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_k); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":203 * return [ k for k in self.iterkeys() ] * * def values(self): # <<<<<<<<<<<<<< * """D.values() -> list of D's values""" * return [ v for v in self.itervalues() ] */ static PyObject *__pyx_pf_4mtbl_9DictMixin_4values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_9DictMixin_4values[] = "D.values() -> list of D's values"; static PyObject *__pyx_pf_4mtbl_9DictMixin_4values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_v_v = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("values"); /* "mtbl.pyx":205 * def values(self): * """D.values() -> list of D's values""" * return [ v for v in self.itervalues() ] # <<<<<<<<<<<<<< * * def __delitem__(self, key): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__itervalues); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; } else if (PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_XDECREF(__pyx_v_v); __pyx_v_v = __pyx_t_3; __pyx_t_3 = 0; if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_v))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("mtbl.DictMixin.values", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_v); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":207 * return [ v for v in self.itervalues() ] * * def __delitem__(self, key): # <<<<<<<<<<<<<< * """will raise ImmutableError""" * raise ImmutableError */ static int __pyx_pf_4mtbl_9DictMixin_5__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ static char __pyx_doc_4mtbl_9DictMixin_5__delitem__[] = "will raise ImmutableError"; struct wrapperbase __pyx_wrapperbase_4mtbl_9DictMixin_5__delitem__; static int __pyx_pf_4mtbl_9DictMixin_5__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__delitem__"); /* "mtbl.pyx":209 * def __delitem__(self, key): * """will raise ImmutableError""" * raise ImmutableError # <<<<<<<<<<<<<< * * def __setitem__(self, key, value): */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ImmutableError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.DictMixin.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":211 * raise ImmutableError * * def __setitem__(self, key, value): # <<<<<<<<<<<<<< * """will raise ImmutableError""" * raise ImmutableError */ static int __pyx_pf_4mtbl_9DictMixin_6__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/ static char __pyx_doc_4mtbl_9DictMixin_6__setitem__[] = "will raise ImmutableError"; struct wrapperbase __pyx_wrapperbase_4mtbl_9DictMixin_6__setitem__; static int __pyx_pf_4mtbl_9DictMixin_6__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__"); /* "mtbl.pyx":213 * def __setitem__(self, key, value): * """will raise ImmutableError""" * raise ImmutableError # <<<<<<<<<<<<<< * * def pop(self, *a, **b): */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ImmutableError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.DictMixin.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":215 * raise ImmutableError * * def pop(self, *a, **b): # <<<<<<<<<<<<<< * """will raise ImmutableError""" * raise ImmutableError */ static PyObject *__pyx_pf_4mtbl_9DictMixin_7pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4mtbl_9DictMixin_7pop[] = "will raise ImmutableError"; static PyObject *__pyx_pf_4mtbl_9DictMixin_7pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_a = 0; PyObject *__pyx_v_b = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pop"); if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "pop", 1))) return NULL; __pyx_v_b = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_b)) return NULL; __Pyx_GOTREF(__pyx_v_b); __Pyx_INCREF(__pyx_args); __pyx_v_a = __pyx_args; /* "mtbl.pyx":217 * def pop(self, *a, **b): * """will raise ImmutableError""" * raise ImmutableError # <<<<<<<<<<<<<< * * def popitem(self): */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ImmutableError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.DictMixin.pop", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_a); __Pyx_XDECREF(__pyx_v_b); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":219 * raise ImmutableError * * def popitem(self): # <<<<<<<<<<<<<< * """will raise ImmutableError""" * raise ImmutableError */ static PyObject *__pyx_pf_4mtbl_9DictMixin_8popitem(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_9DictMixin_8popitem[] = "will raise ImmutableError"; static PyObject *__pyx_pf_4mtbl_9DictMixin_8popitem(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("popitem"); /* "mtbl.pyx":221 * def popitem(self): * """will raise ImmutableError""" * raise ImmutableError # <<<<<<<<<<<<<< * * def update(self, *a, **b): */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ImmutableError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.DictMixin.popitem", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":223 * raise ImmutableError * * def update(self, *a, **b): # <<<<<<<<<<<<<< * """will raise ImmutableError""" * raise ImmutableError */ static PyObject *__pyx_pf_4mtbl_9DictMixin_9update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4mtbl_9DictMixin_9update[] = "will raise ImmutableError"; static PyObject *__pyx_pf_4mtbl_9DictMixin_9update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_a = 0; PyObject *__pyx_v_b = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("update"); if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "update", 1))) return NULL; __pyx_v_b = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_b)) return NULL; __Pyx_GOTREF(__pyx_v_b); __Pyx_INCREF(__pyx_args); __pyx_v_a = __pyx_args; /* "mtbl.pyx":225 * def update(self, *a, **b): * """will raise ImmutableError""" * raise ImmutableError # <<<<<<<<<<<<<< * * cdef class reader(DictMixin): */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ImmutableError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.DictMixin.update", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_a); __Pyx_XDECREF(__pyx_v_b); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":236 * cdef mtbl_reader *_instance * * def __cinit__(self): # <<<<<<<<<<<<<< * self._instance = NULL * */ static int __pyx_pf_4mtbl_6reader___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_6reader___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__"); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; /* "mtbl.pyx":237 * * def __cinit__(self): * self._instance = NULL # <<<<<<<<<<<<<< * * def __dealloc__(self): */ ((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->_instance = NULL; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":239 * self._instance = NULL * * def __dealloc__(self): # <<<<<<<<<<<<<< * with nogil: * mtbl_reader_destroy(&self._instance) */ static void __pyx_pf_4mtbl_6reader_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_4mtbl_6reader_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__"); /* "mtbl.pyx":240 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_reader_destroy(&self._instance) * */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":241 * def __dealloc__(self): * with nogil: * mtbl_reader_destroy(&self._instance) # <<<<<<<<<<<<<< * * def __init__(self, char * fname, bool verify_checksums=False): */ mtbl_reader_destroy((&((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->_instance)); } /* "mtbl.pyx":240 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_reader_destroy(&self._instance) * */ /*finally:*/ { Py_BLOCK_THREADS } } __Pyx_RefNannyFinishContext(); } /* "mtbl.pyx":243 * mtbl_reader_destroy(&self._instance) * * def __init__(self, char * fname, bool verify_checksums=False): # <<<<<<<<<<<<<< * cdef mtbl_reader_options *opt * */ static int __pyx_pf_4mtbl_6reader_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_6reader_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { char *__pyx_v_fname; PyBoolObject *__pyx_v_verify_checksums = 0; struct mtbl_reader_options *__pyx_v_opt; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fname,&__pyx_n_s__verify_checksums,0}; __Pyx_RefNannySetupContext("__init__"); { PyObject* values[2] = {0,0}; values[1] = (PyObject *)__pyx_k_1; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fname); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__verify_checksums); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_fname = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_verify_checksums = ((PyBoolObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("mtbl.reader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_verify_checksums), __pyx_ptype_7cpython_4bool_bool, 1, "verify_checksums", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":246 * cdef mtbl_reader_options *opt * * with nogil: # <<<<<<<<<<<<<< * opt = mtbl_reader_options_init() * mtbl_reader_options_set_verify_checksums(opt, verify_checksums) */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":247 * * with nogil: * opt = mtbl_reader_options_init() # <<<<<<<<<<<<<< * mtbl_reader_options_set_verify_checksums(opt, verify_checksums) * self._instance = mtbl_reader_init(fname, opt) */ __pyx_v_opt = mtbl_reader_options_init(); /* "mtbl.pyx":248 * with nogil: * opt = mtbl_reader_options_init() * mtbl_reader_options_set_verify_checksums(opt, verify_checksums) # <<<<<<<<<<<<<< * self._instance = mtbl_reader_init(fname, opt) * mtbl_reader_options_destroy(&opt) */ mtbl_reader_options_set_verify_checksums(__pyx_v_opt, __pyx_v_verify_checksums); /* "mtbl.pyx":249 * opt = mtbl_reader_options_init() * mtbl_reader_options_set_verify_checksums(opt, verify_checksums) * self._instance = mtbl_reader_init(fname, opt) # <<<<<<<<<<<<<< * mtbl_reader_options_destroy(&opt) * */ ((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->_instance = mtbl_reader_init(__pyx_v_fname, __pyx_v_opt); /* "mtbl.pyx":250 * mtbl_reader_options_set_verify_checksums(opt, verify_checksums) * self._instance = mtbl_reader_init(fname, opt) * mtbl_reader_options_destroy(&opt) # <<<<<<<<<<<<<< * * if (self._instance == NULL): */ mtbl_reader_options_destroy((&__pyx_v_opt)); } /* "mtbl.pyx":246 * cdef mtbl_reader_options *opt * * with nogil: # <<<<<<<<<<<<<< * opt = mtbl_reader_options_init() * mtbl_reader_options_set_verify_checksums(opt, verify_checksums) */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":252 * mtbl_reader_options_destroy(&opt) * * if (self._instance == NULL): # <<<<<<<<<<<<<< * raise IOError("unable to open file: '%s'" % fname) * */ __pyx_t_1 = (((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->_instance == NULL); if (__pyx_t_1) { /* "mtbl.pyx":253 * * if (self._instance == NULL): * raise IOError("unable to open file: '%s'" % fname) # <<<<<<<<<<<<<< * * cdef check_initialized(self): */ __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L9; } __pyx_L9:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("mtbl.reader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":255 * raise IOError("unable to open file: '%s'" % fname) * * cdef check_initialized(self): # <<<<<<<<<<<<<< * if self._instance == NULL: * raise UninitializedException */ static PyObject *__pyx_f_4mtbl_6reader_check_initialized(struct __pyx_obj_4mtbl_reader *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("check_initialized"); /* "mtbl.pyx":256 * * cdef check_initialized(self): * if self._instance == NULL: # <<<<<<<<<<<<<< * raise UninitializedException * */ __pyx_t_1 = (__pyx_v_self->_instance == NULL); if (__pyx_t_1) { /* "mtbl.pyx":257 * cdef check_initialized(self): * if self._instance == NULL: * raise UninitializedException # <<<<<<<<<<<<<< * * def iterkeys(self): */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.reader.check_initialized", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":259 * raise UninitializedException * * def iterkeys(self): # <<<<<<<<<<<<<< * """R.iterkeys() -> an iterator over the keys of R.""" * self.check_initialized() */ static PyObject *__pyx_pf_4mtbl_6reader_3iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_6reader_3iterkeys[] = "R.iterkeys() -> an iterator over the keys of R."; static PyObject *__pyx_pf_4mtbl_6reader_3iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("iterkeys"); /* "mtbl.pyx":261 * def iterkeys(self): * """R.iterkeys() -> an iterator over the keys of R.""" * self.check_initialized() # <<<<<<<<<<<<<< * return get_iterkeys(self, mtbl_source_iter(mtbl_reader_source(self._instance))) * */ __pyx_t_1 = ((struct __pyx_vtabstruct_4mtbl_reader *)((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->__pyx_vtab)->check_initialized(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":262 * """R.iterkeys() -> an iterator over the keys of R.""" * self.check_initialized() * return get_iterkeys(self, mtbl_source_iter(mtbl_reader_source(self._instance))) # <<<<<<<<<<<<<< * * def itervalues(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_4mtbl_get_iterkeys(__pyx_v_self, mtbl_source_iter(mtbl_reader_source(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->_instance))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.reader.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":264 * return get_iterkeys(self, mtbl_source_iter(mtbl_reader_source(self._instance))) * * def itervalues(self): # <<<<<<<<<<<<<< * """R.itervalues() -> an iterator over the values of R.""" * self.check_initialized() */ static PyObject *__pyx_pf_4mtbl_6reader_4itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_6reader_4itervalues[] = "R.itervalues() -> an iterator over the values of R."; static PyObject *__pyx_pf_4mtbl_6reader_4itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("itervalues"); /* "mtbl.pyx":266 * def itervalues(self): * """R.itervalues() -> an iterator over the values of R.""" * self.check_initialized() # <<<<<<<<<<<<<< * return get_itervalues(self, mtbl_source_iter(mtbl_reader_source(self._instance))) * */ __pyx_t_1 = ((struct __pyx_vtabstruct_4mtbl_reader *)((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->__pyx_vtab)->check_initialized(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":267 * """R.itervalues() -> an iterator over the values of R.""" * self.check_initialized() * return get_itervalues(self, mtbl_source_iter(mtbl_reader_source(self._instance))) # <<<<<<<<<<<<<< * * def iteritems(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_4mtbl_get_itervalues(__pyx_v_self, mtbl_source_iter(mtbl_reader_source(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->_instance))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.reader.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":269 * return get_itervalues(self, mtbl_source_iter(mtbl_reader_source(self._instance))) * * def iteritems(self): # <<<<<<<<<<<<<< * """R.iteritems() -> an iterator over the (key, value) items of R.""" * self.check_initialized() */ static PyObject *__pyx_pf_4mtbl_6reader_5iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_6reader_5iteritems[] = "R.iteritems() -> an iterator over the (key, value) items of R."; static PyObject *__pyx_pf_4mtbl_6reader_5iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("iteritems"); /* "mtbl.pyx":271 * def iteritems(self): * """R.iteritems() -> an iterator over the (key, value) items of R.""" * self.check_initialized() # <<<<<<<<<<<<<< * return get_iteritems(self, mtbl_source_iter(mtbl_reader_source(self._instance))) * */ __pyx_t_1 = ((struct __pyx_vtabstruct_4mtbl_reader *)((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->__pyx_vtab)->check_initialized(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":272 * """R.iteritems() -> an iterator over the (key, value) items of R.""" * self.check_initialized() * return get_iteritems(self, mtbl_source_iter(mtbl_reader_source(self._instance))) # <<<<<<<<<<<<<< * * def __contains__(self, bytes py_key): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_4mtbl_get_iteritems(__pyx_v_self, mtbl_source_iter(mtbl_reader_source(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->_instance))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.reader.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":274 * return get_iteritems(self, mtbl_source_iter(mtbl_reader_source(self._instance))) * * def __contains__(self, bytes py_key): # <<<<<<<<<<<<<< * """R.__contains__(k) -> True if R has a key k, else False""" * try: */ static int __pyx_pf_4mtbl_6reader_6__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key); /*proto*/ static char __pyx_doc_4mtbl_6reader_6__contains__[] = "R.__contains__(k) -> True if R has a key k, else False"; struct wrapperbase __pyx_wrapperbase_4mtbl_6reader_6__contains__; static int __pyx_pf_4mtbl_6reader_6__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__contains__"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key), (&PyBytes_Type), 1, "py_key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":276 * def __contains__(self, bytes py_key): * """R.__contains__(k) -> True if R has a key k, else False""" * try: # <<<<<<<<<<<<<< * self.__getitem__(py_key) * return True */ { __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "mtbl.pyx":277 * """R.__contains__(k) -> True if R has a key k, else False""" * try: * self.__getitem__(py_key) # <<<<<<<<<<<<<< * return True * except KeyError: */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getitem__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_INCREF(((PyObject *)__pyx_v_py_key)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_py_key)); __Pyx_GIVEREF(((PyObject *)__pyx_v_py_key)); __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "mtbl.pyx":278 * try: * self.__getitem__(py_key) * return True # <<<<<<<<<<<<<< * except KeyError: * pass */ __pyx_r = 1; goto __pyx_L9_try_return; } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L12_try_end; __pyx_L9_try_return:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L0; __pyx_L5_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; /* "mtbl.pyx":279 * self.__getitem__(py_key) * return True * except KeyError: # <<<<<<<<<<<<<< * pass * return False */ __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_7) { PyErr_Restore(0,0,0); goto __pyx_L6_exception_handled; } __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L6_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); __pyx_L12_try_end:; } /* "mtbl.pyx":281 * except KeyError: * pass * return False # <<<<<<<<<<<<<< * * def has_key(self, bytes py_key): */ __pyx_r = 0; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("mtbl.reader.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":283 * return False * * def has_key(self, bytes py_key): # <<<<<<<<<<<<<< * """R.has_key(k) -> True if R has a key k, else False.""" * return self.__contains__(py_key) */ static PyObject *__pyx_pf_4mtbl_6reader_7has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key); /*proto*/ static char __pyx_doc_4mtbl_6reader_7has_key[] = "R.has_key(k) -> True if R has a key k, else False."; static PyObject *__pyx_pf_4mtbl_6reader_7has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("has_key"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key), (&PyBytes_Type), 1, "py_key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":285 * def has_key(self, bytes py_key): * """R.has_key(k) -> True if R has a key k, else False.""" * return self.__contains__(py_key) # <<<<<<<<<<<<<< * * def get(self, bytes py_key, default=None): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____contains__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_py_key)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_py_key)); __Pyx_GIVEREF(((PyObject *)__pyx_v_py_key)); __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("mtbl.reader.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":287 * return self.__contains__(py_key) * * def get(self, bytes py_key, default=None): # <<<<<<<<<<<<<< * """R.get(k[,d]) -> R[k] if k in R, else d. d defaults to None.""" * try: */ static PyObject *__pyx_pf_4mtbl_6reader_8get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4mtbl_6reader_8get[] = "R.get(k[,d]) -> R[k] if k in R, else d. d defaults to None."; static PyObject *__pyx_pf_4mtbl_6reader_8get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_py_key = 0; PyObject *__pyx_v_default = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__py_key,&__pyx_n_s__default,0}; __Pyx_RefNannySetupContext("get"); { PyObject* values[2] = {0,0}; values[1] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__py_key); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_py_key = ((PyObject*)values[0]); __pyx_v_default = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("mtbl.reader.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key), (&PyBytes_Type), 1, "py_key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":289 * def get(self, bytes py_key, default=None): * """R.get(k[,d]) -> R[k] if k in R, else d. d defaults to None.""" * try: # <<<<<<<<<<<<<< * return self.__getitem__(py_key) * except KeyError: */ { __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "mtbl.pyx":290 * """R.get(k[,d]) -> R[k] if k in R, else d. d defaults to None.""" * try: * return self.__getitem__(py_key) # <<<<<<<<<<<<<< * except KeyError: * pass */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getitem__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_INCREF(((PyObject *)__pyx_v_py_key)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_py_key)); __Pyx_GIVEREF(((PyObject *)__pyx_v_py_key)); __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L10_try_return; } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L13_try_end; __pyx_L10_try_return:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L0; __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; /* "mtbl.pyx":291 * try: * return self.__getitem__(py_key) * except KeyError: # <<<<<<<<<<<<<< * pass * return default */ __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_7) { PyErr_Restore(0,0,0); goto __pyx_L7_exception_handled; } __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L7_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); __pyx_L13_try_end:; } /* "mtbl.pyx":293 * except KeyError: * pass * return default # <<<<<<<<<<<<<< * * def get_range(self, bytes py_key0, bytes py_key1): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_default); __pyx_r = __pyx_v_default; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("mtbl.reader.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":295 * return default * * def get_range(self, bytes py_key0, bytes py_key1): # <<<<<<<<<<<<<< * """ * R.get_range(key0, key1) -> an iterator over all (key, value) items in R where key is */ static PyObject *__pyx_pf_4mtbl_6reader_9get_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4mtbl_6reader_9get_range[] = "\n R.get_range(key0, key1) -> an iterator over all (key, value) items in R where key is\n between key0 and key1 inclusive.\n "; static PyObject *__pyx_pf_4mtbl_6reader_9get_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_py_key0 = 0; PyObject *__pyx_v_py_key1 = 0; uint8_t *__pyx_v_key0; uint8_t *__pyx_v_key1; size_t __pyx_v_len_key0; size_t __pyx_v_len_key1; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; char *__pyx_t_2; Py_ssize_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__py_key0,&__pyx_n_s__py_key1,0}; __Pyx_RefNannySetupContext("get_range"); { PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__py_key0); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__py_key1); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_range", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_range") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_py_key0 = ((PyObject*)values[0]); __pyx_v_py_key1 = ((PyObject*)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_range", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("mtbl.reader.get_range", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key0), (&PyBytes_Type), 1, "py_key0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key1), (&PyBytes_Type), 1, "py_key1", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":306 * cdef size_t len_key1 * * self.check_initialized() # <<<<<<<<<<<<<< * * key0 = PyString_AsString(py_key0) */ __pyx_t_1 = ((struct __pyx_vtabstruct_4mtbl_reader *)((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->__pyx_vtab)->check_initialized(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":308 * self.check_initialized() * * key0 = PyString_AsString(py_key0) # <<<<<<<<<<<<<< * key1 = PyString_AsString(py_key1) * len_key0 = PyString_Size(py_key0) */ __pyx_t_2 = PyString_AsString(((PyObject *)__pyx_v_py_key0)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_key0 = ((uint8_t *)__pyx_t_2); /* "mtbl.pyx":309 * * key0 = PyString_AsString(py_key0) * key1 = PyString_AsString(py_key1) # <<<<<<<<<<<<<< * len_key0 = PyString_Size(py_key0) * len_key1 = PyString_Size(py_key1) */ __pyx_t_2 = PyString_AsString(((PyObject *)__pyx_v_py_key1)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_key1 = ((uint8_t *)__pyx_t_2); /* "mtbl.pyx":310 * key0 = PyString_AsString(py_key0) * key1 = PyString_AsString(py_key1) * len_key0 = PyString_Size(py_key0) # <<<<<<<<<<<<<< * len_key1 = PyString_Size(py_key1) * */ __pyx_t_3 = PyString_Size(((PyObject *)__pyx_v_py_key0)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_key0 = __pyx_t_3; /* "mtbl.pyx":311 * key1 = PyString_AsString(py_key1) * len_key0 = PyString_Size(py_key0) * len_key1 = PyString_Size(py_key1) # <<<<<<<<<<<<<< * * return get_iteritems(self, mtbl_source_get_range( */ __pyx_t_3 = PyString_Size(((PyObject *)__pyx_v_py_key1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_key1 = __pyx_t_3; /* "mtbl.pyx":313 * len_key1 = PyString_Size(py_key1) * * return get_iteritems(self, mtbl_source_get_range( # <<<<<<<<<<<<<< * mtbl_reader_source(self._instance), key0, len_key0, key1, len_key1)) * */ __Pyx_XDECREF(__pyx_r); /* "mtbl.pyx":314 * * return get_iteritems(self, mtbl_source_get_range( * mtbl_reader_source(self._instance), key0, len_key0, key1, len_key1)) # <<<<<<<<<<<<<< * * def get_prefix(self, bytes py_key): */ __pyx_t_1 = __pyx_f_4mtbl_get_iteritems(__pyx_v_self, mtbl_source_get_range(mtbl_reader_source(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->_instance), __pyx_v_key0, __pyx_v_len_key0, __pyx_v_key1, __pyx_v_len_key1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.reader.get_range", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":316 * mtbl_reader_source(self._instance), key0, len_key0, key1, len_key1)) * * def get_prefix(self, bytes py_key): # <<<<<<<<<<<<<< * """ * R.get_prefix(key_prefix) -> an iterator over all (key, value) items in R where key */ static PyObject *__pyx_pf_4mtbl_6reader_10get_prefix(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key); /*proto*/ static char __pyx_doc_4mtbl_6reader_10get_prefix[] = "\n R.get_prefix(key_prefix) -> an iterator over all (key, value) items in R where key\n begins with key_prefix.\n "; static PyObject *__pyx_pf_4mtbl_6reader_10get_prefix(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key) { uint8_t *__pyx_v_key; size_t __pyx_v_len_key; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; char *__pyx_t_2; Py_ssize_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_prefix"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key), (&PyBytes_Type), 1, "py_key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":325 * cdef size_t len_key * * self.check_initialized() # <<<<<<<<<<<<<< * * key = PyString_AsString(py_key) */ __pyx_t_1 = ((struct __pyx_vtabstruct_4mtbl_reader *)((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->__pyx_vtab)->check_initialized(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":327 * self.check_initialized() * * key = PyString_AsString(py_key) # <<<<<<<<<<<<<< * len_key = PyString_Size(py_key) * */ __pyx_t_2 = PyString_AsString(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_key = ((uint8_t *)__pyx_t_2); /* "mtbl.pyx":328 * * key = PyString_AsString(py_key) * len_key = PyString_Size(py_key) # <<<<<<<<<<<<<< * * return get_iteritems(self, mtbl_source_get_prefix( */ __pyx_t_3 = PyString_Size(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_key = __pyx_t_3; /* "mtbl.pyx":330 * len_key = PyString_Size(py_key) * * return get_iteritems(self, mtbl_source_get_prefix( # <<<<<<<<<<<<<< * mtbl_reader_source(self._instance), key, len_key)) * */ __Pyx_XDECREF(__pyx_r); /* "mtbl.pyx":331 * * return get_iteritems(self, mtbl_source_get_prefix( * mtbl_reader_source(self._instance), key, len_key)) # <<<<<<<<<<<<<< * * def __getitem__(self, bytes py_key): */ __pyx_t_1 = __pyx_f_4mtbl_get_iteritems(__pyx_v_self, mtbl_source_get_prefix(mtbl_reader_source(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->_instance), __pyx_v_key, __pyx_v_len_key)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.reader.get_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":333 * mtbl_reader_source(self._instance), key, len_key)) * * def __getitem__(self, bytes py_key): # <<<<<<<<<<<<<< * cdef mtbl_iter *it * cdef mtbl_res res */ static PyObject *__pyx_pf_4mtbl_6reader_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key); /*proto*/ static PyObject *__pyx_pf_4mtbl_6reader_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key) { struct mtbl_iter *__pyx_v_it; mtbl_res __pyx_v_res; uint8_t *__pyx_v_key; uint8_t *__pyx_v_val; size_t __pyx_v_len_key; size_t __pyx_v_len_val; PyObject *__pyx_v_items = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; char *__pyx_t_2; Py_ssize_t __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key), (&PyBytes_Type), 1, "py_key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":341 * cdef size_t len_val * * self.check_initialized() # <<<<<<<<<<<<<< * * key = PyString_AsString(py_key) */ __pyx_t_1 = ((struct __pyx_vtabstruct_4mtbl_reader *)((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->__pyx_vtab)->check_initialized(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":343 * self.check_initialized() * * key = PyString_AsString(py_key) # <<<<<<<<<<<<<< * len_key = PyString_Size(py_key) * */ __pyx_t_2 = PyString_AsString(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_key = ((uint8_t *)__pyx_t_2); /* "mtbl.pyx":344 * * key = PyString_AsString(py_key) * len_key = PyString_Size(py_key) # <<<<<<<<<<<<<< * * items = [] */ __pyx_t_3 = PyString_Size(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_key = __pyx_t_3; /* "mtbl.pyx":346 * len_key = PyString_Size(py_key) * * items = [] # <<<<<<<<<<<<<< * with nogil: * it = mtbl_source_get(mtbl_reader_source(self._instance), key, len_key) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_items = __pyx_t_1; __pyx_t_1 = 0; /* "mtbl.pyx":347 * * items = [] * with nogil: # <<<<<<<<<<<<<< * it = mtbl_source_get(mtbl_reader_source(self._instance), key, len_key) * if it == NULL: */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":348 * items = [] * with nogil: * it = mtbl_source_get(mtbl_reader_source(self._instance), key, len_key) # <<<<<<<<<<<<<< * if it == NULL: * raise KeyError(py_key) */ __pyx_v_it = mtbl_source_get(mtbl_reader_source(((struct __pyx_obj_4mtbl_reader *)__pyx_v_self)->_instance), __pyx_v_key, __pyx_v_len_key); } /* "mtbl.pyx":347 * * items = [] * with nogil: # <<<<<<<<<<<<<< * it = mtbl_source_get(mtbl_reader_source(self._instance), key, len_key) * if it == NULL: */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":349 * with nogil: * it = mtbl_source_get(mtbl_reader_source(self._instance), key, len_key) * if it == NULL: # <<<<<<<<<<<<<< * raise KeyError(py_key) * while True: */ __pyx_t_4 = (__pyx_v_it == NULL); if (__pyx_t_4) { /* "mtbl.pyx":350 * it = mtbl_source_get(mtbl_reader_source(self._instance), key, len_key) * if it == NULL: * raise KeyError(py_key) # <<<<<<<<<<<<<< * while True: * with nogil: */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_py_key)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_py_key)); __Pyx_GIVEREF(((PyObject *)__pyx_v_py_key)); __pyx_t_5 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "mtbl.pyx":351 * if it == NULL: * raise KeyError(py_key) * while True: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_iter_next(it, &key, &len_key, &val, &len_val) */ while (1) { if (!1) break; /* "mtbl.pyx":352 * raise KeyError(py_key) * while True: * with nogil: # <<<<<<<<<<<<<< * res = mtbl_iter_next(it, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":353 * while True: * with nogil: * res = mtbl_iter_next(it, &key, &len_key, &val, &len_val) # <<<<<<<<<<<<<< * if res == mtbl_res_failure: * break */ __pyx_v_res = mtbl_iter_next(__pyx_v_it, (&__pyx_v_key), (&__pyx_v_len_key), (&__pyx_v_val), (&__pyx_v_len_val)); } /* "mtbl.pyx":352 * raise KeyError(py_key) * while True: * with nogil: # <<<<<<<<<<<<<< * res = mtbl_iter_next(it, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":354 * with nogil: * res = mtbl_iter_next(it, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: # <<<<<<<<<<<<<< * break * items.append(PyString_FromStringAndSize( val, len_val)) */ __pyx_t_4 = (__pyx_v_res == mtbl_res_failure); if (__pyx_t_4) { /* "mtbl.pyx":355 * res = mtbl_iter_next(it, &key, &len_key, &val, &len_val) * if res == mtbl_res_failure: * break # <<<<<<<<<<<<<< * items.append(PyString_FromStringAndSize( val, len_val)) * with nogil: */ goto __pyx_L10_break; goto __pyx_L16; } __pyx_L16:; /* "mtbl.pyx":356 * if res == mtbl_res_failure: * break * items.append(PyString_FromStringAndSize( val, len_val)) # <<<<<<<<<<<<<< * with nogil: * mtbl_iter_destroy(&it) */ if (unlikely(((PyObject *)__pyx_v_items) == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = PyString_FromStringAndSize(((char *)__pyx_v_val), __pyx_v_len_val); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyList_Append(__pyx_v_items, __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_L10_break:; /* "mtbl.pyx":357 * break * items.append(PyString_FromStringAndSize( val, len_val)) * with nogil: # <<<<<<<<<<<<<< * mtbl_iter_destroy(&it) * if not items: */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":358 * items.append(PyString_FromStringAndSize( val, len_val)) * with nogil: * mtbl_iter_destroy(&it) # <<<<<<<<<<<<<< * if not items: * raise KeyError(py_key) */ mtbl_iter_destroy((&__pyx_v_it)); } /* "mtbl.pyx":357 * break * items.append(PyString_FromStringAndSize( val, len_val)) * with nogil: # <<<<<<<<<<<<<< * mtbl_iter_destroy(&it) * if not items: */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":359 * with nogil: * mtbl_iter_destroy(&it) * if not items: # <<<<<<<<<<<<<< * raise KeyError(py_key) * return items */ __pyx_t_4 = (((PyObject *)__pyx_v_items) != Py_None) && (PyList_GET_SIZE(((PyObject *)__pyx_v_items)) != 0); __pyx_t_7 = (!__pyx_t_4); if (__pyx_t_7) { /* "mtbl.pyx":360 * mtbl_iter_destroy(&it) * if not items: * raise KeyError(py_key) # <<<<<<<<<<<<<< * return items * */ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_INCREF(((PyObject *)__pyx_v_py_key)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_py_key)); __Pyx_GIVEREF(((PyObject *)__pyx_v_py_key)); __pyx_t_1 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L20; } __pyx_L20:; /* "mtbl.pyx":361 * if not items: * raise KeyError(py_key) * return items # <<<<<<<<<<<<<< * * cdef class writer(object): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_items)); __pyx_r = ((PyObject *)__pyx_v_items); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("mtbl.reader.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_items); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":375 * cdef _lock * * def __cinit__(self): # <<<<<<<<<<<<<< * self._instance = NULL * */ static int __pyx_pf_4mtbl_6writer___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_6writer___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__"); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; /* "mtbl.pyx":376 * * def __cinit__(self): * self._instance = NULL # <<<<<<<<<<<<<< * * def __dealloc__(self): */ ((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_instance = NULL; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":378 * self._instance = NULL * * def __dealloc__(self): # <<<<<<<<<<<<<< * with nogil: * mtbl_writer_destroy(&self._instance) */ static void __pyx_pf_4mtbl_6writer_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_4mtbl_6writer_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__"); /* "mtbl.pyx":379 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_writer_destroy(&self._instance) * */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":380 * def __dealloc__(self): * with nogil: * mtbl_writer_destroy(&self._instance) # <<<<<<<<<<<<<< * * def __init__(self, */ mtbl_writer_destroy((&((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_instance)); } /* "mtbl.pyx":379 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_writer_destroy(&self._instance) * */ /*finally:*/ { Py_BLOCK_THREADS } } __Pyx_RefNannyFinishContext(); } /* "mtbl.pyx":382 * mtbl_writer_destroy(&self._instance) * * def __init__(self, # <<<<<<<<<<<<<< * char * fname, * mtbl_compression_type compression=COMPRESSION_NONE, */ static int __pyx_pf_4mtbl_6writer_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_6writer_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { char *__pyx_v_fname; mtbl_compression_type __pyx_v_compression; size_t __pyx_v_block_size; size_t __pyx_v_block_restart_interval; struct mtbl_writer_options *__pyx_v_opt; int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fname,&__pyx_n_s__compression,&__pyx_n_s__block_size,&__pyx_n_s_4,0}; __Pyx_RefNannySetupContext("__init__"); { PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fname); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__compression); if (value) { values[1] = value; kw_args--; } } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__block_size); if (value) { values[2] = value; kw_args--; } } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_4); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_fname = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} if (values[1]) { __pyx_v_compression = PyInt_AsLong(values[1]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_compression = __pyx_k_5; } if (values[2]) { __pyx_v_block_size = __Pyx_PyInt_AsSize_t(values[2]); if (unlikely((__pyx_v_block_size == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_block_size = ((size_t)8192); } if (values[3]) { __pyx_v_block_restart_interval = __Pyx_PyInt_AsSize_t(values[3]); if (unlikely((__pyx_v_block_restart_interval == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_block_restart_interval = ((size_t)16); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("mtbl.writer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; /* "mtbl.pyx":387 * size_t block_size=8192, * size_t block_restart_interval=16): * if not (compression == COMPRESSION_NONE or # <<<<<<<<<<<<<< * compression == COMPRESSION_SNAPPY or * compression == COMPRESSION_ZLIB or */ __pyx_t_1 = PyInt_FromLong(__pyx_v_compression); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__COMPRESSION_NONE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_4) { /* "mtbl.pyx":388 * size_t block_restart_interval=16): * if not (compression == COMPRESSION_NONE or * compression == COMPRESSION_SNAPPY or # <<<<<<<<<<<<<< * compression == COMPRESSION_ZLIB or * compression == COMPRESSION_LZ4 or */ __pyx_t_3 = PyInt_FromLong(__pyx_v_compression); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__COMPRESSION_SNAPPY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_5) { /* "mtbl.pyx":389 * if not (compression == COMPRESSION_NONE or * compression == COMPRESSION_SNAPPY or * compression == COMPRESSION_ZLIB or # <<<<<<<<<<<<<< * compression == COMPRESSION_LZ4 or * compression == COMPRESSION_LZ4HC): */ __pyx_t_1 = PyInt_FromLong(__pyx_v_compression); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__COMPRESSION_ZLIB); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) { /* "mtbl.pyx":390 * compression == COMPRESSION_SNAPPY or * compression == COMPRESSION_ZLIB or * compression == COMPRESSION_LZ4 or # <<<<<<<<<<<<<< * compression == COMPRESSION_LZ4HC): * raise UnknownCompressionTypeException */ __pyx_t_3 = PyInt_FromLong(__pyx_v_compression); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__COMPRESSION_LZ4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_7) { /* "mtbl.pyx":391 * compression == COMPRESSION_ZLIB or * compression == COMPRESSION_LZ4 or * compression == COMPRESSION_LZ4HC): # <<<<<<<<<<<<<< * raise UnknownCompressionTypeException * */ __pyx_t_1 = PyInt_FromLong(__pyx_v_compression); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__COMPRESSION_LZ4HC); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = __pyx_t_8; } else { __pyx_t_9 = __pyx_t_7; } __pyx_t_7 = __pyx_t_9; } else { __pyx_t_7 = __pyx_t_6; } __pyx_t_6 = __pyx_t_7; } else { __pyx_t_6 = __pyx_t_5; } __pyx_t_5 = __pyx_t_6; } else { __pyx_t_5 = __pyx_t_4; } __pyx_t_4 = (!__pyx_t_5); if (__pyx_t_4) { /* "mtbl.pyx":392 * compression == COMPRESSION_LZ4 or * compression == COMPRESSION_LZ4HC): * raise UnknownCompressionTypeException # <<<<<<<<<<<<<< * * self._lock = threading.Semaphore() */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "mtbl.pyx":394 * raise UnknownCompressionTypeException * * self._lock = threading.Semaphore() # <<<<<<<<<<<<<< * * cdef mtbl_writer_options *opt */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__threading); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__Semaphore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_lock); __Pyx_DECREF(((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_lock); ((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_lock = __pyx_t_3; __pyx_t_3 = 0; /* "mtbl.pyx":397 * * cdef mtbl_writer_options *opt * with nogil: # <<<<<<<<<<<<<< * opt = mtbl_writer_options_init() * mtbl_writer_options_set_compression(opt, compression) */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":398 * cdef mtbl_writer_options *opt * with nogil: * opt = mtbl_writer_options_init() # <<<<<<<<<<<<<< * mtbl_writer_options_set_compression(opt, compression) * mtbl_writer_options_set_block_size(opt, block_size) */ __pyx_v_opt = mtbl_writer_options_init(); /* "mtbl.pyx":399 * with nogil: * opt = mtbl_writer_options_init() * mtbl_writer_options_set_compression(opt, compression) # <<<<<<<<<<<<<< * mtbl_writer_options_set_block_size(opt, block_size) * mtbl_writer_options_set_block_restart_interval(opt, block_restart_interval) */ mtbl_writer_options_set_compression(__pyx_v_opt, __pyx_v_compression); /* "mtbl.pyx":400 * opt = mtbl_writer_options_init() * mtbl_writer_options_set_compression(opt, compression) * mtbl_writer_options_set_block_size(opt, block_size) # <<<<<<<<<<<<<< * mtbl_writer_options_set_block_restart_interval(opt, block_restart_interval) * self._instance = mtbl_writer_init(fname, opt) */ mtbl_writer_options_set_block_size(__pyx_v_opt, __pyx_v_block_size); /* "mtbl.pyx":401 * mtbl_writer_options_set_compression(opt, compression) * mtbl_writer_options_set_block_size(opt, block_size) * mtbl_writer_options_set_block_restart_interval(opt, block_restart_interval) # <<<<<<<<<<<<<< * self._instance = mtbl_writer_init(fname, opt) * mtbl_writer_options_destroy(&opt) */ mtbl_writer_options_set_block_restart_interval(__pyx_v_opt, __pyx_v_block_restart_interval); /* "mtbl.pyx":402 * mtbl_writer_options_set_block_size(opt, block_size) * mtbl_writer_options_set_block_restart_interval(opt, block_restart_interval) * self._instance = mtbl_writer_init(fname, opt) # <<<<<<<<<<<<<< * mtbl_writer_options_destroy(&opt) * if self._instance == NULL: */ ((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_instance = mtbl_writer_init(__pyx_v_fname, __pyx_v_opt); /* "mtbl.pyx":403 * mtbl_writer_options_set_block_restart_interval(opt, block_restart_interval) * self._instance = mtbl_writer_init(fname, opt) * mtbl_writer_options_destroy(&opt) # <<<<<<<<<<<<<< * if self._instance == NULL: * raise IOError("unable to initialize file: '%s'" % fname) */ mtbl_writer_options_destroy((&__pyx_v_opt)); } /* "mtbl.pyx":397 * * cdef mtbl_writer_options *opt * with nogil: # <<<<<<<<<<<<<< * opt = mtbl_writer_options_init() * mtbl_writer_options_set_compression(opt, compression) */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":404 * self._instance = mtbl_writer_init(fname, opt) * mtbl_writer_options_destroy(&opt) * if self._instance == NULL: # <<<<<<<<<<<<<< * raise IOError("unable to initialize file: '%s'" % fname) * */ __pyx_t_4 = (((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_instance == NULL); if (__pyx_t_4) { /* "mtbl.pyx":405 * mtbl_writer_options_destroy(&opt) * if self._instance == NULL: * raise IOError("unable to initialize file: '%s'" % fname) # <<<<<<<<<<<<<< * * def close(self): */ __pyx_t_3 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("mtbl.writer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":407 * raise IOError("unable to initialize file: '%s'" % fname) * * def close(self): # <<<<<<<<<<<<<< * """W.close() -- finalize and close the writer""" * with self._lock: */ static PyObject *__pyx_pf_4mtbl_6writer_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_6writer_3close[] = "W.close() -- finalize and close the writer"; static PyObject *__pyx_pf_4mtbl_6writer_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; int __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("close"); /* "mtbl.pyx":409 * def close(self): * """W.close() -- finalize and close the writer""" * with self._lock: # <<<<<<<<<<<<<< * with nogil: * mtbl_writer_destroy(&self._instance) */ /*with:*/ { __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_lock, __pyx_n_s____exit__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_lock, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); /*try:*/ { /* "mtbl.pyx":410 * """W.close() -- finalize and close the writer""" * with self._lock: * with nogil: # <<<<<<<<<<<<<< * mtbl_writer_destroy(&self._instance) * */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":411 * with self._lock: * with nogil: * mtbl_writer_destroy(&self._instance) # <<<<<<<<<<<<<< * * def __setitem__(self, bytes py_key, bytes py_val): */ mtbl_writer_destroy((&((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_instance)); } /* "mtbl.pyx":410 * """W.close() -- finalize and close the writer""" * with self._lock: * with nogil: # <<<<<<<<<<<<<< * mtbl_writer_destroy(&self._instance) * */ /*finally:*/ { Py_BLOCK_THREADS } } } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L16_try_end; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; /* "mtbl.pyx":409 * def close(self): * """W.close() -- finalize and close the writer""" * with self._lock: # <<<<<<<<<<<<<< * with nogil: * mtbl_writer_destroy(&self._instance) */ /*except:*/ { __Pyx_AddTraceback("mtbl.writer.close", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_INCREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_10 = PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __pyx_t_11 = (!__pyx_t_9); if (__pyx_t_11) { __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_7); __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_7); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_7 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} goto __pyx_L24; } __pyx_L24:; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L10_exception_handled; } __pyx_L11_except_error:; __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); goto __pyx_L1_error; __pyx_L10_exception_handled:; __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); __pyx_L16_try_end:; } } /*finally:*/ { if (__pyx_t_1) { __pyx_t_6 = PyObject_Call(__pyx_t_1, __pyx_k_tuple_8, NULL); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } goto __pyx_L25; __pyx_L5_error:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L1_error; __pyx_L25:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("mtbl.writer.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":413 * mtbl_writer_destroy(&self._instance) * * def __setitem__(self, bytes py_key, bytes py_val): # <<<<<<<<<<<<<< * """ * W.__setitem__(key, value) <==> W[key] = value */ static int __pyx_pf_4mtbl_6writer_4__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key, PyObject *__pyx_v_py_val); /*proto*/ static char __pyx_doc_4mtbl_6writer_4__setitem__[] = "\n W.__setitem__(key, value) <==> W[key] = value\n\n Adds a new (key, value) entry to the writer. key and value must be byte\n strings, and key must be lexicographically greater than any previously\n written key.\n "; struct wrapperbase __pyx_wrapperbase_4mtbl_6writer_4__setitem__; static int __pyx_pf_4mtbl_6writer_4__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key, PyObject *__pyx_v_py_val) { mtbl_res __pyx_v_res; uint8_t *__pyx_v_key; uint8_t *__pyx_v_val; size_t __pyx_v_len_key; size_t __pyx_v_len_val; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; char *__pyx_t_3; Py_ssize_t __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key), (&PyBytes_Type), 1, "py_key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_val), (&PyBytes_Type), 1, "py_val", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":427 * cdef size_t len_val * * if self._instance == NULL: # <<<<<<<<<<<<<< * raise TableClosedException * */ __pyx_t_1 = (((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_instance == NULL); if (__pyx_t_1) { /* "mtbl.pyx":428 * * if self._instance == NULL: * raise TableClosedException # <<<<<<<<<<<<<< * * key = PyString_AsString(py_key) */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "mtbl.pyx":430 * raise TableClosedException * * key = PyString_AsString(py_key) # <<<<<<<<<<<<<< * val = PyString_AsString(py_val) * len_key = PyString_Size(py_key) */ __pyx_t_3 = PyString_AsString(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_key = ((uint8_t *)__pyx_t_3); /* "mtbl.pyx":431 * * key = PyString_AsString(py_key) * val = PyString_AsString(py_val) # <<<<<<<<<<<<<< * len_key = PyString_Size(py_key) * len_val = PyString_Size(py_val) */ __pyx_t_3 = PyString_AsString(((PyObject *)__pyx_v_py_val)); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_val = ((uint8_t *)__pyx_t_3); /* "mtbl.pyx":432 * key = PyString_AsString(py_key) * val = PyString_AsString(py_val) * len_key = PyString_Size(py_key) # <<<<<<<<<<<<<< * len_val = PyString_Size(py_val) * */ __pyx_t_4 = PyString_Size(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_key = __pyx_t_4; /* "mtbl.pyx":433 * val = PyString_AsString(py_val) * len_key = PyString_Size(py_key) * len_val = PyString_Size(py_val) # <<<<<<<<<<<<<< * * with self._lock: */ __pyx_t_4 = PyString_Size(((PyObject *)__pyx_v_py_val)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_val = __pyx_t_4; /* "mtbl.pyx":435 * len_val = PyString_Size(py_val) * * with self._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_writer_add(self._instance, key, len_key, val, len_val) */ /*with:*/ { __pyx_t_5 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_lock, __pyx_n_s____exit__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_lock, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { /* "mtbl.pyx":436 * * with self._lock: * with nogil: # <<<<<<<<<<<<<< * res = mtbl_writer_add(self._instance, key, len_key, val, len_val) * */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":437 * with self._lock: * with nogil: * res = mtbl_writer_add(self._instance, key, len_key, val, len_val) # <<<<<<<<<<<<<< * * if res == mtbl_res_failure: */ __pyx_v_res = mtbl_writer_add(((struct __pyx_obj_4mtbl_writer *)__pyx_v_self)->_instance, __pyx_v_key, __pyx_v_len_key, __pyx_v_val, __pyx_v_len_val); } /* "mtbl.pyx":436 * * with self._lock: * with nogil: # <<<<<<<<<<<<<< * res = mtbl_writer_add(self._instance, key, len_key, val, len_val) * */ /*finally:*/ { Py_BLOCK_THREADS } } } __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L17_try_end; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; /* "mtbl.pyx":435 * len_val = PyString_Size(py_val) * * with self._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_writer_add(self._instance, key, len_key, val, len_val) */ /*except:*/ { __Pyx_AddTraceback("mtbl.writer.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_11)); __Pyx_INCREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_12 = PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} __pyx_t_13 = (!__pyx_t_1); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_10); __Pyx_ErrRestore(__pyx_t_6, __pyx_t_2, __pyx_t_10); __pyx_t_6 = 0; __pyx_t_2 = 0; __pyx_t_10 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} goto __pyx_L25; } __pyx_L25:; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L11_exception_handled; } __pyx_L12_except_error:; __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); goto __pyx_L1_error; __pyx_L11_exception_handled:; __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); __pyx_L17_try_end:; } } /*finally:*/ { if (__pyx_t_5) { __pyx_t_9 = PyObject_Call(__pyx_t_5, __pyx_k_tuple_10, NULL); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } goto __pyx_L26; __pyx_L6_error:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L1_error; __pyx_L26:; } /* "mtbl.pyx":439 * res = mtbl_writer_add(self._instance, key, len_key, val, len_val) * * if res == mtbl_res_failure: # <<<<<<<<<<<<<< * raise KeyOrderError * */ __pyx_t_13 = (__pyx_v_res == mtbl_res_failure); if (__pyx_t_13) { /* "mtbl.pyx":440 * * if res == mtbl_res_failure: * raise KeyOrderError # <<<<<<<<<<<<<< * * def __delitem__(self, key): */ __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__KeyOrderError); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L27; } __pyx_L27:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("mtbl.writer.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":442 * raise KeyOrderError * * def __delitem__(self, key): # <<<<<<<<<<<<<< * """will raise ImmutableError""" * raise ImmutableError */ static int __pyx_pf_4mtbl_6writer_5__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ static char __pyx_doc_4mtbl_6writer_5__delitem__[] = "will raise ImmutableError"; struct wrapperbase __pyx_wrapperbase_4mtbl_6writer_5__delitem__; static int __pyx_pf_4mtbl_6writer_5__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__delitem__"); /* "mtbl.pyx":444 * def __delitem__(self, key): * """will raise ImmutableError""" * raise ImmutableError # <<<<<<<<<<<<<< * * cdef void merge_func_wrapper(void *clos, */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ImmutableError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.writer.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":446 * raise ImmutableError * * cdef void merge_func_wrapper(void *clos, # <<<<<<<<<<<<<< * uint8_t *key, size_t len_key, * uint8_t *val0, size_t len_val0, */ static void __pyx_f_4mtbl_merge_func_wrapper(void *__pyx_v_clos, uint8_t *__pyx_v_key, size_t __pyx_v_len_key, uint8_t *__pyx_v_val0, size_t __pyx_v_len_val0, uint8_t *__pyx_v_val1, size_t __pyx_v_len_val1, uint8_t **__pyx_v_merged_val, size_t *__pyx_v_len_merged_val) { PyObject *__pyx_v_py_key = 0; PyObject *__pyx_v_py_val0 = 0; PyObject *__pyx_v_py_val1 = 0; PyObject *__pyx_v_py_merged_val = 0; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; Py_ssize_t __pyx_t_3; char *__pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("merge_func_wrapper"); /* "mtbl.pyx":455 * cdef str py_val1 * cdef str py_merged_val * py_key = PyString_FromStringAndSize( key, len_key) # <<<<<<<<<<<<<< * py_val0 = PyString_FromStringAndSize( val0, len_val0) * py_val1 = PyString_FromStringAndSize( val1, len_val1) */ __pyx_t_1 = PyString_FromStringAndSize(((char *)__pyx_v_key), __pyx_v_len_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_py_key = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":456 * cdef str py_merged_val * py_key = PyString_FromStringAndSize( key, len_key) * py_val0 = PyString_FromStringAndSize( val0, len_val0) # <<<<<<<<<<<<<< * py_val1 = PyString_FromStringAndSize( val1, len_val1) * py_merged_val = ( clos)(py_key, py_val0, py_val1) */ __pyx_t_1 = PyString_FromStringAndSize(((char *)__pyx_v_val0), __pyx_v_len_val0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_py_val0 = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":457 * py_key = PyString_FromStringAndSize( key, len_key) * py_val0 = PyString_FromStringAndSize( val0, len_val0) * py_val1 = PyString_FromStringAndSize( val1, len_val1) # <<<<<<<<<<<<<< * py_merged_val = ( clos)(py_key, py_val0, py_val1) * len_merged_val[0] = PyString_Size(py_merged_val) */ __pyx_t_1 = PyString_FromStringAndSize(((char *)__pyx_v_val1), __pyx_v_len_val1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_py_val1 = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":458 * py_val0 = PyString_FromStringAndSize( val0, len_val0) * py_val1 = PyString_FromStringAndSize( val1, len_val1) * py_merged_val = ( clos)(py_key, py_val0, py_val1) # <<<<<<<<<<<<<< * len_merged_val[0] = PyString_Size(py_merged_val) * merged_val[0] = malloc(len_merged_val[0]) */ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_py_key)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_py_key)); __Pyx_GIVEREF(((PyObject *)__pyx_v_py_key)); __Pyx_INCREF(((PyObject *)__pyx_v_py_val0)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_py_val0)); __Pyx_GIVEREF(((PyObject *)__pyx_v_py_val0)); __Pyx_INCREF(((PyObject *)__pyx_v_py_val1)); PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_py_val1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_py_val1)); __pyx_t_2 = PyObject_Call(((PyObject *)__pyx_v_clos), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_py_merged_val = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; /* "mtbl.pyx":459 * py_val1 = PyString_FromStringAndSize( val1, len_val1) * py_merged_val = ( clos)(py_key, py_val0, py_val1) * len_merged_val[0] = PyString_Size(py_merged_val) # <<<<<<<<<<<<<< * merged_val[0] = malloc(len_merged_val[0]) * memcpy(merged_val[0], PyString_AsString(py_merged_val), len_merged_val[0]) */ __pyx_t_3 = PyString_Size(((PyObject *)__pyx_v_py_merged_val)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} (__pyx_v_len_merged_val[0]) = ((size_t)__pyx_t_3); /* "mtbl.pyx":460 * py_merged_val = ( clos)(py_key, py_val0, py_val1) * len_merged_val[0] = PyString_Size(py_merged_val) * merged_val[0] = malloc(len_merged_val[0]) # <<<<<<<<<<<<<< * memcpy(merged_val[0], PyString_AsString(py_merged_val), len_merged_val[0]) * */ (__pyx_v_merged_val[0]) = ((uint8_t *)malloc((__pyx_v_len_merged_val[0]))); /* "mtbl.pyx":461 * len_merged_val[0] = PyString_Size(py_merged_val) * merged_val[0] = malloc(len_merged_val[0]) * memcpy(merged_val[0], PyString_AsString(py_merged_val), len_merged_val[0]) # <<<<<<<<<<<<<< * * cdef class merger(object): */ __pyx_t_4 = PyString_AsString(((PyObject *)__pyx_v_py_merged_val)); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} memcpy((__pyx_v_merged_val[0]), __pyx_t_4, (__pyx_v_len_merged_val[0])); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("mtbl.merge_func_wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_py_key); __Pyx_XDECREF(__pyx_v_py_val0); __Pyx_XDECREF(__pyx_v_py_val1); __Pyx_XDECREF(__pyx_v_py_merged_val); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif } /* "mtbl.pyx":478 * cdef object merge_func * * def __cinit__(self): # <<<<<<<<<<<<<< * self._instance = NULL * */ static int __pyx_pf_4mtbl_6merger___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_6merger___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__"); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; /* "mtbl.pyx":479 * * def __cinit__(self): * self._instance = NULL # <<<<<<<<<<<<<< * * def __dealloc__(self): */ ((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_instance = NULL; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":481 * self._instance = NULL * * def __dealloc__(self): # <<<<<<<<<<<<<< * with nogil: * mtbl_merger_destroy(&self._instance) */ static void __pyx_pf_4mtbl_6merger_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_4mtbl_6merger_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__"); /* "mtbl.pyx":482 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_merger_destroy(&self._instance) * */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":483 * def __dealloc__(self): * with nogil: * mtbl_merger_destroy(&self._instance) # <<<<<<<<<<<<<< * * def __init__(self, object merge_func): */ mtbl_merger_destroy((&((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_instance)); } /* "mtbl.pyx":482 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_merger_destroy(&self._instance) * */ /*finally:*/ { Py_BLOCK_THREADS } } __Pyx_RefNannyFinishContext(); } /* "mtbl.pyx":485 * mtbl_merger_destroy(&self._instance) * * def __init__(self, object merge_func): # <<<<<<<<<<<<<< * cdef mtbl_merger_options *opt * self.merge_func = merge_func */ static int __pyx_pf_4mtbl_6merger_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_6merger_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_merge_func = 0; struct mtbl_merger_options *__pyx_v_opt; int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__merge_func,0}; __Pyx_RefNannySetupContext("__init__"); { PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__merge_func); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_merge_func = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("mtbl.merger.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; /* "mtbl.pyx":487 * def __init__(self, object merge_func): * cdef mtbl_merger_options *opt * self.merge_func = merge_func # <<<<<<<<<<<<<< * opt = mtbl_merger_options_init() * mtbl_merger_options_set_merge_func(opt, */ __Pyx_INCREF(__pyx_v_merge_func); __Pyx_GIVEREF(__pyx_v_merge_func); __Pyx_GOTREF(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->merge_func); __Pyx_DECREF(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->merge_func); ((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->merge_func = __pyx_v_merge_func; /* "mtbl.pyx":488 * cdef mtbl_merger_options *opt * self.merge_func = merge_func * opt = mtbl_merger_options_init() # <<<<<<<<<<<<<< * mtbl_merger_options_set_merge_func(opt, * merge_func_wrapper, */ __pyx_v_opt = mtbl_merger_options_init(); /* "mtbl.pyx":491 * mtbl_merger_options_set_merge_func(opt, * merge_func_wrapper, * merge_func) # <<<<<<<<<<<<<< * self._instance = mtbl_merger_init(opt) * mtbl_merger_options_destroy(&opt) */ mtbl_merger_options_set_merge_func(__pyx_v_opt, ((mtbl_merge_func)__pyx_f_4mtbl_merge_func_wrapper), ((void *)__pyx_v_merge_func)); /* "mtbl.pyx":492 * merge_func_wrapper, * merge_func) * self._instance = mtbl_merger_init(opt) # <<<<<<<<<<<<<< * mtbl_merger_options_destroy(&opt) * self._references = set() */ ((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_instance = mtbl_merger_init(__pyx_v_opt); /* "mtbl.pyx":493 * merge_func) * self._instance = mtbl_merger_init(opt) * mtbl_merger_options_destroy(&opt) # <<<<<<<<<<<<<< * self._references = set() * self._lock = threading.Semaphore() */ mtbl_merger_options_destroy((&__pyx_v_opt)); /* "mtbl.pyx":494 * self._instance = mtbl_merger_init(opt) * mtbl_merger_options_destroy(&opt) * self._references = set() # <<<<<<<<<<<<<< * self._lock = threading.Semaphore() * */ __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __Pyx_GOTREF(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_references); __Pyx_DECREF(((PyObject *)((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_references)); ((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_references = __pyx_t_1; __pyx_t_1 = 0; /* "mtbl.pyx":495 * mtbl_merger_options_destroy(&opt) * self._references = set() * self._lock = threading.Semaphore() # <<<<<<<<<<<<<< * * def add_reader(self, reader r): */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__threading); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__Semaphore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_lock); __Pyx_DECREF(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_lock); ((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_lock = __pyx_t_1; __pyx_t_1 = 0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.merger.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":497 * self._lock = threading.Semaphore() * * def add_reader(self, reader r): # <<<<<<<<<<<<<< * """M.add_reader(mtbl.reader) -- add a reader object as a merge input""" * with self._lock: */ static PyObject *__pyx_pf_4mtbl_6merger_3add_reader(PyObject *__pyx_v_self, PyObject *__pyx_v_r); /*proto*/ static char __pyx_doc_4mtbl_6merger_3add_reader[] = "M.add_reader(mtbl.reader) -- add a reader object as a merge input"; static PyObject *__pyx_pf_4mtbl_6merger_3add_reader(PyObject *__pyx_v_self, PyObject *__pyx_v_r) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; int __pyx_t_11; int __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("add_reader"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_r), __pyx_ptype_4mtbl_reader, 1, "r", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":499 * def add_reader(self, reader r): * """M.add_reader(mtbl.reader) -- add a reader object as a merge input""" * with self._lock: # <<<<<<<<<<<<<< * with nogil: * mtbl_merger_add_source(self._instance, mtbl_reader_source(r._instance)) */ /*with:*/ { __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_lock, __pyx_n_s____exit__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_lock, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); /*try:*/ { /* "mtbl.pyx":500 * """M.add_reader(mtbl.reader) -- add a reader object as a merge input""" * with self._lock: * with nogil: # <<<<<<<<<<<<<< * mtbl_merger_add_source(self._instance, mtbl_reader_source(r._instance)) * self._references.add(r) */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":501 * with self._lock: * with nogil: * mtbl_merger_add_source(self._instance, mtbl_reader_source(r._instance)) # <<<<<<<<<<<<<< * self._references.add(r) * */ mtbl_merger_add_source(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_instance, mtbl_reader_source(((struct __pyx_obj_4mtbl_reader *)__pyx_v_r)->_instance)); } /* "mtbl.pyx":500 * """M.add_reader(mtbl.reader) -- add a reader object as a merge input""" * with self._lock: * with nogil: # <<<<<<<<<<<<<< * mtbl_merger_add_source(self._instance, mtbl_reader_source(r._instance)) * self._references.add(r) */ /*finally:*/ { Py_BLOCK_THREADS } } } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L16_try_end; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; /* "mtbl.pyx":499 * def add_reader(self, reader r): * """M.add_reader(mtbl.reader) -- add a reader object as a merge input""" * with self._lock: # <<<<<<<<<<<<<< * with nogil: * mtbl_merger_add_source(self._instance, mtbl_reader_source(r._instance)) */ /*except:*/ { __Pyx_AddTraceback("mtbl.merger.add_reader", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_INCREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_10 = PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __pyx_t_11 = (!__pyx_t_9); if (__pyx_t_11) { __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_7); __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_7); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_7 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} goto __pyx_L24; } __pyx_L24:; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L10_exception_handled; } __pyx_L11_except_error:; __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); goto __pyx_L1_error; __pyx_L10_exception_handled:; __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); __pyx_L16_try_end:; } } /*finally:*/ { if (__pyx_t_1) { __pyx_t_6 = PyObject_Call(__pyx_t_1, __pyx_k_tuple_11, NULL); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } goto __pyx_L25; __pyx_L5_error:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L1_error; __pyx_L25:; } /* "mtbl.pyx":502 * with nogil: * mtbl_merger_add_source(self._instance, mtbl_reader_source(r._instance)) * self._references.add(r) # <<<<<<<<<<<<<< * * def write(self, writer w): */ if (unlikely(((PyObject *)((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_references) == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = PySet_Add(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_references, __pyx_v_r); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("mtbl.merger.add_reader", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":504 * self._references.add(r) * * def write(self, writer w): # <<<<<<<<<<<<<< * """M.write(mtbl.writer) -- dump merged output to writer""" * cdef mtbl_res res */ static PyObject *__pyx_pf_4mtbl_6merger_4write(PyObject *__pyx_v_self, PyObject *__pyx_v_w); /*proto*/ static char __pyx_doc_4mtbl_6merger_4write[] = "M.write(mtbl.writer) -- dump merged output to writer"; static PyObject *__pyx_pf_4mtbl_6merger_4write(PyObject *__pyx_v_self, PyObject *__pyx_v_w) { mtbl_res __pyx_v_res; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; int __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_4mtbl_writer, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":508 * cdef mtbl_res res * * with w._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_source_write(mtbl_merger_source(self._instance), w._instance) */ /*with:*/ { __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_writer *)__pyx_v_w)->_lock, __pyx_n_s____exit__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_writer *)__pyx_v_w)->_lock, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); /*try:*/ { /* "mtbl.pyx":509 * * with w._lock: * with nogil: # <<<<<<<<<<<<<< * res = mtbl_source_write(mtbl_merger_source(self._instance), w._instance) * if res != mtbl_res_success: */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":510 * with w._lock: * with nogil: * res = mtbl_source_write(mtbl_merger_source(self._instance), w._instance) # <<<<<<<<<<<<<< * if res != mtbl_res_success: * raise RuntimeError */ __pyx_v_res = mtbl_source_write(mtbl_merger_source(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_instance), ((struct __pyx_obj_4mtbl_writer *)__pyx_v_w)->_instance); } /* "mtbl.pyx":509 * * with w._lock: * with nogil: # <<<<<<<<<<<<<< * res = mtbl_source_write(mtbl_merger_source(self._instance), w._instance) * if res != mtbl_res_success: */ /*finally:*/ { Py_BLOCK_THREADS } } } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L16_try_end; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; /* "mtbl.pyx":508 * cdef mtbl_res res * * with w._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_source_write(mtbl_merger_source(self._instance), w._instance) */ /*except:*/ { __Pyx_AddTraceback("mtbl.merger.write", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_INCREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_10 = PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __pyx_t_11 = (!__pyx_t_9); if (__pyx_t_11) { __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_7); __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_7); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_7 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} goto __pyx_L24; } __pyx_L24:; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L10_exception_handled; } __pyx_L11_except_error:; __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); goto __pyx_L1_error; __pyx_L10_exception_handled:; __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); __pyx_L16_try_end:; } } /*finally:*/ { if (__pyx_t_1) { __pyx_t_6 = PyObject_Call(__pyx_t_1, __pyx_k_tuple_12, NULL); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } goto __pyx_L25; __pyx_L5_error:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L1_error; __pyx_L25:; } /* "mtbl.pyx":511 * with nogil: * res = mtbl_source_write(mtbl_merger_source(self._instance), w._instance) * if res != mtbl_res_success: # <<<<<<<<<<<<<< * raise RuntimeError * */ __pyx_t_11 = (__pyx_v_res != mtbl_res_success); if (__pyx_t_11) { /* "mtbl.pyx":512 * res = mtbl_source_write(mtbl_merger_source(self._instance), w._instance) * if res != mtbl_res_success: * raise RuntimeError # <<<<<<<<<<<<<< * * def __iter__(self): */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L26; } __pyx_L26:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("mtbl.merger.write", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":514 * raise RuntimeError * * def __iter__(self): # <<<<<<<<<<<<<< * return self.iterkeys() * */ static PyObject *__pyx_pf_4mtbl_6merger_5__iter__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_4mtbl_6merger_5__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__"); /* "mtbl.pyx":515 * * def __iter__(self): * return self.iterkeys() # <<<<<<<<<<<<<< * * def iterkeys(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__iterkeys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.merger.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":517 * return self.iterkeys() * * def iterkeys(self): # <<<<<<<<<<<<<< * """M.iterkeys() -> an iterator over the merged keys of M.""" * return get_iterkeys(self, mtbl_source_iter(mtbl_merger_source(self._instance))) */ static PyObject *__pyx_pf_4mtbl_6merger_6iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_6merger_6iterkeys[] = "M.iterkeys() -> an iterator over the merged keys of M."; static PyObject *__pyx_pf_4mtbl_6merger_6iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("iterkeys"); /* "mtbl.pyx":519 * def iterkeys(self): * """M.iterkeys() -> an iterator over the merged keys of M.""" * return get_iterkeys(self, mtbl_source_iter(mtbl_merger_source(self._instance))) # <<<<<<<<<<<<<< * * def itervalues(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_4mtbl_get_iterkeys(__pyx_v_self, mtbl_source_iter(mtbl_merger_source(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_instance))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.merger.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":521 * return get_iterkeys(self, mtbl_source_iter(mtbl_merger_source(self._instance))) * * def itervalues(self): # <<<<<<<<<<<<<< * """M.itervalues() -> an iterator over the merged values of M.""" * return get_itervalues(self, mtbl_source_iter(mtbl_merger_source(self._instance))) */ static PyObject *__pyx_pf_4mtbl_6merger_7itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_6merger_7itervalues[] = "M.itervalues() -> an iterator over the merged values of M."; static PyObject *__pyx_pf_4mtbl_6merger_7itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("itervalues"); /* "mtbl.pyx":523 * def itervalues(self): * """M.itervalues() -> an iterator over the merged values of M.""" * return get_itervalues(self, mtbl_source_iter(mtbl_merger_source(self._instance))) # <<<<<<<<<<<<<< * * def iteritems(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_4mtbl_get_itervalues(__pyx_v_self, mtbl_source_iter(mtbl_merger_source(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_instance))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.merger.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":525 * return get_itervalues(self, mtbl_source_iter(mtbl_merger_source(self._instance))) * * def iteritems(self): # <<<<<<<<<<<<<< * """M.iteritems() -> an iterator over the merged (key, value) items of M.""" * return get_iteritems(self, mtbl_source_iter(mtbl_merger_source(self._instance))) */ static PyObject *__pyx_pf_4mtbl_6merger_8iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_6merger_8iteritems[] = "M.iteritems() -> an iterator over the merged (key, value) items of M."; static PyObject *__pyx_pf_4mtbl_6merger_8iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("iteritems"); /* "mtbl.pyx":527 * def iteritems(self): * """M.iteritems() -> an iterator over the merged (key, value) items of M.""" * return get_iteritems(self, mtbl_source_iter(mtbl_merger_source(self._instance))) # <<<<<<<<<<<<<< * * def get(self, bytes py_key): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_4mtbl_get_iteritems(__pyx_v_self, mtbl_source_iter(mtbl_merger_source(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_instance))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.merger.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":529 * return get_iteritems(self, mtbl_source_iter(mtbl_merger_source(self._instance))) * * def get(self, bytes py_key): # <<<<<<<<<<<<<< * """ * M.get(key) -> an iterator over all (key, value) items in M which match key. */ static PyObject *__pyx_pf_4mtbl_6merger_9get(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key); /*proto*/ static char __pyx_doc_4mtbl_6merger_9get[] = "\n M.get(key) -> an iterator over all (key, value) items in M which match key.\n "; static PyObject *__pyx_pf_4mtbl_6merger_9get(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key) { uint8_t *__pyx_v_key; size_t __pyx_v_len_key; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key), (&PyBytes_Type), 1, "py_key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":537 * cdef size_t len_key * * key = PyString_AsString(py_key) # <<<<<<<<<<<<<< * len_key = PyString_Size(py_key) * */ __pyx_t_1 = PyString_AsString(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_key = ((uint8_t *)__pyx_t_1); /* "mtbl.pyx":538 * * key = PyString_AsString(py_key) * len_key = PyString_Size(py_key) # <<<<<<<<<<<<<< * * return get_iteritems(self, */ __pyx_t_2 = PyString_Size(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_key = __pyx_t_2; /* "mtbl.pyx":540 * len_key = PyString_Size(py_key) * * return get_iteritems(self, # <<<<<<<<<<<<<< * mtbl_source_get(mtbl_merger_source(self._instance), key, len_key)) * */ __Pyx_XDECREF(__pyx_r); /* "mtbl.pyx":541 * * return get_iteritems(self, * mtbl_source_get(mtbl_merger_source(self._instance), key, len_key)) # <<<<<<<<<<<<<< * * def get_range(self, bytes py_key0, bytes py_key1): */ __pyx_t_3 = __pyx_f_4mtbl_get_iteritems(__pyx_v_self, mtbl_source_get(mtbl_merger_source(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_instance), __pyx_v_key, __pyx_v_len_key)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("mtbl.merger.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":543 * mtbl_source_get(mtbl_merger_source(self._instance), key, len_key)) * * def get_range(self, bytes py_key0, bytes py_key1): # <<<<<<<<<<<<<< * """ * M.get_range(key0, key1) -> an iterator over all (key, value) items in M where key is */ static PyObject *__pyx_pf_4mtbl_6merger_10get_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4mtbl_6merger_10get_range[] = "\n M.get_range(key0, key1) -> an iterator over all (key, value) items in M where key is\n between key0 and key1 inclusive.\n "; static PyObject *__pyx_pf_4mtbl_6merger_10get_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_py_key0 = 0; PyObject *__pyx_v_py_key1 = 0; uint8_t *__pyx_v_key0; uint8_t *__pyx_v_key1; size_t __pyx_v_len_key0; size_t __pyx_v_len_key1; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__py_key0,&__pyx_n_s__py_key1,0}; __Pyx_RefNannySetupContext("get_range"); { PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__py_key0); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__py_key1); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_range", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_range") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_py_key0 = ((PyObject*)values[0]); __pyx_v_py_key1 = ((PyObject*)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_range", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("mtbl.merger.get_range", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key0), (&PyBytes_Type), 1, "py_key0", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key1), (&PyBytes_Type), 1, "py_key1", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":554 * cdef size_t len_key1 * * key0 = PyString_AsString(py_key0) # <<<<<<<<<<<<<< * key1 = PyString_AsString(py_key1) * len_key0 = PyString_Size(py_key0) */ __pyx_t_1 = PyString_AsString(((PyObject *)__pyx_v_py_key0)); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_key0 = ((uint8_t *)__pyx_t_1); /* "mtbl.pyx":555 * * key0 = PyString_AsString(py_key0) * key1 = PyString_AsString(py_key1) # <<<<<<<<<<<<<< * len_key0 = PyString_Size(py_key0) * len_key1 = PyString_Size(py_key1) */ __pyx_t_1 = PyString_AsString(((PyObject *)__pyx_v_py_key1)); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_key1 = ((uint8_t *)__pyx_t_1); /* "mtbl.pyx":556 * key0 = PyString_AsString(py_key0) * key1 = PyString_AsString(py_key1) * len_key0 = PyString_Size(py_key0) # <<<<<<<<<<<<<< * len_key1 = PyString_Size(py_key1) * */ __pyx_t_2 = PyString_Size(((PyObject *)__pyx_v_py_key0)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_key0 = __pyx_t_2; /* "mtbl.pyx":557 * key1 = PyString_AsString(py_key1) * len_key0 = PyString_Size(py_key0) * len_key1 = PyString_Size(py_key1) # <<<<<<<<<<<<<< * * return get_iteritems(self, mtbl_source_get_range( */ __pyx_t_2 = PyString_Size(((PyObject *)__pyx_v_py_key1)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_key1 = __pyx_t_2; /* "mtbl.pyx":559 * len_key1 = PyString_Size(py_key1) * * return get_iteritems(self, mtbl_source_get_range( # <<<<<<<<<<<<<< * mtbl_merger_source(self._instance), key0, len_key0, key1, len_key1)) * */ __Pyx_XDECREF(__pyx_r); /* "mtbl.pyx":560 * * return get_iteritems(self, mtbl_source_get_range( * mtbl_merger_source(self._instance), key0, len_key0, key1, len_key1)) # <<<<<<<<<<<<<< * * def get_prefix(self, bytes py_key): */ __pyx_t_3 = __pyx_f_4mtbl_get_iteritems(__pyx_v_self, mtbl_source_get_range(mtbl_merger_source(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_instance), __pyx_v_key0, __pyx_v_len_key0, __pyx_v_key1, __pyx_v_len_key1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("mtbl.merger.get_range", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":562 * mtbl_merger_source(self._instance), key0, len_key0, key1, len_key1)) * * def get_prefix(self, bytes py_key): # <<<<<<<<<<<<<< * """ * M.get_prefix(key_prefix) -> an iterator over all (key, value) items in M where key */ static PyObject *__pyx_pf_4mtbl_6merger_11get_prefix(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key); /*proto*/ static char __pyx_doc_4mtbl_6merger_11get_prefix[] = "\n M.get_prefix(key_prefix) -> an iterator over all (key, value) items in M where key\n begins with key_prefix.\n "; static PyObject *__pyx_pf_4mtbl_6merger_11get_prefix(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key) { uint8_t *__pyx_v_key; size_t __pyx_v_len_key; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_prefix"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key), (&PyBytes_Type), 1, "py_key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":571 * cdef size_t len_key * * key = PyString_AsString(py_key) # <<<<<<<<<<<<<< * len_key = PyString_Size(py_key) * */ __pyx_t_1 = PyString_AsString(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_key = ((uint8_t *)__pyx_t_1); /* "mtbl.pyx":572 * * key = PyString_AsString(py_key) * len_key = PyString_Size(py_key) # <<<<<<<<<<<<<< * * return get_iteritems(self, mtbl_source_get_prefix( */ __pyx_t_2 = PyString_Size(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_key = __pyx_t_2; /* "mtbl.pyx":574 * len_key = PyString_Size(py_key) * * return get_iteritems(self, mtbl_source_get_prefix( # <<<<<<<<<<<<<< * mtbl_merger_source(self._instance), key, len_key)) * */ __Pyx_XDECREF(__pyx_r); /* "mtbl.pyx":575 * * return get_iteritems(self, mtbl_source_get_prefix( * mtbl_merger_source(self._instance), key, len_key)) # <<<<<<<<<<<<<< * * cdef class sorter(object): */ __pyx_t_3 = __pyx_f_4mtbl_get_iteritems(__pyx_v_self, mtbl_source_get_prefix(mtbl_merger_source(((struct __pyx_obj_4mtbl_merger *)__pyx_v_self)->_instance), __pyx_v_key, __pyx_v_len_key)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("mtbl.merger.get_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":594 * cdef _lock * * def __cinit__(self): # <<<<<<<<<<<<<< * self._instance = NULL * */ static int __pyx_pf_4mtbl_6sorter___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_6sorter___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__"); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; /* "mtbl.pyx":595 * * def __cinit__(self): * self._instance = NULL # <<<<<<<<<<<<<< * * def __dealloc__(self): */ ((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_instance = NULL; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":597 * self._instance = NULL * * def __dealloc__(self): # <<<<<<<<<<<<<< * with nogil: * mtbl_sorter_destroy(&self._instance) */ static void __pyx_pf_4mtbl_6sorter_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_4mtbl_6sorter_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__"); /* "mtbl.pyx":598 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_sorter_destroy(&self._instance) * */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":599 * def __dealloc__(self): * with nogil: * mtbl_sorter_destroy(&self._instance) # <<<<<<<<<<<<<< * * def __init__(self, */ mtbl_sorter_destroy((&((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_instance)); } /* "mtbl.pyx":598 * * def __dealloc__(self): * with nogil: # <<<<<<<<<<<<<< * mtbl_sorter_destroy(&self._instance) * */ /*finally:*/ { Py_BLOCK_THREADS } } __Pyx_RefNannyFinishContext(); } /* "mtbl.pyx":601 * mtbl_sorter_destroy(&self._instance) * * def __init__(self, # <<<<<<<<<<<<<< * object merge_func, * bytes temp_dir=DEFAULT_SORTER_TEMP_DIR, */ static int __pyx_pf_4mtbl_6sorter_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_4mtbl_6sorter_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_merge_func = 0; PyObject *__pyx_v_temp_dir = 0; size_t __pyx_v_max_memory; struct mtbl_sorter_options *__pyx_v_opt; int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; char *__pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__merge_func,&__pyx_n_s__temp_dir,&__pyx_n_s__max_memory,0}; __Pyx_RefNannySetupContext("__init__"); { PyObject* values[3] = {0,0,0}; values[1] = __pyx_k_13; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__merge_func); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__temp_dir); if (value) { values[1] = value; kw_args--; } } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_memory); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_merge_func = values[0]; __pyx_v_temp_dir = ((PyObject*)values[1]); if (values[2]) { __pyx_v_max_memory = __Pyx_PyInt_AsSize_t(values[2]); if (unlikely((__pyx_v_max_memory == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_max_memory = __pyx_k_14; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("mtbl.sorter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_temp_dir), (&PyBytes_Type), 1, "temp_dir", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":606 * size_t max_memory=DEFAULT_SORTER_MEMORY): * cdef mtbl_sorter_options *opt * self._lock = threading.Semaphore() # <<<<<<<<<<<<<< * * with nogil: */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__threading); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__Semaphore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_lock); __Pyx_DECREF(((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_lock); ((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_lock = __pyx_t_1; __pyx_t_1 = 0; /* "mtbl.pyx":608 * self._lock = threading.Semaphore() * * with nogil: # <<<<<<<<<<<<<< * opt = mtbl_sorter_options_init() * */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":609 * * with nogil: * opt = mtbl_sorter_options_init() # <<<<<<<<<<<<<< * * mtbl_sorter_options_set_merge_func(opt, */ __pyx_v_opt = mtbl_sorter_options_init(); } /* "mtbl.pyx":608 * self._lock = threading.Semaphore() * * with nogil: # <<<<<<<<<<<<<< * opt = mtbl_sorter_options_init() * */ /*finally:*/ { Py_BLOCK_THREADS } } /* "mtbl.pyx":613 * mtbl_sorter_options_set_merge_func(opt, * merge_func_wrapper, * merge_func) # <<<<<<<<<<<<<< * * mtbl_sorter_options_set_temp_dir(opt, temp_dir) */ mtbl_sorter_options_set_merge_func(__pyx_v_opt, ((mtbl_merge_func)__pyx_f_4mtbl_merge_func_wrapper), ((void *)__pyx_v_merge_func)); /* "mtbl.pyx":615 * merge_func) * * mtbl_sorter_options_set_temp_dir(opt, temp_dir) # <<<<<<<<<<<<<< * mtbl_sorter_options_set_max_memory(opt, max_memory) * with nogil: */ __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_temp_dir)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} mtbl_sorter_options_set_temp_dir(__pyx_v_opt, __pyx_t_3); /* "mtbl.pyx":616 * * mtbl_sorter_options_set_temp_dir(opt, temp_dir) * mtbl_sorter_options_set_max_memory(opt, max_memory) # <<<<<<<<<<<<<< * with nogil: * self._instance = mtbl_sorter_init(opt) */ mtbl_sorter_options_set_max_memory(__pyx_v_opt, __pyx_v_max_memory); /* "mtbl.pyx":617 * mtbl_sorter_options_set_temp_dir(opt, temp_dir) * mtbl_sorter_options_set_max_memory(opt, max_memory) * with nogil: # <<<<<<<<<<<<<< * self._instance = mtbl_sorter_init(opt) * mtbl_sorter_options_destroy(&opt) */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":618 * mtbl_sorter_options_set_max_memory(opt, max_memory) * with nogil: * self._instance = mtbl_sorter_init(opt) # <<<<<<<<<<<<<< * mtbl_sorter_options_destroy(&opt) * */ ((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_instance = mtbl_sorter_init(__pyx_v_opt); /* "mtbl.pyx":619 * with nogil: * self._instance = mtbl_sorter_init(opt) * mtbl_sorter_options_destroy(&opt) # <<<<<<<<<<<<<< * * def write(self, writer w): */ mtbl_sorter_options_destroy((&__pyx_v_opt)); } /* "mtbl.pyx":617 * mtbl_sorter_options_set_temp_dir(opt, temp_dir) * mtbl_sorter_options_set_max_memory(opt, max_memory) * with nogil: # <<<<<<<<<<<<<< * self._instance = mtbl_sorter_init(opt) * mtbl_sorter_options_destroy(&opt) */ /*finally:*/ { Py_BLOCK_THREADS } } __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.sorter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":621 * mtbl_sorter_options_destroy(&opt) * * def write(self, writer w): # <<<<<<<<<<<<<< * """S.write(mtbl.writer) -- dump sorted output to writer""" * cdef mtbl_res res */ static PyObject *__pyx_pf_4mtbl_6sorter_3write(PyObject *__pyx_v_self, PyObject *__pyx_v_w); /*proto*/ static char __pyx_doc_4mtbl_6sorter_3write[] = "S.write(mtbl.writer) -- dump sorted output to writer"; static PyObject *__pyx_pf_4mtbl_6sorter_3write(PyObject *__pyx_v_self, PyObject *__pyx_v_w) { mtbl_res __pyx_v_res; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; int __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_4mtbl_writer, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":625 * cdef mtbl_res res * * with w._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_sorter_write(self._instance, w._instance) */ /*with:*/ { __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_writer *)__pyx_v_w)->_lock, __pyx_n_s____exit__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_writer *)__pyx_v_w)->_lock, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); /*try:*/ { /* "mtbl.pyx":626 * * with w._lock: * with nogil: # <<<<<<<<<<<<<< * res = mtbl_sorter_write(self._instance, w._instance) * if res != mtbl_res_success: */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":627 * with w._lock: * with nogil: * res = mtbl_sorter_write(self._instance, w._instance) # <<<<<<<<<<<<<< * if res != mtbl_res_success: * raise RuntimeError */ __pyx_v_res = mtbl_sorter_write(((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_instance, ((struct __pyx_obj_4mtbl_writer *)__pyx_v_w)->_instance); } /* "mtbl.pyx":626 * * with w._lock: * with nogil: # <<<<<<<<<<<<<< * res = mtbl_sorter_write(self._instance, w._instance) * if res != mtbl_res_success: */ /*finally:*/ { Py_BLOCK_THREADS } } } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L16_try_end; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; /* "mtbl.pyx":625 * cdef mtbl_res res * * with w._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_sorter_write(self._instance, w._instance) */ /*except:*/ { __Pyx_AddTraceback("mtbl.sorter.write", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_INCREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_10 = PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} __pyx_t_11 = (!__pyx_t_9); if (__pyx_t_11) { __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_7); __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_7); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_7 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} goto __pyx_L24; } __pyx_L24:; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L10_exception_handled; } __pyx_L11_except_error:; __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); goto __pyx_L1_error; __pyx_L10_exception_handled:; __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); __pyx_L16_try_end:; } } /*finally:*/ { if (__pyx_t_1) { __pyx_t_6 = PyObject_Call(__pyx_t_1, __pyx_k_tuple_15, NULL); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } goto __pyx_L25; __pyx_L5_error:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L1_error; __pyx_L25:; } /* "mtbl.pyx":628 * with nogil: * res = mtbl_sorter_write(self._instance, w._instance) * if res != mtbl_res_success: # <<<<<<<<<<<<<< * raise RuntimeError * */ __pyx_t_11 = (__pyx_v_res != mtbl_res_success); if (__pyx_t_11) { /* "mtbl.pyx":629 * res = mtbl_sorter_write(self._instance, w._instance) * if res != mtbl_res_success: * raise RuntimeError # <<<<<<<<<<<<<< * * def __setitem__(self, bytes py_key, bytes py_val): */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L26; } __pyx_L26:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("mtbl.sorter.write", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":631 * raise RuntimeError * * def __setitem__(self, bytes py_key, bytes py_val): # <<<<<<<<<<<<<< * """ * S.__setitem__(key, value) <==> S[key] = value */ static int __pyx_pf_4mtbl_6sorter_4__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key, PyObject *__pyx_v_py_val); /*proto*/ static char __pyx_doc_4mtbl_6sorter_4__setitem__[] = "\n S.__setitem__(key, value) <==> S[key] = value\n\n Adds a new (key, value) item to the sorter. If the key already exists,\n the user-supplied merge function will be called to merge the\n conflicting values.\n "; struct wrapperbase __pyx_wrapperbase_4mtbl_6sorter_4__setitem__; static int __pyx_pf_4mtbl_6sorter_4__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_py_key, PyObject *__pyx_v_py_val) { mtbl_res __pyx_v_res; uint8_t *__pyx_v_key; uint8_t *__pyx_v_val; size_t __pyx_v_len_key; size_t __pyx_v_len_val; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; char *__pyx_t_2; Py_ssize_t __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_key), (&PyBytes_Type), 1, "py_key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_val), (&PyBytes_Type), 1, "py_val", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":645 * cdef size_t len_val * * if self._instance == NULL: # <<<<<<<<<<<<<< * raise RuntimeError * */ __pyx_t_1 = (((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_instance == NULL); if (__pyx_t_1) { /* "mtbl.pyx":646 * * if self._instance == NULL: * raise RuntimeError # <<<<<<<<<<<<<< * * key = PyString_AsString(py_key) */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "mtbl.pyx":648 * raise RuntimeError * * key = PyString_AsString(py_key) # <<<<<<<<<<<<<< * val = PyString_AsString(py_val) * len_key = PyString_Size(py_key) */ __pyx_t_2 = PyString_AsString(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_key = ((uint8_t *)__pyx_t_2); /* "mtbl.pyx":649 * * key = PyString_AsString(py_key) * val = PyString_AsString(py_val) # <<<<<<<<<<<<<< * len_key = PyString_Size(py_key) * len_val = PyString_Size(py_val) */ __pyx_t_2 = PyString_AsString(((PyObject *)__pyx_v_py_val)); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_val = ((uint8_t *)__pyx_t_2); /* "mtbl.pyx":650 * key = PyString_AsString(py_key) * val = PyString_AsString(py_val) * len_key = PyString_Size(py_key) # <<<<<<<<<<<<<< * len_val = PyString_Size(py_val) * */ __pyx_t_3 = PyString_Size(((PyObject *)__pyx_v_py_key)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_key = __pyx_t_3; /* "mtbl.pyx":651 * val = PyString_AsString(py_val) * len_key = PyString_Size(py_key) * len_val = PyString_Size(py_val) # <<<<<<<<<<<<<< * * with self._lock: */ __pyx_t_3 = PyString_Size(((PyObject *)__pyx_v_py_val)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_len_val = __pyx_t_3; /* "mtbl.pyx":653 * len_val = PyString_Size(py_val) * * with self._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_sorter_add(self._instance, key, len_key, val, len_val) */ /*with:*/ { __pyx_t_4 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_lock, __pyx_n_s____exit__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_GetAttr(((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_lock, __pyx_n_s____enter__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { /* "mtbl.pyx":654 * * with self._lock: * with nogil: # <<<<<<<<<<<<<< * res = mtbl_sorter_add(self._instance, key, len_key, val, len_val) * if res == mtbl_res_failure: */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mtbl.pyx":655 * with self._lock: * with nogil: * res = mtbl_sorter_add(self._instance, key, len_key, val, len_val) # <<<<<<<<<<<<<< * if res == mtbl_res_failure: * raise KeyOrderError */ __pyx_v_res = mtbl_sorter_add(((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_instance, __pyx_v_key, __pyx_v_len_key, __pyx_v_val, __pyx_v_len_val); } /* "mtbl.pyx":654 * * with self._lock: * with nogil: # <<<<<<<<<<<<<< * res = mtbl_sorter_add(self._instance, key, len_key, val, len_val) * if res == mtbl_res_failure: */ /*finally:*/ { Py_BLOCK_THREADS } } } __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L17_try_end; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; /* "mtbl.pyx":653 * len_val = PyString_Size(py_val) * * with self._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_sorter_add(self._instance, key, len_key, val, len_val) */ /*except:*/ { __Pyx_AddTraceback("mtbl.sorter.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_11)); __Pyx_INCREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_12 = PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} __pyx_t_13 = (!__pyx_t_1); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_10); __Pyx_ErrRestore(__pyx_t_6, __pyx_t_5, __pyx_t_10); __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_10 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} goto __pyx_L25; } __pyx_L25:; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L11_exception_handled; } __pyx_L12_except_error:; __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); goto __pyx_L1_error; __pyx_L11_exception_handled:; __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); __pyx_L17_try_end:; } } /*finally:*/ { if (__pyx_t_4) { __pyx_t_9 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_16, NULL); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } goto __pyx_L26; __pyx_L6_error:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L1_error; __pyx_L26:; } /* "mtbl.pyx":656 * with nogil: * res = mtbl_sorter_add(self._instance, key, len_key, val, len_val) * if res == mtbl_res_failure: # <<<<<<<<<<<<<< * raise KeyOrderError * */ __pyx_t_13 = (__pyx_v_res == mtbl_res_failure); if (__pyx_t_13) { /* "mtbl.pyx":657 * res = mtbl_sorter_add(self._instance, key, len_key, val, len_val) * if res == mtbl_res_failure: * raise KeyOrderError # <<<<<<<<<<<<<< * * def __delitem__(self, key): */ __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__KeyOrderError); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L27; } __pyx_L27:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("mtbl.sorter.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":659 * raise KeyOrderError * * def __delitem__(self, key): # <<<<<<<<<<<<<< * """will raise ImmutableError""" * raise ImmutableError */ static int __pyx_pf_4mtbl_6sorter_5__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ static char __pyx_doc_4mtbl_6sorter_5__delitem__[] = "will raise ImmutableError"; struct wrapperbase __pyx_wrapperbase_4mtbl_6sorter_5__delitem__; static int __pyx_pf_4mtbl_6sorter_5__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__delitem__"); /* "mtbl.pyx":661 * def __delitem__(self, key): * """will raise ImmutableError""" * raise ImmutableError # <<<<<<<<<<<<<< * * def __iter__(self): */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ImmutableError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.sorter.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":663 * raise ImmutableError * * def __iter__(self): # <<<<<<<<<<<<<< * return self.iterkeys() * */ static PyObject *__pyx_pf_4mtbl_6sorter_6__iter__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_4mtbl_6sorter_6__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__"); /* "mtbl.pyx":664 * * def __iter__(self): * return self.iterkeys() # <<<<<<<<<<<<<< * * def iterkeys(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__iterkeys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("mtbl.sorter.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":666 * return self.iterkeys() * * def iterkeys(self): # <<<<<<<<<<<<<< * """S.iterkeys() -> an iterator over the sorted keys of R.""" * return get_iterkeys(self, mtbl_sorter_iter(self._instance)) */ static PyObject *__pyx_pf_4mtbl_6sorter_7iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_6sorter_7iterkeys[] = "S.iterkeys() -> an iterator over the sorted keys of R."; static PyObject *__pyx_pf_4mtbl_6sorter_7iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("iterkeys"); /* "mtbl.pyx":668 * def iterkeys(self): * """S.iterkeys() -> an iterator over the sorted keys of R.""" * return get_iterkeys(self, mtbl_sorter_iter(self._instance)) # <<<<<<<<<<<<<< * * def itervalues(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_4mtbl_get_iterkeys(__pyx_v_self, mtbl_sorter_iter(((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_instance)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.sorter.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":670 * return get_iterkeys(self, mtbl_sorter_iter(self._instance)) * * def itervalues(self): # <<<<<<<<<<<<<< * """S.itervalues() -> an iterator over the sorted values of R.""" * return get_itervalues(self, mtbl_sorter_iter(self._instance)) */ static PyObject *__pyx_pf_4mtbl_6sorter_8itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_6sorter_8itervalues[] = "S.itervalues() -> an iterator over the sorted values of R."; static PyObject *__pyx_pf_4mtbl_6sorter_8itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("itervalues"); /* "mtbl.pyx":672 * def itervalues(self): * """S.itervalues() -> an iterator over the sorted values of R.""" * return get_itervalues(self, mtbl_sorter_iter(self._instance)) # <<<<<<<<<<<<<< * * def iteritems(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_4mtbl_get_itervalues(__pyx_v_self, mtbl_sorter_iter(((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_instance)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.sorter.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "mtbl.pyx":674 * return get_itervalues(self, mtbl_sorter_iter(self._instance)) * * def iteritems(self): # <<<<<<<<<<<<<< * """S.iteritems() -> an iterator over the sorted (key, value) items of R.""" * return get_iteritems(self, mtbl_sorter_iter(self._instance)) */ static PyObject *__pyx_pf_4mtbl_6sorter_9iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_4mtbl_6sorter_9iteritems[] = "S.iteritems() -> an iterator over the sorted (key, value) items of R."; static PyObject *__pyx_pf_4mtbl_6sorter_9iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("iteritems"); /* "mtbl.pyx":676 * def iteritems(self): * """S.iteritems() -> an iterator over the sorted (key, value) items of R.""" * return get_iteritems(self, mtbl_sorter_iter(self._instance)) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_4mtbl_get_iteritems(__pyx_v_self, mtbl_sorter_iter(((struct __pyx_obj_4mtbl_sorter *)__pyx_v_self)->_instance)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("mtbl.sorter.iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_tp_new_4mtbl_iterkeys(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_4mtbl_iterkeys *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_4mtbl_iterkeys *)o); p->_parent = Py_None; Py_INCREF(Py_None); if (__pyx_pf_4mtbl_8iterkeys___cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_4mtbl_iterkeys(PyObject *o) { struct __pyx_obj_4mtbl_iterkeys *p = (struct __pyx_obj_4mtbl_iterkeys *)o; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pf_4mtbl_8iterkeys_2__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_XDECREF(p->_parent); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_4mtbl_iterkeys(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_4mtbl_iterkeys *p = (struct __pyx_obj_4mtbl_iterkeys *)o; if (p->_parent) { e = (*v)(p->_parent, a); if (e) return e; } return 0; } static int __pyx_tp_clear_4mtbl_iterkeys(PyObject *o) { struct __pyx_obj_4mtbl_iterkeys *p = (struct __pyx_obj_4mtbl_iterkeys *)o; PyObject* tmp; tmp = ((PyObject*)p->_parent); p->_parent = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyMethodDef __pyx_methods_4mtbl_iterkeys[] = { {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4mtbl_8iterkeys_4__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_iterkeys = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_iterkeys = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_iterkeys = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_iterkeys = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_4mtbl_iterkeys = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("mtbl.iterkeys"), /*tp_name*/ sizeof(struct __pyx_obj_4mtbl_iterkeys), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_4mtbl_iterkeys, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_iterkeys, /*tp_as_number*/ &__pyx_tp_as_sequence_iterkeys, /*tp_as_sequence*/ &__pyx_tp_as_mapping_iterkeys, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_iterkeys, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_4mtbl_iterkeys, /*tp_traverse*/ __pyx_tp_clear_4mtbl_iterkeys, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ __pyx_pf_4mtbl_8iterkeys_3__iter__, /*tp_iter*/ __pyx_pf_4mtbl_8iterkeys_4__next__, /*tp_iternext*/ __pyx_methods_4mtbl_iterkeys, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_4mtbl_8iterkeys_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_4mtbl_iterkeys, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static PyObject *__pyx_tp_new_4mtbl_itervalues(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_4mtbl_itervalues *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_4mtbl_itervalues *)o); p->_parent = Py_None; Py_INCREF(Py_None); if (__pyx_pf_4mtbl_10itervalues___cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_4mtbl_itervalues(PyObject *o) { struct __pyx_obj_4mtbl_itervalues *p = (struct __pyx_obj_4mtbl_itervalues *)o; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pf_4mtbl_10itervalues_2__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_XDECREF(p->_parent); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_4mtbl_itervalues(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_4mtbl_itervalues *p = (struct __pyx_obj_4mtbl_itervalues *)o; if (p->_parent) { e = (*v)(p->_parent, a); if (e) return e; } return 0; } static int __pyx_tp_clear_4mtbl_itervalues(PyObject *o) { struct __pyx_obj_4mtbl_itervalues *p = (struct __pyx_obj_4mtbl_itervalues *)o; PyObject* tmp; tmp = ((PyObject*)p->_parent); p->_parent = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyMethodDef __pyx_methods_4mtbl_itervalues[] = { {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4mtbl_10itervalues_4__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_itervalues = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_itervalues = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_itervalues = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_itervalues = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_4mtbl_itervalues = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("mtbl.itervalues"), /*tp_name*/ sizeof(struct __pyx_obj_4mtbl_itervalues), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_4mtbl_itervalues, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_itervalues, /*tp_as_number*/ &__pyx_tp_as_sequence_itervalues, /*tp_as_sequence*/ &__pyx_tp_as_mapping_itervalues, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_itervalues, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_4mtbl_itervalues, /*tp_traverse*/ __pyx_tp_clear_4mtbl_itervalues, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ __pyx_pf_4mtbl_10itervalues_3__iter__, /*tp_iter*/ __pyx_pf_4mtbl_10itervalues_4__next__, /*tp_iternext*/ __pyx_methods_4mtbl_itervalues, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_4mtbl_10itervalues_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_4mtbl_itervalues, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static PyObject *__pyx_tp_new_4mtbl_iteritems(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_4mtbl_iteritems *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_4mtbl_iteritems *)o); p->_parent = Py_None; Py_INCREF(Py_None); if (__pyx_pf_4mtbl_9iteritems___cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_4mtbl_iteritems(PyObject *o) { struct __pyx_obj_4mtbl_iteritems *p = (struct __pyx_obj_4mtbl_iteritems *)o; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pf_4mtbl_9iteritems_2__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_XDECREF(p->_parent); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_4mtbl_iteritems(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_4mtbl_iteritems *p = (struct __pyx_obj_4mtbl_iteritems *)o; if (p->_parent) { e = (*v)(p->_parent, a); if (e) return e; } return 0; } static int __pyx_tp_clear_4mtbl_iteritems(PyObject *o) { struct __pyx_obj_4mtbl_iteritems *p = (struct __pyx_obj_4mtbl_iteritems *)o; PyObject* tmp; tmp = ((PyObject*)p->_parent); p->_parent = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyMethodDef __pyx_methods_4mtbl_iteritems[] = { {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_4mtbl_9iteritems_4__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_iteritems = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_iteritems = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_iteritems = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_iteritems = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_4mtbl_iteritems = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("mtbl.iteritems"), /*tp_name*/ sizeof(struct __pyx_obj_4mtbl_iteritems), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_4mtbl_iteritems, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_iteritems, /*tp_as_number*/ &__pyx_tp_as_sequence_iteritems, /*tp_as_sequence*/ &__pyx_tp_as_mapping_iteritems, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_iteritems, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_4mtbl_iteritems, /*tp_traverse*/ __pyx_tp_clear_4mtbl_iteritems, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ __pyx_pf_4mtbl_9iteritems_3__iter__, /*tp_iter*/ __pyx_pf_4mtbl_9iteritems_4__next__, /*tp_iternext*/ __pyx_methods_4mtbl_iteritems, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_4mtbl_9iteritems_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_4mtbl_iteritems, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static PyObject *__pyx_tp_new_4mtbl_DictMixin(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; } static void __pyx_tp_dealloc_4mtbl_DictMixin(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } static int __pyx_mp_ass_subscript_4mtbl_DictMixin(PyObject *o, PyObject *i, PyObject *v) { if (v) { return __pyx_pf_4mtbl_9DictMixin_6__setitem__(o, i, v); } else { return __pyx_pf_4mtbl_9DictMixin_5__delitem__(o, i); } } static PyMethodDef __pyx_methods_4mtbl_DictMixin[] = { {__Pyx_NAMESTR("iter"), (PyCFunction)__pyx_pf_4mtbl_9DictMixin_1iter, METH_NOARGS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_4mtbl_9DictMixin_2items, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_9DictMixin_2items)}, {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_4mtbl_9DictMixin_3keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_9DictMixin_3keys)}, {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_4mtbl_9DictMixin_4values, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_9DictMixin_4values)}, {__Pyx_NAMESTR("pop"), (PyCFunction)__pyx_pf_4mtbl_9DictMixin_7pop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4mtbl_9DictMixin_7pop)}, {__Pyx_NAMESTR("popitem"), (PyCFunction)__pyx_pf_4mtbl_9DictMixin_8popitem, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_9DictMixin_8popitem)}, {__Pyx_NAMESTR("update"), (PyCFunction)__pyx_pf_4mtbl_9DictMixin_9update, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4mtbl_9DictMixin_9update)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_DictMixin = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_DictMixin = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_DictMixin = { 0, /*mp_length*/ 0, /*mp_subscript*/ __pyx_mp_ass_subscript_4mtbl_DictMixin, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_DictMixin = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_4mtbl_DictMixin = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("mtbl.DictMixin"), /*tp_name*/ sizeof(struct __pyx_obj_4mtbl_DictMixin), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_4mtbl_DictMixin, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_DictMixin, /*tp_as_number*/ &__pyx_tp_as_sequence_DictMixin, /*tp_as_sequence*/ &__pyx_tp_as_mapping_DictMixin, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_DictMixin, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ __pyx_pf_4mtbl_9DictMixin___iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_4mtbl_DictMixin, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_4mtbl_DictMixin, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static struct __pyx_vtabstruct_4mtbl_reader __pyx_vtable_4mtbl_reader; static PyObject *__pyx_tp_new_4mtbl_reader(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_4mtbl_reader *p; PyObject *o = __pyx_tp_new_4mtbl_DictMixin(t, a, k); if (!o) return 0; p = ((struct __pyx_obj_4mtbl_reader *)o); p->__pyx_vtab = __pyx_vtabptr_4mtbl_reader; if (__pyx_pf_4mtbl_6reader___cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_4mtbl_reader(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pf_4mtbl_6reader_1__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } __pyx_tp_dealloc_4mtbl_DictMixin(o); } static PyObject *__pyx_sq_item_4mtbl_reader(PyObject *o, Py_ssize_t i) { PyObject *r; PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); Py_DECREF(x); return r; } static PyMethodDef __pyx_methods_4mtbl_reader[] = { {__Pyx_NAMESTR("iterkeys"), (PyCFunction)__pyx_pf_4mtbl_6reader_3iterkeys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6reader_3iterkeys)}, {__Pyx_NAMESTR("itervalues"), (PyCFunction)__pyx_pf_4mtbl_6reader_4itervalues, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6reader_4itervalues)}, {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pf_4mtbl_6reader_5iteritems, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6reader_5iteritems)}, {__Pyx_NAMESTR("has_key"), (PyCFunction)__pyx_pf_4mtbl_6reader_7has_key, METH_O, __Pyx_DOCSTR(__pyx_doc_4mtbl_6reader_7has_key)}, {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4mtbl_6reader_8get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6reader_8get)}, {__Pyx_NAMESTR("get_range"), (PyCFunction)__pyx_pf_4mtbl_6reader_9get_range, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6reader_9get_range)}, {__Pyx_NAMESTR("get_prefix"), (PyCFunction)__pyx_pf_4mtbl_6reader_10get_prefix, METH_O, __Pyx_DOCSTR(__pyx_doc_4mtbl_6reader_10get_prefix)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_reader = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_reader = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_4mtbl_reader, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ __pyx_pf_4mtbl_6reader_6__contains__, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_reader = { 0, /*mp_length*/ __pyx_pf_4mtbl_6reader_11__getitem__, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_reader = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_4mtbl_reader = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("mtbl.reader"), /*tp_name*/ sizeof(struct __pyx_obj_4mtbl_reader), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_4mtbl_reader, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_reader, /*tp_as_number*/ &__pyx_tp_as_sequence_reader, /*tp_as_sequence*/ &__pyx_tp_as_mapping_reader, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_reader, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ __Pyx_DOCSTR("\n reader(fname) -> new MTBL reader initialized from file fname\n\n Keyword arguments:\n verify_checksums -- whether to verify data block checksums (default False)\n "), /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_4mtbl_reader, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_4mtbl_6reader_2__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_4mtbl_reader, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static PyObject *__pyx_tp_new_4mtbl_writer(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_4mtbl_writer *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_4mtbl_writer *)o); p->_lock = Py_None; Py_INCREF(Py_None); if (__pyx_pf_4mtbl_6writer___cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_4mtbl_writer(PyObject *o) { struct __pyx_obj_4mtbl_writer *p = (struct __pyx_obj_4mtbl_writer *)o; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pf_4mtbl_6writer_1__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_XDECREF(p->_lock); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_4mtbl_writer(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_4mtbl_writer *p = (struct __pyx_obj_4mtbl_writer *)o; if (p->_lock) { e = (*v)(p->_lock, a); if (e) return e; } return 0; } static int __pyx_tp_clear_4mtbl_writer(PyObject *o) { struct __pyx_obj_4mtbl_writer *p = (struct __pyx_obj_4mtbl_writer *)o; PyObject* tmp; tmp = ((PyObject*)p->_lock); p->_lock = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static int __pyx_mp_ass_subscript_4mtbl_writer(PyObject *o, PyObject *i, PyObject *v) { if (v) { return __pyx_pf_4mtbl_6writer_4__setitem__(o, i, v); } else { return __pyx_pf_4mtbl_6writer_5__delitem__(o, i); } } static PyMethodDef __pyx_methods_4mtbl_writer[] = { {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_4mtbl_6writer_3close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6writer_3close)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_writer = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_writer = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_writer = { 0, /*mp_length*/ 0, /*mp_subscript*/ __pyx_mp_ass_subscript_4mtbl_writer, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_writer = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_4mtbl_writer = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("mtbl.writer"), /*tp_name*/ sizeof(struct __pyx_obj_4mtbl_writer), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_4mtbl_writer, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_writer, /*tp_as_number*/ &__pyx_tp_as_sequence_writer, /*tp_as_sequence*/ &__pyx_tp_as_mapping_writer, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_writer, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ __Pyx_DOCSTR("\n writer(fname) -> new MTBL writer, output to file fname\n\n Keyword arguments:\n compression -- compression type (default COMPRESSION_NONE)\n block_size -- maximum data block size in bytes (default 8192)\n block_restart_interval -- how frequently to restart key prefix compression (default 16)\n "), /*tp_doc*/ __pyx_tp_traverse_4mtbl_writer, /*tp_traverse*/ __pyx_tp_clear_4mtbl_writer, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_4mtbl_writer, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_4mtbl_6writer_2__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_4mtbl_writer, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static PyObject *__pyx_tp_new_4mtbl_merger(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_4mtbl_merger *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_4mtbl_merger *)o); p->_references = ((PyObject*)Py_None); Py_INCREF(Py_None); p->_lock = Py_None; Py_INCREF(Py_None); p->merge_func = Py_None; Py_INCREF(Py_None); if (__pyx_pf_4mtbl_6merger___cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_4mtbl_merger(PyObject *o) { struct __pyx_obj_4mtbl_merger *p = (struct __pyx_obj_4mtbl_merger *)o; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pf_4mtbl_6merger_1__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_XDECREF(((PyObject *)p->_references)); Py_XDECREF(p->_lock); Py_XDECREF(p->merge_func); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_4mtbl_merger(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_4mtbl_merger *p = (struct __pyx_obj_4mtbl_merger *)o; if (p->_references) { e = (*v)(p->_references, a); if (e) return e; } if (p->_lock) { e = (*v)(p->_lock, a); if (e) return e; } if (p->merge_func) { e = (*v)(p->merge_func, a); if (e) return e; } return 0; } static int __pyx_tp_clear_4mtbl_merger(PyObject *o) { struct __pyx_obj_4mtbl_merger *p = (struct __pyx_obj_4mtbl_merger *)o; PyObject* tmp; tmp = ((PyObject*)p->_references); p->_references = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->_lock); p->_lock = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->merge_func); p->merge_func = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyMethodDef __pyx_methods_4mtbl_merger[] = { {__Pyx_NAMESTR("add_reader"), (PyCFunction)__pyx_pf_4mtbl_6merger_3add_reader, METH_O, __Pyx_DOCSTR(__pyx_doc_4mtbl_6merger_3add_reader)}, {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_4mtbl_6merger_4write, METH_O, __Pyx_DOCSTR(__pyx_doc_4mtbl_6merger_4write)}, {__Pyx_NAMESTR("iterkeys"), (PyCFunction)__pyx_pf_4mtbl_6merger_6iterkeys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6merger_6iterkeys)}, {__Pyx_NAMESTR("itervalues"), (PyCFunction)__pyx_pf_4mtbl_6merger_7itervalues, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6merger_7itervalues)}, {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pf_4mtbl_6merger_8iteritems, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6merger_8iteritems)}, {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_4mtbl_6merger_9get, METH_O, __Pyx_DOCSTR(__pyx_doc_4mtbl_6merger_9get)}, {__Pyx_NAMESTR("get_range"), (PyCFunction)__pyx_pf_4mtbl_6merger_10get_range, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6merger_10get_range)}, {__Pyx_NAMESTR("get_prefix"), (PyCFunction)__pyx_pf_4mtbl_6merger_11get_prefix, METH_O, __Pyx_DOCSTR(__pyx_doc_4mtbl_6merger_11get_prefix)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_merger = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_merger = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_merger = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_merger = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_4mtbl_merger = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("mtbl.merger"), /*tp_name*/ sizeof(struct __pyx_obj_4mtbl_merger), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_4mtbl_merger, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_merger, /*tp_as_number*/ &__pyx_tp_as_sequence_merger, /*tp_as_sequence*/ &__pyx_tp_as_mapping_merger, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_merger, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ __Pyx_DOCSTR("\n merger(merge_func) -> new MTBL merger\n\n merge_func is the user-supplied value merging function:\n\n merge_func(key, val0, val1) -> merged_val\n\n all parameters are byte strings, and the return value must be a byte string.\n "), /*tp_doc*/ __pyx_tp_traverse_4mtbl_merger, /*tp_traverse*/ __pyx_tp_clear_4mtbl_merger, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ __pyx_pf_4mtbl_6merger_5__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_4mtbl_merger, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_4mtbl_6merger_2__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_4mtbl_merger, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static PyObject *__pyx_tp_new_4mtbl_sorter(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_4mtbl_sorter *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_4mtbl_sorter *)o); p->_lock = Py_None; Py_INCREF(Py_None); if (__pyx_pf_4mtbl_6sorter___cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_4mtbl_sorter(PyObject *o) { struct __pyx_obj_4mtbl_sorter *p = (struct __pyx_obj_4mtbl_sorter *)o; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pf_4mtbl_6sorter_1__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_XDECREF(p->_lock); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_4mtbl_sorter(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_4mtbl_sorter *p = (struct __pyx_obj_4mtbl_sorter *)o; if (p->_lock) { e = (*v)(p->_lock, a); if (e) return e; } return 0; } static int __pyx_tp_clear_4mtbl_sorter(PyObject *o) { struct __pyx_obj_4mtbl_sorter *p = (struct __pyx_obj_4mtbl_sorter *)o; PyObject* tmp; tmp = ((PyObject*)p->_lock); p->_lock = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static int __pyx_mp_ass_subscript_4mtbl_sorter(PyObject *o, PyObject *i, PyObject *v) { if (v) { return __pyx_pf_4mtbl_6sorter_4__setitem__(o, i, v); } else { return __pyx_pf_4mtbl_6sorter_5__delitem__(o, i); } } static PyMethodDef __pyx_methods_4mtbl_sorter[] = { {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_4mtbl_6sorter_3write, METH_O, __Pyx_DOCSTR(__pyx_doc_4mtbl_6sorter_3write)}, {__Pyx_NAMESTR("iterkeys"), (PyCFunction)__pyx_pf_4mtbl_6sorter_7iterkeys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6sorter_7iterkeys)}, {__Pyx_NAMESTR("itervalues"), (PyCFunction)__pyx_pf_4mtbl_6sorter_8itervalues, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6sorter_8itervalues)}, {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pf_4mtbl_6sorter_9iteritems, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4mtbl_6sorter_9iteritems)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_sorter = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_sorter = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_sorter = { 0, /*mp_length*/ 0, /*mp_subscript*/ __pyx_mp_ass_subscript_4mtbl_sorter, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_sorter = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_4mtbl_sorter = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("mtbl.sorter"), /*tp_name*/ sizeof(struct __pyx_obj_4mtbl_sorter), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_4mtbl_sorter, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_sorter, /*tp_as_number*/ &__pyx_tp_as_sequence_sorter, /*tp_as_sequence*/ &__pyx_tp_as_mapping_sorter, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_sorter, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ __Pyx_DOCSTR("\n sorter(merge_func) -> new MTBL sorter\n\n merge_func is the user-supplied value merging function:\n\n merge_func(key, val0, val1) -> merged_val\n\n all parameters are byte strings, and the return value must be a byte string.\n\n Keyword arguments:\n temp_dir -- temporary directory (default \"/var/tmp\")\n max_memory -- maxmimum amount of memory for in-memory sorting in bytes (default 1 GB)\n "), /*tp_doc*/ __pyx_tp_traverse_4mtbl_sorter, /*tp_traverse*/ __pyx_tp_clear_4mtbl_sorter, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ __pyx_pf_4mtbl_6sorter_6__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_4mtbl_sorter, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_4mtbl_6sorter_2__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_4mtbl_sorter, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("mtbl"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1}, {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, {&__pyx_n_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 1}, {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1}, {&__pyx_n_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 1}, {&__pyx_n_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 1}, {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, {&__pyx_n_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 1}, {&__pyx_n_s__COMPRESSION_LZ4, __pyx_k__COMPRESSION_LZ4, sizeof(__pyx_k__COMPRESSION_LZ4), 0, 0, 1, 1}, {&__pyx_n_s__COMPRESSION_LZ4HC, __pyx_k__COMPRESSION_LZ4HC, sizeof(__pyx_k__COMPRESSION_LZ4HC), 0, 0, 1, 1}, {&__pyx_n_s__COMPRESSION_NONE, __pyx_k__COMPRESSION_NONE, sizeof(__pyx_k__COMPRESSION_NONE), 0, 0, 1, 1}, {&__pyx_n_s__COMPRESSION_SNAPPY, __pyx_k__COMPRESSION_SNAPPY, sizeof(__pyx_k__COMPRESSION_SNAPPY), 0, 0, 1, 1}, {&__pyx_n_s__COMPRESSION_ZLIB, __pyx_k__COMPRESSION_ZLIB, sizeof(__pyx_k__COMPRESSION_ZLIB), 0, 0, 1, 1}, {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1}, {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1}, {&__pyx_n_s__ImmutableError, __pyx_k__ImmutableError, sizeof(__pyx_k__ImmutableError), 0, 0, 1, 1}, {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1}, {&__pyx_n_s__KeyOrderError, __pyx_k__KeyOrderError, sizeof(__pyx_k__KeyOrderError), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__Semaphore, __pyx_k__Semaphore, sizeof(__pyx_k__Semaphore), 0, 0, 1, 1}, {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1}, {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, {&__pyx_n_s__VarintDecodingError, __pyx_k__VarintDecodingError, sizeof(__pyx_k__VarintDecodingError), 0, 0, 1, 1}, {&__pyx_n_s____contains__, __pyx_k____contains__, sizeof(__pyx_k____contains__), 0, 0, 1, 1}, {&__pyx_n_s____enter__, __pyx_k____enter__, sizeof(__pyx_k____enter__), 0, 0, 1, 1}, {&__pyx_n_s____exit__, __pyx_k____exit__, sizeof(__pyx_k____exit__), 0, 0, 1, 1}, {&__pyx_n_s____getitem__, __pyx_k____getitem__, sizeof(__pyx_k____getitem__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s___parent, __pyx_k___parent, sizeof(__pyx_k___parent), 0, 0, 1, 1}, {&__pyx_n_s__block_size, __pyx_k__block_size, sizeof(__pyx_k__block_size), 0, 0, 1, 1}, {&__pyx_n_s__compression, __pyx_k__compression, sizeof(__pyx_k__compression), 0, 0, 1, 1}, {&__pyx_n_s__default, __pyx_k__default, sizeof(__pyx_k__default), 0, 0, 1, 1}, {&__pyx_n_s__fname, __pyx_k__fname, sizeof(__pyx_k__fname), 0, 0, 1, 1}, {&__pyx_n_s__iteritems, __pyx_k__iteritems, sizeof(__pyx_k__iteritems), 0, 0, 1, 1}, {&__pyx_n_s__iterkeys, __pyx_k__iterkeys, sizeof(__pyx_k__iterkeys), 0, 0, 1, 1}, {&__pyx_n_s__itervalues, __pyx_k__itervalues, sizeof(__pyx_k__itervalues), 0, 0, 1, 1}, {&__pyx_n_s__max_memory, __pyx_k__max_memory, sizeof(__pyx_k__max_memory), 0, 0, 1, 1}, {&__pyx_n_s__merge_func, __pyx_k__merge_func, sizeof(__pyx_k__merge_func), 0, 0, 1, 1}, {&__pyx_n_s__mtbl, __pyx_k__mtbl, sizeof(__pyx_k__mtbl), 0, 0, 1, 1}, {&__pyx_n_s__py_key, __pyx_k__py_key, sizeof(__pyx_k__py_key), 0, 0, 1, 1}, {&__pyx_n_s__py_key0, __pyx_k__py_key0, sizeof(__pyx_k__py_key0), 0, 0, 1, 1}, {&__pyx_n_s__py_key1, __pyx_k__py_key1, sizeof(__pyx_k__py_key1), 0, 0, 1, 1}, {&__pyx_n_s__temp_dir, __pyx_k__temp_dir, sizeof(__pyx_k__temp_dir), 0, 0, 1, 1}, {&__pyx_n_s__threading, __pyx_k__threading, sizeof(__pyx_k__threading), 0, 0, 1, 1}, {&__pyx_n_s__varint_decode, __pyx_k__varint_decode, sizeof(__pyx_k__varint_decode), 0, 0, 1, 1}, {&__pyx_n_s__varint_encode, __pyx_k__varint_encode, sizeof(__pyx_k__varint_encode), 0, 0, 1, 1}, {&__pyx_n_s__varint_length, __pyx_k__varint_length, sizeof(__pyx_k__varint_length), 0, 0, 1, 1}, {&__pyx_n_s__verify_checksums, __pyx_k__verify_checksums, sizeof(__pyx_k__verify_checksums), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); /* "mtbl.pyx":409 * def close(self): * """W.close() -- finalize and close the writer""" * with self._lock: # <<<<<<<<<<<<<< * with nogil: * mtbl_writer_destroy(&self._instance) */ __pyx_k_tuple_8 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_8, 1, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_8, 2, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "mtbl.pyx":435 * len_val = PyString_Size(py_val) * * with self._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_writer_add(self._instance, key, len_key, val, len_val) */ __pyx_k_tuple_10 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_10, 1, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_10, 2, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); /* "mtbl.pyx":499 * def add_reader(self, reader r): * """M.add_reader(mtbl.reader) -- add a reader object as a merge input""" * with self._lock: # <<<<<<<<<<<<<< * with nogil: * mtbl_merger_add_source(self._instance, mtbl_reader_source(r._instance)) */ __pyx_k_tuple_11 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_11, 1, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_11, 2, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); /* "mtbl.pyx":508 * cdef mtbl_res res * * with w._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_source_write(mtbl_merger_source(self._instance), w._instance) */ __pyx_k_tuple_12 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_12, 1, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_12, 2, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); /* "mtbl.pyx":625 * cdef mtbl_res res * * with w._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_sorter_write(self._instance, w._instance) */ __pyx_k_tuple_15 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); /* "mtbl.pyx":653 * len_val = PyString_Size(py_val) * * with self._lock: # <<<<<<<<<<<<<< * with nogil: * res = mtbl_sorter_add(self._instance, key, len_key, val, len_val) */ __pyx_k_tuple_16 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_16, 1, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_16, 2, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); /* "mtbl.pyx":28 * pass * * ImmutableError = TypeError('object does not support mutation') # <<<<<<<<<<<<<< * * def varint_length(uint64_t value): */ __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_20)); PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { #if PY_VERSION_HEX < 0x02040000 if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1073741824 = PyInt_FromLong(1073741824); if (unlikely(!__pyx_int_1073741824)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initmtbl(void); /*proto*/ PyMODINIT_FUNC initmtbl(void) #else PyMODINIT_FUNC PyInit_mtbl(void); /*proto*/ PyMODINIT_FUNC PyInit_mtbl(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; mtbl_compression_type __pyx_t_4; size_t __pyx_t_5; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_mtbl(void)"); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __pyx_binding_PyCFunctionType_USED if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mtbl"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_mtbl) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ if (PyType_Ready(&__pyx_type_4mtbl_iterkeys) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4mtbl_iterkeys = &__pyx_type_4mtbl_iterkeys; if (PyType_Ready(&__pyx_type_4mtbl_itervalues) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4mtbl_itervalues = &__pyx_type_4mtbl_itervalues; if (PyType_Ready(&__pyx_type_4mtbl_iteritems) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4mtbl_iteritems = &__pyx_type_4mtbl_iteritems; if (PyType_Ready(&__pyx_type_4mtbl_DictMixin) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4mtbl_DictMixin, "__delitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_4mtbl_9DictMixin_5__delitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_4mtbl_9DictMixin_5__delitem__.doc = __pyx_doc_4mtbl_9DictMixin_5__delitem__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4mtbl_9DictMixin_5__delitem__; } } { PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4mtbl_DictMixin, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_4mtbl_9DictMixin_6__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_4mtbl_9DictMixin_6__setitem__.doc = __pyx_doc_4mtbl_9DictMixin_6__setitem__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4mtbl_9DictMixin_6__setitem__; } } __pyx_ptype_4mtbl_DictMixin = &__pyx_type_4mtbl_DictMixin; __pyx_vtabptr_4mtbl_reader = &__pyx_vtable_4mtbl_reader; __pyx_vtable_4mtbl_reader.check_initialized = (PyObject *(*)(struct __pyx_obj_4mtbl_reader *))__pyx_f_4mtbl_6reader_check_initialized; __pyx_type_4mtbl_reader.tp_base = __pyx_ptype_4mtbl_DictMixin; if (PyType_Ready(&__pyx_type_4mtbl_reader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4mtbl_reader, "__contains__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_4mtbl_6reader_6__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_4mtbl_6reader_6__contains__.doc = __pyx_doc_4mtbl_6reader_6__contains__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4mtbl_6reader_6__contains__; } } if (__Pyx_SetVtable(__pyx_type_4mtbl_reader.tp_dict, __pyx_vtabptr_4mtbl_reader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "reader", (PyObject *)&__pyx_type_4mtbl_reader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4mtbl_reader = &__pyx_type_4mtbl_reader; if (PyType_Ready(&__pyx_type_4mtbl_writer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4mtbl_writer, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_4mtbl_6writer_4__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_4mtbl_6writer_4__setitem__.doc = __pyx_doc_4mtbl_6writer_4__setitem__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4mtbl_6writer_4__setitem__; } } { PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4mtbl_writer, "__delitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_4mtbl_6writer_5__delitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_4mtbl_6writer_5__delitem__.doc = __pyx_doc_4mtbl_6writer_5__delitem__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4mtbl_6writer_5__delitem__; } } if (__Pyx_SetAttrString(__pyx_m, "writer", (PyObject *)&__pyx_type_4mtbl_writer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4mtbl_writer = &__pyx_type_4mtbl_writer; if (PyType_Ready(&__pyx_type_4mtbl_merger) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "merger", (PyObject *)&__pyx_type_4mtbl_merger) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4mtbl_merger = &__pyx_type_4mtbl_merger; if (PyType_Ready(&__pyx_type_4mtbl_sorter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4mtbl_sorter, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_4mtbl_6sorter_4__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_4mtbl_6sorter_4__setitem__.doc = __pyx_doc_4mtbl_6sorter_4__setitem__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4mtbl_6sorter_4__setitem__; } } { PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4mtbl_sorter, "__delitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_4mtbl_6sorter_5__delitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_4mtbl_6sorter_5__delitem__.doc = __pyx_doc_4mtbl_6sorter_5__delitem__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4mtbl_6sorter_5__delitem__; } } if (__Pyx_SetAttrString(__pyx_m, "sorter", (PyObject *)&__pyx_type_4mtbl_sorter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4mtbl_sorter = &__pyx_type_4mtbl_sorter; /*--- Type import code ---*/ __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "mtbl.pyx":2 * include "mtbl.pxi" * import threading # <<<<<<<<<<<<<< * * DEFAULT_SORTER_TEMP_DIR = '/var/tmp' */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__threading), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__threading, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":4 * import threading * * DEFAULT_SORTER_TEMP_DIR = '/var/tmp' # <<<<<<<<<<<<<< * DEFAULT_SORTER_MEMORY = 1073741824 * */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_18, ((PyObject *)__pyx_kp_s_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":5 * * DEFAULT_SORTER_TEMP_DIR = '/var/tmp' * DEFAULT_SORTER_MEMORY = 1073741824 # <<<<<<<<<<<<<< * * COMPRESSION_NONE = MTBL_COMPRESSION_NONE */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_19, __pyx_int_1073741824) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "mtbl.pyx":7 * DEFAULT_SORTER_MEMORY = 1073741824 * * COMPRESSION_NONE = MTBL_COMPRESSION_NONE # <<<<<<<<<<<<<< * COMPRESSION_SNAPPY = MTBL_COMPRESSION_SNAPPY * COMPRESSION_ZLIB = MTBL_COMPRESSION_ZLIB */ __pyx_t_1 = PyInt_FromLong(MTBL_COMPRESSION_NONE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__COMPRESSION_NONE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":8 * * COMPRESSION_NONE = MTBL_COMPRESSION_NONE * COMPRESSION_SNAPPY = MTBL_COMPRESSION_SNAPPY # <<<<<<<<<<<<<< * COMPRESSION_ZLIB = MTBL_COMPRESSION_ZLIB * COMPRESSION_LZ4 = MTBL_COMPRESSION_LZ4 */ __pyx_t_1 = PyInt_FromLong(MTBL_COMPRESSION_SNAPPY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__COMPRESSION_SNAPPY, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":9 * COMPRESSION_NONE = MTBL_COMPRESSION_NONE * COMPRESSION_SNAPPY = MTBL_COMPRESSION_SNAPPY * COMPRESSION_ZLIB = MTBL_COMPRESSION_ZLIB # <<<<<<<<<<<<<< * COMPRESSION_LZ4 = MTBL_COMPRESSION_LZ4 * COMPRESSION_LZ4HC = MTBL_COMPRESSION_LZ4HC */ __pyx_t_1 = PyInt_FromLong(MTBL_COMPRESSION_ZLIB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__COMPRESSION_ZLIB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":10 * COMPRESSION_SNAPPY = MTBL_COMPRESSION_SNAPPY * COMPRESSION_ZLIB = MTBL_COMPRESSION_ZLIB * COMPRESSION_LZ4 = MTBL_COMPRESSION_LZ4 # <<<<<<<<<<<<<< * COMPRESSION_LZ4HC = MTBL_COMPRESSION_LZ4HC * */ __pyx_t_1 = PyInt_FromLong(MTBL_COMPRESSION_LZ4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__COMPRESSION_LZ4, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":11 * COMPRESSION_ZLIB = MTBL_COMPRESSION_ZLIB * COMPRESSION_LZ4 = MTBL_COMPRESSION_LZ4 * COMPRESSION_LZ4HC = MTBL_COMPRESSION_LZ4HC # <<<<<<<<<<<<<< * * class KeyOrderError(Exception): */ __pyx_t_1 = PyInt_FromLong(MTBL_COMPRESSION_LZ4HC); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__COMPRESSION_LZ4HC, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":13 * COMPRESSION_LZ4HC = MTBL_COMPRESSION_LZ4HC * * class KeyOrderError(Exception): # <<<<<<<<<<<<<< * pass * */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception); __Pyx_GIVEREF(__pyx_builtin_Exception); __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__KeyOrderError, __pyx_n_s__mtbl); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__KeyOrderError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "mtbl.pyx":16 * pass * * class TableClosedException(Exception): # <<<<<<<<<<<<<< * pass * */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_Exception); __Pyx_GIVEREF(__pyx_builtin_Exception); __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1), __pyx_n_s_9, __pyx_n_s__mtbl); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s_9, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "mtbl.pyx":19 * pass * * class UnknownCompressionTypeException(Exception): # <<<<<<<<<<<<<< * pass * */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception); __Pyx_GIVEREF(__pyx_builtin_Exception); __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s_6, __pyx_n_s__mtbl); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s_6, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "mtbl.pyx":22 * pass * * class UninitializedException(Exception): # <<<<<<<<<<<<<< * pass * */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_Exception); __Pyx_GIVEREF(__pyx_builtin_Exception); __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1), __pyx_n_s_3, __pyx_n_s__mtbl); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s_3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "mtbl.pyx":25 * pass * * class VarintDecodingError(Exception): # <<<<<<<<<<<<<< * pass * */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception); __Pyx_GIVEREF(__pyx_builtin_Exception); __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__VarintDecodingError, __pyx_n_s__mtbl); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VarintDecodingError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "mtbl.pyx":28 * pass * * ImmutableError = TypeError('object does not support mutation') # <<<<<<<<<<<<<< * * def varint_length(uint64_t value): */ __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ImmutableError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":30 * ImmutableError = TypeError('object does not support mutation') * * def varint_length(uint64_t value): # <<<<<<<<<<<<<< * """varint_length(v) -> number of bytes the integer v would require in varint encoding.""" * return mtbl_varint_length(value) */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4mtbl_varint_length, NULL, __pyx_n_s__mtbl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__varint_length, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":34 * return mtbl_varint_length(value) * * def varint_length_packed(bytes py_buf): # <<<<<<<<<<<<<< * """varint_length_packed(b) -> number of varint-packed bytes at the start of b.""" * cdef uint8_t *buf */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4mtbl_1varint_length_packed, NULL, __pyx_n_s__mtbl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_22, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":46 * return sz * * def varint_encode(long v): # <<<<<<<<<<<<<< * """varint_encode(v) -> encode integer v using packed variable-width encoding.""" * cdef uint8_t buf[10] */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4mtbl_2varint_encode, NULL, __pyx_n_s__mtbl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__varint_encode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":54 * return PyString_FromStringAndSize( buf, sz) * * def varint_decode(bytes py_buf): # <<<<<<<<<<<<<< * """varint_decode(b) -> decode variable-width packed integer from b""" * cdef uint64_t val */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4mtbl_3varint_decode, NULL, __pyx_n_s__mtbl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__varint_decode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":243 * mtbl_reader_destroy(&self._instance) * * def __init__(self, char * fname, bool verify_checksums=False): # <<<<<<<<<<<<<< * cdef mtbl_reader_options *opt * */ __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_1 = ((PyBoolObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":384 * def __init__(self, * char * fname, * mtbl_compression_type compression=COMPRESSION_NONE, # <<<<<<<<<<<<<< * size_t block_size=8192, * size_t block_restart_interval=16): */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__COMPRESSION_NONE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = ((mtbl_compression_type)PyInt_AsLong(__pyx_t_1)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_k_5 = __pyx_t_4; /* "mtbl.pyx":603 * def __init__(self, * object merge_func, * bytes temp_dir=DEFAULT_SORTER_TEMP_DIR, # <<<<<<<<<<<<<< * size_t max_memory=DEFAULT_SORTER_MEMORY): * cdef mtbl_sorter_options *opt */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_13 = ((PyObject*)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; /* "mtbl.pyx":604 * object merge_func, * bytes temp_dir=DEFAULT_SORTER_TEMP_DIR, * size_t max_memory=DEFAULT_SORTER_MEMORY): # <<<<<<<<<<<<<< * cdef mtbl_sorter_options *opt * self._lock = threading.Semaphore() */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_19); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_k_14 = __pyx_t_5; /* "mtbl.pyx":1 * include "mtbl.pxi" # <<<<<<<<<<<<<< * import threading * */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { __Pyx_AddTraceback("init mtbl", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init mtbl"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { /* cause is unused */ Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise , */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (!PyExceptionClass_Check(type)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } if (!value) { value = PyObject_CallObject(type, NULL); } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: return; } #endif static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static CYTHON_INLINE int __Pyx_CheckKeywordStrings( PyObject *kwdict, const char* function_name, int kw_allowed) { PyObject* key = 0; Py_ssize_t pos = 0; while (PyDict_Next(kwdict, &pos, &key, 0)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) #endif goto invalid_keyword_type; } if ((!kw_allowed) && unlikely(key)) goto invalid_keyword; return 1; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); return 0; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif return 0; } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AS_STRING(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; } else { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { #endif goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) break; #endif } if (*name) { values[name-argnames] = value; } else { /* unexpected keyword found */ for (name=argnames; name != first_kw_arg; name++) { if (**name == key) goto arg_passed_twice; #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } } } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, **name); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); } static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; } static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *local_type, *local_value, *local_tb; PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; PyErr_NormalizeException(&local_type, &local_value, &local_tb); if (unlikely(tstate->curexc_type)) goto bad; #if PY_MAJOR_VERSION >= 3 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; #endif *type = local_type; *value = local_value; *tb = local_tb; Py_INCREF(local_type); Py_INCREF(local_value); Py_INCREF(local_tb); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; /* Make sure tstate is in a consistent state when we XDECREF these objects (XDECREF may run arbitrary code). */ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); return 0; bad: *type = 0; *value = 0; *tb = 0; Py_XDECREF(local_type); Py_XDECREF(local_value); Py_XDECREF(local_tb); return -1; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); } static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: Py_XDECREF(empty_list); Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { PyObject *metaclass; /* Default metaclass */ #if PY_MAJOR_VERSION < 3 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { PyObject *base = PyTuple_GET_ITEM(bases, 0); metaclass = PyObject_GetAttrString(base, (char *)"__class__"); if (!metaclass) { PyErr_Clear(); metaclass = (PyObject*) Py_TYPE(base); } } else { metaclass = (PyObject *) &PyClass_Type; } #else if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { PyObject *base = PyTuple_GET_ITEM(bases, 0); metaclass = (PyObject*) Py_TYPE(base); } else { metaclass = (PyObject *) &PyType_Type; } #endif Py_INCREF(metaclass); return metaclass; } static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, PyObject *modname) { PyObject *result; PyObject *metaclass; if (PyDict_SetItemString(dict, "__module__", modname) < 0) return NULL; /* Python2 __metaclass__ */ metaclass = PyDict_GetItemString(dict, "__metaclass__"); if (metaclass) { Py_INCREF(metaclass); } else { metaclass = __Pyx_FindPy2Metaclass(bases); } result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL); Py_DECREF(metaclass); return result; } static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint64_t(uint64_t val) { const uint64_t neg_one = (uint64_t)-1, const_zero = (uint64_t)0; const int is_unsigned = const_zero < neg_one; if ((sizeof(uint64_t) == sizeof(char)) || (sizeof(uint64_t) == sizeof(short))) { return PyInt_FromLong((long)val); } else if ((sizeof(uint64_t) == sizeof(int)) || (sizeof(uint64_t) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); } else if (sizeof(uint64_t) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); } else { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; return _PyLong_FromByteArray(bytes, sizeof(uint64_t), little, !is_unsigned); } } static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject* x) { const uint64_t neg_one = (uint64_t)-1, const_zero = (uint64_t)0; const int is_unsigned = const_zero < neg_one; if (sizeof(uint64_t) == sizeof(char)) { if (is_unsigned) return (uint64_t)__Pyx_PyInt_AsUnsignedChar(x); else return (uint64_t)__Pyx_PyInt_AsSignedChar(x); } else if (sizeof(uint64_t) == sizeof(short)) { if (is_unsigned) return (uint64_t)__Pyx_PyInt_AsUnsignedShort(x); else return (uint64_t)__Pyx_PyInt_AsSignedShort(x); } else if (sizeof(uint64_t) == sizeof(int)) { if (is_unsigned) return (uint64_t)__Pyx_PyInt_AsUnsignedInt(x); else return (uint64_t)__Pyx_PyInt_AsSignedInt(x); } else if (sizeof(uint64_t) == sizeof(long)) { if (is_unsigned) return (uint64_t)__Pyx_PyInt_AsUnsignedLong(x); else return (uint64_t)__Pyx_PyInt_AsSignedLong(x); } else if (sizeof(uint64_t) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return (uint64_t)__Pyx_PyInt_AsUnsignedLongLong(x); else return (uint64_t)__Pyx_PyInt_AsSignedLongLong(x); } else { uint64_t val; PyObject *v = __Pyx_PyNumber_Int(x); #if PY_VERSION_HEX < 0x03000000 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } return (uint64_t)-1; } } static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); #if PY_MAJOR_VERSION < 3 ctx = PyString_FromString(name); #else ctx = PyUnicode_FromString(name); #endif __Pyx_ErrRestore(old_exc, old_val, old_tb); if (!ctx) { PyErr_WriteUnraisable(Py_None); } else { PyErr_WriteUnraisable(ctx); Py_DECREF(ctx); } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) PyObject *ob = PyCapsule_New(vtable, 0, 0); #else PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); #endif if (!ob) goto bad; if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) goto bad; Py_DECREF(ob); return 0; bad: Py_XDECREF(ob); return -1; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; #if PY_MAJOR_VERSION < 3 py_name = PyString_FromString(class_name); #else py_name = PyUnicode_FromString(class_name); #endif if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; #if PY_MAJOR_VERSION < 3 py_name = PyString_FromString(name); #else py_name = PyUnicode_FromString(name); #endif if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ pymtbl-0.4.1/setup.py0000755002364700236470000000215213135451747014454 0ustar reedreed00000000000000#!/usr/bin/env python NAME = 'pymtbl' VERSION = '0.4.1' from distutils.core import setup from distutils.extension import Extension def pkgconfig(*packages, **kw): import subprocess flag_map = { '-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries' } pkg_config_cmd = 'pkg-config --cflags --libs "%s"' % ' '.join(packages) for token in subprocess.check_output(pkg_config_cmd, shell=True).split(): flag = token[:2] arg = token[2:] if flag in flag_map: kw.setdefault(flag_map[flag], []).append(arg) return kw try: from Cython.Distutils import build_ext setup( name = NAME, version = VERSION, ext_modules = [ Extension('mtbl', ['mtbl.pyx'], **pkgconfig('libmtbl >= 1.1.0')) ], cmdclass = {'build_ext': build_ext}, ) except ImportError: import os if os.path.isfile('mtbl.c'): setup( name = NAME, version = VERSION, ext_modules = [ Extension('mtbl', ['mtbl.c'], **pkgconfig('libmtbl >= 0.8.0')) ], ) else: raise pymtbl-0.4.1/PKG-INFO0000644002364700236470000000026413135453410014023 0ustar reedreed00000000000000Metadata-Version: 1.0 Name: pymtbl Version: 0.4.1 Summary: UNKNOWN Home-page: UNKNOWN Author: UNKNOWN Author-email: UNKNOWN License: UNKNOWN Description: UNKNOWN Platform: UNKNOWN pymtbl-0.4.1/mtbl.pxi0000644002364700236470000001004213121024350014371 0ustar reedreed00000000000000cimport cython from cpython cimport bool from cpython.string cimport * from libc.stddef cimport * from libc.stdint cimport * from libc.stdlib cimport * from libc.string cimport * cdef extern from "mtbl.h": ctypedef enum mtbl_res: mtbl_res_failure mtbl_res_success ctypedef enum mtbl_compression_type: MTBL_COMPRESSION_NONE MTBL_COMPRESSION_SNAPPY MTBL_COMPRESSION_ZLIB MTBL_COMPRESSION_LZ4 MTBL_COMPRESSION_LZ4HC struct mtbl_iter: pass struct mtbl_source: pass struct mtbl_reader: pass struct mtbl_reader_options: pass struct mtbl_writer: pass struct mtbl_writer_options: pass struct mtbl_merger: pass struct mtbl_merger_options: pass struct mtbl_sorter: pass struct mtbl_sorter_options: pass ctypedef void (*mtbl_merge_func)(void *clos, uint8_t *, size_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t **, size_t *) # iter void mtbl_iter_destroy(mtbl_iter **) nogil mtbl_res mtbl_iter_next(mtbl_iter *, uint8_t **, size_t *, uint8_t **, size_t *) nogil # source mtbl_iter *mtbl_source_iter(mtbl_source *) nogil mtbl_iter *mtbl_source_get(mtbl_source *, uint8_t *, size_t) nogil mtbl_iter *mtbl_source_get_range(mtbl_source *, uint8_t *, size_t, uint8_t *, size_t) nogil mtbl_iter *mtbl_source_get_prefix(mtbl_source *, uint8_t *, size_t) nogil mtbl_res mtbl_source_write(mtbl_source *, mtbl_writer *) nogil # reader mtbl_reader *mtbl_reader_init(char *, mtbl_reader_options *) nogil void mtbl_reader_destroy(mtbl_reader **) nogil mtbl_source *mtbl_reader_source(mtbl_reader *) nogil mtbl_reader_options *mtbl_reader_options_init() nogil void mtbl_reader_options_destroy(mtbl_reader_options **) nogil void mtbl_reader_options_set_verify_checksums(mtbl_reader_options *, bool) nogil # writer mtbl_writer *mtbl_writer_init(char *, mtbl_writer_options *) nogil void mtbl_writer_destroy(mtbl_writer **) nogil mtbl_res mtbl_writer_add(mtbl_writer *, uint8_t *, size_t, uint8_t *, size_t) nogil mtbl_writer_options *mtbl_writer_options_init() nogil void mtbl_writer_options_destroy(mtbl_writer_options **) nogil void mtbl_writer_options_set_compression(mtbl_writer_options *, mtbl_compression_type) nogil void mtbl_writer_options_set_block_size(mtbl_writer_options *, size_t) nogil void mtbl_writer_options_set_block_restart_interval(mtbl_writer_options *, size_t) nogil # merger mtbl_merger *mtbl_merger_init(mtbl_merger_options *) nogil void mtbl_merger_destroy(mtbl_merger **) nogil void mtbl_merger_add_source(mtbl_merger *, mtbl_source *) nogil mtbl_source *mtbl_merger_source(mtbl_merger *) nogil mtbl_merger_options *mtbl_merger_options_init() nogil void mtbl_merger_options_destroy(mtbl_merger_options **) nogil void mtbl_merger_options_set_merge_func(mtbl_merger_options *, mtbl_merge_func, void *) nogil # sorter mtbl_sorter *mtbl_sorter_init(mtbl_sorter_options *) nogil void mtbl_sorter_destroy(mtbl_sorter **) nogil mtbl_res mtbl_sorter_add(mtbl_sorter *, uint8_t *, size_t, uint8_t *, size_t) nogil mtbl_res mtbl_sorter_write(mtbl_sorter *, mtbl_writer *) nogil mtbl_iter *mtbl_sorter_iter(mtbl_sorter *) nogil mtbl_sorter_options *mtbl_sorter_options_init() nogil void mtbl_sorter_options_destroy(mtbl_sorter_options **) nogil void mtbl_sorter_options_set_merge_func(mtbl_sorter_options *, mtbl_merge_func, void *) nogil void mtbl_sorter_options_set_temp_dir(mtbl_sorter_options *, char *) nogil void mtbl_sorter_options_set_max_memory(mtbl_sorter_options *, size_t) nogil # varint unsigned mtbl_varint_length(uint64_t) nogil unsigned mtbl_varint_length_packed(uint8_t *, size_t) nogil size_t mtbl_varint_encode32(uint8_t *, uint32_t) nogil size_t mtbl_varint_encode64(uint8_t *, uint64_t) nogil size_t mtbl_varint_decode32(uint8_t *, uint32_t *) nogil size_t mtbl_varint_decode64(uint8_t *, uint64_t *) nogil pymtbl-0.4.1/COPYRIGHT0000644002364700236470000000107713121024350014214 0ustar reedreed00000000000000Copyright (c) 2012-2014 by Farsight Security, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.