diff --git a/.gitattributes b/.gitattributes new file mode 100755 index 0000000..306fcb3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +textadapter/_version.py export-subst diff --git a/.gitignore b/.gitignore index e09fd44..b107eed 100644 --- a/.gitignore +++ b/.gitignore @@ -57,12 +57,11 @@ Thumbs.db # Specific cython generated c files ###################### -iopro/textadapter/TextAdapter.c -iopro/mongoadapter/MongoAdapter.c +textadapter/core/TextAdapter.c # Generated data files for /tests and /examples -iopro/tests/data/fixedwidths -iopro/tests/data/floats -iopro/tests/data/ints -iopro/tests/data/ints.gz -iopro/tests/data/missingvalues +textadapter/tests/data/fixedwidths +textadapter/tests/data/floats +textadapter/tests/data/ints +textadapter/tests/data/ints.gz +textadapter/tests/data/missingvalues diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 140e724..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,388 +0,0 @@ -TextAdapter Release Notes -========================= - -2016-10-30: 2.0.0 ------------------ - -* Release the closed source of IOPro as Freee Software. Touch up some -naming issues and small tweaks to build scripts, documentation, etc. - - -IOPro Release Notes -=================== - -2016-07-30: 1.9.0 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Remove warnings and documentation for unsupported Numba use -* Rewrite most documentation for clarity and accuracy -* Improve unit tests - - -2016-04-05: 1.8.0: -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-------- -======= -------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Add PostgresAdapter for reading data from PostgreSQL databases -* Add AccumuloAdapter for reading data from Accumulo databases - - -2015-10-09: 1.7.2: -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-------- -======= -------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix an issue with pyodbc where result NumPy arrays could return - uninitialized data after the actual data null character. Now it pads - the results with nulls. - - -2015-05-04: 1.7.1 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Properly cache output string objects for better performance - - -2015-03-02: 1.7.0 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-------- -======= -------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Add Python 3 support -* Add support for parsing utf8 text files -* Add ability to set/get field types in MongoAdapter - - -2015-02-02: 1.6.11 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-------- -======= -------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue with escape char not being parsed correctly inside quoted strings - - -2014-12-17: 1.6.10 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-------- -======= -------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue with using field filters with json parser - - -2014-12-02: 1.6.9 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue with json field names getting mixed up - - -2014-11-20: 1.6.8 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue with return nulls returning wrong "null" for large queries - (more than 10000 rows) in some circumstances. -* Fix issue with reading slices of json data -* Change json parser so that strings fields of numbers do not get converted - to number type by default -* Allow json field names to be specified with field_names constructor - argument -* If user does not specify json field names, use json attribute names as - field names in array result - - -2014-07-03: 1.6.7 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue when reading more than 10000 rows containing unicode strings in platform where ODBC uses UTF-16/UCS2 encoding (notably Windows and unixODBC). The resulting data could be corrupt. - - -2014-06-16: 1.6.6 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix possible segfault when dealing with unicode strings in platforms where ODBC uses UTF-16/UCS2 encoding (notably Windows and unixODBC) -* Add iopro_set_text_limit function to iopro. It globally limits the size of text fields read by fetchdictarray and fetchsarray. By default it is set to 1024 characters. -* Fix possible segfault in fetchdictarray and fetchsarray when failing to allocate some NumPy array. This could notably happen in the presence of "TEXT" fields. Now it will raise an OutOfMemory error. -* Add lazy loading of submodules in IOPro. This reduces upfront import time of IOPro. Features are imported as they are used for the first time. - - -2014-05-07: 1.6.5 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix crash when building textadapter index - - -2014-04-29: 1.6.4 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix default value for null strings in IOPro/pyodbc changed to be an empty string instead of 'NA'. NA was not appropriate as it can collide with valid data (Namibia country code is 'NA', for example), and it failed with single character columns. -* Ignore SQlRowCount when performing queries with fetchsarray and fetchdictarray, since SQLRowCount sometimes returns incorrect number of rows. - - -2014-03-25: 1.6.3 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix SQL TINYINT is now returned as an unsigned 8 bit integer in fetchdictarray/fetchsarray. This is to match the range specified in SQL (0...255). It was being returned as a signed 8 bit integer before (range -128...127) -* Add Preliminary unicode string support in fetchdictarray/fetchsarray. - - -2014-02-12: 1.6.2 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Disable Numba support for version 0.12 due to lack of string support. - - -2014-01-30: 1.6.1 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix a regression that made possible some garbage in string fields when using fetchdictarray/fetchsarray. -* Fix a problem where heap corruption could happen in IOPro.pyodbc fetchdictarray/fetchsarray related to nullable string fields. -* Fix the allocation guard debugging code: iopro.pyodbc.enable_mem_guards(True|False) should no longer crash. -* Merge Vertica fix for cancelling queries - - -2013-10-30: 1.6.0 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Add JSON support -* Misc bug fixes -* Fix crash in IOPro.pyodbc when dealing with nullable datetimes in fetch_dictarray and fetch_sarray. - - -2013-06-12: 1.5.5 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue parsing negative ints with leading whitespace in csv data. - - -2013-06-10: 1.5.4 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Allow delimiter to be set to None for csv files with single field. -* Fill in missing csv fields with fill values. -* Fill in blank csv lines with fill values for pandas dataframe output. -* Allow list of field names for TextAdapter field_names parameter. -* Change default missing fill value to empty string for string fields. - - -2013-06-05: 1.5.3 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Temporary fix for IndexError exception in TextAdapter.__read_slice method. - - -2013-05-28: 1.5.2 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Add ability to specify escape character in csv data - - -2013-05-23: 1.5.1 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* fixed coredump when using datetime with numpy < 1.7 - - -2013-05-22: 1.5.0 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Added a cancel method to the Cursor object in iopro.pyodbc. - This method wraps ODBC SQLCancel. -* DECIMAL and NUMERIC types are now working on iopro.pyodbc on regular fetch - functions. They are still unsupported in fetchsarray and fetchdict and - fetchsarray -* Add ftp support -* Performance improvements to S3 support -* Misc bug fixes - - -2013-04-05: 1.4.3 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Update loadtxt and genfromtxt to reflect numpy versions' behavior - for dealing with whitespace (default to any whitespace as delimiter, - and treat multiple whitespace as one delimiter) -* Add read/write field_names property -* Add support for pandas dataframes as output -* Misc bug fixes diff --git a/README.md b/README.md index f7f4e22..9813509 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -<<<<<<< HEAD # Working Efficiently with Big Data in Text Formats Using Free Software One of our first commercial software products at Continuum Analytics was a product called *IOPro* which we have sold continuously since 2009. Now we are releasing the code under a liberal open source license. @@ -11,50 +10,39 @@ We don't only hope this code is useful to you, however, we also hope you—or yo IOPro loads NumPy arrays and Pandas DataFrames directly from files, SQL databases and NoSQL stores–including ones with millions (or billions) of rows. It provides a drop-in replacement for NumPy data loading functions but dramatically improves performance and starkly reduces memory overhead. -The key concept in our code is that we access data via *adapters* which are something like enhanced file handles or database cursors. An adapter does not read data directly into memory, but rather provides a mechanism to use familiar NumPy/Pandas slicing syntax to load manageable segments of a large dataset. Moreover, an adapter provides fine-grained control over exactly *how* data is eventually read into memory, whether using custom patterns for how a line of data is parsed, choosing the precise data type of a textually represented number, or exposing data as "calculated fields" (that is, "virtual columns"). +The key concept in our code is that we access data via *adapters* which are something like enhanced file handles or database cursors. An adapter does not read data directly into memory, but rather provides a mechanism to use familiar NumPy/Pandas slicing syntax to load manageable segments of a large dataset. Moreover, an adapter provides fine-grained control over exactly *how* data is eventually read into memory, whether using custom patterns for how a line of data is parsed, choosing the precise data type of a textually represented number, or exposing data as "calculated fields" (that is, "virtual columns"). -As well as local CSV, JSON or other textual data sources, IOPro can load data from Amazon S3 buckets. When accessing large datasets—especially ones too large to load into memory—from files that do not have fixed record sizes, IOPro's indexing feature allows users to seek to a specific collection of records tens, hundreds or thousands of times faster than is possible with a linear scan. +As well as local CSV, JSON or other textual data sources, IOPro can load data from Amazon S3 buckets. When accessing large datasets—especially ones too large to load into memory—from files that do not have fixed record sizes, IOPro's indexing feature allows users to seek to a specific collection of records tens, hundreds or thousands of times faster than is possible with a linear scan. ## Our release schedule -The intial release of our open source code will be of the TextAdapter component that makes up the better part of the code in IOPro. This code will be renamed—straightforwardly enough—as **TextAdapter**. The project will live at https://github.com/ContinuumIO/TextAdapter. We will make this forked project available by October 15, 2016 under a BSD 3-Clause License. +The intial release of our open source code will be of the TextAdapter component that makes up the better part of the code in IOPro. This code will be renamed—straightforwardly enough—as **TextAdapter**. The project will live at https://github.com/ContinuumIO/TextAdapter. We will make this forked project available by October 15, 2016 under a BSD 3-Clause License. -Continuum is evaluating the details of our release of the database adapters, but will definitely make the code (though possibly unrefined) available by December 31, 2016. Our main hesitations with releasing the database adapters is that the state of the art in Python database adapters has advanced considerably since 2009, and we do not want to advocate a codebase unless it is currently best-of-breed (at very least for some niche use case). At worst, we will still release the code as an historical artifact. That project will live at https://github.com/ContinuumIO/DBAdapter. +Continuum is evaluating the details of our release of the database adapters, but will definitely make the code (though possibly unrefined) available by December 31, 2016. Our main hesitations with releasing the database adapters is that the state of the art in Python database adapters has advanced considerably since 2009, and we do not want to advocate a codebase unless it is currently best-of-breed (at very least for some niche use case). At worst, we will still release the code as an historical artifact. That project will live at https://github.com/ContinuumIO/DBAdapter. If you are a current paid customer of IOPro, and are due for renewal before January 1, 2017, your sales rep will get in touch with you for renewal arrangements. We will continue to monitor and reply to issues and discussion about these successor projects at their GitHub repositories. -Thank you to prior contributors at Continuum, especially Jay Bourque (jayvius), but notably also Francesc Alted (FrancescAlted), Óscar Villellas Guillén (ovillellas), Michael Kleehammer (mkleehammer) and Ilan Schnell (ilanschnell) for their wonderful contributions. Any remaining bugs are my responsibility alone as current maintainer of the project. +Thank you to prior contributors at Continuum, especially Jay Bourque (jayvius), but notably also Francesc Alted (FrancescAlted), Óscar Villellas Guillén (ovillellas), Michael Kleehammer (mkleehammer) and Ilan Schnell (ilanschnell) for their wonderful contributions. Any remaining bugs are my responsibility alone as current maintainer of the project. ## The Blaze ecosystem -As part of the open source release of TextAdapter, we plan to integrate TextAdapter into the Blaze ecosystem. Blaze itself, as well as odo, provide translation between data formats and querying of data within a large variety of formats. Putting TextAdapter clearly in this ecosystem will let an *adapter* act as one such data format, and hence leverage the indexing speedups and data massaging that TextAdapter provides. +As part of the open source release of TextAdapter, we plan to integrate TextAdapter into the Blaze ecosystem. Blaze itself, as well as odo, provide translation between data formats and querying of data within a large variety of formats. Putting TextAdapter clearly in this ecosystem will let an *adapter* act as one such data format, and hence leverage the indexing speedups and data massaging that TextAdapter provides. -## Other open source tools - -Other open source projects for interacting with large datasets provide either competitors or collaborative capabilities. - -* The **ParaText** from Wise Technology looks like a very promising approach to accelerating raw reads of CSV data. It doesn't currently provide regular expression matching nor as rich data typing as IOPro, but the raw reads are shockingly fast. Most importantly, perhaps, ParaText does not address indexing, so as fast as it is at linear scan, it remains stuck with big-O inefficiencies that TextAdapter addresses. I personally think that (optionally) utilizing the underlying reader of ParaText as a layer underneath TextAdapter would be a wonderful combination. Information about ParaText can be found at http://www.wise.io/tech/paratext -Database access is almost always I/O bound rather than CPU bound, and hence the likely wins are by switching to asynchronous frameworks. This *does* involve using a somewhat different programming style than synchronous adapters, but some recent ones look amazingly fast. I am not yet sure whether it is worthwhile to create IOPro style adapters around these `asyncio`-based interfaces. -* **asyncpg** is a database interface library designed specifically for PostgreSQL and Python/asyncio. asyncpg is an efficient, clean implementation of PostgreSQL server binary protocol. Information about asyncpg can be found at https://magicstack.github.io/asyncpg/current/. -* **Motor** presents a callback- or Future-based API for non-blocking access to MongoDB from Tornado or asyncio. Information about Motor can be found at http://motor.readthedocs.io/en/stable/. -======= -TextAdapter -====== +## TextAdapter TextAdapter is a Python module containing optimized data adapters for importing data from a variety of data sources into NumPy arrays and Pandas -DataFrame. Current data adapters include TextAdapter for JSON, free-form, -and CSV-like text files. DBAdapter, also based on IOPro, accesses +DataFrame. Current data adapters include TextAdapter for JSON, free-form, +and CSV-like text files. DBAdapter, also based on IOPro, accesses MongoAdapter for mongo databases, PostgresAdapter for PostgreSQL databases, AccumuloAdapter for Accumulo databases, and an optimized pyodbc module for accessing any relational database that supports the ODBC interface (SQL Server, PostgreSQL, MySQL, etc). -Build Requirements ------------------- +## Build Requirements Building TextAdapter requires a number of dependencies. In addition to a C/C++ dev environment, the following modules are needed, which can be @@ -65,52 +53,62 @@ installed via conda. * zlib 1.2.8 (C lib) * pcre 8.31 (C lib) -Building Conda Package ----------------------- +## Building Conda Package Note: If building under Windows, make sure the following commands are issued within the Visual Studio command prompt for version of Visual Studio that -matches the version of Python you're building for. Python 2.6 and 2.7 needs +matches the version of Python you're building for. Python 2.6 and 2.7 needs Visual Studio 2008, Python 3.3 and 3.4 needs Visual Studio 2010, and Python 3.5 needs Visual Studio 2015. -* Build TextAdapter using the following command: +1. Build TextAdapter using the following command: `conda build buildscripts/condarecipe --python 3.5` -* TextAdapter can now be installed from the built conda package: - `conda install iopro --use-local` +1. TextAdapter can now be installed from the built conda package: + `conda install textadapter --use-local` -Building By Hand ----------------- +## Building By Hand Note: If building under Windows, make sure the following commands are issued within the Visual Studio command prompt for version of Visual Studio that -matches the version of Python you're building for. Python 2.6 and 2.7 needs +matches the version of Python you're building for. Python 2.6 and 2.7 needs Visual Studio 2008, Python 3.3 and 3.4 needs Visual Studio 2010, and Python 3.5 needs Visual Studio 2015. For building TextAdapter for local development/testing: 1. Install most of the above dependencies into environment called - 'TextAdapter': `conda env create -f environment.yml` + 'textadapter': `conda env create -f environment.yml` Be sure to activate new TextAdapter environment before proceeding. -2. Build TextAdapter using Cython/distutils: +1. Build TextAdapter using Cython/distutils: `python setup.py build_ext --inplace` -Testing -------- +## Testing -Tests can be run by calling the iopro module's test function. By default +Tests can be run by calling the iopro module's test function. By default only the TextAdapter tests will be run: ```python -python -Wignore -c 'import iopro; iopro.test()' +python -Wignore -c 'import textadapter; textadapter.test()' ``` (Note: `numpy.testing` might produce a FurtureWarning that is not directly -relevant to these unit tests). +relevant to these unit tests) + + + + +## Other open source tools + +Other open source projects for interacting with large datasets provide either competitors or collaborative capabilities. + +* The **ParaText** from Wise Technology looks like a very promising approach to accelerating raw reads of CSV data. It doesn't currently provide regular expression matching nor as rich data typing as IOPro, but the raw reads are shockingly fast. Most importantly, perhaps, ParaText does not address indexing, so as fast as it is at linear scan, it remains stuck with big-O inefficiencies that TextAdapter addresses. I personally think that (optionally) utilizing the underlying reader of ParaText as a layer underneath TextAdapter would be a wonderful combination. Information about ParaText can be found at http://www.wise.io/tech/paratext + +Database access is almost always I/O bound rather than CPU bound, and hence the likely wins are by switching to asynchronous frameworks. This *does* involve using a somewhat different programming style than synchronous adapters, but some recent ones look amazingly fast. I am not yet sure whether it is worthwhile to create IOPro style adapters around these `asyncio`-based interfaces. + +* **asyncpg** is a database interface library designed specifically for PostgreSQL and Python/asyncio. asyncpg is an efficient, clean implementation of PostgreSQL server binary protocol. Information about asyncpg can be found at https://magicstack.github.io/asyncpg/current/. ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c +* **Motor** presents a callback- or Future-based API for non-blocking access to MongoDB from Tornado or asyncio. Information about Motor can be found at http://motor.readthedocs.io/en/stable/. diff --git a/TEXTADAPTER_DEV.md b/TEXTADAPTER_DEV.md index 34d135e..f903597 100644 --- a/TEXTADAPTER_DEV.md +++ b/TEXTADAPTER_DEV.md @@ -47,17 +47,9 @@ functions are also implemented for parsing lines and records as single string values (a record can be multiple lines). Key Low Level C Data Structures -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-------- ======= -------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c -TextAdapter (iopro/textadapter/text_adapter.h): +TextAdapter (textadapter/core/text_adapter.h): Core struct for text parser. Contains attributes for input text such as delimiter character, comment character, etc. tokenize field is a function @@ -65,27 +57,19 @@ TextAdapter (iopro/textadapter/text_adapter.h): delimited, fixed width, etc). Also contains pointers to InputDatastruct and TextAdapterBuffer described below. -InputData (iopro/textadapter/text_adapter.h): +InputData (textadapter/core/text_adapter.h): Contains function pointers for IO functions (open, read, seek, close) and for compressed data read and seek functions. Also contains a void *input field for storing a data structure specific to each data source (C FILE pointer, S3 bucket info, etc). -TextAdapterBuffer (iopro/textadapter/text_adapter.h): +TextAdapterBuffer (textadapter/core/text_adapter.h): Main buffer for storing text data to be parsed. Ideas for Future Optimizations -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 ======= ------------------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - The biggest performance gains could be had by incorporating some parallel processing goodness. The most natural way to split it up (this should diff --git a/TextAdapter-env.yml b/TextAdapter-env.yml deleted file mode 100644 index b82bc83..0000000 --- a/TextAdapter-env.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: TextAdapter -dependencies: -- thrift=0.9.3=py35_2 -- anaconda-client=1.4.0=py35_0 -- appnope=0.1.0=py35_0 -- boost=1.60.0=py35_0 -- boto=2.40.0=py35_0 -- clyent=1.2.2=py35_0 -- cython=0.24.1=py35_0 -- decorator=4.0.10=py35_0 -- unixodbc=2.3.4=0 -- openssl=1.0.2h=1 -- pip=8.1.2=py35_0 -- readline=6.2=2 -- setuptools=23.0.0=py35_0 -- sqlite=3.13.0=0 -- tk=8.5.18=0 -- wheel=0.29.0=py35_0 -- zlib=1.2.8=3 -- icu=54.1=0 -- ipython=5.0.0=py35_0 -- ipython_genutils=0.1.0=py35_0 -- llvmlite=0.11.0=py35_0 -- postgresql=9.1.4=0 -- mkl=11.3.3=0 -- mongo-driver=0.7.1=0 -- nose=1.3.7=py35_1 -- numba=0.26.0=np110py35_0 -- numpy=1.10.4=py35_2 -- pandas=0.18.1=np110py35_0 -- path.py=8.2.1=py35_0 -- pcre=8.39=0 -- pexpect=4.0.1=py35_0 -- pickleshare=0.7.2=py35_0 -- prompt_toolkit=1.0.3=py35_0 -- ptyprocess=0.5.1=py35_0 -- py=1.4.31=py35_0 -- pygments=2.1.3=py35_0 -- pytest=2.9.2=py35_0 -- python=3.5.2=0 -- python-dateutil=2.5.3=py35_0 -- python.app=1.2=py35_4 -- pytz=2016.6.1=py35_0 -- pyyaml=3.11=py35_4 -- requests=2.10.0=py35_0 -- simplegeneric=0.8.1=py35_1 -- six=1.10.0=py35_0 -- traitlets=4.2.2=py35_0 -- wcwidth=0.1.7=py35_0 -- xz=5.2.2=0 -- yaml=0.1.6=0 -- pip: - - ipython-genutils==0.1.0 - - prompt-toolkit==1.0.3 - diff --git a/TextAdapter/__init__.py b/TextAdapter/__init__.py deleted file mode 100644 index 6f16126..0000000 --- a/TextAdapter/__init__.py +++ /dev/null @@ -1,137 +0,0 @@ -""" - TextAdapter - ~~~~~ - - TextAdapter provides tools to work with large data files in a fast, - memory-efficient way. -""" - -from __future__ import absolute_import - -from types import ModuleType -import sys -from ._version import get_versions -import os - -__version__ = get_versions()['version'] -del get_versions - -module_to_attr_dict = { - 'TextAdapter.textadapter.TextAdapter': - ['ArrayDealloc', 'CSVTextAdapter', - 'FixedWidthTextAdapter', 'JSONTextAdapter', - 'RegexTextAdapter', 's3_text_adapter', - 'text_adapter'], - 'TextAdapter.textadapter.loadtxt': - ['loadtxt'], - 'TextAdapter.textadapter.genfromtxt': - ['genfromtxt'], - 'TextAdapter.lib.errors': - ['AdapterException', 'AdapterIndexError', - 'ArgumentError', 'ConfigurationError', - 'DataIndexError', 'DataTypeError', - 'InternalInconsistencyError', 'NoSuchFieldError', - 'ParserError', 'SourceError', 'SourceNotFoundError'] -} - -attr_to_module_dict = {} -for module, items in module_to_attr_dict.items(): - for item in items: - attr_to_module_dict[item] = module - - -meta_attr = { - '__file__': __file__, - '__package__': __name__, - '__path__': __path__, - '__doc__': __doc__, - '__version__': __version__, - '__all__': tuple([key for key in attr_to_module_dict.keys()] + - ['textadapter', 'mongoadapter', 'postgresadapter'] + - ['test', 'test_mongo', 'test_postgres', 'test_accumulo']) -} - -class module(ModuleType): - """ - The actual TextAdapter module. It provides lazy-loading of submodules. - Import time is only paid for those submodules used - """ - - def __getattr__(self, name): - module_to_load = attr_to_module_dict.get(name) - if module_to_load is not None: - __import__(module_to_load) - module = sys.modules[module_to_load] - for attr in module_to_attr_dict[module_to_load]: - setattr(self, attr, getattr(module, attr)) - return ModuleType.__getattribute__(self, name) - - def __dir__(self): - loaded = set(meta_attr.keys()) - potentially_not_loaded = set(self.__all__) - return sorted(loaded | potentially_not_loaded) - - def test(self, verbosity=1, num_records=100000, results = []): - - from .tests.test_TextAdapter import run as run_textadapter_tests - result_text = run_textadapter_tests(verbosity=verbosity, - num_records=num_records) - results.append(result_text) - - from .tests.test_io import run as run_io_tests - result_text = run_io_tests(verbosity=verbosity) - results.append(result_text) - - for result in results: - if not result.wasSuccessful(): - return False - return True - - def test_mongo(self, host='localhost', port=27017, verbosity=2): - from .tests.test_MongoAdapter import run as run_mongo_tests - return run_mongo_tests(verbosity, host, port) - - def test_postgres(self, host, dbname, user, verbose=True): - import pytest - test_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'tests') - postgres_test_script = 'test_PostgresAdapter.py' - args = [] - args.append(os.path.join(test_dir, postgres_test_script)) - args.append('--pg_host {0}'.format(host)) - args.append('--pg_dbname {0}'.format(dbname)) - args.append('--pg_user {0}'.format(user)) - if verbose: - args.append('-v') - - result = pytest.main(' '.join(args)) - if result == 0: - return True - return False - - def test_accumulo(self, host, user, password, verbose=True): - import pytest - test_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'tests') - accumulo_test_script = 'test_AccumuloAdapter.py' - args = [] - args.append(os.path.join(test_dir, accumulo_test_script)) - args.append('--acc_host {0}'.format(host)) - args.append('--acc_user {0}'.format(user)) - args.append('--acc_password {0}'.format(password)) - if verbose: - args.append('-v') - - result = pytest.main(' '.join(args)) - if result == 0: - return True - return False - - -new_module = module(__name__) -new_module.__dict__.update(meta_attr) - -# this is somewhat magic, if not present it seems that the old module gets -# disposed causing problems. -_old_module = sys.modules[__name__] -# replace the module with our module class -sys.modules[__name__] = new_module - diff --git a/TextAdapter/db.py b/TextAdapter/db.py deleted file mode 100644 index cf9e067..0000000 --- a/TextAdapter/db.py +++ /dev/null @@ -1 +0,0 @@ -from pyodbc import * diff --git a/TextAdapter/tests/setup_accumulo_data.py b/TextAdapter/tests/setup_accumulo_data.py deleted file mode 100755 index f709364..0000000 --- a/TextAdapter/tests/setup_accumulo_data.py +++ /dev/null @@ -1,41 +0,0 @@ -import pyaccumulo - -conn = pyaccumulo.Accumulo('172.17.0.2', port=42424, user='root', password='secret') - -def create_table(name, start, stop): - global conn - if conn.table_exists(name): - conn.delete_table(name) - conn.create_table(name) - - writer = conn.create_batch_writer(name) - for i in range(start, stop): - if name == 'uints': - value = '{0:06d}'.format(i) - elif name == 'ints': - value = '{0:06d}'.format(i) - elif name == 'floats': - value = '{0:07f}'.format(i + 0.5) - elif name == 'strings': - value = 'xxx' + str(i) - elif name == 'missing_data': - if i % 2 == 0: - value = 'NA' - elif i % 3 == 0: - value = 'nan' - else: - value = '{0:06d}'.format(i) - else: - raise ValueError('invalid table name') - m = pyaccumulo.Mutation('row{0:06d}'.format(i - start)) - m.put(cf='f{0:06d}'.format(i - start), cq='q{0:06d}'.format(i - start), val=value) - writer.add_mutation(m) - writer.close() - -create_table('uints', 0, 100000) -create_table('ints', -50000, 50000) -create_table('floats', -50000, 50000) -create_table('strings', 0, 100000) -create_table('missing_data', 0, 12) - -conn.close() diff --git a/TextAdapter/tests/setup_postgresql_data.py b/TextAdapter/tests/setup_postgresql_data.py deleted file mode 100644 index 9bd13fc..0000000 --- a/TextAdapter/tests/setup_postgresql_data.py +++ /dev/null @@ -1,170 +0,0 @@ -import psycopg2 -import numpy as np -import string - -CASTS_TEST_NUM_RECORDS = 23456 - -if __name__ == '__main__': - conn = psycopg2.connect('host=localhost dbname=postgres user=jayvius') - conn.set_isolation_level(0) - cursor = conn.cursor() - cursor.execute('create database unit_tests') - conn.set_isolation_level(1) - conn.close() - - conn = psycopg2.connect('host=localhost dbname=unit_tests user=jayvius') - - cursor = conn.cursor() - cursor.execute('CREATE EXTENSION postgis') - cursor.execute('CREATE EXTENSION postgis_topology') - - cursor.execute('create table ints_test (int2 smallint, int4 integer, int8 bigint)') - cmd = 'insert into ints_test (int2, int4, int8) values ({0}, {1}, {2})' - cursor.execute(cmd.format(np.iinfo(np.int16).min, np.iinfo(np.int32).min, np.iinfo(np.int64).min)) - cursor.execute(cmd.format(0, 0, 0)) - cursor.execute(cmd.format(np.iinfo(np.int16).max, np.iinfo(np.int32).max, np.iinfo(np.int64).max)) - - cursor.execute('create table serial_test (int2 smallserial, int4 serial, int8 bigserial)') - cmd = 'insert into serial_test (int2, int4, int8) values ({0}, {1}, {2})' - cursor.execute(cmd.format(np.iinfo(np.int16).min, np.iinfo(np.int32).min, np.iinfo(np.int64).min)) - cursor.execute(cmd.format(0, 0, 0)) - cursor.execute(cmd.format(np.iinfo(np.int16).max, np.iinfo(np.int32).max, np.iinfo(np.int64).max)) - - cursor.execute('create table floats_test (float4 real, float8 double precision)') - cmd = 'insert into floats_test (float4, float8) values ({0}, {1})' - cursor.execute(cmd.format(np.finfo(np.float32).min, np.finfo(np.float64).min)) - cursor.execute(cmd.format(0.0, 0.0)) - cursor.execute(cmd.format(-1.1, 1.1)) - - cursor.execute('create table numeric_test (numeric1 numeric(20, 10), numeric2 decimal(20, 10))') - cmd = 'insert into numeric_test (numeric1, numeric2) values ({0}, {1})' - cursor.execute(cmd.format(1234567890.0123456789, 1234567890.0123456789)) - - cursor.execute('create table fixed_strings_test (fixed char(10))') - cmd = "insert into fixed_strings_test (fixed) values ('{0}')" - cursor.execute(cmd.format('aaa')) - cursor.execute(cmd.format('bbb')) - cursor.execute(cmd.format('ccc')) - - cursor.execute('create table var_strings_test (varchar varchar(10), text text)') - cmd = "insert into var_strings_test (varchar, text) values ('{0}', '{1}')" - cursor.execute(cmd.format('aaa', string.ascii_lowercase)) - cursor.execute(cmd.format('bbb', string.ascii_uppercase)) - cursor.execute(cmd.format('ccc', string.ascii_letters)) - - cursor.execute('create table unicode_strings_test (fixed char(10), text text)') - cursor.execute(u"insert into unicode_strings_test (fixed, text) values ('\u4242xxx', 'xxx\u4242')") - - cursor.execute(u'create table unicode_table_name_test (name\u4242 text)') - cursor.execute(u"insert into unicode_table_name_test (name\u4242) values ('foo')") - - cursor.execute('create table geometric_test (point point, line line, ' - 'lseg lseg, box box, path path, polygon polygon, circle circle)') - cursor.execute("insert into geometric_test (point, line, lseg, box, path, " - "polygon, circle) values " - "('(1.1 , 2.2)', '{1, 2, 3}', '((1, 2), (3, 4))', " - "'((1, 2), (3, 4))', '((1, 2), (3, 4), (5, 6))', " - "'((1, 2), (3, 4), (5, 6))', '((1, 2), 3)')") - - cursor.execute('create table casts_test (char char(10), int4 int4, float8 double precision)') - cmd = "insert into casts_test (char, int4, float8) values ('{0}', {0}, {0}.{0})" - for i in range(CASTS_TEST_NUM_RECORDS): - cursor.execute(cmd.format(i)) - - cursor.execute('create table missing_values_test (char char(5), int4 int4, float4 real, ' - 'point point, path path, polygon polygon)') - #'gis_point geometry(POINT), gis_multipoint geometry(MULTIPOINT), ' - #'gis_polygon geometry(POLYGON))') - cursor.execute('insert into missing_values_test default values') - - cursor.execute('create table empty_test (dummy int4)') - - cursor.execute('create table points (' - 'point2d geometry(POINT), ' - 'point3d geometry(POINTZ), ' - 'point4d geometry(POINTZM))') - cursor.execute("insert into points (point2d, point3d, point4d) values (" - "ST_GeomFromText('POINT(0 1)'), " - "ST_GeomFromText('POINT(0 1 2)'), " - "ST_GeomFromText('POINT(0 1 2 3)'))") - - cursor.execute('create table multipoints (' - 'point2d geometry(MULTIPOINT), ' - 'point3d geometry(MULTIPOINTZ), ' - 'point4d geometry(MULTIPOINTZM))') - cursor.execute("insert into multipoints (point2d, point3d, point4d) values (" - "ST_GeomFromText('MULTIPOINT(0 1, 2 3)'), " - "ST_GeomFromText('MULTIPOINT(0 1 2, 3 4 5)'), " - "ST_GeomFromText('MULTIPOINT(0 1 2 3, 4 5 6 7)'))") - - cursor.execute('create table lines (' - 'line2d geometry(LINESTRING), ' - 'line3d geometry(LINESTRINGZ), ' - 'line4d geometry(LINESTRINGZM))') - cursor.execute("insert into lines (line2d, line3d, line4d) values (" - "ST_GeomFromText('LINESTRING(0 1, 2 3)'), " - "ST_GeomFromText('LINESTRING(0 1 2, 3 4 5)'), " - "ST_GeomFromText('LINESTRING(0 1 2 3, 4 5 6 7)'))") - cursor.execute("insert into lines (line2d, line3d, line4d) values (" - "ST_GeomFromText('LINESTRING(0 1, 2 3, 4 5)'), " - "ST_GeomFromText('LINESTRING(0 1 2, 3 4 5, 6 7 8)'), " - "ST_GeomFromText('LINESTRING(0 1 2 3, 4 5 6 7)'))") - - cursor.execute('create table multilines (' - 'line2d geometry(MULTILINESTRING), ' - 'line3d geometry(MULTILINESTRINGZ), ' - 'line4d geometry(MULTILINESTRINGZM))') - cursor.execute("insert into multilines (line2d, line3d, line4d) values (" - "ST_GeomFromText('MULTILINESTRING((0 1, 2 3), (4 5, 6 7))'), " - "ST_GeomFromText('MULTILINESTRING((0 1 2, 3 4 5), (6 7 8, 9 10 11, 12 13 14))'), " - "ST_GeomFromText('MULTILINESTRING((0 1 2 3, 4 5 6 7), (8 9 10 11, 12 13 14 15))'))") - - cursor.execute('create table polygons (' - 'polygon2d geometry(POLYGON), ' - 'polygon3d geometry(POLYGONZ), ' - 'polygon4d geometry(POLYGONZM))') - cursor.execute("insert into polygons (polygon2d, polygon3d, polygon4d) values (" - "ST_GeomFromText('POLYGON((0 1, 2 3, 4 5, 0 1), " - "(0 1, 2 3, 4 5, 0 1), " - "(0 1, 2 3, 4 5, 0 1))'), " - "ST_GeomFromText('POLYGON((0 1 2, 3 4 5, 6 7 8, 0 1 2), " - "(0 1 2, 3 4 5, 6 7 8, 0 1 2), " - "(0 1 2, 3 4 5, 6 7 8, 0 1 2))'), " - "ST_GeomFromText('POLYGON((0 1 2 3, 4 5 6 7, 8 9 10 11, 0 1 2 3), " - "(0 1 2 3, 4 5 6 7, 8 9 10 11, 0 1 2 3), " - "(0 1 2 3, 4 5 6 7, 8 9 10 11, 0 1 2 3))'))") - - cursor.execute('create table multipolygons (' - 'polygon2d geometry(MULTIPOLYGON), ' - 'polygon3d geometry(MULTIPOLYGONZ), ' - 'polygon4d geometry(MULTIPOLYGONZM))') - cursor.execute("insert into multipolygons (polygon2d, polygon3d, polygon4d) values (" - "ST_GeomFromText('MULTIPOLYGON(((0 1, 2 3, 4 5, 0 1), " - "(0 1, 2 3, 4 5, 0 1), " - "(0 1, 2 3, 4 5, 0 1)), " - "((0 1, 2 3, 4 5, 0 1), " - "(0 1, 2 3, 4 5, 0 1), " - "(0 1, 2 3, 4 5, 0 1)))'), " - "ST_GeomFromText('MULTIPOLYGON(((0 1 2, 3 4 5, 6 7 8, 0 1 2), " - "(0 1 2, 3 4 5, 6 7 8, 0 1 2), " - "(0 1 2, 3 4 5, 6 7 8, 0 1 2)), " - "((0 1 2, 3 4 5, 6 7 8, 0 1 2), " - "(0 1 2, 3 4 5, 6 7 8, 0 1 2), " - "(0 1 2, 3 4 5, 6 7 8, 0 1 2)))'), " - "ST_GeomFromText('MULTIPOLYGON(((0 1 2 3, 4 5 6 7, 8 9 10 11, 0 1 2 3), " - "(0 1 2 3, 4 5 6 7, 8 9 10 11, 0 1 2 3), " - "(0 1 2 3, 4 5 6 7, 8 9 10 11, 0 1 2 3)), " - "((0 1 2 3, 4 5 6 7, 8 9 10 11, 0 1 2 3), " - "(0 1 2 3, 4 5 6 7, 8 9 10 11, 0 1 2 3), " - "(0 1 2 3, 4 5 6 7, 8 9 10 11, 0 1 2 3)))'))") - - cursor.execute('create table triangles ' - '(tri2d geometry(TRIANGLE), tri3d geometry(TRIANGLEZ), tri4d geometry(TRIANGLEZM))') - cursor.execute("insert into triangles (tri2d, tri3d, tri4d) values (" - "ST_GeomFromText('TRIANGLE((0 0,1 1,2 2,0 0))'), " - "ST_GeomFromText('TRIANGLE((0 0 0,1 1 1,2 2 2,0 0 0))'), " - "ST_GeomFromText('TRIANGLE((0 0 0 0,1 1 1 1,2 2 2 2,0 0 0 0))'))") - - conn.commit() - cursor.close() - conn.close() diff --git a/TextAdapter/tests/test_mongo_adapter.c b/TextAdapter/tests/test_mongo_adapter.c deleted file mode 100644 index 463473e..0000000 --- a/TextAdapter/tests/test_mongo_adapter.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "mongo_adapter.h" - - -int main() -{ - MongoAdapter *adapter = open_mongo_adapter("127.0.0.1", 27017, "MongoAdapter_tests", "test_ints"); - set_converter(adapter->fields, 0, "field0", sizeof(uint64_t), &mongo2int_converter, NULL); - set_converter(adapter->fields, 0, "field1", sizeof(uint64_t), &mongo2int_converter, NULL); - set_converter(adapter->fields, 0, "field2", sizeof(uint64_t), &mongo2int_converter, NULL); - set_converter(adapter->fields, 0, "field3", sizeof(uint64_t), &mongo2int_converter, NULL); - set_converter(adapter->fields, 0, "field4", sizeof(uint64_t), &mongo2int_converter, NULL); - - uint64_t *output = calloc(10000000, sizeof(uint64_t) * 5); - uint64_t num_recs_read = 0; - MongoAdapterError error = read_records(adapter, 0, 10000000, 1, (void *)output, &num_recs_read); - printf("JNB: num_recs_read=%llu error=%d\n", num_recs_read, error); - close_mongo_adapter(adapter); - - return 0; -} diff --git a/TextAdapter/textadapter/TextAdapter.c b/TextAdapter/textadapter/TextAdapter.c deleted file mode 100644 index bdfc315..0000000 --- a/TextAdapter/textadapter/TextAdapter.c +++ /dev/null @@ -1,58582 +0,0 @@ -/* Generated by Cython 0.25.1 */ - -#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. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. -#else -#define CYTHON_ABI "0_25_1" -#include -#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 HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && METH_FASTCALL == PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#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_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -#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 - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - 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_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#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 - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#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 - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__TextAdapter__textadapter__TextAdapter -#define __PYX_HAVE_API__TextAdapter__textadapter__TextAdapter -#include -#include -#include -#include "numpy/arrayobject.h" -#include "numpy/ufuncobject.h" -#include "_stdint.h" -#include "string.h" -#include "stdlib.h" -#include "../lib/khash.h" -#include "zlib.h" -#include "io_functions.h" -#include "converter_functions.h" -#include "index.h" -#include "field_info.h" -#include "text_adapter.h" -#include "pcre.h" -#include "json_tokenizer.h" -#include "numpy/ndarraytypes.h" -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -#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) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - -/* Header.proto */ -#if !defined(CYTHON_CCOMPLEX) - #if defined(__cplusplus) - #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) - #define CYTHON_CCOMPLEX 1 - #else - #define CYTHON_CCOMPLEX 0 - #endif -#endif -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #include - #else - #include - #endif -#endif -#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) - #undef _Complex_I - #define _Complex_I 1.0fj -#endif - - -static const char *__pyx_f[] = { - "TextAdapter/textadapter/TextAdapter.pyx", - "TextAdapter/textadapter/Index.pyx", - "TextAdapter/textadapter/IO.pyx", - "TextAdapter/lib/Converters.pyx", - "__init__.pxd", - "type.pxd", -}; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":725 - * # in Cython to enable them only on the right systems. - * - * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t - */ -typedef npy_int8 __pyx_t_5numpy_int8_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":726 - * - * ctypedef npy_int8 int8_t - * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< - * ctypedef npy_int32 int32_t - * ctypedef npy_int64 int64_t - */ -typedef npy_int16 __pyx_t_5numpy_int16_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":727 - * ctypedef npy_int8 int8_t - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< - * ctypedef npy_int64 int64_t - * #ctypedef npy_int96 int96_t - */ -typedef npy_int32 __pyx_t_5numpy_int32_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":728 - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t - * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< - * #ctypedef npy_int96 int96_t - * #ctypedef npy_int128 int128_t - */ -typedef npy_int64 __pyx_t_5numpy_int64_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":732 - * #ctypedef npy_int128 int128_t - * - * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t - */ -typedef npy_uint8 __pyx_t_5numpy_uint8_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":733 - * - * ctypedef npy_uint8 uint8_t - * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< - * ctypedef npy_uint32 uint32_t - * ctypedef npy_uint64 uint64_t - */ -typedef npy_uint16 __pyx_t_5numpy_uint16_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":734 - * ctypedef npy_uint8 uint8_t - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< - * ctypedef npy_uint64 uint64_t - * #ctypedef npy_uint96 uint96_t - */ -typedef npy_uint32 __pyx_t_5numpy_uint32_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":735 - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t - * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< - * #ctypedef npy_uint96 uint96_t - * #ctypedef npy_uint128 uint128_t - */ -typedef npy_uint64 __pyx_t_5numpy_uint64_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":739 - * #ctypedef npy_uint128 uint128_t - * - * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< - * ctypedef npy_float64 float64_t - * #ctypedef npy_float80 float80_t - */ -typedef npy_float32 __pyx_t_5numpy_float32_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":740 - * - * ctypedef npy_float32 float32_t - * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< - * #ctypedef npy_float80 float80_t - * #ctypedef npy_float128 float128_t - */ -typedef npy_float64 __pyx_t_5numpy_float64_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":749 - * # The int types are mapped a bit surprising -- - * # numpy.int corresponds to 'l' and numpy.long to 'q' - * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t - * ctypedef npy_longlong longlong_t - */ -typedef npy_long __pyx_t_5numpy_int_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":750 - * # numpy.int corresponds to 'l' and numpy.long to 'q' - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":751 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t - * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< - * - * ctypedef npy_ulong uint_t - */ -typedef npy_longlong __pyx_t_5numpy_longlong_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":753 - * ctypedef npy_longlong longlong_t - * - * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t - * ctypedef npy_ulonglong ulonglong_t - */ -typedef npy_ulong __pyx_t_5numpy_uint_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":754 - * - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t - * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":755 - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t - * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< - * - * ctypedef npy_intp intp_t - */ -typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":757 - * ctypedef npy_ulonglong ulonglong_t - * - * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< - * ctypedef npy_uintp uintp_t - * - */ -typedef npy_intp __pyx_t_5numpy_intp_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":758 - * - * ctypedef npy_intp intp_t - * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< - * - * ctypedef npy_double float_t - */ -typedef npy_uintp __pyx_t_5numpy_uintp_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":760 - * ctypedef npy_uintp uintp_t - * - * ctypedef npy_double float_t # <<<<<<<<<<<<<< - * ctypedef npy_double double_t - * ctypedef npy_longdouble longdouble_t - */ -typedef npy_double __pyx_t_5numpy_float_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":761 - * - * ctypedef npy_double float_t - * ctypedef npy_double double_t # <<<<<<<<<<<<<< - * ctypedef npy_longdouble longdouble_t - * - */ -typedef npy_double __pyx_t_5numpy_double_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":762 - * ctypedef npy_double float_t - * ctypedef npy_double double_t - * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< - * - * ctypedef npy_cfloat cfloat_t - */ -typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* Declarations.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< float > __pyx_t_float_complex; - #else - typedef float _Complex __pyx_t_float_complex; - #endif -#else - typedef struct { float real, imag; } __pyx_t_float_complex; -#endif -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - -/* Declarations.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< double > __pyx_t_double_complex; - #else - typedef double _Complex __pyx_t_double_complex; - #endif -#else - typedef struct { double real, imag; } __pyx_t_double_complex; -#endif -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - - -/*--- Type declarations ---*/ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_LineIter; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RecordIter; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter; -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":764 - * ctypedef npy_longdouble longdouble_t - * - * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< - * ctypedef npy_cdouble cdouble_t - * ctypedef npy_clongdouble clongdouble_t - */ -typedef npy_cfloat __pyx_t_5numpy_cfloat_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":765 - * - * ctypedef npy_cfloat cfloat_t - * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< - * ctypedef npy_clongdouble clongdouble_t - * - */ -typedef npy_cdouble __pyx_t_5numpy_cdouble_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":766 - * ctypedef npy_cfloat cfloat_t - * ctypedef npy_cdouble cdouble_t - * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< - * - * ctypedef npy_cdouble complex_t - */ -typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":768 - * ctypedef npy_clongdouble clongdouble_t - * - * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew1(a): - */ -typedef npy_cdouble __pyx_t_5numpy_complex_t; -struct __pyx_defaults; -typedef struct __pyx_defaults __pyx_defaults; -struct __pyx_defaults1; -typedef struct __pyx_defaults1 __pyx_defaults1; - -/* "TextAdapter/lib/Converters.pyx":199 - * - * - * ctypedef uint64_t (*uint_numba_func_ptr)(char *) # <<<<<<<<<<<<<< - * ctypedef int64_t (*int_numba_func_ptr)(char *) - * ctypedef double (*float_numba_func_ptr)(char *) - */ -typedef uint64_t (*__pyx_t_5TextAdapter_11textadapter_11TextAdapter_uint_numba_func_ptr)(char *); - -/* "TextAdapter/lib/Converters.pyx":200 - * - * ctypedef uint64_t (*uint_numba_func_ptr)(char *) - * ctypedef int64_t (*int_numba_func_ptr)(char *) # <<<<<<<<<<<<<< - * ctypedef double (*float_numba_func_ptr)(char *) - * ctypedef PyObject* (*object_numba_func_ptr)(char *) - */ -typedef int64_t (*__pyx_t_5TextAdapter_11textadapter_11TextAdapter_int_numba_func_ptr)(char *); - -/* "TextAdapter/lib/Converters.pyx":201 - * ctypedef uint64_t (*uint_numba_func_ptr)(char *) - * ctypedef int64_t (*int_numba_func_ptr)(char *) - * ctypedef double (*float_numba_func_ptr)(char *) # <<<<<<<<<<<<<< - * ctypedef PyObject* (*object_numba_func_ptr)(char *) - * ctypedef int64_t (*datetime_numba_func_ptr)(char *) - */ -typedef double (*__pyx_t_5TextAdapter_11textadapter_11TextAdapter_float_numba_func_ptr)(char *); - -/* "TextAdapter/lib/Converters.pyx":202 - * ctypedef int64_t (*int_numba_func_ptr)(char *) - * ctypedef double (*float_numba_func_ptr)(char *) - * ctypedef PyObject* (*object_numba_func_ptr)(char *) # <<<<<<<<<<<<<< - * ctypedef int64_t (*datetime_numba_func_ptr)(char *) - * - */ -typedef PyObject *(*__pyx_t_5TextAdapter_11textadapter_11TextAdapter_object_numba_func_ptr)(char *); - -/* "TextAdapter/lib/Converters.pyx":203 - * ctypedef double (*float_numba_func_ptr)(char *) - * ctypedef PyObject* (*object_numba_func_ptr)(char *) - * ctypedef int64_t (*datetime_numba_func_ptr)(char *) # <<<<<<<<<<<<<< - * - * cdef ConvertError str2uint_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - */ -typedef int64_t (*__pyx_t_5TextAdapter_11textadapter_11TextAdapter_datetime_numba_func_ptr)(char *); -struct __pyx_defaults { - PyObject *__pyx_arg_density; -}; -struct __pyx_defaults1 { - PyObject *__pyx_arg_chunksize; -}; - -/* "TextAdapter/textadapter/TextAdapter.pyx":62 - * # this object is used by the numpy array to handle deallocation properly. - * # (see create_array function below). - * cdef class ArrayDealloc: # <<<<<<<<<<<<<< - * cdef void* data - * - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc { - PyObject_HEAD - void *data; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":98 - * # output and passes it to field dtype's object to make sure it's - * # the proper dtype value. - * cdef class ConverterDecorator(object): # <<<<<<<<<<<<<< - * cdef object converter - * cdef object dtype - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator { - PyObject_HEAD - struct __pyx_vtabstruct_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *__pyx_vtab; - PyObject *converter; - PyObject *dtype; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":111 - * - * - * cdef class TextAdapter(object): # <<<<<<<<<<<<<< - * """ - * TextAdapter objects read CSV data and output a numpy array or Pandas - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter { - PyObject_HEAD - struct text_adapter_t *adapter; - PyObject *encoding; - PyObject *compression; - PyObject *REC_CHUNK_SIZE; - PyObject *exact_index; - PyObject *indexing; - kh_string_t *kh_string_table; - PyObject *mapping; - PyObject *_field_names; - PyObject *_field_filter; - PyObject *fill_values; - PyObject *loose_fill; - PyObject *build_converter; - PyObject *converter_objects; - PyObject *default_output; - PyObject *logger; - PyObject *missing_values; - PyObject *data; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":1176 - * - * - * cdef class CSVTextAdapter(TextAdapter): # <<<<<<<<<<<<<< - * """ - * CSV adapter for parsing CSV data using delimiter character. - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter __pyx_base; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":1335 - * - * - * cdef class FixedWidthTextAdapter(TextAdapter): # <<<<<<<<<<<<<< - * """ - * CSV adapter for parsing CSV data with fixed width fields. - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter __pyx_base; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":1440 - * - * - * cdef class JSONTextAdapter(TextAdapter): # <<<<<<<<<<<<<< - * - * cdef JsonTokenizerArgs *json_args - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter __pyx_base; - JsonTokenizerArgs *json_args; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":1505 - * - * - * cdef class RegexTextAdapter(TextAdapter): # <<<<<<<<<<<<<< - * """ - * CSV adapter for parsing csv data using regular expressions. - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter __pyx_base; - RegexTokenizerArgs *regex_args; - PyObject *temp; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":1614 - * return line_iter - * - * cdef class LineIter(object): # <<<<<<<<<<<<<< - * - * cdef text_adapter_t *adapter - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_LineIter { - PyObject_HEAD - struct text_adapter_t *adapter; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":1672 - * return record_iter - * - * cdef class RecordIter(object): # <<<<<<<<<<<<<< - * - * cdef text_adapter_t *adapter - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RecordIter { - PyObject_HEAD - struct text_adapter_t *adapter; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":1714 - * return record_iter - * - * cdef class JSONRecordIter(object): # <<<<<<<<<<<<<< - * - * cdef text_adapter_t *adapter - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter { - PyObject_HEAD - struct text_adapter_t *adapter; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":431 - * - * - * def set_field_filter(self, fields): # <<<<<<<<<<<<<< - * """ - * Set fields to read. - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter { - PyObject_HEAD - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":455 - * self._field_filter = sorted(field_filter) - * self.logger.debug('set_field_filter() setting field filter to [{0}]' - * .format(','.join(str(x) for x in self._field_filter))) # <<<<<<<<<<<<<< - * - * - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr { - PyObject_HEAD - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *__pyx_outer_scope; - PyObject *__pyx_v_x; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":465 - * return self._field_names - * - * def set_field_names(self, field_names): # <<<<<<<<<<<<<< - * """ - * Set field names - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names { - PyObject_HEAD - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":478 - * self._field_names = field_names - * self.logger.debug('set_field_names() setting field names to [{0}]' - * .format(','.join(str(x) for x in self._field_names))) # <<<<<<<<<<<<<< - * - * field_names = property(get_field_names, set_field_names) - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr { - PyObject_HEAD - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *__pyx_outer_scope; - PyObject *__pyx_v_x; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":488 - * - * - * def set_field_types(self, types=None): # <<<<<<<<<<<<<< - * """ - * Set field dtype for each field. dtype should be in NumPy dtype format. - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types { - PyObject_HEAD - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":517 - * 'or None to reset field types') - * self.logger.debug('set_field_types() setting dtypes to {0}' - * .format(','.join(str(field) + ':' + str(dtype) for field,dtype in self.mapping.iteritems()))) # <<<<<<<<<<<<<< - * - * - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr { - PyObject_HEAD - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *__pyx_outer_scope; - PyObject *__pyx_v_dtype; - PyObject *__pyx_v_field; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":565 - * - * - * def set_converter(self, field, converter): # <<<<<<<<<<<<<< - * """ - * Set converter function for field. - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter { - PyObject_HEAD - PyObject *__pyx_v_converter; - PyObject *__pyx_v_field; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self; -}; - - -/* "TextAdapter/textadapter/TextAdapter.pyx":1444 - * cdef JsonTokenizerArgs *json_args - * - * def __cinit__(self, fh, encoding='utf_8', compression=None, num_records=0, # <<<<<<<<<<<<<< - * field_names=None, infer_types=True, indexing=False, - * index_name=None, output='ndarray', debug=False): - */ -struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ { - PyObject_HEAD - PyObject *__pyx_v_count_fields; -}; - - - -/* "TextAdapter/textadapter/TextAdapter.pyx":98 - * # output and passes it to field dtype's object to make sure it's - * # the proper dtype value. - * cdef class ConverterDecorator(object): # <<<<<<<<<<<<<< - * cdef object converter - * cdef object dtype - */ - -struct __pyx_vtabstruct_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator { - PyObject *(*getSize)(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *); -}; -static struct __pyx_vtabstruct_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *__pyx_vtabptr_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator; - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#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); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #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, acquire_gil) - #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 -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif - -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* IterFinish.proto */ -static CYTHON_INLINE int __Pyx_IterFinish(void); - -/* UnpackItemEndCheck.proto */ -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* RaiseArgTupleInvalid.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); - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* PyObjectSetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); -#endif - return PyObject_SetAttr(obj, attr_name, value); -} -#else -#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) -#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) -#endif - -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* SetItemInt.proto */ -#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) -static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, - int is_list, int wraparound, int boundscheck); - -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\ - PyObject_RichCompare(op1, op2, Py_EQ) - #endif - -/* GetItemInt.proto */ -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ - __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace)\ - (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) -#endif - -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - -/* PyObjectCallMethod1.proto */ -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); - -/* append.proto */ -static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); - -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif - -/* SliceObject.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** py_start, PyObject** py_stop, PyObject** py_slice, - int has_cstart, int has_cstop, int wraparound); - -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* SwapException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* KeywordStringCheck.proto */ -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); - -/* PySequenceContains.proto */ -static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { - int result = PySequence_Contains(seq, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* ListCompAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len)) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) -#endif - -/* StringJoin.proto */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyString_Join __Pyx_PyBytes_Join -#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v)) -#else -#define __Pyx_PyString_Join PyUnicode_Join -#define __Pyx_PyBaseString_Join PyUnicode_Join -#endif -#if CYTHON_COMPILING_IN_CPYTHON - #if PY_MAJOR_VERSION < 3 - #define __Pyx_PyBytes_Join _PyString_Join - #else - #define __Pyx_PyBytes_Join _PyBytes_Join - #endif -#else -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); -#endif - -/* UnicodeAsUCS4.proto */ -static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*); - -/* object_ord.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyObject_Ord(c)\ - (likely(PyUnicode_Check(c)) ? (long)__Pyx_PyUnicode_AsPy_UCS4(c) : __Pyx__PyObject_Ord(c)) -#else -#define __Pyx_PyObject_Ord(c) __Pyx__PyObject_Ord(c) -#endif -static long __Pyx__PyObject_Ord(PyObject* c); - -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); - -/* PyObjectCallMethod0.proto */ -static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -/* UnpackTupleError.proto */ -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); - -/* UnpackTuple2.proto */ -static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2, - int is_tuple, int has_known_size, int decref_tuple); - -/* dict_iter.proto */ -static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name, - Py_ssize_t* p_orig_length, int* p_is_dict); -static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos, - PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict); - -/* FetchCommonType.proto */ -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); - -/* CythonFunction.proto */ -#define __Pyx_CyFunction_USED 1 -#include -#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 -#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 -#define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CyFunction_GetClosure(f)\ - (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) -#define __Pyx_CyFunction_Defaults(type, f)\ - ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ - ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) -typedef struct { - PyCFunctionObject func; -#if PY_VERSION_HEX < 0x030500A0 - PyObject *func_weakreflist; -#endif - PyObject *func_dict; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_globals; - PyObject *func_code; - PyObject *func_closure; - PyObject *func_classobj; - void *defaults; - int defaults_pyobjects; - int flags; - PyObject *defaults_tuple; - PyObject *defaults_kwdict; - PyObject *(*defaults_getter)(PyObject *); - PyObject *func_annotations; -} __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ - __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) -static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *self, - PyObject *module, PyObject *globals, - PyObject* code); -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __pyx_CyFunction_init(void); - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -/* CalculateMetaclass.proto */ -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); - -/* Py3ClassCreate.proto */ -static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, - PyObject *mkw, PyObject *modname, PyObject *doc); -static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, - PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); - -/* PyDictContains.proto */ -static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { - int result = PyDict_Contains(dict, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* DictGetItem.proto */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) - PyErr_SetObject(PyExc_KeyError, args); - Py_XDECREF(args); - } - return NULL; - } - Py_INCREF(value); - return value; -} -#else - #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#endif - -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - -/* MergeKeywords.proto */ -static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping); - -/* IterNext.proto */ -#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL) -static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - -/* GetNameInClass.proto */ -static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ConvertError(ConvertError value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_AdapterError(AdapterError value); - -/* RealImag.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #define __Pyx_CREAL(z) ((z).real()) - #define __Pyx_CIMAG(z) ((z).imag()) - #else - #define __Pyx_CREAL(z) (__real__(z)) - #define __Pyx_CIMAG(z) (__imag__(z)) - #endif -#else - #define __Pyx_CREAL(z) ((z).real) - #define __Pyx_CIMAG(z) ((z).imag) -#endif -#if defined(__cplusplus) && CYTHON_CCOMPLEX\ - && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) - #define __Pyx_SET_CREAL(z,x) ((z).real(x)) - #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) -#else - #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) - #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) -#endif - -/* Arithmetic.proto */ -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq_float(a, b) ((a)==(b)) - #define __Pyx_c_sum_float(a, b) ((a)+(b)) - #define __Pyx_c_diff_float(a, b) ((a)-(b)) - #define __Pyx_c_prod_float(a, b) ((a)*(b)) - #define __Pyx_c_quot_float(a, b) ((a)/(b)) - #define __Pyx_c_neg_float(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero_float(z) ((z)==(float)0) - #define __Pyx_c_conj_float(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_abs_float(z) (::std::abs(z)) - #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zero_float(z) ((z)==0) - #define __Pyx_c_conj_float(z) (conjf(z)) - #if 1 - #define __Pyx_c_abs_float(z) (cabsf(z)) - #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); - #if 1 - static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); - #endif -#endif - -/* Arithmetic.proto */ -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq_double(a, b) ((a)==(b)) - #define __Pyx_c_sum_double(a, b) ((a)+(b)) - #define __Pyx_c_diff_double(a, b) ((a)-(b)) - #define __Pyx_c_prod_double(a, b) ((a)*(b)) - #define __Pyx_c_quot_double(a, b) ((a)/(b)) - #define __Pyx_c_neg_double(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero_double(z) ((z)==(double)0) - #define __Pyx_c_conj_double(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_abs_double(z) (::std::abs(z)) - #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zero_double(z) ((z)==0) - #define __Pyx_c_conj_double(z) (conj(z)) - #if 1 - #define __Pyx_c_abs_double(z) (cabs(z)) - #define __Pyx_c_pow_double(a, b) (cpow(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); - static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); - #if 1 - static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); - #endif -#endif - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CoroutineBase.proto */ -typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *); -typedef struct { - PyObject_HEAD - __pyx_coroutine_body_t body; - PyObject *closure; - PyObject *exc_type; - PyObject *exc_value; - PyObject *exc_traceback; - PyObject *gi_weakreflist; - PyObject *classobj; - PyObject *yieldfrom; - PyObject *gi_name; - PyObject *gi_qualname; - PyObject *gi_modulename; - int resume_label; - char is_running; -} __pyx_CoroutineObject; -static __pyx_CoroutineObject *__Pyx__Coroutine_New( - PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *closure, - PyObject *name, PyObject *qualname, PyObject *module_name); -static int __Pyx_Coroutine_clear(PyObject *self); -#if 1 || PY_VERSION_HEX < 0x030300B0 -static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); -#else -#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue) -#endif - -/* PatchModuleWithCoroutine.proto */ -static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); - -/* PatchGeneratorABC.proto */ -static int __Pyx_patch_abc(void); - -/* Generator.proto */ -#define __Pyx_Generator_USED -static PyTypeObject *__pyx_GeneratorType = 0; -#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) -#define __Pyx_Generator_New(body, closure, name, qualname, module_name)\ - __Pyx__Coroutine_New(__pyx_GeneratorType, body, closure, name, qualname, module_name) -static PyObject *__Pyx_Generator_Next(PyObject *self); -static int __pyx_Generator_init(void); - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* TypeImport.proto */ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - -static PyObject *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_getSize(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *__pyx_v_self); /* proto*/ - -/* Module declarations from 'cpython.buffer' */ - -/* Module declarations from 'libc.string' */ - -/* Module declarations from 'libc.stdio' */ - -/* Module declarations from '__builtin__' */ - -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; - -/* Module declarations from 'cpython' */ - -/* Module declarations from 'cpython.object' */ - -/* Module declarations from 'cpython.ref' */ - -/* Module declarations from 'libc.stdlib' */ - -/* Module declarations from 'numpy' */ - -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE int __pyx_f_5numpy_import_array(void); /*proto*/ - -/* Module declarations from 'TextAdapter.textadapter.TextAdapter' */ -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_LineIter = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_RecordIter = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter = 0; -static PyTypeObject *__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ = 0; -__PYX_EXTERN_C DL_IMPORT(converter_func_ptr) default_converters[((unsigned int)NUM_CONVERTER_FUNCS)]; -static InputData *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_open_s3(PyObject *); /*proto*/ -static void __pyx_f_5TextAdapter_11textadapter_11TextAdapter_close_s3(InputData *); /*proto*/ -static AdapterError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_seek_s3(InputData *, uint64_t); /*proto*/ -static AdapterError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_read_s3(InputData *, char *, uint64_t, uint64_t *); /*proto*/ -static void __pyx_f_5TextAdapter_11textadapter_11TextAdapter_indexer_callback(void *, uint64_t, uint64_t); /*proto*/ -static RecordOffset __pyx_f_5TextAdapter_11textadapter_11TextAdapter_index_lookup_callback(void *, uint64_t); /*proto*/ -static void __pyx_f_5TextAdapter_11textadapter_11TextAdapter_add_gzip_access_point_callback(void *, unsigned char *, uint32_t, uint64_t, int, int, uint8_t); /*proto*/ -static void __pyx_f_5TextAdapter_11textadapter_11TextAdapter_get_gzip_access_point_callback(void *, uint64_t, GzipIndexAccessPoint *); /*proto*/ -static ConvertError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2str_object_converter(void *, uint32_t, int, void *, uint32_t, void *); /*proto*/ -static ConvertError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2datetime_converter(void *, uint32_t, int, void *, uint32_t, void *); /*proto*/ -static ConvertError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_python_converter(void *, uint32_t, int, void *, uint32_t, void *); /*proto*/ -static PyObject *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_line_iter(struct text_adapter_t *); /*proto*/ -static PyObject *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_record_iter(struct text_adapter_t *); /*proto*/ -static PyObject *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_json_record_iter(struct text_adapter_t *); /*proto*/ -static PyObject *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_array(char *, PyObject *, uint64_t); /*proto*/ -#define __Pyx_MODULE_NAME "TextAdapter.textadapter.TextAdapter" -int __pyx_module_is_main_TextAdapter__textadapter__TextAdapter = 0; - -/* Implementation of 'TextAdapter.textadapter.TextAdapter' */ -static PyObject *__pyx_builtin_ImportError; -static PyObject *__pyx_builtin_object; -static PyObject *__pyx_builtin_property; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_open; -static PyObject *__pyx_builtin_enumerate; -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_NotImplementedError; -static PyObject *__pyx_builtin_IOError; -static PyObject *__pyx_builtin_IndexError; -static PyObject *__pyx_builtin_round; -static PyObject *__pyx_builtin_TypeError; -static PyObject *__pyx_builtin_MemoryError; -static PyObject *__pyx_builtin_KeyError; -static PyObject *__pyx_builtin_StopIteration; -static PyObject *__pyx_builtin_EOFError; -static PyObject *__pyx_builtin_OverflowError; -static PyObject *__pyx_builtin_RuntimeError; -static const char __pyx_k_3[] = "3"; -static const char __pyx_k_M[] = "M"; -static const char __pyx_k_O[] = "O"; -static const char __pyx_k_S[] = "S"; -static const char __pyx_k_U[] = "U"; -static const char __pyx_k_b[] = "b"; -static const char __pyx_k_c[] = "c"; -static const char __pyx_k_e[] = "e"; -static const char __pyx_k_f[] = "f"; -static const char __pyx_k_i[] = "i"; -static const char __pyx_k_k[] = "k"; -static const char __pyx_k_m[] = "m"; -static const char __pyx_k_u[] = "u"; -static const char __pyx_k_CS[] = "CS"; -static const char __pyx_k_NA[] = "NA"; -static const char __pyx_k_NB[] = "NB"; -static const char __pyx_k_fh[] = "fh"; -static const char __pyx_k_gz[] = ".gz"; -static const char __pyx_k_i4[] = "i4"; -static const char __pyx_k_i8[] = "i8"; -static const char __pyx_k_io[] = "io"; -static const char __pyx_k_os[] = "os"; -static const char __pyx_k_re[] = "re"; -static const char __pyx_k_u1[] = "u1"; -static const char __pyx_k_u4[] = "u4"; -static const char __pyx_k_u8[] = "u8"; -static const char __pyx_k_wb[] = "wb"; -static const char __pyx_k_1_6[] = "1.6"; -static const char __pyx_k_2_7[] = "2.7"; -static const char __pyx_k_Key[] = "Key"; -static const char __pyx_k_NaN[] = "NaN"; -static const char __pyx_k__25[] = ""; -static const char __pyx_k__27[] = "\n"; -static const char __pyx_k__37[] = "#"; -static const char __pyx_k__38[] = "\""; -static const char __pyx_k__50[] = ","; -static const char __pyx_k__51[] = ":"; -static const char __pyx_k__78[] = "\\"; -static const char __pyx_k__79[] = "\t"; -static const char __pyx_k__80[] = " "; -static const char __pyx_k__91[] = "^"; -static const char __pyx_k_all[] = "__all__"; -static const char __pyx_k_csv[] = "csv"; -static const char __pyx_k_doc[] = "__doc__"; -static const char __pyx_k_end[] = "end"; -static const char __pyx_k_f_d[] = "f%d"; -static const char __pyx_k_ftp[] = "ftp://"; -static const char __pyx_k_get[] = "get"; -static const char __pyx_k_hnb[] = "hnb"; -static const char __pyx_k_i_d[] = "i%d"; -static const char __pyx_k_idx[] = ".idx"; -static const char __pyx_k_inf[] = "inf"; -static const char __pyx_k_key[] = "key"; -static const char __pyx_k_len[] = "__len__"; -static const char __pyx_k_nan[] = "nan"; -static const char __pyx_k_num[] = "num"; -static const char __pyx_k_pos[] = "pos"; -static const char __pyx_k_r_b[] = "r+b"; -static const char __pyx_k_rec[] = "rec"; -static const char __pyx_k_six[] = "six"; -static const char __pyx_k_std[] = "std"; -static const char __pyx_k_str[] = "str"; -static const char __pyx_k_sum[] = "sum"; -static const char __pyx_k_sys[] = "sys"; -static const char __pyx_k_u_d[] = "u%d"; -static const char __pyx_k_INFO[] = "INFO"; -static const char __pyx_k_None[] = "None"; -static const char __pyx_k_args[] = "args"; -static const char __pyx_k_bits[] = "bits"; -static const char __pyx_k_boto[] = "boto"; -static const char __pyx_k_bpos[] = "bpos"; -static const char __pyx_k_ceil[] = "ceil"; -static const char __pyx_k_conn[] = "conn"; -static const char __pyx_k_data[] = "data"; -static const char __pyx_k_estd[] = "estd"; -static const char __pyx_k_find[] = "find"; -static const char __pyx_k_fpos[] = "fpos"; -static const char __pyx_k_gzip[] = "gzip"; -static const char __pyx_k_http[] = "http://"; -static const char __pyx_k_idxh[] = "idxh"; -static const char __pyx_k_init[] = "__init__"; -static const char __pyx_k_istd[] = "istd"; -static const char __pyx_k_join[] = "join"; -static const char __pyx_k_json[] = "json"; -static const char __pyx_k_keys[] = "keys"; -static const char __pyx_k_kind[] = "kind"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_math[] = "math"; -static const char __pyx_k_mean[] = "mean"; -static const char __pyx_k_next[] = "__next__"; -static const char __pyx_k_none[] = "none"; -static const char __pyx_k_open[] = "open"; -static const char __pyx_k_path[] = "path"; -static const char __pyx_k_read[] = "read"; -static const char __pyx_k_seek[] = "seek"; -static const char __pyx_k_self[] = "self"; -static const char __pyx_k_send[] = "send"; -static const char __pyx_k_size[] = "size"; -static const char __pyx_k_skip[] = "skip"; -static const char __pyx_k_step[] = "step"; -static const char __pyx_k_stop[] = "stop"; -static const char __pyx_k_taix[] = "taix"; -static const char __pyx_k_tell[] = "tell"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_type[] = "type"; -static const char __pyx_k_warn[] = "warn"; -static const char __pyx_k_DEBUG[] = "DEBUG"; -static const char __pyx_k_Error[] = "Error"; -static const char __pyx_k_Range[] = "Range"; -static const char __pyx_k_array[] = "array"; -static const char __pyx_k_ascii[] = "ascii"; -static const char __pyx_k_bytes[] = "bytes"; -static const char __pyx_k_chunk[] = "chunk"; -static const char __pyx_k_close[] = "close"; -static const char __pyx_k_count[] = "count"; -static const char __pyx_k_debug[] = "debug"; -static const char __pyx_k_dtype[] = "dtype"; -static const char __pyx_k_emean[] = "emean"; -static const char __pyx_k_empty[] = "empty"; -static const char __pyx_k_error[] = "error"; -static const char __pyx_k_field[] = "field"; -static const char __pyx_k_fuzzy[] = "fuzzy"; -static const char __pyx_k_imean[] = "imean"; -static const char __pyx_k_index[] = "index"; -static const char __pyx_k_inf_2[] = "-inf"; -static const char __pyx_k_items[] = "items"; -static const char __pyx_k_loads[] = "loads"; -static const char __pyx_k_loose[] = "loose"; -static const char __pyx_k_magic[] = "magic"; -static const char __pyx_k_numpy[] = "numpy"; -static const char __pyx_k_quote[] = "quote"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_regex[] = "regex"; -static const char __pyx_k_rfind[] = "rfind"; -static const char __pyx_k_round[] = "round"; -static const char __pyx_k_shape[] = "shape"; -static const char __pyx_k_sizes[] = "sizes"; -static const char __pyx_k_sniff[] = "sniff"; -static const char __pyx_k_split[] = "split"; -static const char __pyx_k_start[] = "start"; -static const char __pyx_k_strip[] = "strip"; -static const char __pyx_k_throw[] = "throw"; -static const char __pyx_k_token[] = "token"; -static const char __pyx_k_types[] = "types"; -static const char __pyx_k_utf_8[] = "utf_8"; -static const char __pyx_k_value[] = "value"; -static const char __pyx_k_where[] = "where"; -static const char __pyx_k_write[] = "write"; -static const char __pyx_k_S32768[] = "S32768"; -static const char __pyx_k_append[] = "append"; -static const char __pyx_k_asizes[] = "asizes"; -static const char __pyx_k_bucket[] = "bucket"; -static const char __pyx_k_config[] = "config"; -static const char __pyx_k_decode[] = "decode"; -static const char __pyx_k_encode[] = "encode"; -static const char __pyx_k_errors[] = "errors"; -static const char __pyx_k_escape[] = "escape"; -static const char __pyx_k_esizes[] = "esizes"; -static const char __pyx_k_exists[] = "exists"; -static const char __pyx_k_fields[] = "fields"; -static const char __pyx_k_footer[] = "footer"; -static const char __pyx_k_format[] = "format"; -static const char __pyx_k_groups[] = "groups"; -static const char __pyx_k_header[] = "header"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_isizes[] = "isizes"; -static const char __pyx_k_kwargs[] = "kwargs"; -static const char __pyx_k_lookup[] = "lookup"; -static const char __pyx_k_module[] = "__module__"; -static const char __pyx_k_object[] = "object"; -static const char __pyx_k_offset[] = "offset"; -static const char __pyx_k_output[] = "output"; -static const char __pyx_k_pandas[] = "pandas"; -static const char __pyx_k_parser[] = "parser"; -static const char __pyx_k_reader[] = "reader"; -static const char __pyx_k_reason[] = "reason"; -static const char __pyx_k_record[] = "record"; -static const char __pyx_k_remove[] = "remove"; -static const char __pyx_k_s3_key[] = "s3_key"; -static const char __pyx_k_shmean[] = "shmean"; -static const char __pyx_k_source[] = "source"; -static const char __pyx_k_tofile[] = "tofile"; -static const char __pyx_k_urllib[] = "urllib"; -static const char __pyx_k_values[] = "values"; -static const char __pyx_k_window[] = "window"; -static const char __pyx_k_BytesIO[] = "BytesIO"; -static const char __pyx_k_IOError[] = "IOError"; -static const char __pyx_k_Sniffer[] = "Sniffer"; -static const char __pyx_k_adapter[] = "adapter"; -static const char __pyx_k_aliases[] = "aliases"; -static const char __pyx_k_asarray[] = "asarray"; -static const char __pyx_k_boto_s3[] = "boto.s3"; -static const char __pyx_k_comment[] = "comment"; -static const char __pyx_k_compile[] = "compile"; -static const char __pyx_k_density[] = "density"; -static const char __pyx_k_generic[] = "generic"; -static const char __pyx_k_genexpr[] = "genexpr"; -static const char __pyx_k_getitem[] = "__getitem__"; -static const char __pyx_k_headers[] = "headers"; -static const char __pyx_k_idxfile[] = "idxfile"; -static const char __pyx_k_ioffset[] = "ioffset"; -static const char __pyx_k_logging[] = "logging"; -static const char __pyx_k_ndarray[] = "ndarray"; -static const char __pyx_k_offsets[] = "offsets"; -static const char __pyx_k_options[] = "options"; -static const char __pyx_k_prepare[] = "__prepare__"; -static const char __pyx_k_rec_num[] = "rec_num"; -static const char __pyx_k_unknown[] = "unknown"; -static const char __pyx_k_urlopen[] = "urlopen"; -static const char __pyx_k_version[] = "version"; -static const char __pyx_k_warning[] = "warning"; -static const char __pyx_k_EOFError[] = "EOFError"; -static const char __pyx_k_FuzzyIdx[] = "FuzzyIdx"; -static const char __pyx_k_KeyError[] = "KeyError"; -static const char __pyx_k_SEEK_END[] = "SEEK_END"; -static const char __pyx_k_SEEK_SET[] = "SEEK_SET"; -static const char __pyx_k_StringIO[] = "StringIO"; -static const char __pyx_k_TAG_SIZE[] = "TAG_SIZE"; -static const char __pyx_k_allsizes[] = "allsizes"; -static const char __pyx_k_avail_in[] = "avail_in"; -static const char __pyx_k_checksum[] = "checksum"; -static const char __pyx_k_encoding[] = "encoding"; -static const char __pyx_k_endswith[] = "endswith"; -static const char __pyx_k_filesize[] = "filesize"; -static const char __pyx_k_finalize[] = "finalize"; -static const char __pyx_k_fromfile[] = "fromfile"; -static const char __pyx_k_indexing[] = "indexing"; -static const char __pyx_k_itemsize[] = "itemsize"; -static const char __pyx_k_key_name[] = "key_name"; -static const char __pyx_k_nrecords[] = "nrecords"; -static const char __pyx_k_num_recs[] = "num_recs"; -static const char __pyx_k_overflow[] = "overflow"; -static const char __pyx_k_property[] = "property"; -static const char __pyx_k_qualname[] = "__qualname__"; -static const char __pyx_k_setLevel[] = "setLevel"; -static const char __pyx_k_step_rec[] = "step_rec"; -static const char __pyx_k_stop_rec[] = "stop_rec"; -static const char __pyx_k_to_array[] = "to_array"; -static const char __pyx_k_typesize[] = "typesize"; -static const char __pyx_k_warnings[] = "warnings"; -static const char __pyx_k_DataFrame[] = "DataFrame"; -static const char __pyx_k_TypeError[] = "TypeError"; -static const char __pyx_k_avail_out[] = "avail_out"; -static const char __pyx_k_bytes_0_1[] = "bytes={0}-{1}"; -static const char __pyx_k_chunksize[] = "chunksize"; -static const char __pyx_k_converter[] = "converter"; -static const char __pyx_k_dataframe[] = "dataframe"; -static const char __pyx_k_delimiter[] = "delimiter"; -static const char __pyx_k_encodings[] = "encodings"; -static const char __pyx_k_enumerate[] = "enumerate"; -static const char __pyx_k_getLogger[] = "getLogger"; -static const char __pyx_k_TextAdapter_lib[] = "TextAdapter.lib"; -static const char __pyx_k_iteritems[] = "iteritems"; -static const char __pyx_k_metaclass[] = "__metaclass__"; -static const char __pyx_k_prev_bits[] = "prev_bits"; -static const char __pyx_k_quotechar[] = "quotechar"; -static const char __pyx_k_skipbytes[] = "skipbytes"; -static const char __pyx_k_start_rec[] = "start_rec"; -static const char __pyx_k_textfileh[] = "textfileh"; -static const char __pyx_k_ExactIndex[] = "ExactIndex"; -static const char __pyx_k_IndexError[] = "IndexError"; -static const char __pyx_k_Read_error[] = "Read error"; -static const char __pyx_k_Seek_error[] = "Seek error"; -static const char __pyx_k_TAG_OFFSET[] = "TAG_OFFSET"; -static const char __pyx_k_ValueError[] = "ValueError"; -static const char __pyx_k_access_key[] = "access_key"; -static const char __pyx_k_connect_s3[] = "connect_s3"; -static const char __pyx_k_escapechar[] = "escapechar"; -static const char __pyx_k_fromstring[] = "fromstring"; -static const char __pyx_k_get_bucket[] = "get_bucket"; -static const char __pyx_k_get_offset[] = "get_offset"; -static const char __pyx_k_index_name[] = "index_name"; -static const char __pyx_k_input_size[] = "input size"; -static const char __pyx_k_input_type[] = "input type"; -static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static const char __pyx_k_read_slice[] = "__read_slice"; -static const char __pyx_k_secret_key[] = "secret_key"; -static const char __pyx_k_set_offset[] = "set_offset"; -static const char __pyx_k_HEADER_SIZE[] = "HEADER_SIZE"; -static const char __pyx_k_ImportError[] = "ImportError"; -static const char __pyx_k_MemoryError[] = "MemoryError"; -static const char __pyx_k_OrderedDict[] = "OrderedDict"; -static const char __pyx_k_ParserError[] = "ParserError"; -static const char __pyx_k_SourceError[] = "SourceError"; -static const char __pyx_k_TextAdapter[] = "TextAdapter"; -static const char __pyx_k_align_fuzzy[] = "align_fuzzy"; -static const char __pyx_k_bucket_name[] = "bucket_name"; -static const char __pyx_k_chunk_sizes[] = "chunk_sizes"; -static const char __pyx_k_collections[] = "collections"; -static const char __pyx_k_compression[] = "compression"; -static const char __pyx_k_concatenate[] = "concatenate"; -static const char __pyx_k_field_count[] = "field_count"; -static const char __pyx_k_field_names[] = "field_names"; -static const char __pyx_k_field_types[] = "field_types"; -static const char __pyx_k_fill_values[] = "fill_values"; -static const char __pyx_k_fixed_width[] = "fixed_width"; -static const char __pyx_k_get_density[] = "get_density"; -static const char __pyx_k_infer_types[] = "__infer_types"; -static const char __pyx_k_inv_rec_num[] = "inv_rec_num"; -static const char __pyx_k_num_offsets[] = "num_offsets"; -static const char __pyx_k_num_records[] = "num_records"; -static const char __pyx_k_object_hook[] = "object_hook"; -static const char __pyx_k_ordereddict[] = "ordereddict"; -static const char __pyx_k_output_size[] = "output size"; -static const char __pyx_k_parse_slice[] = "__parse_slice"; -static const char __pyx_k_prev_window[] = "prev_window"; -static const char __pyx_k_seek_offset[] = "seek_offset"; -static const char __pyx_k_OPTIONS_SIZE[] = "OPTIONS_SIZE"; -static const char __pyx_k_RuntimeError[] = "RuntimeError"; -static const char __pyx_k_VERSION_SIZE[] = "VERSION_SIZE"; -static const char __pyx_k_access_point[] = "access_point"; -static const char __pyx_k_count_fields[] = "count_fields"; -static const char __pyx_k_field_filter[] = "field_filter"; -static const char __pyx_k_field_widths[] = "field_widths"; -static const char __pyx_k_from_records[] = "from_records"; -static const char __pyx_k_input_string[] = "input string"; -static const char __pyx_k_regex_string[] = "regex_string"; -static const char __pyx_k_string_types[] = "string_types"; -static const char __pyx_k_text_adapter[] = "text_adapter"; -static const char __pyx_k_ArgumentError[] = "ArgumentError"; -static const char __pyx_k_CHECKSUM_SIZE[] = "CHECKSUM_SIZE"; -static const char __pyx_k_DataTypeError[] = "DataTypeError"; -static const char __pyx_k_GeneratorType[] = "GeneratorType"; -static const char __pyx_k_OverflowError[] = "OverflowError"; -static const char __pyx_k_S3_read_error[] = "S3 read error"; -static const char __pyx_k_S3_seek_error[] = "S3 seek error"; -static const char __pyx_k_StopIteration[] = "StopIteration"; -static const char __pyx_k_TYPESIZE_SIZE[] = "TYPESIZE_SIZE"; -static const char __pyx_k_convert_error[] = "convert_error"; -static const char __pyx_k_header_length[] = "header_length"; -static const char __pyx_k_infer_types_2[] = "infer_types"; -static const char __pyx_k_open_s3_index[] = "open_s3_index"; -static const char __pyx_k_out_of_memory[] = "out of memory"; -static const char __pyx_k_CSVTextAdapter[] = "CSVTextAdapter"; -static const char __pyx_k_DENSITY_OFFSET[] = "DENSITY_OFFSET"; -static const char __pyx_k_DataIndexError[] = "DataIndexError"; -static const char __pyx_k_FuzzyIdx___len[] = "FuzzyIdx.__len__"; -static const char __pyx_k_FuzzyIdx_close[] = "FuzzyIdx.close"; -static const char __pyx_k_OPTIONS_OFFSET[] = "OPTIONS_OFFSET"; -static const char __pyx_k_RESERVED1_SIZE[] = "RESERVED1_SIZE"; -static const char __pyx_k_VERSION_OFFSET[] = "VERSION_OFFSET"; -static const char __pyx_k_boto_installed[] = "boto_installed"; -static const char __pyx_k_parser_classes[] = "parser_classes"; -static const char __pyx_k_urllib_request[] = "urllib.request"; -static const char __pyx_k_user_converter[] = "user converter"; -static const char __pyx_k_CHECKSUM_OFFSET[] = "CHECKSUM_OFFSET"; -static const char __pyx_k_FuzzyIdx___init[] = "FuzzyIdx.__init__"; -static const char __pyx_k_JSONTextAdapter[] = "JSONTextAdapter"; -static const char __pyx_k_NUMOFFSETS_SIZE[] = "NUMOFFSETS_SIZE"; -static const char __pyx_k_TYPESIZE_OFFSET[] = "TYPESIZE_OFFSET"; -static const char __pyx_k_get_field_names[] = "get_field_names"; -static const char __pyx_k_get_field_types[] = "get_field_types"; -static const char __pyx_k_open_disk_index[] = "open_disk_index"; -static const char __pyx_k_remote_s3_index[] = "remote_s3_index"; -static const char __pyx_k_s3_text_adapter[] = "s3_text_adapter"; -static const char __pyx_k_set_field_names[] = "set_field_names"; -static const char __pyx_k_set_field_types[] = "set_field_types"; -static const char __pyx_k_set_fill_values[] = "__set_fill_values"; -static const char __pyx_k_AdapterException[] = "AdapterException"; -static const char __pyx_k_ExactIndex___len[] = "ExactIndex.__len__"; -static const char __pyx_k_ExactIndex_close[] = "ExactIndex.close"; -static const char __pyx_k_NoSuchFieldError[] = "NoSuchFieldError"; -static const char __pyx_k_RESERVED1_OFFSET[] = "RESERVED1_OFFSET"; -static const char __pyx_k_RegexTextAdapter[] = "RegexTextAdapter"; -static const char __pyx_k_build_converters[] = "__build_converters"; -static const char __pyx_k_get_field_filter[] = "get_field_filter"; -static const char __pyx_k_object_converter[] = "object converter"; -static const char __pyx_k_pandas_installed[] = "pandas_installed"; -static const char __pyx_k_set_field_filter[] = "set_field_filter"; -static const char __pyx_k_skipinitialspace[] = "skipinitialspace"; -static const char __pyx_k_AdapterIndexError[] = "AdapterIndexError"; -static const char __pyx_k_ExactIndex___init[] = "ExactIndex.__init__"; -static const char __pyx_k_NUMOFFSETS_OFFSET[] = "NUMOFFSETS_OFFSET"; -static const char __pyx_k_TextAdapterFields[] = "TextAdapterFields"; -static const char __pyx_k_compressed_offset[] = "compressed_offset"; -static const char __pyx_k_create_disk_index[] = "create_disk_index"; -static const char __pyx_k_init_text_adapter[] = "__init_text_adapter"; -static const char __pyx_k_object_pairs_hook[] = "object_pairs_hook"; -static const char __pyx_k_temp_field_filter[] = "temp_field_filter"; -static const char __pyx_k_total_num_records[] = "total_num_records"; -static const char __pyx_k_whitespace_delims[] = "whitespace_delims"; -static const char __pyx_k_ConfigurationError[] = "ConfigurationError"; -static const char __pyx_k_Invalid_field_name[] = "Invalid field name"; -static const char __pyx_k_get_size_skipbytes[] = "get_size_skipbytes"; -static const char __pyx_k_gzip_access_points[] = "gzip_access_points"; -static const char __pyx_k_index_out_ot_range[] = "index out ot range"; -static const char __pyx_k_normalize_encoding[] = "normalize_encoding"; -static const char __pyx_k_set_missing_values[] = "set_missing_values"; -static const char __pyx_k_ExactIndex_finalize[] = "ExactIndex.finalize"; -static const char __pyx_k_NotImplementedError[] = "NotImplementedError"; -static const char __pyx_k_default_fill_values[] = "default_fill_values"; -static const char __pyx_k_no_conversion_error[] = "no conversion error"; -static const char __pyx_k_set_dtype_converter[] = "__set_dtype_converter"; -static const char __pyx_k_supported_encodings[] = "supported_encodings"; -static const char __pyx_k_uncompressed_offset[] = "uncompressed_offset"; -static const char __pyx_k_Error_reading_tokens[] = "Error reading tokens"; -static const char __pyx_k_FuzzyIdx_align_fuzzy[] = "FuzzyIdx.align_fuzzy"; -static const char __pyx_k_FuzzyIdx_chunk_sizes[] = "FuzzyIdx.chunk_sizes"; -static const char __pyx_k_FuzzyIdx_seek_offset[] = "FuzzyIdx.seek_offset"; -static const char __pyx_k_Invalid_field_number[] = "Invalid field number"; -static const char __pyx_k_default_field_filter[] = "default_field_filter"; -static const char __pyx_k_density_is_too_large[] = "density is too large"; -static const char __pyx_k_get_sample_chunksize[] = "get_sample_chunksize"; -static const char __pyx_k_invalid_field_number[] = "invalid field number "; -static const char __pyx_k_Error_reading_records[] = "Error reading records"; -static const char __pyx_k_ExactIndex_get_offset[] = "ExactIndex.get_offset"; -static const char __pyx_k_ExactIndex_set_offset[] = "ExactIndex.set_offset"; -static const char __pyx_k_FixedWidthTextAdapter[] = "FixedWidthTextAdapter"; -static const char __pyx_k_Invalid_record_number[] = "Invalid record number"; -static const char __pyx_k_Unknown_text_parser_s[] = "Unknown text parser '%s'"; -static const char __pyx_k_add_gzip_access_point[] = "add_gzip_access_point"; -static const char __pyx_k_convert_error_reasons[] = "convert_error_reasons"; -static const char __pyx_k_get_gzip_access_point[] = "get_gzip_access_point"; -static const char __pyx_k_Error_processing_token[] = "Error processing token"; -static const char __pyx_k_ExactIndex_get_density[] = "ExactIndex.get_density"; -static const char __pyx_k_TOTAL_NUM_RECORDS_SIZE[] = "TOTAL_NUM_RECORDS_SIZE"; -static const char __pyx_k_build_python_converter[] = "__build_python_converter"; -static const char __pyx_k_default_missing_values[] = "default_missing_values"; -static const char __pyx_k_get_contents_as_string[] = "get_contents_as_string"; -static const char __pyx_k_num_gzip_access_points[] = "num_gzip_access_points"; -static const char __pyx_k_prev_compressed_offset[] = "prev_compressed_offset"; -static const char __pyx_k_read_slice_infer_types[] = "__read_slice_infer_types"; -static const char __pyx_k_text_adapter_exception[] = "text_adapter_exception"; -static const char __pyx_k_group_whitespace_delims[] = "group_whitespace_delims"; -static const char __pyx_k_raise_adapter_exception[] = "__raise_adapter_exception"; -static const char __pyx_k_ExactIndex_open_s3_index[] = "ExactIndex.open_s3_index"; -static const char __pyx_k_TOTAL_NUM_RECORDS_OFFSET[] = "TOTAL_NUM_RECORDS_OFFSET"; -static const char __pyx_k_prev_uncompressed_offset[] = "prev_uncompressed_offset"; -static const char __pyx_k_Record_0_is_out_of_bounds[] = "Record {0} is out of bounds"; -static const char __pyx_k_is_not_a_valid_field_name[] = " is not a valid field name"; -static const char __pyx_k_ExactIndex_open_disk_index[] = "ExactIndex.open_disk_index"; -static const char __pyx_k_unknown_compression_type_0[] = "unknown compression type {0}"; -static const char __pyx_k_Field_must_be_int_or_string[] = "Field must be int or string"; -static const char __pyx_k_NUM_GZIP_ACCESS_POINTS_SIZE[] = "NUM_GZIP_ACCESS_POINTS_SIZE"; -static const char __pyx_k_cinit___locals_count_fields[] = "__cinit__..count_fields"; -static const char __pyx_k_field_must_be_int_in_string[] = "field must be int in string"; -static const char __pyx_k_get_mapping_from_converters[] = "__get_mapping_from_converters"; -static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; -static const char __pyx_k_set_converter_locals_lambda[] = "set_converter.."; -static const char __pyx_k_0_encoding_not_supported_yet[] = "{0} encoding not supported yet "; -static const char __pyx_k_ExactIndex_create_disk_index[] = "ExactIndex.create_disk_index"; -static const char __pyx_k_FuzzyIdx_get_sample_chunksize[] = "FuzzyIdx.get_sample_chunksize"; -static const char __pyx_k_NUM_GZIP_ACCESS_POINTS_OFFSET[] = "NUM_GZIP_ACCESS_POINTS_OFFSET"; -static const char __pyx_k_TextAdapter_textadapter_TextAdapter[] = "TextAdapter.textadapter.TextAdapter"; -static const char __pyx_k_Invalid_record_number_or_slice[] = "Invalid record number or slice"; -static const char __pyx_k_Pandas_module_is_not_installed[] = "Pandas module is not installed."; -static const char __pyx_k_getitem___locals_TextAdapterFi[] = "__getitem__..TextAdapterFields"; -static const char __pyx_k_infer_types_setting_dtype_0_fo[] = "__infer_types() setting dtype {0} for field {1}"; -static const char __pyx_k_n_not_detected_in_the_backward[] = "\\n not detected in the backward direction!"; -static const char __pyx_k_set_field_names_locals_genexpr[] = "set_field_names..genexpr"; -static const char __pyx_k_set_field_types_locals_genexpr[] = "set_field_types..genexpr"; -static const char __pyx_k_Adapter_has_no_fields_specified[] = "Adapter has no fields specified"; -static const char __pyx_k_Cannot_open_data_source_of_type[] = "Cannot open data source of type %s must be file name, url, StringIO, BytesIO, or generator "; -static const char __pyx_k_Could_not_find_record_offset_in[] = "Could not find record offset in index"; -static const char __pyx_k_Implementation_of_a_fuzzy_index[] = "Implementation of a fuzzy index"; -static const char __pyx_k_Invalid_character_in_input_data[] = "Invalid character in input data"; -static const char __pyx_k_Invalid_index_0_for_field_names[] = "Invalid index {0} for field names [{1}]. Default field names will be used."; -static const char __pyx_k_No_missing_values_specified_for[] = "No missing values specified for field "; -static const char __pyx_k_Unknown_text_adapter_error_code[] = "Unknown text adapter error (code %d)"; -static const char __pyx_k_Users_dmertz_Projects_TextAdapt[] = "/Users/dmertz/Projects/TextAdapter/TextAdapter/textadapter/TextAdapter.pyx"; -static const char __pyx_k_n_not_detected_in_the_forward_d[] = "\\n not detected in the forward direction!"; -static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; -static const char __pyx_k_set_field_filter_locals_genexpr[] = "set_field_filter..genexpr"; -static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; -static const char __pyx_k_Cannot_use_s3_interface_boto_not[] = "Cannot use s3 interface: boto not installed"; -static const char __pyx_k_Could_not_convert_token_0_at_rec[] = "Could not convert token \"{0}\" at record {1} field {2} to {3}.Reason: {4}"; -static const char __pyx_k_Could_not_initialize_data_source[] = "Could not initialize data source"; -static const char __pyx_k_Could_not_initialize_text_adapte[] = "Could not initialize text adapter"; -static const char __pyx_k_ExactIndex_add_gzip_access_point[] = "ExactIndex.add_gzip_access_point"; -static const char __pyx_k_ExactIndex_get_gzip_access_point[] = "ExactIndex.get_gzip_access_point"; -static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; -static const char __pyx_k_Implementation_of_an_exact_index[] = "Implementation of an exact index on-disk.\n\n The following ASCII representation shows the layout of the header::\n\n |-0-|-1-|-2-|-3-|-4-|-5-|-6-|-7-|-8-|-9-|-A-|-B-|-C-|-D-|-E-|-F-|\n | t a i x | ^ | ^ | ^ | ^ | density | RESERVED |\n | | | |\n version ----+ | | |\n options --------+ | |\n checksum ------------+ |\n typesize ----------------+\n\n |-0-|-1-|-2-|-3-|-4-|-5-|-6-|-7-|-8-|-9-|-A-|-B-|-C-|-D-|-E-|-F-|\n | num_offsets | num_gzip_access_points |\n\n |-0-|-1-|-2-|-3-|-4-|-5-|-6-|-7-|-8-|-9-|-A-|-B-|-C-|-D-|-E-|-F-|\n | total_num_records | RESERVED |\n\n |-0-|-1-|-2-|-3-|-4-|-5-|-6-|-7-|-8-|-9-|-A-|-B-|-C-|-D-|-E-|-F-|\n | RESERVED | RESERVED |\n\n\n The 'taix' magic bytes stand for 'Text Adapter IndeX'. See below for\n other fields.\n\n Description of the header entries\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n All entries are little-endian.\n\n :version:\n (``uint8``)\n Format version of the TAIX header, to ensure exceptions in case of\n forward incompatibilities.\n\n :options:\n (``bitfield``)\n A bitfield which allows for setting certain options in this file.\n\n :``bit 0 (0x01)``:\n If the offsets in this file are compressed.\n\n :checksum:\n (``uint8``)\n The checksum used. The following checksums, available in the python\n standard library should be supported. The checksum is always computed\n on the compressed data and placed after the chunk.\n\n :``0``:\n ``no checksum``\n :``1``:\n ``zlib.adler32``\n :``2``:\n ``zlib.crc32``\n :``3``:\n ``hashlib.md5``\n :``4``:\n ``hashlib.sha1``\n :``5""``:\n ``hashlib.sha224``\n :``6``:\n ``hashlib.sha256``\n :``7``:\n ``hashlib.sha384``\n :``8``:\n ``Hashlib.sha512``\n\n :typesize:\n (``uint8``)\n The typesize of the data in the index. Currently, assume that the\n default typesize is 8 (uint64).\n\n :density:\n (``uint32``)\n Denotes the density of the index. A value of 1 means a fully dense\n index (i.e. 1 offset entry per record), while a value N larger than 1\n means and sparse index (i.e. 1 offset entry per N records).\n\n :num_offsets:\n (``uint64``)\n Denotes the number of records in the text file. Value of zero means\n no records have been indexed.\n "; -static const char __pyx_k_Invalid_missing_value_must_be_st[] = "Invalid missing value; must be string (is {0})"; -static const char __pyx_k_No_fields_found_or_no_converters[] = "No fields found or no converters set"; -static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; -static const char __pyx_k_NumPy_1_6_datetime_timedelta_not[] = "NumPy 1.6 datetime/timedelta not supported"; -static const char __pyx_k_Number_of_field_names_0_does_not[] = "Number of field names ({0}) does not match number of fields ({1}) in data source"; -static const char __pyx_k_Pandas_module_is_not_installed_O[] = "Pandas module is not installed. Output type will be set to numpy array."; -static const char __pyx_k_TextAdapter_cannot_be_used_direc[] = "TextAdapter cannot be used directly. Use CSVTextAdapter, FixedWidthTextAdapter, RegexTextAdapter,or JSONTextAdapter"; -static const char __pyx_k_The_magic_value_s_is_not_recogni[] = "The magic value '%s' is not recognized!"; -static const char __pyx_k_could_not_guess_delimiter_charac[] = "could not guess delimiter character"; -static const char __pyx_k_delimiter_must_be_ASCII_characte[] = "delimiter must be ASCII character"; -static const char __pyx_k_field_to_map_must_be_int_or_stri[] = "field to map must be int or string"; -static const char __pyx_k_field_width_must_be_greater_than[] = "field width must be greater than 0"; -static const char __pyx_k_field_widths_must_be_specified_b[] = "field widths must be specified by int or list of ints"; -static const char __pyx_k_getitem___locals_TextAdapterFi_2[] = "__getitem__..TextAdapterFields.__init__"; -static const char __pyx_k_getitem___locals_TextAdapterFi_3[] = "__getitem__..TextAdapterFields.__getitem__"; -static const char __pyx_k_index_must_be_int_slice_fancy_in[] = "index must be int, slice, fancy indexing, or field name"; -static const char __pyx_k_missing_values_must_be_dict_of_f[] = "missing values must be dict of field numbers and missing value strings (is {0})"; -static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; -static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; -static const char __pyx_k_reverse_stepping_not_implemented[] = "reverse stepping not implemented yet"; -static const char __pyx_k_set_field_filter_setting_field_f[] = "set_field_filter() setting field filter to [{0}]"; -static const char __pyx_k_set_field_names_setting_field_na[] = "set_field_names() setting field names to [{0}]"; -static const char __pyx_k_set_field_types_setting_dtypes_t[] = "set_field_types() setting dtypes to {0}"; -static const char __pyx_k_types_must_be_dict_of_fields_dty[] = "types must be dict of fields/dtypes, or None to reset field types"; -static const char __pyx_k_Users_dmertz_Projects_TextAdapt_2[] = "/Users/dmertz/Projects/TextAdapter/TextAdapter/textadapter/Index.pyx"; -static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; -static PyObject *__pyx_kp_s_0_encoding_not_supported_yet; -static PyObject *__pyx_kp_s_1_6; -static PyObject *__pyx_kp_s_2_7; -static PyObject *__pyx_kp_s_3; -static PyObject *__pyx_n_s_AdapterException; -static PyObject *__pyx_n_s_AdapterIndexError; -static PyObject *__pyx_kp_s_Adapter_has_no_fields_specified; -static PyObject *__pyx_n_s_ArgumentError; -static PyObject *__pyx_n_s_BytesIO; -static PyObject *__pyx_n_s_CHECKSUM_OFFSET; -static PyObject *__pyx_n_s_CHECKSUM_SIZE; -static PyObject *__pyx_n_s_CS; -static PyObject *__pyx_n_s_CSVTextAdapter; -static PyObject *__pyx_kp_s_Cannot_open_data_source_of_type; -static PyObject *__pyx_kp_s_Cannot_use_s3_interface_boto_not; -static PyObject *__pyx_n_s_ConfigurationError; -static PyObject *__pyx_kp_s_Could_not_convert_token_0_at_rec; -static PyObject *__pyx_kp_s_Could_not_find_record_offset_in; -static PyObject *__pyx_kp_s_Could_not_initialize_data_source; -static PyObject *__pyx_kp_s_Could_not_initialize_text_adapte; -static PyObject *__pyx_n_s_DEBUG; -static PyObject *__pyx_n_s_DENSITY_OFFSET; -static PyObject *__pyx_n_s_DataFrame; -static PyObject *__pyx_n_s_DataIndexError; -static PyObject *__pyx_n_s_DataTypeError; -static PyObject *__pyx_n_s_EOFError; -static PyObject *__pyx_n_s_Error; -static PyObject *__pyx_kp_s_Error_processing_token; -static PyObject *__pyx_kp_s_Error_reading_records; -static PyObject *__pyx_kp_s_Error_reading_tokens; -static PyObject *__pyx_n_s_ExactIndex; -static PyObject *__pyx_n_s_ExactIndex___init; -static PyObject *__pyx_n_s_ExactIndex___len; -static PyObject *__pyx_n_s_ExactIndex_add_gzip_access_point; -static PyObject *__pyx_n_s_ExactIndex_close; -static PyObject *__pyx_n_s_ExactIndex_create_disk_index; -static PyObject *__pyx_n_s_ExactIndex_finalize; -static PyObject *__pyx_n_s_ExactIndex_get_density; -static PyObject *__pyx_n_s_ExactIndex_get_gzip_access_point; -static PyObject *__pyx_n_s_ExactIndex_get_offset; -static PyObject *__pyx_n_s_ExactIndex_open_disk_index; -static PyObject *__pyx_n_s_ExactIndex_open_s3_index; -static PyObject *__pyx_n_s_ExactIndex_set_offset; -static PyObject *__pyx_kp_s_Field_must_be_int_or_string; -static PyObject *__pyx_n_s_FixedWidthTextAdapter; -static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; -static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; -static PyObject *__pyx_n_s_FuzzyIdx; -static PyObject *__pyx_n_s_FuzzyIdx___init; -static PyObject *__pyx_n_s_FuzzyIdx___len; -static PyObject *__pyx_n_s_FuzzyIdx_align_fuzzy; -static PyObject *__pyx_n_s_FuzzyIdx_chunk_sizes; -static PyObject *__pyx_n_s_FuzzyIdx_close; -static PyObject *__pyx_n_s_FuzzyIdx_get_sample_chunksize; -static PyObject *__pyx_n_s_FuzzyIdx_seek_offset; -static PyObject *__pyx_n_s_GeneratorType; -static PyObject *__pyx_n_s_HEADER_SIZE; -static PyObject *__pyx_n_s_INFO; -static PyObject *__pyx_n_s_IOError; -static PyObject *__pyx_kp_s_Implementation_of_a_fuzzy_index; -static PyObject *__pyx_kp_s_Implementation_of_an_exact_index; -static PyObject *__pyx_n_s_ImportError; -static PyObject *__pyx_n_s_IndexError; -static PyObject *__pyx_kp_s_Invalid_character_in_input_data; -static PyObject *__pyx_kp_s_Invalid_field_name; -static PyObject *__pyx_kp_s_Invalid_field_number; -static PyObject *__pyx_kp_s_Invalid_index_0_for_field_names; -static PyObject *__pyx_kp_s_Invalid_missing_value_must_be_st; -static PyObject *__pyx_kp_s_Invalid_record_number; -static PyObject *__pyx_kp_s_Invalid_record_number_or_slice; -static PyObject *__pyx_n_s_JSONTextAdapter; -static PyObject *__pyx_n_s_Key; -static PyObject *__pyx_n_s_KeyError; -static PyObject *__pyx_n_s_M; -static PyObject *__pyx_n_s_MemoryError; -static PyObject *__pyx_n_s_NA; -static PyObject *__pyx_n_s_NB; -static PyObject *__pyx_n_s_NUMOFFSETS_OFFSET; -static PyObject *__pyx_n_s_NUMOFFSETS_SIZE; -static PyObject *__pyx_n_s_NUM_GZIP_ACCESS_POINTS_OFFSET; -static PyObject *__pyx_n_s_NUM_GZIP_ACCESS_POINTS_SIZE; -static PyObject *__pyx_n_s_NaN; -static PyObject *__pyx_n_s_NoSuchFieldError; -static PyObject *__pyx_kp_s_No_fields_found_or_no_converters; -static PyObject *__pyx_kp_s_No_missing_values_specified_for; -static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; -static PyObject *__pyx_n_s_None; -static PyObject *__pyx_n_s_NotImplementedError; -static PyObject *__pyx_kp_s_NumPy_1_6_datetime_timedelta_not; -static PyObject *__pyx_kp_s_Number_of_field_names_0_does_not; -static PyObject *__pyx_n_s_O; -static PyObject *__pyx_n_s_OPTIONS_OFFSET; -static PyObject *__pyx_n_s_OPTIONS_SIZE; -static PyObject *__pyx_n_s_OrderedDict; -static PyObject *__pyx_n_s_OverflowError; -static PyObject *__pyx_kp_s_Pandas_module_is_not_installed; -static PyObject *__pyx_kp_s_Pandas_module_is_not_installed_O; -static PyObject *__pyx_n_s_ParserError; -static PyObject *__pyx_n_s_RESERVED1_OFFSET; -static PyObject *__pyx_n_s_RESERVED1_SIZE; -static PyObject *__pyx_n_s_Range; -static PyObject *__pyx_kp_s_Read_error; -static PyObject *__pyx_kp_s_Record_0_is_out_of_bounds; -static PyObject *__pyx_n_s_RegexTextAdapter; -static PyObject *__pyx_n_s_RuntimeError; -static PyObject *__pyx_n_s_S; -static PyObject *__pyx_n_s_S32768; -static PyObject *__pyx_kp_s_S3_read_error; -static PyObject *__pyx_kp_s_S3_seek_error; -static PyObject *__pyx_n_s_SEEK_END; -static PyObject *__pyx_n_s_SEEK_SET; -static PyObject *__pyx_kp_s_Seek_error; -static PyObject *__pyx_n_s_Sniffer; -static PyObject *__pyx_n_s_SourceError; -static PyObject *__pyx_n_s_StopIteration; -static PyObject *__pyx_n_s_StringIO; -static PyObject *__pyx_n_s_TAG_OFFSET; -static PyObject *__pyx_n_s_TAG_SIZE; -static PyObject *__pyx_n_s_TOTAL_NUM_RECORDS_OFFSET; -static PyObject *__pyx_n_s_TOTAL_NUM_RECORDS_SIZE; -static PyObject *__pyx_n_s_TYPESIZE_OFFSET; -static PyObject *__pyx_n_s_TYPESIZE_SIZE; -static PyObject *__pyx_n_s_TextAdapter; -static PyObject *__pyx_n_s_TextAdapterFields; -static PyObject *__pyx_kp_s_TextAdapter_cannot_be_used_direc; -static PyObject *__pyx_kp_s_The_magic_value_s_is_not_recogni; -static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_n_s_U; -static PyObject *__pyx_kp_s_Unknown_text_adapter_error_code; -static PyObject *__pyx_kp_s_Unknown_text_parser_s; -static PyObject *__pyx_kp_s_Users_dmertz_Projects_TextAdapt; -static PyObject *__pyx_kp_s_Users_dmertz_Projects_TextAdapt_2; -static PyObject *__pyx_n_s_VERSION_OFFSET; -static PyObject *__pyx_n_s_VERSION_SIZE; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_kp_s__25; -static PyObject *__pyx_kp_b__27; -static PyObject *__pyx_kp_s__27; -static PyObject *__pyx_kp_s__37; -static PyObject *__pyx_kp_s__38; -static PyObject *__pyx_kp_s__50; -static PyObject *__pyx_kp_s__51; -static PyObject *__pyx_kp_s__78; -static PyObject *__pyx_kp_s__79; -static PyObject *__pyx_kp_s__80; -static PyObject *__pyx_kp_s__91; -static PyObject *__pyx_n_s_access_key; -static PyObject *__pyx_n_s_access_point; -static PyObject *__pyx_n_s_adapter; -static PyObject *__pyx_n_s_add_gzip_access_point; -static PyObject *__pyx_n_s_aliases; -static PyObject *__pyx_n_s_align_fuzzy; -static PyObject *__pyx_n_s_all; -static PyObject *__pyx_n_s_allsizes; -static PyObject *__pyx_n_s_append; -static PyObject *__pyx_n_s_args; -static PyObject *__pyx_n_s_array; -static PyObject *__pyx_n_s_asarray; -static PyObject *__pyx_n_s_ascii; -static PyObject *__pyx_n_s_asizes; -static PyObject *__pyx_n_s_avail_in; -static PyObject *__pyx_n_s_avail_out; -static PyObject *__pyx_n_s_b; -static PyObject *__pyx_n_s_bits; -static PyObject *__pyx_n_s_boto; -static PyObject *__pyx_n_s_boto_installed; -static PyObject *__pyx_n_s_boto_s3; -static PyObject *__pyx_n_s_bpos; -static PyObject *__pyx_n_s_bucket; -static PyObject *__pyx_n_s_bucket_name; -static PyObject *__pyx_n_s_build_converters; -static PyObject *__pyx_n_s_build_python_converter; -static PyObject *__pyx_n_s_bytes; -static PyObject *__pyx_kp_s_bytes_0_1; -static PyObject *__pyx_n_s_c; -static PyObject *__pyx_n_s_ceil; -static PyObject *__pyx_n_s_checksum; -static PyObject *__pyx_n_s_chunk; -static PyObject *__pyx_n_s_chunk_sizes; -static PyObject *__pyx_n_s_chunksize; -static PyObject *__pyx_n_s_cinit___locals_count_fields; -static PyObject *__pyx_n_s_close; -static PyObject *__pyx_n_s_collections; -static PyObject *__pyx_n_s_comment; -static PyObject *__pyx_n_s_compile; -static PyObject *__pyx_n_s_compressed_offset; -static PyObject *__pyx_n_s_compression; -static PyObject *__pyx_n_s_concatenate; -static PyObject *__pyx_n_s_config; -static PyObject *__pyx_n_s_conn; -static PyObject *__pyx_n_s_connect_s3; -static PyObject *__pyx_n_s_convert_error; -static PyObject *__pyx_n_s_convert_error_reasons; -static PyObject *__pyx_n_s_converter; -static PyObject *__pyx_kp_s_could_not_guess_delimiter_charac; -static PyObject *__pyx_n_s_count; -static PyObject *__pyx_n_s_count_fields; -static PyObject *__pyx_n_s_create_disk_index; -static PyObject *__pyx_n_s_csv; -static PyObject *__pyx_n_s_data; -static PyObject *__pyx_n_s_dataframe; -static PyObject *__pyx_n_s_debug; -static PyObject *__pyx_n_s_decode; -static PyObject *__pyx_n_s_default_field_filter; -static PyObject *__pyx_n_s_default_fill_values; -static PyObject *__pyx_n_s_default_missing_values; -static PyObject *__pyx_n_s_delimiter; -static PyObject *__pyx_kp_s_delimiter_must_be_ASCII_characte; -static PyObject *__pyx_n_s_density; -static PyObject *__pyx_kp_s_density_is_too_large; -static PyObject *__pyx_n_s_doc; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_e; -static PyObject *__pyx_n_s_emean; -static PyObject *__pyx_n_s_empty; -static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_encoding; -static PyObject *__pyx_n_s_encodings; -static PyObject *__pyx_n_s_end; -static PyObject *__pyx_n_s_endswith; -static PyObject *__pyx_n_s_enumerate; -static PyObject *__pyx_n_s_error; -static PyObject *__pyx_n_s_errors; -static PyObject *__pyx_n_s_escape; -static PyObject *__pyx_n_s_escapechar; -static PyObject *__pyx_n_s_esizes; -static PyObject *__pyx_n_s_estd; -static PyObject *__pyx_n_s_exists; -static PyObject *__pyx_n_s_f; -static PyObject *__pyx_kp_s_f_d; -static PyObject *__pyx_n_s_fh; -static PyObject *__pyx_n_s_field; -static PyObject *__pyx_n_s_field_count; -static PyObject *__pyx_n_s_field_filter; -static PyObject *__pyx_kp_s_field_must_be_int_in_string; -static PyObject *__pyx_n_s_field_names; -static PyObject *__pyx_kp_s_field_to_map_must_be_int_or_stri; -static PyObject *__pyx_n_s_field_types; -static PyObject *__pyx_kp_s_field_width_must_be_greater_than; -static PyObject *__pyx_n_s_field_widths; -static PyObject *__pyx_kp_s_field_widths_must_be_specified_b; -static PyObject *__pyx_n_s_fields; -static PyObject *__pyx_n_s_filesize; -static PyObject *__pyx_n_s_fill_values; -static PyObject *__pyx_n_s_finalize; -static PyObject *__pyx_n_s_find; -static PyObject *__pyx_n_s_fixed_width; -static PyObject *__pyx_n_s_footer; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_fpos; -static PyObject *__pyx_n_s_from_records; -static PyObject *__pyx_n_s_fromfile; -static PyObject *__pyx_n_s_fromstring; -static PyObject *__pyx_kp_s_ftp; -static PyObject *__pyx_n_s_fuzzy; -static PyObject *__pyx_n_s_generic; -static PyObject *__pyx_n_s_genexpr; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_getLogger; -static PyObject *__pyx_n_s_get_bucket; -static PyObject *__pyx_n_s_get_contents_as_string; -static PyObject *__pyx_n_s_get_density; -static PyObject *__pyx_n_s_get_field_filter; -static PyObject *__pyx_n_s_get_field_names; -static PyObject *__pyx_n_s_get_field_types; -static PyObject *__pyx_n_s_get_gzip_access_point; -static PyObject *__pyx_n_s_get_mapping_from_converters; -static PyObject *__pyx_n_s_get_offset; -static PyObject *__pyx_n_s_get_sample_chunksize; -static PyObject *__pyx_n_s_get_size_skipbytes; -static PyObject *__pyx_n_s_getitem; -static PyObject *__pyx_n_s_getitem___locals_TextAdapterFi; -static PyObject *__pyx_n_s_getitem___locals_TextAdapterFi_2; -static PyObject *__pyx_n_s_getitem___locals_TextAdapterFi_3; -static PyObject *__pyx_n_s_group_whitespace_delims; -static PyObject *__pyx_n_s_groups; -static PyObject *__pyx_kp_s_gz; -static PyObject *__pyx_n_s_gzip; -static PyObject *__pyx_n_s_gzip_access_points; -static PyObject *__pyx_n_s_header; -static PyObject *__pyx_n_s_header_length; -static PyObject *__pyx_n_s_headers; -static PyObject *__pyx_n_s_hnb; -static PyObject *__pyx_kp_s_http; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_i4; -static PyObject *__pyx_n_s_i8; -static PyObject *__pyx_kp_s_i_d; -static PyObject *__pyx_kp_s_idx; -static PyObject *__pyx_n_s_idxfile; -static PyObject *__pyx_n_s_idxh; -static PyObject *__pyx_n_s_imean; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_index; -static PyObject *__pyx_kp_s_index_must_be_int_slice_fancy_in; -static PyObject *__pyx_n_s_index_name; -static PyObject *__pyx_kp_s_index_out_ot_range; -static PyObject *__pyx_n_s_indexing; -static PyObject *__pyx_n_s_inf; -static PyObject *__pyx_kp_s_inf_2; -static PyObject *__pyx_n_s_infer_types; -static PyObject *__pyx_n_s_infer_types_2; -static PyObject *__pyx_kp_s_infer_types_setting_dtype_0_fo; -static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_s_init_text_adapter; -static PyObject *__pyx_kp_s_input_size; -static PyObject *__pyx_kp_s_input_string; -static PyObject *__pyx_kp_s_input_type; -static PyObject *__pyx_n_s_inv_rec_num; -static PyObject *__pyx_kp_s_invalid_field_number; -static PyObject *__pyx_n_s_io; -static PyObject *__pyx_n_s_ioffset; -static PyObject *__pyx_n_s_TextAdapter_lib; -static PyObject *__pyx_n_s_TextAdapter_textadapter_TextAdapter; -static PyObject *__pyx_kp_s_is_not_a_valid_field_name; -static PyObject *__pyx_n_s_isizes; -static PyObject *__pyx_n_s_istd; -static PyObject *__pyx_n_s_items; -static PyObject *__pyx_n_s_itemsize; -static PyObject *__pyx_n_s_iteritems; -static PyObject *__pyx_n_s_join; -static PyObject *__pyx_n_s_json; -static PyObject *__pyx_n_s_k; -static PyObject *__pyx_n_s_key; -static PyObject *__pyx_n_s_key_name; -static PyObject *__pyx_n_s_keys; -static PyObject *__pyx_n_s_kind; -static PyObject *__pyx_n_s_kwargs; -static PyObject *__pyx_n_s_len; -static PyObject *__pyx_n_s_loads; -static PyObject *__pyx_n_s_logging; -static PyObject *__pyx_n_s_lookup; -static PyObject *__pyx_n_s_loose; -static PyObject *__pyx_n_s_m; -static PyObject *__pyx_n_s_magic; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_math; -static PyObject *__pyx_n_s_mean; -static PyObject *__pyx_n_s_metaclass; -static PyObject *__pyx_kp_s_missing_values_must_be_dict_of_f; -static PyObject *__pyx_n_s_module; -static PyObject *__pyx_kp_s_n_not_detected_in_the_backward; -static PyObject *__pyx_kp_s_n_not_detected_in_the_forward_d; -static PyObject *__pyx_n_s_nan; -static PyObject *__pyx_n_s_ndarray; -static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; -static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; -static PyObject *__pyx_n_s_next; -static PyObject *__pyx_kp_s_no_conversion_error; -static PyObject *__pyx_n_s_none; -static PyObject *__pyx_n_s_normalize_encoding; -static PyObject *__pyx_n_s_nrecords; -static PyObject *__pyx_n_s_num; -static PyObject *__pyx_n_s_num_gzip_access_points; -static PyObject *__pyx_n_s_num_offsets; -static PyObject *__pyx_n_s_num_records; -static PyObject *__pyx_n_s_num_recs; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; -static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; -static PyObject *__pyx_n_s_object; -static PyObject *__pyx_kp_s_object_converter; -static PyObject *__pyx_n_s_object_hook; -static PyObject *__pyx_n_s_object_pairs_hook; -static PyObject *__pyx_n_s_offset; -static PyObject *__pyx_n_s_offsets; -static PyObject *__pyx_n_s_open; -static PyObject *__pyx_n_s_open_disk_index; -static PyObject *__pyx_n_s_open_s3_index; -static PyObject *__pyx_n_s_options; -static PyObject *__pyx_n_s_ordereddict; -static PyObject *__pyx_n_s_os; -static PyObject *__pyx_kp_s_out_of_memory; -static PyObject *__pyx_n_s_output; -static PyObject *__pyx_kp_s_output_size; -static PyObject *__pyx_n_s_overflow; -static PyObject *__pyx_n_s_pandas; -static PyObject *__pyx_n_s_pandas_installed; -static PyObject *__pyx_n_s_parse_slice; -static PyObject *__pyx_n_s_parser; -static PyObject *__pyx_n_s_parser_classes; -static PyObject *__pyx_n_s_path; -static PyObject *__pyx_n_s_pos; -static PyObject *__pyx_n_s_prepare; -static PyObject *__pyx_n_s_prev_bits; -static PyObject *__pyx_n_s_prev_compressed_offset; -static PyObject *__pyx_n_s_prev_uncompressed_offset; -static PyObject *__pyx_n_s_prev_window; -static PyObject *__pyx_n_s_property; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_qualname; -static PyObject *__pyx_n_s_quote; -static PyObject *__pyx_n_s_quotechar; -static PyObject *__pyx_kp_s_r_b; -static PyObject *__pyx_n_s_raise_adapter_exception; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_re; -static PyObject *__pyx_n_s_read; -static PyObject *__pyx_n_s_read_slice; -static PyObject *__pyx_n_s_read_slice_infer_types; -static PyObject *__pyx_n_s_reader; -static PyObject *__pyx_n_s_reason; -static PyObject *__pyx_n_s_rec; -static PyObject *__pyx_n_s_rec_num; -static PyObject *__pyx_n_s_record; -static PyObject *__pyx_n_s_regex; -static PyObject *__pyx_n_s_regex_string; -static PyObject *__pyx_n_s_remote_s3_index; -static PyObject *__pyx_n_s_remove; -static PyObject *__pyx_kp_s_reverse_stepping_not_implemented; -static PyObject *__pyx_n_s_rfind; -static PyObject *__pyx_n_s_round; -static PyObject *__pyx_n_s_s3_key; -static PyObject *__pyx_n_s_s3_text_adapter; -static PyObject *__pyx_n_s_secret_key; -static PyObject *__pyx_n_s_seek; -static PyObject *__pyx_n_s_seek_offset; -static PyObject *__pyx_n_s_self; -static PyObject *__pyx_n_s_send; -static PyObject *__pyx_n_s_setLevel; -static PyObject *__pyx_n_s_set_converter_locals_lambda; -static PyObject *__pyx_n_s_set_dtype_converter; -static PyObject *__pyx_n_s_set_field_filter; -static PyObject *__pyx_n_s_set_field_filter_locals_genexpr; -static PyObject *__pyx_kp_s_set_field_filter_setting_field_f; -static PyObject *__pyx_n_s_set_field_names; -static PyObject *__pyx_n_s_set_field_names_locals_genexpr; -static PyObject *__pyx_kp_s_set_field_names_setting_field_na; -static PyObject *__pyx_n_s_set_field_types; -static PyObject *__pyx_n_s_set_field_types_locals_genexpr; -static PyObject *__pyx_kp_s_set_field_types_setting_dtypes_t; -static PyObject *__pyx_n_s_set_fill_values; -static PyObject *__pyx_n_s_set_missing_values; -static PyObject *__pyx_n_s_set_offset; -static PyObject *__pyx_n_s_shape; -static PyObject *__pyx_n_s_shmean; -static PyObject *__pyx_n_s_six; -static PyObject *__pyx_n_s_size; -static PyObject *__pyx_n_s_sizes; -static PyObject *__pyx_n_s_skip; -static PyObject *__pyx_n_s_skipbytes; -static PyObject *__pyx_n_s_skipinitialspace; -static PyObject *__pyx_n_s_sniff; -static PyObject *__pyx_n_s_source; -static PyObject *__pyx_n_s_split; -static PyObject *__pyx_n_s_start; -static PyObject *__pyx_n_s_start_rec; -static PyObject *__pyx_n_s_std; -static PyObject *__pyx_n_s_step; -static PyObject *__pyx_n_s_step_rec; -static PyObject *__pyx_n_s_stop; -static PyObject *__pyx_n_s_stop_rec; -static PyObject *__pyx_n_s_str; -static PyObject *__pyx_n_s_string_types; -static PyObject *__pyx_n_s_strip; -static PyObject *__pyx_n_s_sum; -static PyObject *__pyx_n_s_supported_encodings; -static PyObject *__pyx_n_s_sys; -static PyObject *__pyx_n_b_taix; -static PyObject *__pyx_n_s_taix; -static PyObject *__pyx_n_s_tell; -static PyObject *__pyx_n_s_temp_field_filter; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_text_adapter; -static PyObject *__pyx_n_s_text_adapter_exception; -static PyObject *__pyx_n_s_textfileh; -static PyObject *__pyx_n_s_throw; -static PyObject *__pyx_n_s_to_array; -static PyObject *__pyx_n_s_tofile; -static PyObject *__pyx_n_s_token; -static PyObject *__pyx_n_s_total_num_records; -static PyObject *__pyx_n_s_type; -static PyObject *__pyx_n_s_types; -static PyObject *__pyx_kp_s_types_must_be_dict_of_fields_dty; -static PyObject *__pyx_n_s_typesize; -static PyObject *__pyx_n_s_u; -static PyObject *__pyx_n_s_u1; -static PyObject *__pyx_n_s_u4; -static PyObject *__pyx_n_s_u8; -static PyObject *__pyx_kp_s_u_d; -static PyObject *__pyx_n_s_uncompressed_offset; -static PyObject *__pyx_n_s_unknown; -static PyObject *__pyx_kp_s_unknown_compression_type_0; -static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; -static PyObject *__pyx_n_s_urllib; -static PyObject *__pyx_n_s_urllib_request; -static PyObject *__pyx_n_s_urlopen; -static PyObject *__pyx_kp_s_user_converter; -static PyObject *__pyx_n_s_utf_8; -static PyObject *__pyx_n_s_value; -static PyObject *__pyx_n_s_values; -static PyObject *__pyx_n_s_version; -static PyObject *__pyx_n_s_warn; -static PyObject *__pyx_n_s_warning; -static PyObject *__pyx_n_s_warnings; -static PyObject *__pyx_n_s_wb; -static PyObject *__pyx_n_s_where; -static PyObject *__pyx_n_s_whitespace_delims; -static PyObject *__pyx_n_s_window; -static PyObject *__pyx_n_s_write; -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_6__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index_name, PyObject *__pyx_v_density, PyObject *__pyx_v_typesize, PyObject *__pyx_v_num_records); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_2create_disk_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_4open_disk_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_6open_s3_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_8get_offset(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rec_num); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_10set_offset(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rec_num, PyObject *__pyx_v_offset); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_12add_gzip_access_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_window, PyObject *__pyx_v_compressed_offset, PyObject *__pyx_v_uncompressed_offset, CYTHON_UNUSED PyObject *__pyx_v_avail_in, CYTHON_UNUSED PyObject *__pyx_v_avail_out, PyObject *__pyx_v_bits); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_14get_gzip_access_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_offset); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_16finalize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_total_num_records); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_18__len__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_20get_density(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_22close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_textfileh, PyObject *__pyx_v_skip); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_2chunk_sizes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_where, PyObject *__pyx_v_skipbytes, PyObject *__pyx_v_chunksize); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_4get_sample_chunksize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_6align_fuzzy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_offset); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_8seek_offset(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rec_num); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_10__len__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_12close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc *__pyx_v_self); /* proto */ -static void __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc_2__dealloc__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc *__pyx_v_self); /* proto */ -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *__pyx_v_self, PyObject *__pyx_v_converter, PyObject *__pyx_v_dtype); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_2__call__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_2__init_text_adapter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_fh, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_comment, PyObject *__pyx_v_quote, PyObject *__pyx_v_num_records, PyObject *__pyx_v_header, CYTHON_UNUSED PyObject *__pyx_v_footer, PyObject *__pyx_v_indexing, PyObject *__pyx_v_index_name, PyObject *__pyx_v_output, PyObject *__pyx_v_debug); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_4close(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static void __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_6__dealloc__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_4size___get__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11field_count___get__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_8get_field_filter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_16set_field_filter_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_10set_field_filter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_fields); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_12get_field_names(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_names_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_14set_field_names(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_field_names); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_16get_field_types(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_types_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_18set_field_types(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_types); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_20create_index(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_index_name, PyObject *__pyx_v_density); /* proto */ -static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_22set_converter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_converter); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_24__build_python_converter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_converter); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_26set_missing_values(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_missing_values); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_28set_fill_values(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_fill_values, PyObject *__pyx_v_loose); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_30__set_fill_values(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_fill_values); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_32to_array(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_34to_dataframe(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_adapter, PyObject *__pyx_v_fields); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_36__getitem__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_38__parse_slice(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_40__read_slice_infer_types(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_start_rec, PyObject *__pyx_v_stop_rec, PyObject *__pyx_v_step_rec); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_42__infer_types(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_start_rec, PyObject *__pyx_v_num_recs, PyObject *__pyx_v_step_rec); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_44__read_slice(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_start_rec, PyObject *__pyx_v_stop_rec, PyObject *__pyx_v_step_rec); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_46__build_converters(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_48__get_mapping_from_converters(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_50__set_dtype_converter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_dtype); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_52__raise_adapter_exception(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_result); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_text_adapter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source, PyObject *__pyx_v_parser, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_2s3_text_adapter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_access_key, PyObject *__pyx_v_secret_key, PyObject *__pyx_v_bucket_name, PyObject *__pyx_v_key_name, PyObject *__pyx_v_remote_s3_index, PyObject *__pyx_v_parser, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_14CSVTextAdapter___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter *__pyx_v_self, PyObject *__pyx_v_fh, PyObject *__pyx_v_delimiter, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_comment, PyObject *__pyx_v_quote, PyObject *__pyx_v_escape, PyObject *__pyx_v_num_records, PyObject *__pyx_v_header, PyObject *__pyx_v_footer, PyObject *__pyx_v_field_names, CYTHON_UNUSED PyObject *__pyx_v_infer_types, PyObject *__pyx_v_indexing, PyObject *__pyx_v_index_name, PyObject *__pyx_v_output, PyObject *__pyx_v_group_whitespace_delims, PyObject *__pyx_v_whitespace_delims, PyObject *__pyx_v_debug); /* proto */ -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_21FixedWidthTextAdapter___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter *__pyx_v_self, PyObject *__pyx_v_fh, PyObject *__pyx_v_field_widths, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_comment, PyObject *__pyx_v_quote, PyObject *__pyx_v_num_records, PyObject *__pyx_v_header, PyObject *__pyx_v_footer, PyObject *__pyx_v_field_names, CYTHON_UNUSED PyObject *__pyx_v_infer_types, PyObject *__pyx_v_indexing, PyObject *__pyx_v_index_name, PyObject *__pyx_v_output, PyObject *__pyx_v_debug); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___count_fields(PyObject *__pyx_self, PyObject *__pyx_v_rec, PyObject *__pyx_v_num); /* proto */ -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter *__pyx_v_self, PyObject *__pyx_v_fh, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_num_records, PyObject *__pyx_v_field_names, CYTHON_UNUSED PyObject *__pyx_v_infer_types, PyObject *__pyx_v_indexing, PyObject *__pyx_v_index_name, PyObject *__pyx_v_output, PyObject *__pyx_v_debug); /* proto */ -static void __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_2__dealloc__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter *__pyx_v_self); /* proto */ -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *__pyx_v_self, PyObject *__pyx_v_fh, PyObject *__pyx_v_regex_string, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_comment, PyObject *__pyx_v_quote, PyObject *__pyx_v_num_records, PyObject *__pyx_v_header, PyObject *__pyx_v_footer, PyObject *__pyx_v_field_names, CYTHON_UNUSED PyObject *__pyx_v_infer_types, PyObject *__pyx_v_indexing, PyObject *__pyx_v_index_name, PyObject *__pyx_v_output, PyObject *__pyx_v_debug); /* proto */ -static void __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter_2__dealloc__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8LineIter___iter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_LineIter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8LineIter_2__next__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_LineIter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10RecordIter___iter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RecordIter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10RecordIter_2__next__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RecordIter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter___iter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter_2__next__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_4text_adapter_exception(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_error, PyObject *__pyx_v_convert_error, PyObject *__pyx_v_token, PyObject *__pyx_v_record, PyObject *__pyx_v_field, PyObject *__pyx_v_dtype); /* proto */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ -static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_LineIter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_RecordIter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_2; -static PyObject *__pyx_int_3; -static PyObject *__pyx_int_4; -static PyObject *__pyx_int_5; -static PyObject *__pyx_int_6; -static PyObject *__pyx_int_7; -static PyObject *__pyx_int_8; -static PyObject *__pyx_int_10; -static PyObject *__pyx_int_12; -static PyObject *__pyx_int_16; -static PyObject *__pyx_int_24; -static PyObject *__pyx_int_32; -static PyObject *__pyx_int_64; -static PyObject *__pyx_int_1000; -static PyObject *__pyx_int_65535; -static PyObject *__pyx_int_100000; -static PyObject *__pyx_int_131072; -static PyObject *__pyx_int_4294967295; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_k__56; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__26; -static PyObject *__pyx_slice__41; -static PyObject *__pyx_slice__42; -static PyObject *__pyx_slice__53; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__24; -static PyObject *__pyx_tuple__28; -static PyObject *__pyx_tuple__29; -static PyObject *__pyx_tuple__30; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__32; -static PyObject *__pyx_tuple__33; -static PyObject *__pyx_tuple__34; -static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__36; -static PyObject *__pyx_tuple__39; -static PyObject *__pyx_tuple__40; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__44; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__46; -static PyObject *__pyx_tuple__47; -static PyObject *__pyx_tuple__48; -static PyObject *__pyx_tuple__49; -static PyObject *__pyx_tuple__52; -static PyObject *__pyx_tuple__54; -static PyObject *__pyx_tuple__55; -static PyObject *__pyx_tuple__57; -static PyObject *__pyx_tuple__58; -static PyObject *__pyx_tuple__59; -static PyObject *__pyx_tuple__60; -static PyObject *__pyx_tuple__61; -static PyObject *__pyx_tuple__63; -static PyObject *__pyx_tuple__65; -static PyObject *__pyx_tuple__66; -static PyObject *__pyx_tuple__67; -static PyObject *__pyx_tuple__68; -static PyObject *__pyx_tuple__69; -static PyObject *__pyx_tuple__70; -static PyObject *__pyx_tuple__71; -static PyObject *__pyx_tuple__72; -static PyObject *__pyx_tuple__73; -static PyObject *__pyx_tuple__74; -static PyObject *__pyx_tuple__75; -static PyObject *__pyx_tuple__76; -static PyObject *__pyx_tuple__77; -static PyObject *__pyx_tuple__81; -static PyObject *__pyx_tuple__82; -static PyObject *__pyx_tuple__83; -static PyObject *__pyx_tuple__84; -static PyObject *__pyx_tuple__85; -static PyObject *__pyx_tuple__86; -static PyObject *__pyx_tuple__87; -static PyObject *__pyx_tuple__88; -static PyObject *__pyx_tuple__89; -static PyObject *__pyx_tuple__92; -static PyObject *__pyx_tuple__93; -static PyObject *__pyx_tuple__94; -static PyObject *__pyx_tuple__95; -static PyObject *__pyx_tuple__96; -static PyObject *__pyx_tuple__97; -static PyObject *__pyx_tuple__98; -static PyObject *__pyx_tuple__99; -static PyObject *__pyx_tuple__100; -static PyObject *__pyx_tuple__101; -static PyObject *__pyx_tuple__102; -static PyObject *__pyx_tuple__103; -static PyObject *__pyx_tuple__104; -static PyObject *__pyx_tuple__105; -static PyObject *__pyx_tuple__106; -static PyObject *__pyx_tuple__107; -static PyObject *__pyx_tuple__108; -static PyObject *__pyx_tuple__109; -static PyObject *__pyx_tuple__110; -static PyObject *__pyx_tuple__111; -static PyObject *__pyx_tuple__112; -static PyObject *__pyx_tuple__113; -static PyObject *__pyx_tuple__114; -static PyObject *__pyx_tuple__115; -static PyObject *__pyx_tuple__117; -static PyObject *__pyx_tuple__119; -static PyObject *__pyx_tuple__121; -static PyObject *__pyx_tuple__123; -static PyObject *__pyx_tuple__125; -static PyObject *__pyx_tuple__127; -static PyObject *__pyx_tuple__129; -static PyObject *__pyx_tuple__131; -static PyObject *__pyx_tuple__133; -static PyObject *__pyx_tuple__135; -static PyObject *__pyx_tuple__137; -static PyObject *__pyx_tuple__139; -static PyObject *__pyx_tuple__141; -static PyObject *__pyx_tuple__143; -static PyObject *__pyx_tuple__145; -static PyObject *__pyx_tuple__147; -static PyObject *__pyx_tuple__149; -static PyObject *__pyx_tuple__151; -static PyObject *__pyx_tuple__153; -static PyObject *__pyx_tuple__154; -static PyObject *__pyx_tuple__156; -static PyObject *__pyx_tuple__158; -static PyObject *__pyx_codeobj__62; -static PyObject *__pyx_codeobj__64; -static PyObject *__pyx_codeobj__90; -static PyObject *__pyx_codeobj__116; -static PyObject *__pyx_codeobj__118; -static PyObject *__pyx_codeobj__120; -static PyObject *__pyx_codeobj__122; -static PyObject *__pyx_codeobj__124; -static PyObject *__pyx_codeobj__126; -static PyObject *__pyx_codeobj__128; -static PyObject *__pyx_codeobj__130; -static PyObject *__pyx_codeobj__132; -static PyObject *__pyx_codeobj__134; -static PyObject *__pyx_codeobj__136; -static PyObject *__pyx_codeobj__138; -static PyObject *__pyx_codeobj__140; -static PyObject *__pyx_codeobj__142; -static PyObject *__pyx_codeobj__144; -static PyObject *__pyx_codeobj__146; -static PyObject *__pyx_codeobj__148; -static PyObject *__pyx_codeobj__150; -static PyObject *__pyx_codeobj__152; -static PyObject *__pyx_codeobj__155; -static PyObject *__pyx_codeobj__157; -static PyObject *__pyx_codeobj__159; - -/* "TextAdapter/textadapter/IO.pyx":2 - * - * cdef InputData* open_s3(object data): # <<<<<<<<<<<<<< - * """ - * Set up read/seek functions for S3 data source - */ - -static InputData *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_open_s3(PyObject *__pyx_v_data) { - InputData *__pyx_v_input_data; - InputData *__pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("open_s3", 0); - - /* "TextAdapter/textadapter/IO.pyx":6 - * Set up read/seek functions for S3 data source - * """ - * cdef InputData *input_data = calloc(1, sizeof(InputData)) # <<<<<<<<<<<<<< - * input_data.seek = &seek_s3 - * input_data.read = &read_s3 - */ - __pyx_v_input_data = ((InputData *)calloc(1, (sizeof(InputData)))); - - /* "TextAdapter/textadapter/IO.pyx":7 - * """ - * cdef InputData *input_data = calloc(1, sizeof(InputData)) - * input_data.seek = &seek_s3 # <<<<<<<<<<<<<< - * input_data.read = &read_s3 - * input_data.close = &close_s3 - */ - __pyx_v_input_data->seek = ((seek_func_ptr)(&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_seek_s3)); - - /* "TextAdapter/textadapter/IO.pyx":8 - * cdef InputData *input_data = calloc(1, sizeof(InputData)) - * input_data.seek = &seek_s3 - * input_data.read = &read_s3 # <<<<<<<<<<<<<< - * input_data.close = &close_s3 - * input_data.input = data - */ - __pyx_v_input_data->read = ((read_func_ptr)(&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_read_s3)); - - /* "TextAdapter/textadapter/IO.pyx":9 - * input_data.seek = &seek_s3 - * input_data.read = &read_s3 - * input_data.close = &close_s3 # <<<<<<<<<<<<<< - * input_data.input = data - * return input_data - */ - __pyx_v_input_data->close = ((close_func_ptr)(&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_close_s3)); - - /* "TextAdapter/textadapter/IO.pyx":10 - * input_data.read = &read_s3 - * input_data.close = &close_s3 - * input_data.input = data # <<<<<<<<<<<<<< - * return input_data - * - */ - __pyx_v_input_data->input = ((void *)__pyx_v_data); - - /* "TextAdapter/textadapter/IO.pyx":11 - * input_data.close = &close_s3 - * input_data.input = data - * return input_data # <<<<<<<<<<<<<< - * - * cdef void close_s3(InputData *input_data): - */ - __pyx_r = __pyx_v_input_data; - goto __pyx_L0; - - /* "TextAdapter/textadapter/IO.pyx":2 - * - * cdef InputData* open_s3(object data): # <<<<<<<<<<<<<< - * """ - * Set up read/seek functions for S3 data source - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/IO.pyx":13 - * return input_data - * - * cdef void close_s3(InputData *input_data): # <<<<<<<<<<<<<< - * """ - * Clean up InputData for S3 data source - */ - -static void __pyx_f_5TextAdapter_11textadapter_11TextAdapter_close_s3(InputData *__pyx_v_input_data) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("close_s3", 0); - - /* "TextAdapter/textadapter/IO.pyx":17 - * Clean up InputData for S3 data source - * """ - * if input_data != NULL: # <<<<<<<<<<<<<< - * free(input_data) - * - */ - __pyx_t_1 = ((__pyx_v_input_data != NULL) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/IO.pyx":18 - * """ - * if input_data != NULL: - * free(input_data) # <<<<<<<<<<<<<< - * - * cdef AdapterError seek_s3(InputData *input, uint64_t offset): - */ - free(__pyx_v_input_data); - - /* "TextAdapter/textadapter/IO.pyx":17 - * Clean up InputData for S3 data source - * """ - * if input_data != NULL: # <<<<<<<<<<<<<< - * free(input_data) - * - */ - } - - /* "TextAdapter/textadapter/IO.pyx":13 - * return input_data - * - * cdef void close_s3(InputData *input_data): # <<<<<<<<<<<<<< - * """ - * Clean up InputData for S3 data source - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "TextAdapter/textadapter/IO.pyx":20 - * free(input_data) - * - * cdef AdapterError seek_s3(InputData *input, uint64_t offset): # <<<<<<<<<<<<<< - * """ - * Seek to offset in S3 data source - */ - -static AdapterError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_seek_s3(InputData *__pyx_v_input, uint64_t __pyx_v_offset) { - PyObject *__pyx_v_s3_input = NULL; - PyObject *__pyx_v_s3_key = NULL; - AdapterError __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("seek_s3", 0); - - /* "TextAdapter/textadapter/IO.pyx":28 - * offset - offset to seek to - * """ - * if (input == NULL): # <<<<<<<<<<<<<< - * return ADAPTER_ERROR_SEEK; - * - */ - __pyx_t_1 = ((__pyx_v_input == NULL) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/IO.pyx":29 - * """ - * if (input == NULL): - * return ADAPTER_ERROR_SEEK; # <<<<<<<<<<<<<< - * - * s3_input = input.input - */ - __pyx_r = ADAPTER_ERROR_SEEK; - goto __pyx_L0; - - /* "TextAdapter/textadapter/IO.pyx":28 - * offset - offset to seek to - * """ - * if (input == NULL): # <<<<<<<<<<<<<< - * return ADAPTER_ERROR_SEEK; - * - */ - } - - /* "TextAdapter/textadapter/IO.pyx":31 - * return ADAPTER_ERROR_SEEK; - * - * s3_input = input.input # <<<<<<<<<<<<<< - * - * s3_key = s3_input['s3_key'] - */ - __pyx_t_2 = ((PyObject *)__pyx_v_input->input); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_s3_input = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/IO.pyx":33 - * s3_input = input.input - * - * s3_key = s3_input['s3_key'] # <<<<<<<<<<<<<< - * if offset > (s3_key.size - input.header): - * return ADAPTER_ERROR_SEEK_S3 - */ - __pyx_t_2 = PyObject_GetItem(__pyx_v_s3_input, __pyx_n_s_s3_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_s3_key = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/IO.pyx":34 - * - * s3_key = s3_input['s3_key'] - * if offset > (s3_key.size - input.header): # <<<<<<<<<<<<<< - * return ADAPTER_ERROR_SEEK_S3 - * - */ - __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_s3_key, __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_input->header); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 34, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 34, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/IO.pyx":35 - * s3_key = s3_input['s3_key'] - * if offset > (s3_key.size - input.header): - * return ADAPTER_ERROR_SEEK_S3 # <<<<<<<<<<<<<< - * - * s3_input['offset'] = offset + input.header - */ - __pyx_r = ADAPTER_ERROR_SEEK_S3; - goto __pyx_L0; - - /* "TextAdapter/textadapter/IO.pyx":34 - * - * s3_key = s3_input['s3_key'] - * if offset > (s3_key.size - input.header): # <<<<<<<<<<<<<< - * return ADAPTER_ERROR_SEEK_S3 - * - */ - } - - /* "TextAdapter/textadapter/IO.pyx":37 - * return ADAPTER_ERROR_SEEK_S3 - * - * s3_input['offset'] = offset + input.header # <<<<<<<<<<<<<< - * return ADAPTER_SUCCESS - * - */ - __pyx_t_4 = __Pyx_PyInt_From_uint64_t((__pyx_v_offset + __pyx_v_input->header)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyObject_SetItem(__pyx_v_s3_input, __pyx_n_s_offset, __pyx_t_4) < 0)) __PYX_ERR(2, 37, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/IO.pyx":38 - * - * s3_input['offset'] = offset + input.header - * return ADAPTER_SUCCESS # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = ADAPTER_SUCCESS; - goto __pyx_L0; - - /* "TextAdapter/textadapter/IO.pyx":20 - * free(input_data) - * - * cdef AdapterError seek_s3(InputData *input, uint64_t offset): # <<<<<<<<<<<<<< - * """ - * Seek to offset in S3 data source - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_WriteUnraisable("TextAdapter.textadapter.TextAdapter.seek_s3", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = (AdapterError) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_s3_input); - __Pyx_XDECREF(__pyx_v_s3_key); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/IO.pyx":41 - * - * - * cdef AdapterError read_s3(InputData *input, char *buffer, uint64_t buffer_len, uint64_t *num_bytes_read): # <<<<<<<<<<<<<< - * """ - * Read bytes from S3 data source and store in buffer. - */ - -static AdapterError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_read_s3(InputData *__pyx_v_input, char *__pyx_v_buffer, uint64_t __pyx_v_buffer_len, uint64_t *__pyx_v_num_bytes_read) { - PyObject *__pyx_v_s3_input = NULL; - PyObject *__pyx_v_offset = NULL; - PyObject *__pyx_v_s3_key = NULL; - PyObject *__pyx_v_data = NULL; - PyObject *__pyx_v_data_len = NULL; - AdapterError __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - 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; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - PyObject *__pyx_t_13 = NULL; - Py_ssize_t __pyx_t_14; - char *__pyx_t_15; - size_t __pyx_t_16; - uint64_t __pyx_t_17; - __Pyx_RefNannySetupContext("read_s3", 0); - - /* "TextAdapter/textadapter/IO.pyx":51 - * num_bytes_read - pointer to variable for storing number of bytes read from S3 - * """ - * if (input == NULL): # <<<<<<<<<<<<<< - * return ADAPTER_ERROR_SEEK; - * - */ - __pyx_t_1 = ((__pyx_v_input == NULL) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/IO.pyx":52 - * """ - * if (input == NULL): - * return ADAPTER_ERROR_SEEK; # <<<<<<<<<<<<<< - * - * s3_input = input.input - */ - __pyx_r = ADAPTER_ERROR_SEEK; - goto __pyx_L0; - - /* "TextAdapter/textadapter/IO.pyx":51 - * num_bytes_read - pointer to variable for storing number of bytes read from S3 - * """ - * if (input == NULL): # <<<<<<<<<<<<<< - * return ADAPTER_ERROR_SEEK; - * - */ - } - - /* "TextAdapter/textadapter/IO.pyx":54 - * return ADAPTER_ERROR_SEEK; - * - * s3_input = input.input # <<<<<<<<<<<<<< - * offset = s3_input['offset'] - * s3_key = s3_input['s3_key'] - */ - __pyx_t_2 = ((PyObject *)__pyx_v_input->input); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_s3_input = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/IO.pyx":55 - * - * s3_input = input.input - * offset = s3_input['offset'] # <<<<<<<<<<<<<< - * s3_key = s3_input['s3_key'] - * - */ - __pyx_t_2 = PyObject_GetItem(__pyx_v_s3_input, __pyx_n_s_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_offset = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/IO.pyx":56 - * s3_input = input.input - * offset = s3_input['offset'] - * s3_key = s3_input['s3_key'] # <<<<<<<<<<<<<< - * - * if offset >= s3_key.size: - */ - __pyx_t_2 = PyObject_GetItem(__pyx_v_s3_input, __pyx_n_s_s3_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_s3_key = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/IO.pyx":58 - * s3_key = s3_input['s3_key'] - * - * if offset >= s3_key.size: # <<<<<<<<<<<<<< - * num_bytes_read[0] = 0 - * return ADAPTER_ERROR_READ_EOF - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_s3_key, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_offset, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 58, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 58, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/IO.pyx":59 - * - * if offset >= s3_key.size: - * num_bytes_read[0] = 0 # <<<<<<<<<<<<<< - * return ADAPTER_ERROR_READ_EOF - * - */ - (__pyx_v_num_bytes_read[0]) = 0; - - /* "TextAdapter/textadapter/IO.pyx":60 - * if offset >= s3_key.size: - * num_bytes_read[0] = 0 - * return ADAPTER_ERROR_READ_EOF # <<<<<<<<<<<<<< - * - * if offset < 0: - */ - __pyx_r = ADAPTER_ERROR_READ_EOF; - goto __pyx_L0; - - /* "TextAdapter/textadapter/IO.pyx":58 - * s3_key = s3_input['s3_key'] - * - * if offset >= s3_key.size: # <<<<<<<<<<<<<< - * num_bytes_read[0] = 0 - * return ADAPTER_ERROR_READ_EOF - */ - } - - /* "TextAdapter/textadapter/IO.pyx":62 - * return ADAPTER_ERROR_READ_EOF - * - * if offset < 0: # <<<<<<<<<<<<<< - * return ADAPTER_ERROR_READ - * - */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_offset, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 62, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 62, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/IO.pyx":63 - * - * if offset < 0: - * return ADAPTER_ERROR_READ # <<<<<<<<<<<<<< - * - * try: - */ - __pyx_r = ADAPTER_ERROR_READ; - goto __pyx_L0; - - /* "TextAdapter/textadapter/IO.pyx":62 - * return ADAPTER_ERROR_READ_EOF - * - * if offset < 0: # <<<<<<<<<<<<<< - * return ADAPTER_ERROR_READ - * - */ - } - - /* "TextAdapter/textadapter/IO.pyx":65 - * return ADAPTER_ERROR_READ - * - * try: # <<<<<<<<<<<<<< - * data = s3_key.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(offset, offset+buffer_len)}) - * except: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __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:*/ { - - /* "TextAdapter/textadapter/IO.pyx":66 - * - * try: - * data = s3_key.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(offset, offset+buffer_len)}) # <<<<<<<<<<<<<< - * except: - * return ADAPTER_ERROR_READ_S3 - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_s3_key, __pyx_n_s_get_contents_as_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_bytes_0_1, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyInt_From_uint64_t(__pyx_v_buffer_len); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyNumber_Add(__pyx_v_offset, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_offset, __pyx_t_11}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_offset, __pyx_t_11}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_13); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_INCREF(__pyx_v_offset); - __Pyx_GIVEREF(__pyx_v_offset); - PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_v_offset); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_11); - __pyx_t_11 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_Range, __pyx_t_8) < 0) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_headers, __pyx_t_7) < 0) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 66, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_data = __pyx_t_7; - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/IO.pyx":65 - * return ADAPTER_ERROR_READ - * - * try: # <<<<<<<<<<<<<< - * data = s3_key.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(offset, offset+buffer_len)}) - * except: - */ - } - __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_L13_try_end; - __pyx_L6_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/IO.pyx":67 - * try: - * data = s3_key.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(offset, offset+buffer_len)}) - * except: # <<<<<<<<<<<<<< - * return ADAPTER_ERROR_READ_S3 - * data_len = len(data) - */ - /*except:*/ { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.read_s3", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(2, 67, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_3); - - /* "TextAdapter/textadapter/IO.pyx":68 - * data = s3_key.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(offset, offset+buffer_len)}) - * except: - * return ADAPTER_ERROR_READ_S3 # <<<<<<<<<<<<<< - * data_len = len(data) - * - */ - __pyx_r = ADAPTER_ERROR_READ_S3; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L9_except_return; - } - __pyx_L8_except_error:; - - /* "TextAdapter/textadapter/IO.pyx":65 - * return ADAPTER_ERROR_READ - * - * try: # <<<<<<<<<<<<<< - * data = s3_key.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(offset, offset+buffer_len)}) - * except: - */ - __Pyx_PyThreadState_assign - __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_L9_except_return:; - __Pyx_PyThreadState_assign - __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_L0; - __pyx_L13_try_end:; - } - - /* "TextAdapter/textadapter/IO.pyx":69 - * except: - * return ADAPTER_ERROR_READ_S3 - * data_len = len(data) # <<<<<<<<<<<<<< - * - * if data_len > buffer_len: - */ - __pyx_t_14 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(2, 69, __pyx_L1_error) - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_data_len = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/IO.pyx":71 - * data_len = len(data) - * - * if data_len > buffer_len: # <<<<<<<<<<<<<< - * data_len = buffer_len - * - */ - __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_buffer_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_data_len, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 71, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 71, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/IO.pyx":72 - * - * if data_len > buffer_len: - * data_len = buffer_len # <<<<<<<<<<<<<< - * - * memcpy(buffer, data, data_len) - */ - __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_buffer_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_data_len, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/IO.pyx":71 - * data_len = len(data) - * - * if data_len > buffer_len: # <<<<<<<<<<<<<< - * data_len = buffer_len - * - */ - } - - /* "TextAdapter/textadapter/IO.pyx":74 - * data_len = buffer_len - * - * memcpy(buffer, data, data_len) # <<<<<<<<<<<<<< - * num_bytes_read[0] = data_len - * - */ - __pyx_t_15 = __Pyx_PyObject_AsString(__pyx_v_data); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(2, 74, __pyx_L1_error) - __pyx_t_16 = __Pyx_PyInt_As_size_t(__pyx_v_data_len); if (unlikely((__pyx_t_16 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 74, __pyx_L1_error) - memcpy(__pyx_v_buffer, ((char *)__pyx_t_15), __pyx_t_16); - - /* "TextAdapter/textadapter/IO.pyx":75 - * - * memcpy(buffer, data, data_len) - * num_bytes_read[0] = data_len # <<<<<<<<<<<<<< - * - * s3_input['offset'] = s3_input['offset'] + data_len - */ - __pyx_t_17 = __Pyx_PyInt_As_uint64_t(__pyx_v_data_len); if (unlikely((__pyx_t_17 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(2, 75, __pyx_L1_error) - (__pyx_v_num_bytes_read[0]) = __pyx_t_17; - - /* "TextAdapter/textadapter/IO.pyx":77 - * num_bytes_read[0] = data_len - * - * s3_input['offset'] = s3_input['offset'] + data_len # <<<<<<<<<<<<<< - * - * return ADAPTER_SUCCESS - */ - __pyx_t_2 = PyObject_GetItem(__pyx_v_s3_input, __pyx_n_s_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_data_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_s3_input, __pyx_n_s_offset, __pyx_t_3) < 0)) __PYX_ERR(2, 77, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/IO.pyx":79 - * s3_input['offset'] = s3_input['offset'] + data_len - * - * return ADAPTER_SUCCESS # <<<<<<<<<<<<<< - */ - __pyx_r = ADAPTER_SUCCESS; - goto __pyx_L0; - - /* "TextAdapter/textadapter/IO.pyx":41 - * - * - * cdef AdapterError read_s3(InputData *input, char *buffer, uint64_t buffer_len, uint64_t *num_bytes_read): # <<<<<<<<<<<<<< - * """ - * Read bytes from S3 data source and store in buffer. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_WriteUnraisable("TextAdapter.textadapter.TextAdapter.read_s3", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = (AdapterError) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_s3_input); - __Pyx_XDECREF(__pyx_v_offset); - __Pyx_XDECREF(__pyx_v_s3_key); - __Pyx_XDECREF(__pyx_v_data); - __Pyx_XDECREF(__pyx_v_data_len); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":6 - * - * - * cdef void indexer_callback(void *index, uint64_t record_num, uint64_t record_offset): # <<<<<<<<<<<<<< - * """ - * Callback function for C parsing engine to store record number - */ - -static void __pyx_f_5TextAdapter_11textadapter_11TextAdapter_indexer_callback(void *__pyx_v_index, uint64_t __pyx_v_record_num, uint64_t __pyx_v_record_offset) { - PyObject *__pyx_v_idx = 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; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("indexer_callback", 0); - - /* "TextAdapter/textadapter/Index.pyx":12 - * """ - * - * idx = index # <<<<<<<<<<<<<< - * idx.set_offset(record_num, record_offset) - * - */ - __pyx_t_1 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_idx = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":13 - * - * idx = index - * idx.set_offset(record_num, record_offset) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_idx, __pyx_n_s_set_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_record_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_record_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":6 - * - * - * cdef void indexer_callback(void *index, uint64_t record_num, uint64_t record_offset): # <<<<<<<<<<<<<< - * """ - * Callback function for C parsing engine to store record number - */ - - /* function exit code */ - 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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_WriteUnraisable("TextAdapter.textadapter.TextAdapter.indexer_callback", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_RefNannyFinishContext(); -} - -/* "TextAdapter/textadapter/Index.pyx":16 - * - * - * cdef RecordOffset index_lookup_callback(void *index, uint64_t record_num): # <<<<<<<<<<<<<< - * """ - * Callback function for C parsing engine to retrieve offset - */ - -static RecordOffset __pyx_f_5TextAdapter_11textadapter_11TextAdapter_index_lookup_callback(void *__pyx_v_index, uint64_t __pyx_v_record_num) { - PyObject *__pyx_v_idx = NULL; - RecordOffset __pyx_v_offset; - RecordOffset __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)(PyObject *); - uint64_t __pyx_t_7; - uint64_t __pyx_t_8; - __Pyx_RefNannySetupContext("index_lookup_callback", 0); - - /* "TextAdapter/textadapter/Index.pyx":23 - * requested one. - * """ - * idx = index # <<<<<<<<<<<<<< - * cdef RecordOffset offset - * offset.record_num, offset.offset = idx.get_offset(record_num) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_idx = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":25 - * idx = index - * cdef RecordOffset offset - * offset.record_num, offset.offset = idx.get_offset(record_num) # <<<<<<<<<<<<<< - * return offset - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_idx, __pyx_n_s_get_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_record_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 25, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_5 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(1, 25, __pyx_L1_error) - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(1, 25, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_t_7 = __Pyx_PyInt_As_uint64_t(__pyx_t_2); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_8 = __Pyx_PyInt_As_uint64_t(__pyx_t_5); if (unlikely((__pyx_t_8 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_offset.record_num = __pyx_t_7; - __pyx_v_offset.offset = __pyx_t_8; - - /* "TextAdapter/textadapter/Index.pyx":26 - * cdef RecordOffset offset - * offset.record_num, offset.offset = idx.get_offset(record_num) - * return offset # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_offset; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":16 - * - * - * cdef RecordOffset index_lookup_callback(void *index, uint64_t record_num): # <<<<<<<<<<<<<< - * """ - * Callback function for C parsing engine to retrieve offset - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_WriteUnraisable("TextAdapter.textadapter.TextAdapter.index_lookup_callback", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":29 - * - * - * cdef void add_gzip_access_point_callback(void *index, unsigned char *window, uint32_t compressed_offset, uint64_t uncompressed_offset, # <<<<<<<<<<<<<< - * int avail_in, int avail_out, uint8_t bits): - * - */ - -static void __pyx_f_5TextAdapter_11textadapter_11TextAdapter_add_gzip_access_point_callback(void *__pyx_v_index, unsigned char *__pyx_v_window, uint32_t __pyx_v_compressed_offset, uint64_t __pyx_v_uncompressed_offset, int __pyx_v_avail_in, int __pyx_v_avail_out, uint8_t __pyx_v_bits) { - PyObject *__pyx_v_idx = 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; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("add_gzip_access_point_callback", 0); - - /* "TextAdapter/textadapter/Index.pyx":32 - * int avail_in, int avail_out, uint8_t bits): - * - * idx = index # <<<<<<<<<<<<<< - * idx.add_gzip_access_point(window, compressed_offset, uncompressed_offset, avail_in, avail_out, bits) - * - */ - __pyx_t_1 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_idx = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":33 - * - * idx = index - * idx.add_gzip_access_point(window, compressed_offset, uncompressed_offset, avail_in, avail_out, bits) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_idx, __pyx_n_s_add_gzip_access_point); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromCString(__pyx_v_window); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_From_uint32_t(__pyx_v_compressed_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_uint64_t(__pyx_v_uncompressed_offset); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_avail_in); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_avail_out); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_From_uint8_t(__pyx_v_bits); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[7] = {__pyx_t_9, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[7] = {__pyx_t_9, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(6+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_10, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_11, 5+__pyx_t_10, __pyx_t_8); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":29 - * - * - * cdef void add_gzip_access_point_callback(void *index, unsigned char *window, uint32_t compressed_offset, uint64_t uncompressed_offset, # <<<<<<<<<<<<<< - * int avail_in, int avail_out, uint8_t bits): - * - */ - - /* function exit code */ - 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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_WriteUnraisable("TextAdapter.textadapter.TextAdapter.add_gzip_access_point_callback", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_RefNannyFinishContext(); -} - -/* "TextAdapter/textadapter/Index.pyx":36 - * - * - * cdef void get_gzip_access_point_callback(void *index, uint64_t offset, GzipIndexAccessPoint *point): # <<<<<<<<<<<<<< - * - * idx = index - */ - -static void __pyx_f_5TextAdapter_11textadapter_11TextAdapter_get_gzip_access_point_callback(void *__pyx_v_index, uint64_t __pyx_v_offset, GzipIndexAccessPoint *__pyx_v_point) { - PyObject *__pyx_v_idx = NULL; - PyObject *__pyx_v_bits = NULL; - PyObject *__pyx_v_compressed_offset = NULL; - PyObject *__pyx_v_uncompressed_offset = NULL; - PyObject *__pyx_v_window = 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)(PyObject *); - uint8_t __pyx_t_8; - uint64_t __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("get_gzip_access_point_callback", 0); - - /* "TextAdapter/textadapter/Index.pyx":38 - * cdef void get_gzip_access_point_callback(void *index, uint64_t offset, GzipIndexAccessPoint *point): - * - * idx = index # <<<<<<<<<<<<<< - * bits, compressed_offset, uncompressed_offset, window = idx.get_gzip_access_point(offset) - * point.bits = bits - */ - __pyx_t_1 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_idx = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":39 - * - * idx = index - * bits, compressed_offset, uncompressed_offset, window = idx.get_gzip_access_point(offset) # <<<<<<<<<<<<<< - * point.bits = bits - * point.compressed_offset = compressed_offset - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_idx, __pyx_n_s_get_gzip_access_point); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_uint64_t(__pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 4)) { - if (size > 4) __Pyx_RaiseTooManyValuesError(4); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 39, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_5 = PyList_GET_ITEM(sequence, 1); - __pyx_t_3 = PyList_GET_ITEM(sequence, 2); - __pyx_t_4 = PyList_GET_ITEM(sequence, 3); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - { - Py_ssize_t i; - PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_3,&__pyx_t_4}; - for (i=0; i < 4; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_GOTREF(item); - *(temps[i]) = item; - } - } - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_3,&__pyx_t_4}; - __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; - for (index=0; index < 4; index++) { - PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(item); - *(temps[index]) = item; - } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(1, 39, __pyx_L1_error) - __pyx_t_7 = NULL; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(1, 39, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_v_bits = __pyx_t_2; - __pyx_t_2 = 0; - __pyx_v_compressed_offset = __pyx_t_5; - __pyx_t_5 = 0; - __pyx_v_uncompressed_offset = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_v_window = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":40 - * idx = index - * bits, compressed_offset, uncompressed_offset, window = idx.get_gzip_access_point(offset) - * point.bits = bits # <<<<<<<<<<<<<< - * point.compressed_offset = compressed_offset - * point.uncompressed_offset = uncompressed_offset - */ - __pyx_t_8 = __Pyx_PyInt_As_uint8_t(__pyx_v_bits); if (unlikely((__pyx_t_8 == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 40, __pyx_L1_error) - __pyx_v_point->bits = __pyx_t_8; - - /* "TextAdapter/textadapter/Index.pyx":41 - * bits, compressed_offset, uncompressed_offset, window = idx.get_gzip_access_point(offset) - * point.bits = bits - * point.compressed_offset = compressed_offset # <<<<<<<<<<<<<< - * point.uncompressed_offset = uncompressed_offset - * memcpy(point.window, window, UNCOMPRESSED_WINDOW_SIZE) - */ - __pyx_t_9 = __Pyx_PyInt_As_uint64_t(__pyx_v_compressed_offset); if (unlikely((__pyx_t_9 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 41, __pyx_L1_error) - __pyx_v_point->compressed_offset = __pyx_t_9; - - /* "TextAdapter/textadapter/Index.pyx":42 - * point.bits = bits - * point.compressed_offset = compressed_offset - * point.uncompressed_offset = uncompressed_offset # <<<<<<<<<<<<<< - * memcpy(point.window, window, UNCOMPRESSED_WINDOW_SIZE) - * - */ - __pyx_t_9 = __Pyx_PyInt_As_uint64_t(__pyx_v_uncompressed_offset); if (unlikely((__pyx_t_9 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 42, __pyx_L1_error) - __pyx_v_point->uncompressed_offset = __pyx_t_9; - - /* "TextAdapter/textadapter/Index.pyx":43 - * point.compressed_offset = compressed_offset - * point.uncompressed_offset = uncompressed_offset - * memcpy(point.window, window, UNCOMPRESSED_WINDOW_SIZE) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_window); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(1, 43, __pyx_L1_error) - memcpy(((char *)__pyx_v_point->window), ((char *)__pyx_t_10), UNCOMPRESSED_WINDOW_SIZE); - - /* "TextAdapter/textadapter/Index.pyx":36 - * - * - * cdef void get_gzip_access_point_callback(void *index, uint64_t offset, GzipIndexAccessPoint *point): # <<<<<<<<<<<<<< - * - * idx = index - */ - - /* function exit code */ - 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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("TextAdapter.textadapter.TextAdapter.get_gzip_access_point_callback", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_XDECREF(__pyx_v_bits); - __Pyx_XDECREF(__pyx_v_compressed_offset); - __Pyx_XDECREF(__pyx_v_uncompressed_offset); - __Pyx_XDECREF(__pyx_v_window); - __Pyx_RefNannyFinishContext(); -} - -/* "TextAdapter/textadapter/Index.pyx":160 - * HEADER_SIZE = 64 - * - * def __init__(self, index_name=None, density=DEFAULT_INDEX_DENSITY, typesize=8, num_records=0): # <<<<<<<<<<<<<< - * if density > 2**16-1: - * raise ValueError("density is too large") - */ - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_6__defaults__(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__defaults__", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_None)); - __Pyx_GIVEREF(((PyObject *)Py_None)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_None)); - __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_density); - __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_density); - PyTuple_SET_ITEM(__pyx_t_1, 1, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_density); - __Pyx_INCREF(((PyObject *)__pyx_int_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_int_8)); - PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_int_8)); - __Pyx_INCREF(((PyObject *)__pyx_int_0)); - __Pyx_GIVEREF(((PyObject *)__pyx_int_0)); - PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_int_0)); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None); - __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_index_name = 0; - PyObject *__pyx_v_density = 0; - PyObject *__pyx_v_typesize = 0; - PyObject *__pyx_v_num_records = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_index_name,&__pyx_n_s_density,&__pyx_n_s_typesize,&__pyx_n_s_num_records,0}; - PyObject* values[5] = {0,0,0,0,0}; - __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self); - values[1] = ((PyObject *)((PyObject *)Py_None)); - values[2] = __pyx_dynamic_args->__pyx_arg_density; - values[3] = ((PyObject *)((PyObject *)__pyx_int_8)); - values[4] = ((PyObject *)((PyObject *)__pyx_int_0)); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_name); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_density); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_typesize); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_records); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 160, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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_self = values[0]; - __pyx_v_index_name = values[1]; - __pyx_v_density = values[2]; - __pyx_v_typesize = values[3]; - __pyx_v_num_records = values[4]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 160, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex___init__(__pyx_self, __pyx_v_self, __pyx_v_index_name, __pyx_v_density, __pyx_v_typesize, __pyx_v_num_records); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index_name, PyObject *__pyx_v_density, PyObject *__pyx_v_typesize, PyObject *__pyx_v_num_records) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "TextAdapter/textadapter/Index.pyx":161 - * - * def __init__(self, index_name=None, density=DEFAULT_INDEX_DENSITY, typesize=8, num_records=0): - * if density > 2**16-1: # <<<<<<<<<<<<<< - * raise ValueError("density is too large") - * self.density = density - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_density, __pyx_int_65535, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 161, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 161, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/Index.pyx":162 - * def __init__(self, index_name=None, density=DEFAULT_INDEX_DENSITY, typesize=8, num_records=0): - * if density > 2**16-1: - * raise ValueError("density is too large") # <<<<<<<<<<<<<< - * self.density = density - * self.typesize = typesize - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 162, __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_ERR(1, 162, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":161 - * - * def __init__(self, index_name=None, density=DEFAULT_INDEX_DENSITY, typesize=8, num_records=0): - * if density > 2**16-1: # <<<<<<<<<<<<<< - * raise ValueError("density is too large") - * self.density = density - */ - } - - /* "TextAdapter/textadapter/Index.pyx":163 - * if density > 2**16-1: - * raise ValueError("density is too large") - * self.density = density # <<<<<<<<<<<<<< - * self.typesize = typesize - * self.num_offsets = 0 - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_density, __pyx_v_density) < 0) __PYX_ERR(1, 163, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":164 - * raise ValueError("density is too large") - * self.density = density - * self.typesize = typesize # <<<<<<<<<<<<<< - * self.num_offsets = 0 - * self.num_gzip_access_points = 0 - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_typesize, __pyx_v_typesize) < 0) __PYX_ERR(1, 164, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":165 - * self.density = density - * self.typesize = typesize - * self.num_offsets = 0 # <<<<<<<<<<<<<< - * self.num_gzip_access_points = 0 - * self.total_num_records = num_records - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets, __pyx_int_0) < 0) __PYX_ERR(1, 165, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":166 - * self.typesize = typesize - * self.num_offsets = 0 - * self.num_gzip_access_points = 0 # <<<<<<<<<<<<<< - * self.total_num_records = num_records - * global boto_installed - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_num_gzip_access_points, __pyx_int_0) < 0) __PYX_ERR(1, 166, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":167 - * self.num_offsets = 0 - * self.num_gzip_access_points = 0 - * self.total_num_records = num_records # <<<<<<<<<<<<<< - * global boto_installed - * - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_total_num_records, __pyx_v_num_records) < 0) __PYX_ERR(1, 167, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":170 - * global boto_installed - * - * if index_name is None: # <<<<<<<<<<<<<< - * self.offsets = [] - * self.gzip_access_points = [] - */ - __pyx_t_2 = (__pyx_v_index_name == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":171 - * - * if index_name is None: - * self.offsets = [] # <<<<<<<<<<<<<< - * self.gzip_access_points = [] - * self.idxfile = None - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_offsets, __pyx_t_1) < 0) __PYX_ERR(1, 171, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":172 - * if index_name is None: - * self.offsets = [] - * self.gzip_access_points = [] # <<<<<<<<<<<<<< - * self.idxfile = None - * else: - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_gzip_access_points, __pyx_t_1) < 0) __PYX_ERR(1, 172, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":173 - * self.offsets = [] - * self.gzip_access_points = [] - * self.idxfile = None # <<<<<<<<<<<<<< - * else: - * if isinstance(index_name, basestring): - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_idxfile, Py_None) < 0) __PYX_ERR(1, 173, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":170 - * global boto_installed - * - * if index_name is None: # <<<<<<<<<<<<<< - * self.offsets = [] - * self.gzip_access_points = [] - */ - goto __pyx_L4; - } - - /* "TextAdapter/textadapter/Index.pyx":175 - * self.idxfile = None - * else: - * if isinstance(index_name, basestring): # <<<<<<<<<<<<<< - * self.idxfile = index_name - * if not os.path.exists(self.idxfile): - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyBaseString_Check(__pyx_v_index_name); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/Index.pyx":176 - * else: - * if isinstance(index_name, basestring): - * self.idxfile = index_name # <<<<<<<<<<<<<< - * if not os.path.exists(self.idxfile): - * self.create_disk_index() - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_idxfile, __pyx_v_index_name) < 0) __PYX_ERR(1, 176, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":177 - * if isinstance(index_name, basestring): - * self.idxfile = index_name - * if not os.path.exists(self.idxfile): # <<<<<<<<<<<<<< - * self.create_disk_index() - * else: - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_6) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 177, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!__pyx_t_2) != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":178 - * self.idxfile = index_name - * if not os.path.exists(self.idxfile): - * self.create_disk_index() # <<<<<<<<<<<<<< - * else: - * self.open_disk_index() - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_create_disk_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 178, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 178, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":177 - * if isinstance(index_name, basestring): - * self.idxfile = index_name - * if not os.path.exists(self.idxfile): # <<<<<<<<<<<<<< - * self.create_disk_index() - * else: - */ - goto __pyx_L6; - } - - /* "TextAdapter/textadapter/Index.pyx":180 - * self.create_disk_index() - * else: - * self.open_disk_index() # <<<<<<<<<<<<<< - * elif boto_installed and isinstance(index_name, key.Key): - * - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_open_disk_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 180, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 180, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L6:; - - /* "TextAdapter/textadapter/Index.pyx":175 - * self.idxfile = None - * else: - * if isinstance(index_name, basestring): # <<<<<<<<<<<<<< - * self.idxfile = index_name - * if not os.path.exists(self.idxfile): - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/Index.pyx":181 - * else: - * self.open_disk_index() - * elif boto_installed and isinstance(index_name, key.Key): # <<<<<<<<<<<<<< - * - * self.idxfile = key.Key(index_name.bucket) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_boto_installed); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 181, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 181, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 181, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Key); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 181, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = PyObject_IsInstance(__pyx_v_index_name, __pyx_t_4); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 181, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = (__pyx_t_2 != 0); - __pyx_t_3 = __pyx_t_8; - __pyx_L7_bool_binop_done:; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":183 - * elif boto_installed and isinstance(index_name, key.Key): - * - * self.idxfile = key.Key(index_name.bucket) # <<<<<<<<<<<<<< - * self.idxfile.key = index_name.key + '.idx' - * self.open_s3_index() - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Key); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_index_name, __pyx_n_s_bucket); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (!__pyx_t_5) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 183, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 183, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 183, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_idxfile, __pyx_t_4) < 0) __PYX_ERR(1, 183, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":184 - * - * self.idxfile = key.Key(index_name.bucket) - * self.idxfile.key = index_name.key + '.idx' # <<<<<<<<<<<<<< - * self.open_s3_index() - * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_index_name, __pyx_n_s_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_kp_s_idx); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_PyObject_SetAttrStr(__pyx_t_4, __pyx_n_s_key, __pyx_t_7) < 0) __PYX_ERR(1, 184, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":185 - * self.idxfile = key.Key(index_name.bucket) - * self.idxfile.key = index_name.key + '.idx' - * self.open_s3_index() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_open_s3_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 185, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (__pyx_t_6) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 185, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 185, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":181 - * else: - * self.open_disk_index() - * elif boto_installed and isinstance(index_name, key.Key): # <<<<<<<<<<<<<< - * - * self.idxfile = key.Key(index_name.bucket) - */ - } - __pyx_L5:; - } - __pyx_L4:; - - /* "TextAdapter/textadapter/Index.pyx":160 - * HEADER_SIZE = 64 - * - * def __init__(self, index_name=None, density=DEFAULT_INDEX_DENSITY, typesize=8, num_records=0): # <<<<<<<<<<<<<< - * if density > 2**16-1: - * raise ValueError("density is too large") - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":188 - * - * - * def create_disk_index(self): # <<<<<<<<<<<<<< - * """Create an exact index following the format specifcation.""" - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_3create_disk_index(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_2create_disk_index[] = "Create an exact index following the format specifcation."; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_3create_disk_index = {"create_disk_index", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_3create_disk_index, METH_O, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_2create_disk_index}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_3create_disk_index(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("create_disk_index (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_2create_disk_index(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_2create_disk_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_v_idxh = NULL; - PyObject *__pyx_v_bytes = NULL; - 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; - __Pyx_RefNannySetupContext("create_disk_index", 0); - - /* "TextAdapter/textadapter/Index.pyx":192 - * - * # The dtype for the offsets - * self.dtype = numpy.dtype("u%d"%self.typesize) # <<<<<<<<<<<<<< - * - * # Write index header for version 1 of the format - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_typesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_u_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 192, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":195 - * - * # Write index header for version 1 of the format - * idxh = open(self.idxfile, 'wb') # <<<<<<<<<<<<<< - * idxh.write(b"taix") # the 'magic' header - * bytes = numpy.empty(4, dtype='u1') - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_n_s_wb); - __Pyx_GIVEREF(__pyx_n_s_wb); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_wb); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_idxh = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":196 - * # Write index header for version 1 of the format - * idxh = open(self.idxfile, 'wb') - * idxh.write(b"taix") # the 'magic' header # <<<<<<<<<<<<<< - * bytes = numpy.empty(4, dtype='u1') - * bytes[0] = 0x1 # the version - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_idxh, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":197 - * idxh = open(self.idxfile, 'wb') - * idxh.write(b"taix") # the 'magic' header - * bytes = numpy.empty(4, dtype='u1') # <<<<<<<<<<<<<< - * bytes[0] = 0x1 # the version - * bytes[1] = 0x0 # the options - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_u1) < 0) __PYX_ERR(1, 197, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__3, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_bytes = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":198 - * idxh.write(b"taix") # the 'magic' header - * bytes = numpy.empty(4, dtype='u1') - * bytes[0] = 0x1 # the version # <<<<<<<<<<<<<< - * bytes[1] = 0x0 # the options - * bytes[2] = 0x0 # the checksum method - */ - if (unlikely(__Pyx_SetItemInt(__pyx_v_bytes, 0, __pyx_int_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(1, 198, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":199 - * bytes = numpy.empty(4, dtype='u1') - * bytes[0] = 0x1 # the version - * bytes[1] = 0x0 # the options # <<<<<<<<<<<<<< - * bytes[2] = 0x0 # the checksum method - * bytes[3] = self.typesize # the typesize for offsets - */ - if (unlikely(__Pyx_SetItemInt(__pyx_v_bytes, 1, __pyx_int_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(1, 199, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":200 - * bytes[0] = 0x1 # the version - * bytes[1] = 0x0 # the options - * bytes[2] = 0x0 # the checksum method # <<<<<<<<<<<<<< - * bytes[3] = self.typesize # the typesize for offsets - * bytes.tofile(idxh) - */ - if (unlikely(__Pyx_SetItemInt(__pyx_v_bytes, 2, __pyx_int_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(1, 200, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":201 - * bytes[1] = 0x0 # the options - * bytes[2] = 0x0 # the checksum method - * bytes[3] = self.typesize # the typesize for offsets # <<<<<<<<<<<<<< - * bytes.tofile(idxh) - * # The density of the index - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_typesize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 201, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_SetItemInt(__pyx_v_bytes, 3, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(1, 201, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":202 - * bytes[2] = 0x0 # the checksum method - * bytes[3] = self.typesize # the typesize for offsets - * bytes.tofile(idxh) # <<<<<<<<<<<<<< - * # The density of the index - * numpy.array(self.density, dtype='u4').tofile(idxh) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_bytes, __pyx_n_s_tofile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_2) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_idxh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 202, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 202, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_idxh); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":204 - * bytes.tofile(idxh) - * # The density of the index - * numpy.array(self.density, dtype='u4').tofile(idxh) # <<<<<<<<<<<<<< - * # Now, a reserved field - * numpy.array(-1, dtype='i4').tofile(idxh) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_density); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_u4) < 0) __PYX_ERR(1, 204, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tofile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_idxh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_idxh); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":206 - * numpy.array(self.density, dtype='u4').tofile(idxh) - * # Now, a reserved field - * numpy.array(-1, dtype='i4').tofile(idxh) # <<<<<<<<<<<<<< - * # The number of offsets is still unknown - * numpy.array(0, dtype='u8').tofile(idxh) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_i4) < 0) __PYX_ERR(1, 206, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tofile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_idxh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_idxh); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":208 - * numpy.array(-1, dtype='i4').tofile(idxh) - * # The number of offsets is still unknown - * numpy.array(0, dtype='u8').tofile(idxh) # <<<<<<<<<<<<<< - * # The number of gzip access points is still unknown - * numpy.array(0, dtype='u8').tofile(idxh) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 208, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__5, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tofile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_idxh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_idxh); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":210 - * numpy.array(0, dtype='u8').tofile(idxh) - * # The number of gzip access points is still unknown - * numpy.array(0, dtype='u8').tofile(idxh) # <<<<<<<<<<<<<< - * # The total number of records in file - * numpy.array(self.total_num_records, dtype='u8').tofile(idxh) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 210, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tofile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_idxh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 210, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 210, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_idxh); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":212 - * numpy.array(0, dtype='u8').tofile(idxh) - * # The total number of records in file - * numpy.array(self.total_num_records, dtype='u8').tofile(idxh) # <<<<<<<<<<<<<< - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_total_num_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 212, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_tofile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_idxh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_idxh); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":214 - * numpy.array(self.total_num_records, dtype='u8').tofile(idxh) - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) # <<<<<<<<<<<<<< - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_i8) < 0) __PYX_ERR(1, 214, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__7, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_tofile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_idxh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 214, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 214, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_idxh); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":216 - * numpy.array(-1, dtype='i8').tofile(idxh) - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) # <<<<<<<<<<<<<< - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_i8) < 0) __PYX_ERR(1, 216, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__8, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_tofile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_idxh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 216, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 216, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_idxh); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":218 - * numpy.array(-1, dtype='i8').tofile(idxh) - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) # <<<<<<<<<<<<<< - * self.header_length = self.HEADER_SIZE - * self.idxh = idxh - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_i8) < 0) __PYX_ERR(1, 218, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__9, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_tofile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_idxh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_idxh}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_idxh); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":219 - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) - * self.header_length = self.HEADER_SIZE # <<<<<<<<<<<<<< - * self.idxh = idxh - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_HEADER_SIZE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_header_length, __pyx_t_3) < 0) __PYX_ERR(1, 219, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":220 - * numpy.array(-1, dtype='i8').tofile(idxh) - * self.header_length = self.HEADER_SIZE - * self.idxh = idxh # <<<<<<<<<<<<<< - * - * self.idxh.close() - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_idxh, __pyx_v_idxh) < 0) __PYX_ERR(1, 220, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":222 - * self.idxh = idxh - * - * self.idxh.close() # <<<<<<<<<<<<<< - * self.idxh = open(self.idxfile, 'r+b') - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_1) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 222, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 222, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":223 - * - * self.idxh.close() - * self.idxh = open(self.idxfile, 'r+b') # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_kp_s_r_b); - __Pyx_GIVEREF(__pyx_kp_s_r_b); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_kp_s_r_b); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_idxh, __pyx_t_3) < 0) __PYX_ERR(1, 223, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":188 - * - * - * def create_disk_index(self): # <<<<<<<<<<<<<< - * """Create an exact index following the format specifcation.""" - * - */ - - /* function exit code */ - __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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.create_disk_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idxh); - __Pyx_XDECREF(__pyx_v_bytes); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":226 - * - * - * def open_disk_index(self): # <<<<<<<<<<<<<< - * """Open an existing index""" - * self.idxh = idxh = open(self.idxfile, 'r+b') - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_5open_disk_index(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_4open_disk_index[] = "Open an existing index"; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_5open_disk_index = {"open_disk_index", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_5open_disk_index, METH_O, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_4open_disk_index}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_5open_disk_index(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("open_disk_index (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_4open_disk_index(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_4open_disk_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_v_idxh = NULL; - PyObject *__pyx_v_magic = NULL; - PyObject *__pyx_v_version = NULL; - CYTHON_UNUSED PyObject *__pyx_v_options = NULL; - CYTHON_UNUSED PyObject *__pyx_v_checksum = NULL; - PyObject *__pyx_v_typesize = NULL; - PyObject *__pyx_v_num_offsets = NULL; - PyObject *__pyx_v_num_gzip_access_points = NULL; - PyObject *__pyx_v_total_num_records = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __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)(PyObject *); - __Pyx_RefNannySetupContext("open_disk_index", 0); - - /* "TextAdapter/textadapter/Index.pyx":228 - * def open_disk_index(self): - * """Open an existing index""" - * self.idxh = idxh = open(self.idxfile, 'r+b') # <<<<<<<<<<<<<< - * # Read header. - * magic = idxh.read(4) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_kp_s_r_b); - __Pyx_GIVEREF(__pyx_kp_s_r_b); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_kp_s_r_b); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_idxh, __pyx_t_1) < 0) __PYX_ERR(1, 228, __pyx_L1_error) - __Pyx_INCREF(__pyx_t_1); - __pyx_v_idxh = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":230 - * self.idxh = idxh = open(self.idxfile, 'r+b') - * # Read header. - * magic = idxh.read(4) # <<<<<<<<<<<<<< - * if magic != b"taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_idxh, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_magic = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":231 - * # Read header. - * magic = idxh.read(4) - * if magic != b"taix": # <<<<<<<<<<<<<< - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( - */ - __pyx_t_3 = (__Pyx_PyBytes_Equals(__pyx_v_magic, __pyx_n_b_taix, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 231, __pyx_L1_error) - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":232 - * magic = idxh.read(4) - * if magic != b"taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) # <<<<<<<<<<<<<< - * version, options, checksum, typesize = numpy.fromstring( - * idxh.read(4), dtype='u1') - */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_The_magic_value_s_is_not_recogni, __pyx_v_magic); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(1, 232, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":231 - * # Read header. - * magic = idxh.read(4) - * if magic != b"taix": # <<<<<<<<<<<<<< - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( - */ - } - - /* "TextAdapter/textadapter/Index.pyx":233 - * if magic != b"taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( # <<<<<<<<<<<<<< - * idxh.read(4), dtype='u1') - * if version == 1: - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":234 - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( - * idxh.read(4), dtype='u1') # <<<<<<<<<<<<<< - * if version == 1: - * self.header_length = self.HEADER_SIZE - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_idxh, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":233 - * if magic != b"taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( # <<<<<<<<<<<<<< - * idxh.read(4), dtype='u1') - * if version == 1: - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":234 - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( - * idxh.read(4), dtype='u1') # <<<<<<<<<<<<<< - * if version == 1: - * self.header_length = self.HEADER_SIZE - */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_u1) < 0) __PYX_ERR(1, 234, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":233 - * if magic != b"taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( # <<<<<<<<<<<<<< - * idxh.read(4), dtype='u1') - * if version == 1: - */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { - PyObject* sequence = __pyx_t_5; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 4)) { - if (size > 4) __Pyx_RaiseTooManyValuesError(4); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 233, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); - } else { - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_2 = PyList_GET_ITEM(sequence, 1); - __pyx_t_1 = PyList_GET_ITEM(sequence, 2); - __pyx_t_6 = PyList_GET_ITEM(sequence, 3); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - #else - { - Py_ssize_t i; - PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_2,&__pyx_t_1,&__pyx_t_6}; - for (i=0; i < 4; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(1, 233, __pyx_L1_error) - __Pyx_GOTREF(item); - *(temps[i]) = item; - } - } - #endif - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - Py_ssize_t index = -1; - PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_2,&__pyx_t_1,&__pyx_t_6}; - __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; - for (index=0; index < 4; index++) { - PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L4_unpacking_failed; - __Pyx_GOTREF(item); - *(temps[index]) = item; - } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < 0) __PYX_ERR(1, 233, __pyx_L1_error) - __pyx_t_8 = NULL; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L5_unpacking_done; - __pyx_L4_unpacking_failed:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(1, 233, __pyx_L1_error) - __pyx_L5_unpacking_done:; - } - __pyx_v_version = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_v_options = __pyx_t_2; - __pyx_t_2 = 0; - __pyx_v_checksum = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_v_typesize = __pyx_t_6; - __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/Index.pyx":235 - * version, options, checksum, typesize = numpy.fromstring( - * idxh.read(4), dtype='u1') - * if version == 1: # <<<<<<<<<<<<<< - * self.header_length = self.HEADER_SIZE - * self.typesize = int(typesize) - */ - __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_v_version, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 235, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":236 - * idxh.read(4), dtype='u1') - * if version == 1: - * self.header_length = self.HEADER_SIZE # <<<<<<<<<<<<<< - * self.typesize = int(typesize) - * self.dtype = numpy.dtype("u%d"%self.typesize) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_HEADER_SIZE); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_header_length, __pyx_t_5) < 0) __PYX_ERR(1, 236, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":235 - * version, options, checksum, typesize = numpy.fromstring( - * idxh.read(4), dtype='u1') - * if version == 1: # <<<<<<<<<<<<<< - * self.header_length = self.HEADER_SIZE - * self.typesize = int(typesize) - */ - } - - /* "TextAdapter/textadapter/Index.pyx":237 - * if version == 1: - * self.header_length = self.HEADER_SIZE - * self.typesize = int(typesize) # <<<<<<<<<<<<<< - * self.dtype = numpy.dtype("u%d"%self.typesize) - * # The density - */ - __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_typesize); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 237, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_typesize, __pyx_t_5) < 0) __PYX_ERR(1, 237, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":238 - * self.header_length = self.HEADER_SIZE - * self.typesize = int(typesize) - * self.dtype = numpy.dtype("u%d"%self.typesize) # <<<<<<<<<<<<<< - * # The density - * self.density = long(numpy.fromfile(idxh, dtype='u4', count=1)[0]) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_typesize); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_u_d, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(1, 238, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/Index.pyx":240 - * self.dtype = numpy.dtype("u%d"%self.typesize) - * # The density - * self.density = long(numpy.fromfile(idxh, dtype='u4', count=1)[0]) # <<<<<<<<<<<<<< - * # A reserved field - * idxh.read(4) - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_fromfile); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_idxh); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_u4) < 0) __PYX_ERR(1, 240, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_count, __pyx_int_1) < 0) __PYX_ERR(1, 240, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyLong_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_density, __pyx_t_1) < 0) __PYX_ERR(1, 240, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":242 - * self.density = long(numpy.fromfile(idxh, dtype='u4', count=1)[0]) - * # A reserved field - * idxh.read(4) # <<<<<<<<<<<<<< - * # The number of offsets - * num_offsets = numpy.fromfile(idxh, dtype='u8', count=1)[0] - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_idxh, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":244 - * idxh.read(4) - * # The number of offsets - * num_offsets = numpy.fromfile(idxh, dtype='u8', count=1)[0] # <<<<<<<<<<<<<< - * self.num_offsets = long(num_offsets) - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fromfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_idxh); - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 244, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_count, __pyx_int_1) < 0) __PYX_ERR(1, 244, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_num_offsets = __pyx_t_6; - __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/Index.pyx":245 - * # The number of offsets - * num_offsets = numpy.fromfile(idxh, dtype='u8', count=1)[0] - * self.num_offsets = long(num_offsets) # <<<<<<<<<<<<<< - * - * num_gzip_access_points = numpy.fromfile(idxh, dtype='u8', count=1)[0] - */ - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 245, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_num_offsets); - __Pyx_GIVEREF(__pyx_v_num_offsets); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_num_offsets); - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyLong_Type)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 245, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets, __pyx_t_5) < 0) __PYX_ERR(1, 245, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":247 - * self.num_offsets = long(num_offsets) - * - * num_gzip_access_points = numpy.fromfile(idxh, dtype='u8', count=1)[0] # <<<<<<<<<<<<<< - * self.num_gzip_access_points = long(num_gzip_access_points) - * - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_fromfile); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_idxh); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 247, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_count, __pyx_int_1) < 0) __PYX_ERR(1, 247, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_num_gzip_access_points = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":248 - * - * num_gzip_access_points = numpy.fromfile(idxh, dtype='u8', count=1)[0] - * self.num_gzip_access_points = long(num_gzip_access_points) # <<<<<<<<<<<<<< - * - * total_num_records = numpy.fromfile(idxh, dtype='u8', count=1)[0] - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_num_gzip_access_points); - __Pyx_GIVEREF(__pyx_v_num_gzip_access_points); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_num_gzip_access_points); - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyLong_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_num_gzip_access_points, __pyx_t_1) < 0) __PYX_ERR(1, 248, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":250 - * self.num_gzip_access_points = long(num_gzip_access_points) - * - * total_num_records = numpy.fromfile(idxh, dtype='u8', count=1)[0] # <<<<<<<<<<<<<< - * self.total_num_records = long(total_num_records) - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_fromfile); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_idxh); - __Pyx_GIVEREF(__pyx_v_idxh); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_idxh); - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 250, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_count, __pyx_int_1) < 0) __PYX_ERR(1, 250, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_total_num_records = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":251 - * - * total_num_records = numpy.fromfile(idxh, dtype='u8', count=1)[0] - * self.total_num_records = long(total_num_records) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_total_num_records); - __Pyx_GIVEREF(__pyx_v_total_num_records); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_total_num_records); - __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyLong_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 251, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_total_num_records, __pyx_t_6) < 0) __PYX_ERR(1, 251, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/Index.pyx":226 - * - * - * def open_disk_index(self): # <<<<<<<<<<<<<< - * """Open an existing index""" - * self.idxh = idxh = open(self.idxfile, 'r+b') - */ - - /* function exit code */ - __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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.open_disk_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idxh); - __Pyx_XDECREF(__pyx_v_magic); - __Pyx_XDECREF(__pyx_v_version); - __Pyx_XDECREF(__pyx_v_options); - __Pyx_XDECREF(__pyx_v_checksum); - __Pyx_XDECREF(__pyx_v_typesize); - __Pyx_XDECREF(__pyx_v_num_offsets); - __Pyx_XDECREF(__pyx_v_num_gzip_access_points); - __Pyx_XDECREF(__pyx_v_total_num_records); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":254 - * - * - * def open_s3_index(self): # <<<<<<<<<<<<<< - * """Open an existing S3 index""" - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(0, self.HEADER_SIZE)})) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_7open_s3_index(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_6open_s3_index[] = "Open an existing S3 index"; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_7open_s3_index = {"open_s3_index", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_7open_s3_index, METH_O, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_6open_s3_index}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_7open_s3_index(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("open_s3_index (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_6open_s3_index(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_6open_s3_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_v_data = NULL; - PyObject *__pyx_v_magic = NULL; - PyObject *__pyx_v_version = NULL; - CYTHON_UNUSED PyObject *__pyx_v_options = NULL; - CYTHON_UNUSED PyObject *__pyx_v_checksum = NULL; - PyObject *__pyx_v_typesize = NULL; - PyObject *__pyx_v_num_offsets = NULL; - PyObject *__pyx_v_num_gzip_access_points = NULL; - PyObject *__pyx_v_total_num_records = NULL; - 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; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - PyObject *(*__pyx_t_13)(PyObject *); - __Pyx_RefNannySetupContext("open_s3_index", 0); - - /* "TextAdapter/textadapter/Index.pyx":256 - * def open_s3_index(self): - * """Open an existing S3 index""" - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(0, self.HEADER_SIZE)})) # <<<<<<<<<<<<<< - * - * # Read header. - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_StringIO); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_contents_as_string); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_bytes_0_1, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_HEADER_SIZE); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_int_0, __pyx_t_8}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_int_0, __pyx_t_8}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_Range, __pyx_t_6) < 0) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_headers, __pyx_t_5) < 0) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_data = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":259 - * - * # Read header. - * magic = data.read(4) # <<<<<<<<<<<<<< - * if magic != "taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_magic = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":260 - * # Read header. - * magic = data.read(4) - * if magic != "taix": # <<<<<<<<<<<<<< - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( - */ - __pyx_t_12 = (__Pyx_PyString_Equals(__pyx_v_magic, __pyx_n_s_taix, Py_NE)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(1, 260, __pyx_L1_error) - if (__pyx_t_12) { - - /* "TextAdapter/textadapter/Index.pyx":261 - * magic = data.read(4) - * if magic != "taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) # <<<<<<<<<<<<<< - * version, options, checksum, typesize = numpy.fromstring( - * data.read(4), dtype='u1') - */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_The_magic_value_s_is_not_recogni, __pyx_v_magic); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 261, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 261, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 261, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(1, 261, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":260 - * # Read header. - * magic = data.read(4) - * if magic != "taix": # <<<<<<<<<<<<<< - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( - */ - } - - /* "TextAdapter/textadapter/Index.pyx":262 - * if magic != "taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( # <<<<<<<<<<<<<< - * data.read(4), dtype='u1') - * if version == 1: - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":263 - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( - * data.read(4), dtype='u1') # <<<<<<<<<<<<<< - * if version == 1: - * self.header_length = self.HEADER_SIZE - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":262 - * if magic != "taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( # <<<<<<<<<<<<<< - * data.read(4), dtype='u1') - * if version == 1: - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":263 - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( - * data.read(4), dtype='u1') # <<<<<<<<<<<<<< - * if version == 1: - * self.header_length = self.HEADER_SIZE - */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_u1) < 0) __PYX_ERR(1, 263, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":262 - * if magic != "taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( # <<<<<<<<<<<<<< - * data.read(4), dtype='u1') - * if version == 1: - */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { - PyObject* sequence = __pyx_t_5; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 4)) { - if (size > 4) __Pyx_RaiseTooManyValuesError(4); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 262, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); - } else { - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_2 = PyList_GET_ITEM(sequence, 1); - __pyx_t_1 = PyList_GET_ITEM(sequence, 2); - __pyx_t_3 = PyList_GET_ITEM(sequence, 3); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - #else - { - Py_ssize_t i; - PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_2,&__pyx_t_1,&__pyx_t_3}; - for (i=0; i < 4; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(1, 262, __pyx_L1_error) - __Pyx_GOTREF(item); - *(temps[i]) = item; - } - } - #endif - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - Py_ssize_t index = -1; - PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_2,&__pyx_t_1,&__pyx_t_3}; - __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_13 = Py_TYPE(__pyx_t_6)->tp_iternext; - for (index=0; index < 4; index++) { - PyObject* item = __pyx_t_13(__pyx_t_6); if (unlikely(!item)) goto __pyx_L4_unpacking_failed; - __Pyx_GOTREF(item); - *(temps[index]) = item; - } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 4) < 0) __PYX_ERR(1, 262, __pyx_L1_error) - __pyx_t_13 = NULL; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L5_unpacking_done; - __pyx_L4_unpacking_failed:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_13 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(1, 262, __pyx_L1_error) - __pyx_L5_unpacking_done:; - } - __pyx_v_version = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_v_options = __pyx_t_2; - __pyx_t_2 = 0; - __pyx_v_checksum = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_v_typesize = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":264 - * version, options, checksum, typesize = numpy.fromstring( - * data.read(4), dtype='u1') - * if version == 1: # <<<<<<<<<<<<<< - * self.header_length = self.HEADER_SIZE - * self.typesize = int(typesize) - */ - __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_v_version, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 264, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(1, 264, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_12) { - - /* "TextAdapter/textadapter/Index.pyx":265 - * data.read(4), dtype='u1') - * if version == 1: - * self.header_length = self.HEADER_SIZE # <<<<<<<<<<<<<< - * self.typesize = int(typesize) - * self.dtype = numpy.dtype("u%d"%self.typesize) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_HEADER_SIZE); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_header_length, __pyx_t_5) < 0) __PYX_ERR(1, 265, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":264 - * version, options, checksum, typesize = numpy.fromstring( - * data.read(4), dtype='u1') - * if version == 1: # <<<<<<<<<<<<<< - * self.header_length = self.HEADER_SIZE - * self.typesize = int(typesize) - */ - } - - /* "TextAdapter/textadapter/Index.pyx":266 - * if version == 1: - * self.header_length = self.HEADER_SIZE - * self.typesize = int(typesize) # <<<<<<<<<<<<<< - * self.dtype = numpy.dtype("u%d"%self.typesize) - * # The density - */ - __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_typesize); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 266, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_typesize, __pyx_t_5) < 0) __PYX_ERR(1, 266, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":267 - * self.header_length = self.HEADER_SIZE - * self.typesize = int(typesize) - * self.dtype = numpy.dtype("u%d"%self.typesize) # <<<<<<<<<<<<<< - * # The density - * self.density = long(numpy.fromstring(data.read(4), dtype='u4')) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_typesize); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_u_d, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(1, 267, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":269 - * self.dtype = numpy.dtype("u%d"%self.typesize) - * # The density - * self.density = long(numpy.fromstring(data.read(4), dtype='u4')) # <<<<<<<<<<<<<< - * # A reserved field - * data.read(4) - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_u4) < 0) __PYX_ERR(1, 269, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyLong_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_density, __pyx_t_2) < 0) __PYX_ERR(1, 269, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":271 - * self.density = long(numpy.fromstring(data.read(4), dtype='u4')) - * # A reserved field - * data.read(4) # <<<<<<<<<<<<<< - * # The number of offsets - * num_offsets = numpy.fromstring(data.read(8), dtype='u8') - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":273 - * data.read(4) - * # The number of offsets - * num_offsets = numpy.fromstring(data.read(8), dtype='u8') # <<<<<<<<<<<<<< - * self.num_offsets = long(num_offsets) - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 273, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_num_offsets = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":274 - * # The number of offsets - * num_offsets = numpy.fromstring(data.read(8), dtype='u8') - * self.num_offsets = long(num_offsets) # <<<<<<<<<<<<<< - * - * num_gzip_access_points = numpy.fromstring(data.read(8), dtype='u8') - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_num_offsets); - __Pyx_GIVEREF(__pyx_v_num_offsets); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_num_offsets); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyLong_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets, __pyx_t_3) < 0) __PYX_ERR(1, 274, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":276 - * self.num_offsets = long(num_offsets) - * - * num_gzip_access_points = numpy.fromstring(data.read(8), dtype='u8') # <<<<<<<<<<<<<< - * self.num_gzip_access_points = long(num_gzip_access_points) - * - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_read); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 276, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_num_gzip_access_points = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":277 - * - * num_gzip_access_points = numpy.fromstring(data.read(8), dtype='u8') - * self.num_gzip_access_points = long(num_gzip_access_points) # <<<<<<<<<<<<<< - * - * total_num_records = numpy.fromstring(data.read(8), dtype='u8') - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 277, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_num_gzip_access_points); - __Pyx_GIVEREF(__pyx_v_num_gzip_access_points); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_num_gzip_access_points); - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyLong_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 277, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_num_gzip_access_points, __pyx_t_1) < 0) __PYX_ERR(1, 277, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":279 - * self.num_gzip_access_points = long(num_gzip_access_points) - * - * total_num_records = numpy.fromstring(data.read(8), dtype='u8') # <<<<<<<<<<<<<< - * self.total_num_records = long(total_num_records) - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 279, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_total_num_records = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":280 - * - * total_num_records = numpy.fromstring(data.read(8), dtype='u8') - * self.total_num_records = long(total_num_records) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 280, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_total_num_records); - __Pyx_GIVEREF(__pyx_v_total_num_records); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_total_num_records); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyLong_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 280, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_total_num_records, __pyx_t_3) < 0) __PYX_ERR(1, 280, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":254 - * - * - * def open_s3_index(self): # <<<<<<<<<<<<<< - * """Open an existing S3 index""" - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(0, self.HEADER_SIZE)})) - */ - - /* function exit code */ - __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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.open_s3_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_data); - __Pyx_XDECREF(__pyx_v_magic); - __Pyx_XDECREF(__pyx_v_version); - __Pyx_XDECREF(__pyx_v_options); - __Pyx_XDECREF(__pyx_v_checksum); - __Pyx_XDECREF(__pyx_v_typesize); - __Pyx_XDECREF(__pyx_v_num_offsets); - __Pyx_XDECREF(__pyx_v_num_gzip_access_points); - __Pyx_XDECREF(__pyx_v_total_num_records); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":283 - * - * - * def get_offset(self, rec_num): # <<<<<<<<<<<<<< - * """Get the offset for `rec_num`.""" - * global boto_installed - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_9get_offset(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_8get_offset[] = "Get the offset for `rec_num`."; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_9get_offset = {"get_offset", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_9get_offset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_8get_offset}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_9get_offset(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_rec_num = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_offset (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rec_num,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rec_num)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_offset", 1, 2, 2, 1); __PYX_ERR(1, 283, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_offset") < 0)) __PYX_ERR(1, 283, __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_self = values[0]; - __pyx_v_rec_num = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_offset", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 283, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.get_offset", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_8get_offset(__pyx_self, __pyx_v_self, __pyx_v_rec_num); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_8get_offset(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rec_num) { - PyObject *__pyx_v_ioffset = NULL; - CYTHON_UNUSED PyObject *__pyx_v_num_offsets = NULL; - PyObject *__pyx_v_pos = NULL; - PyObject *__pyx_v_offset = NULL; - PyObject *__pyx_v_data = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *(*__pyx_t_6)(PyObject *); - int __pyx_t_7; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - __Pyx_RefNannySetupContext("get_offset", 0); - - /* "TextAdapter/textadapter/Index.pyx":287 - * global boto_installed - * - * if self.num_offsets == 0: # <<<<<<<<<<<<<< - * return (0, 0) - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 287, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":288 - * - * if self.num_offsets == 0: - * return (0, 0) # <<<<<<<<<<<<<< - * - * # Do a seek in index file depending on the sign of the offset - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_tuple__20); - __pyx_r = __pyx_tuple__20; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":287 - * global boto_installed - * - * if self.num_offsets == 0: # <<<<<<<<<<<<<< - * return (0, 0) - * - */ - } - - /* "TextAdapter/textadapter/Index.pyx":291 - * - * # Do a seek in index file depending on the sign of the offset - * if rec_num < 0: # <<<<<<<<<<<<<< - * raise ValueError('Invalid record number') - * - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_rec_num, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 291, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 291, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":292 - * # Do a seek in index file depending on the sign of the offset - * if rec_num < 0: - * raise ValueError('Invalid record number') # <<<<<<<<<<<<<< - * - * ioffset, num_offsets = divmod(rec_num, self.density) - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 292, __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_ERR(1, 292, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":291 - * - * # Do a seek in index file depending on the sign of the offset - * if rec_num < 0: # <<<<<<<<<<<<<< - * raise ValueError('Invalid record number') - * - */ - } - - /* "TextAdapter/textadapter/Index.pyx":294 - * raise ValueError('Invalid record number') - * - * ioffset, num_offsets = divmod(rec_num, self.density) # <<<<<<<<<<<<<< - * if not -self.num_offsets <= ioffset < self.num_offsets: - * #raise IndexError("index out of range") - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_density); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Divmod(__pyx_v_rec_num, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 294, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_4 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(1, 294, __pyx_L1_error) - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(1, 294, __pyx_L1_error) - __pyx_L6_unpacking_done:; - } - __pyx_v_ioffset = __pyx_t_2; - __pyx_t_2 = 0; - __pyx_v_num_offsets = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":295 - * - * ioffset, num_offsets = divmod(rec_num, self.density) - * if not -self.num_offsets <= ioffset < self.num_offsets: # <<<<<<<<<<<<<< - * #raise IndexError("index out of range") - * ioffset = self.num_offsets - 1 - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_ioffset, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 295, __pyx_L1_error) - if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { - __Pyx_DECREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_ioffset, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 295, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 295, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = ((!__pyx_t_3) != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/Index.pyx":297 - * if not -self.num_offsets <= ioffset < self.num_offsets: - * #raise IndexError("index out of range") - * ioffset = self.num_offsets - 1 # <<<<<<<<<<<<<< - * - * if self.idxfile is None: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_ioffset, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":295 - * - * ioffset, num_offsets = divmod(rec_num, self.density) - * if not -self.num_offsets <= ioffset < self.num_offsets: # <<<<<<<<<<<<<< - * #raise IndexError("index out of range") - * ioffset = self.num_offsets - 1 - */ - } - - /* "TextAdapter/textadapter/Index.pyx":299 - * ioffset = self.num_offsets - 1 - * - * if self.idxfile is None: # <<<<<<<<<<<<<< - * return (ioffset * self.density, self.offsets[ioffset]) - * elif isinstance(self.idxfile, basestring): - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = (__pyx_t_4 == Py_None); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = (__pyx_t_7 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":300 - * - * if self.idxfile is None: - * return (ioffset * self.density, self.offsets[ioffset]) # <<<<<<<<<<<<<< - * elif isinstance(self.idxfile, basestring): - * pos = ioffset * self.typesize + self.header_length - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_density); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_Multiply(__pyx_v_ioffset, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_offsets); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetItem(__pyx_t_4, __pyx_v_ioffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":299 - * ioffset = self.num_offsets - 1 - * - * if self.idxfile is None: # <<<<<<<<<<<<<< - * return (ioffset * self.density, self.offsets[ioffset]) - * elif isinstance(self.idxfile, basestring): - */ - } - - /* "TextAdapter/textadapter/Index.pyx":301 - * if self.idxfile is None: - * return (ioffset * self.density, self.offsets[ioffset]) - * elif isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * pos = ioffset * self.typesize + self.header_length - * self.idxh.seek(pos, os.SEEK_SET) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyBaseString_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = (__pyx_t_3 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/Index.pyx":302 - * return (ioffset * self.density, self.offsets[ioffset]) - * elif isinstance(self.idxfile, basestring): - * pos = ioffset * self.typesize + self.header_length # <<<<<<<<<<<<<< - * self.idxh.seek(pos, os.SEEK_SET) - * offset = numpy.fromfile(self.idxh, dtype=self.dtype, count=1)[0] - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_typesize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyNumber_Multiply(__pyx_v_ioffset, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_header_length); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_pos = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":303 - * elif isinstance(self.idxfile, basestring): - * pos = ioffset * self.typesize + self.header_length - * self.idxh.seek(pos, os.SEEK_SET) # <<<<<<<<<<<<<< - * offset = numpy.fromfile(self.idxh, dtype=self.dtype, count=1)[0] - * return (ioffset * self.density,offset) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_seek); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_pos, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 303, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_pos, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 303, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_pos); - __Pyx_GIVEREF(__pyx_v_pos); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_pos); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":304 - * pos = ioffset * self.typesize + self.header_length - * self.idxh.seek(pos, os.SEEK_SET) - * offset = numpy.fromfile(self.idxh, dtype=self.dtype, count=1)[0] # <<<<<<<<<<<<<< - * return (ioffset * self.density,offset) - * elif boto_installed and isinstance(self.idxfile, key.Key): - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_fromfile); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 304, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_count, __pyx_int_1) < 0) __PYX_ERR(1, 304, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_offset = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":305 - * self.idxh.seek(pos, os.SEEK_SET) - * offset = numpy.fromfile(self.idxh, dtype=self.dtype, count=1)[0] - * return (ioffset * self.density,offset) # <<<<<<<<<<<<<< - * elif boto_installed and isinstance(self.idxfile, key.Key): - * pos = ioffset * self.typesize + self.header_length - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_density); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyNumber_Multiply(__pyx_v_ioffset, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __Pyx_INCREF(__pyx_v_offset); - __Pyx_GIVEREF(__pyx_v_offset); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_offset); - __pyx_t_5 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":301 - * if self.idxfile is None: - * return (ioffset * self.density, self.offsets[ioffset]) - * elif isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * pos = ioffset * self.typesize + self.header_length - * self.idxh.seek(pos, os.SEEK_SET) - */ - } - - /* "TextAdapter/textadapter/Index.pyx":306 - * offset = numpy.fromfile(self.idxh, dtype=self.dtype, count=1)[0] - * return (ioffset * self.density,offset) - * elif boto_installed and isinstance(self.idxfile, key.Key): # <<<<<<<<<<<<<< - * pos = ioffset * self.typesize + self.header_length - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(pos, pos+self.typesize)})) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_boto_installed); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 306, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - } else { - __pyx_t_7 = __pyx_t_3; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Key); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, __pyx_t_9); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(1, 306, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = (__pyx_t_3 != 0); - __pyx_t_7 = __pyx_t_10; - __pyx_L9_bool_binop_done:; - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/Index.pyx":307 - * return (ioffset * self.density,offset) - * elif boto_installed and isinstance(self.idxfile, key.Key): - * pos = ioffset * self.typesize + self.header_length # <<<<<<<<<<<<<< - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(pos, pos+self.typesize)})) - * offset = long(numpy.fromstring(data.read(8), dtype='u8')) - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_typesize); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PyNumber_Multiply(__pyx_v_ioffset, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_header_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_pos = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":308 - * elif boto_installed and isinstance(self.idxfile, key.Key): - * pos = ioffset * self.typesize + self.header_length - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(pos, pos+self.typesize)})) # <<<<<<<<<<<<<< - * offset = long(numpy.fromstring(data.read(8), dtype='u8')) - * return (ioffset * self.density, offset) - */ - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_StringIO); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get_contents_as_string); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_bytes_0_1, __pyx_n_s_format); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_typesize); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = PyNumber_Add(__pyx_v_pos, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_12)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_pos, __pyx_t_14}; - __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_pos, __pyx_t_14}; - __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else - #endif - { - __pyx_t_15 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL; - } - __Pyx_INCREF(__pyx_v_pos); - __Pyx_GIVEREF(__pyx_v_pos); - PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_8, __pyx_v_pos); - __Pyx_GIVEREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_8, __pyx_t_14); - __pyx_t_14 = 0; - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Range, __pyx_t_11) < 0) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_headers, __pyx_t_4) < 0) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - if (!__pyx_t_1) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_data = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":309 - * pos = ioffset * self.typesize + self.header_length - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(pos, pos+self.typesize)})) - * offset = long(numpy.fromstring(data.read(8), dtype='u8')) # <<<<<<<<<<<<<< - * return (ioffset * self.density, offset) - * - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_read); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 309, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyLong_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_offset = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":310 - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(pos, pos+self.typesize)})) - * offset = long(numpy.fromstring(data.read(8), dtype='u8')) - * return (ioffset * self.density, offset) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_density); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyNumber_Multiply(__pyx_v_ioffset, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_v_offset); - __Pyx_GIVEREF(__pyx_v_offset); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_offset); - __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":306 - * offset = numpy.fromfile(self.idxh, dtype=self.dtype, count=1)[0] - * return (ioffset * self.density,offset) - * elif boto_installed and isinstance(self.idxfile, key.Key): # <<<<<<<<<<<<<< - * pos = ioffset * self.typesize + self.header_length - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(pos, pos+self.typesize)})) - */ - } - - /* "TextAdapter/textadapter/Index.pyx":283 - * - * - * def get_offset(self, rec_num): # <<<<<<<<<<<<<< - * """Get the offset for `rec_num`.""" - * global boto_installed - */ - - /* function exit code */ - __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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.get_offset", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_ioffset); - __Pyx_XDECREF(__pyx_v_num_offsets); - __Pyx_XDECREF(__pyx_v_pos); - __Pyx_XDECREF(__pyx_v_offset); - __Pyx_XDECREF(__pyx_v_data); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":313 - * - * - * def set_offset(self, rec_num, offset): # <<<<<<<<<<<<<< - * """ - * Set offset for rec_num. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_11set_offset(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_10set_offset[] = "\n Set offset for rec_num.\n Offset is added at end of offsets array.\n "; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_11set_offset = {"set_offset", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_11set_offset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_10set_offset}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_11set_offset(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_rec_num = 0; - PyObject *__pyx_v_offset = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_offset (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rec_num,&__pyx_n_s_offset,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rec_num)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_offset", 1, 3, 3, 1); __PYX_ERR(1, 313, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_offset", 1, 3, 3, 2); __PYX_ERR(1, 313, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_offset") < 0)) __PYX_ERR(1, 313, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_self = values[0]; - __pyx_v_rec_num = values[1]; - __pyx_v_offset = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_offset", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 313, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.set_offset", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_10set_offset(__pyx_self, __pyx_v_self, __pyx_v_rec_num, __pyx_v_offset); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_10set_offset(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rec_num, PyObject *__pyx_v_offset) { - PyObject *__pyx_v_ioffset = NULL; - CYTHON_UNUSED PyObject *__pyx_v_num_offsets = NULL; - 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)(PyObject *); - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - __Pyx_RefNannySetupContext("set_offset", 0); - - /* "TextAdapter/textadapter/Index.pyx":320 - * - * # Check to see if we've already indexed this record - * ioffset, num_offsets = divmod(rec_num, self.density) # <<<<<<<<<<<<<< - * if ioffset < self.num_offsets: - * return - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_density); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 320, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Divmod(__pyx_v_rec_num, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 320, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { - PyObject* sequence = __pyx_t_2; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 320, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_1 = PyList_GET_ITEM(sequence, 0); - __pyx_t_3 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 320, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 320, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 320, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; - index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_1); - index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 320, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(1, 320, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_v_ioffset = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_v_num_offsets = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":321 - * # Check to see if we've already indexed this record - * ioffset, num_offsets = divmod(rec_num, self.density) - * if ioffset < self.num_offsets: # <<<<<<<<<<<<<< - * return - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_ioffset, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 321, __pyx_L1_error) - __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_ERR(1, 321, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/Index.pyx":322 - * ioffset, num_offsets = divmod(rec_num, self.density) - * if ioffset < self.num_offsets: - * return # <<<<<<<<<<<<<< - * - * if self.idxfile is None: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":321 - * # Check to see if we've already indexed this record - * ioffset, num_offsets = divmod(rec_num, self.density) - * if ioffset < self.num_offsets: # <<<<<<<<<<<<<< - * return - * - */ - } - - /* "TextAdapter/textadapter/Index.pyx":324 - * return - * - * if self.idxfile is None: # <<<<<<<<<<<<<< - * self.offsets.append(offset) - * elif isinstance(self.idxfile, basestring): - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 324, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = (__pyx_t_3 == Py_None); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/Index.pyx":325 - * - * if self.idxfile is None: - * self.offsets.append(offset) # <<<<<<<<<<<<<< - * elif isinstance(self.idxfile, basestring): - * self.idxh.seek(0, 2) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_offsets); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_offset); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(1, 325, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":324 - * return - * - * if self.idxfile is None: # <<<<<<<<<<<<<< - * self.offsets.append(offset) - * elif isinstance(self.idxfile, basestring): - */ - goto __pyx_L6; - } - - /* "TextAdapter/textadapter/Index.pyx":326 - * if self.idxfile is None: - * self.offsets.append(offset) - * elif isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * self.idxh.seek(0, 2) - * numpy.array(offset, dtype=self.dtype).tofile(self.idxh) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyBaseString_Check(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = (__pyx_t_7 != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/Index.pyx":327 - * self.offsets.append(offset) - * elif isinstance(self.idxfile, basestring): - * self.idxh.seek(0, 2) # <<<<<<<<<<<<<< - * numpy.array(offset, dtype=self.dtype).tofile(self.idxh) - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_seek); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":328 - * elif isinstance(self.idxfile, basestring): - * self.idxh.seek(0, 2) - * numpy.array(offset, dtype=self.dtype).tofile(self.idxh) # <<<<<<<<<<<<<< - * - * # Increment number of records in header - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_offset); - __Pyx_GIVEREF(__pyx_v_offset); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_offset); - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_tofile); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_2) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_9}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_9}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":326 - * if self.idxfile is None: - * self.offsets.append(offset) - * elif isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * self.idxh.seek(0, 2) - * numpy.array(offset, dtype=self.dtype).tofile(self.idxh) - */ - } - __pyx_L6:; - - /* "TextAdapter/textadapter/Index.pyx":331 - * - * # Increment number of records in header - * self.num_offsets += 1 # <<<<<<<<<<<<<< - * - * def add_gzip_access_point(self, window, compressed_offset, uncompressed_offset, avail_in, avail_out, bits): - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets, __pyx_t_4) < 0) __PYX_ERR(1, 331, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":313 - * - * - * def set_offset(self, rec_num, offset): # <<<<<<<<<<<<<< - * """ - * Set offset for rec_num. - */ - - /* function exit code */ - __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_4); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.set_offset", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_ioffset); - __Pyx_XDECREF(__pyx_v_num_offsets); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":333 - * self.num_offsets += 1 - * - * def add_gzip_access_point(self, window, compressed_offset, uncompressed_offset, avail_in, avail_out, bits): # <<<<<<<<<<<<<< - * - * if self.idxfile is None: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_13add_gzip_access_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_13add_gzip_access_point = {"add_gzip_access_point", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_13add_gzip_access_point, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_13add_gzip_access_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_window = 0; - PyObject *__pyx_v_compressed_offset = 0; - PyObject *__pyx_v_uncompressed_offset = 0; - CYTHON_UNUSED PyObject *__pyx_v_avail_in = 0; - CYTHON_UNUSED PyObject *__pyx_v_avail_out = 0; - PyObject *__pyx_v_bits = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_gzip_access_point (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_window,&__pyx_n_s_compressed_offset,&__pyx_n_s_uncompressed_offset,&__pyx_n_s_avail_in,&__pyx_n_s_avail_out,&__pyx_n_s_bits,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_window)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_gzip_access_point", 1, 7, 7, 1); __PYX_ERR(1, 333, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compressed_offset)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_gzip_access_point", 1, 7, 7, 2); __PYX_ERR(1, 333, __pyx_L3_error) - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_uncompressed_offset)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_gzip_access_point", 1, 7, 7, 3); __PYX_ERR(1, 333, __pyx_L3_error) - } - case 4: - if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_avail_in)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_gzip_access_point", 1, 7, 7, 4); __PYX_ERR(1, 333, __pyx_L3_error) - } - case 5: - if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_avail_out)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_gzip_access_point", 1, 7, 7, 5); __PYX_ERR(1, 333, __pyx_L3_error) - } - case 6: - if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bits)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_gzip_access_point", 1, 7, 7, 6); __PYX_ERR(1, 333, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_gzip_access_point") < 0)) __PYX_ERR(1, 333, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - } - __pyx_v_self = values[0]; - __pyx_v_window = values[1]; - __pyx_v_compressed_offset = values[2]; - __pyx_v_uncompressed_offset = values[3]; - __pyx_v_avail_in = values[4]; - __pyx_v_avail_out = values[5]; - __pyx_v_bits = values[6]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_gzip_access_point", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 333, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.add_gzip_access_point", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_12add_gzip_access_point(__pyx_self, __pyx_v_self, __pyx_v_window, __pyx_v_compressed_offset, __pyx_v_uncompressed_offset, __pyx_v_avail_in, __pyx_v_avail_out, __pyx_v_bits); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_12add_gzip_access_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_window, PyObject *__pyx_v_compressed_offset, PyObject *__pyx_v_uncompressed_offset, CYTHON_UNUSED PyObject *__pyx_v_avail_in, CYTHON_UNUSED PyObject *__pyx_v_avail_out, PyObject *__pyx_v_bits) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("add_gzip_access_point", 0); - - /* "TextAdapter/textadapter/Index.pyx":335 - * def add_gzip_access_point(self, window, compressed_offset, uncompressed_offset, avail_in, avail_out, bits): - * - * if self.idxfile is None: # <<<<<<<<<<<<<< - * self.gzip_access_points.append((bits, compressed_offset, uncompressed_offset, window)) - * elif isinstance(self.idxfile, basestring): - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__pyx_t_1 == Py_None); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":336 - * - * if self.idxfile is None: - * self.gzip_access_points.append((bits, compressed_offset, uncompressed_offset, window)) # <<<<<<<<<<<<<< - * elif isinstance(self.idxfile, basestring): - * self.idxh.seek(0, 2) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_gzip_access_points); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 336, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 336, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_bits); - __Pyx_GIVEREF(__pyx_v_bits); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_bits); - __Pyx_INCREF(__pyx_v_compressed_offset); - __Pyx_GIVEREF(__pyx_v_compressed_offset); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_compressed_offset); - __Pyx_INCREF(__pyx_v_uncompressed_offset); - __Pyx_GIVEREF(__pyx_v_uncompressed_offset); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_uncompressed_offset); - __Pyx_INCREF(__pyx_v_window); - __Pyx_GIVEREF(__pyx_v_window); - PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_window); - __pyx_t_5 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 336, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":335 - * def add_gzip_access_point(self, window, compressed_offset, uncompressed_offset, avail_in, avail_out, bits): - * - * if self.idxfile is None: # <<<<<<<<<<<<<< - * self.gzip_access_points.append((bits, compressed_offset, uncompressed_offset, window)) - * elif isinstance(self.idxfile, basestring): - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/Index.pyx":337 - * if self.idxfile is None: - * self.gzip_access_points.append((bits, compressed_offset, uncompressed_offset, window)) - * elif isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * self.idxh.seek(0, 2) - * numpy.array(bits, dtype='u1').tofile(self.idxh) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 337, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyBaseString_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/Index.pyx":338 - * self.gzip_access_points.append((bits, compressed_offset, uncompressed_offset, window)) - * elif isinstance(self.idxfile, basestring): - * self.idxh.seek(0, 2) # <<<<<<<<<<<<<< - * numpy.array(bits, dtype='u1').tofile(self.idxh) - * numpy.array(compressed_offset, dtype='u8').tofile(self.idxh) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_seek); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":339 - * elif isinstance(self.idxfile, basestring): - * self.idxh.seek(0, 2) - * numpy.array(bits, dtype='u1').tofile(self.idxh) # <<<<<<<<<<<<<< - * numpy.array(compressed_offset, dtype='u8').tofile(self.idxh) - * numpy.array(uncompressed_offset, dtype='u8').tofile(self.idxh) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_bits); - __Pyx_GIVEREF(__pyx_v_bits); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bits); - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_n_s_u1) < 0) __PYX_ERR(1, 339, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_tofile); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (!__pyx_t_1) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_8}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_8}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":340 - * self.idxh.seek(0, 2) - * numpy.array(bits, dtype='u1').tofile(self.idxh) - * numpy.array(compressed_offset, dtype='u8').tofile(self.idxh) # <<<<<<<<<<<<<< - * numpy.array(uncompressed_offset, dtype='u8').tofile(self.idxh) - * numpy.array(window, dtype='S32768').tofile(self.idxh) - */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_v_compressed_offset); - __Pyx_GIVEREF(__pyx_v_compressed_offset); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_compressed_offset); - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 340, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_tofile); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - if (!__pyx_t_7) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":341 - * numpy.array(bits, dtype='u1').tofile(self.idxh) - * numpy.array(compressed_offset, dtype='u8').tofile(self.idxh) - * numpy.array(uncompressed_offset, dtype='u8').tofile(self.idxh) # <<<<<<<<<<<<<< - * numpy.array(window, dtype='S32768').tofile(self.idxh) - * - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_uncompressed_offset); - __Pyx_GIVEREF(__pyx_v_uncompressed_offset); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_uncompressed_offset); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 341, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_tofile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_8) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":342 - * numpy.array(compressed_offset, dtype='u8').tofile(self.idxh) - * numpy.array(uncompressed_offset, dtype='u8').tofile(self.idxh) - * numpy.array(window, dtype='S32768').tofile(self.idxh) # <<<<<<<<<<<<<< - * - * self.num_gzip_access_points += 1 - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_window); - __Pyx_GIVEREF(__pyx_v_window); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_window); - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_n_s_S32768) < 0) __PYX_ERR(1, 342, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_tofile); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (!__pyx_t_1) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_8}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_8}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":337 - * if self.idxfile is None: - * self.gzip_access_points.append((bits, compressed_offset, uncompressed_offset, window)) - * elif isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * self.idxh.seek(0, 2) - * numpy.array(bits, dtype='u1').tofile(self.idxh) - */ - } - __pyx_L3:; - - /* "TextAdapter/textadapter/Index.pyx":344 - * numpy.array(window, dtype='S32768').tofile(self.idxh) - * - * self.num_gzip_access_points += 1 # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_gzip_access_points); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 344, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 344, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_num_gzip_access_points, __pyx_t_7) < 0) __PYX_ERR(1, 344, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/Index.pyx":333 - * self.num_offsets += 1 - * - * def add_gzip_access_point(self, window, compressed_offset, uncompressed_offset, avail_in, avail_out, bits): # <<<<<<<<<<<<<< - * - * if self.idxfile is None: - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.add_gzip_access_point", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":347 - * - * - * def get_gzip_access_point(self, offset): # <<<<<<<<<<<<<< - * - * if self.idxfile is None: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_15get_gzip_access_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_15get_gzip_access_point = {"get_gzip_access_point", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_15get_gzip_access_point, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_15get_gzip_access_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_offset = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_gzip_access_point (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_offset,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_gzip_access_point", 1, 2, 2, 1); __PYX_ERR(1, 347, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_gzip_access_point") < 0)) __PYX_ERR(1, 347, __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_self = values[0]; - __pyx_v_offset = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_gzip_access_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 347, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.get_gzip_access_point", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_14get_gzip_access_point(__pyx_self, __pyx_v_self, __pyx_v_offset); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_14get_gzip_access_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_offset) { - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_access_point = NULL; - PyObject *__pyx_v_pos = NULL; - PyObject *__pyx_v_prev_bits = NULL; - PyObject *__pyx_v_prev_compressed_offset = NULL; - PyObject *__pyx_v_prev_uncompressed_offset = NULL; - PyObject *__pyx_v_prev_window = NULL; - PyObject *__pyx_v_bits = NULL; - PyObject *__pyx_v_compressed_offset = NULL; - PyObject *__pyx_v_uncompressed_offset = NULL; - PyObject *__pyx_v_window = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - __Pyx_RefNannySetupContext("get_gzip_access_point", 0); - - /* "TextAdapter/textadapter/Index.pyx":349 - * def get_gzip_access_point(self, offset): - * - * if self.idxfile is None: # <<<<<<<<<<<<<< - * for i, access_point in enumerate(self.gzip_access_points): - * if offset == access_point[2]: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 349, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__pyx_t_1 == Py_None); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":350 - * - * if self.idxfile is None: - * for i, access_point in enumerate(self.gzip_access_points): # <<<<<<<<<<<<<< - * if offset == access_point[2]: - * return access_point - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_1 = __pyx_int_0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_gzip_access_points); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 350, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(1, 350, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(1, 350, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_7(__pyx_t_5); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 350, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_access_point, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":351 - * if self.idxfile is None: - * for i, access_point in enumerate(self.gzip_access_points): - * if offset == access_point[2]: # <<<<<<<<<<<<<< - * return access_point - * elif offset < access_point[2] and i > 0: - */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_access_point, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyObject_RichCompare(__pyx_v_offset, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 351, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 351, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":352 - * for i, access_point in enumerate(self.gzip_access_points): - * if offset == access_point[2]: - * return access_point # <<<<<<<<<<<<<< - * elif offset < access_point[2] and i > 0: - * return self.gzip_access_points[i-1] - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_access_point); - __pyx_r = __pyx_v_access_point; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":351 - * if self.idxfile is None: - * for i, access_point in enumerate(self.gzip_access_points): - * if offset == access_point[2]: # <<<<<<<<<<<<<< - * return access_point - * elif offset < access_point[2] and i > 0: - */ - } - - /* "TextAdapter/textadapter/Index.pyx":353 - * if offset == access_point[2]: - * return access_point - * elif offset < access_point[2] and i > 0: # <<<<<<<<<<<<<< - * return self.gzip_access_points[i-1] - * return self.gzip_access_points[-1] - */ - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_access_point, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_offset, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 353, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 353, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_4 = PyObject_RichCompare(__pyx_v_i, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 353, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 353, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __pyx_t_2; - __pyx_L7_bool_binop_done:; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":354 - * return access_point - * elif offset < access_point[2] and i > 0: - * return self.gzip_access_points[i-1] # <<<<<<<<<<<<<< - * return self.gzip_access_points[-1] - * elif isinstance(self.idxfile, basestring): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_gzip_access_points); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_v_i, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetItem(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":353 - * if offset == access_point[2]: - * return access_point - * elif offset < access_point[2] and i > 0: # <<<<<<<<<<<<<< - * return self.gzip_access_points[i-1] - * return self.gzip_access_points[-1] - */ - } - - /* "TextAdapter/textadapter/Index.pyx":350 - * - * if self.idxfile is None: - * for i, access_point in enumerate(self.gzip_access_points): # <<<<<<<<<<<<<< - * if offset == access_point[2]: - * return access_point - */ - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":355 - * elif offset < access_point[2] and i > 0: - * return self.gzip_access_points[i-1] - * return self.gzip_access_points[-1] # <<<<<<<<<<<<<< - * elif isinstance(self.idxfile, basestring): - * pos = self.num_offsets * self.typesize + self.header_length - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_gzip_access_points); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 355, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 355, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":349 - * def get_gzip_access_point(self, offset): - * - * if self.idxfile is None: # <<<<<<<<<<<<<< - * for i, access_point in enumerate(self.gzip_access_points): - * if offset == access_point[2]: - */ - } - - /* "TextAdapter/textadapter/Index.pyx":356 - * return self.gzip_access_points[i-1] - * return self.gzip_access_points[-1] - * elif isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * pos = self.num_offsets * self.typesize + self.header_length - * self.idxh.seek(pos, 0) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyBaseString_Check(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/Index.pyx":357 - * return self.gzip_access_points[-1] - * elif isinstance(self.idxfile, basestring): - * pos = self.num_offsets * self.typesize + self.header_length # <<<<<<<<<<<<<< - * self.idxh.seek(pos, 0) - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_typesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_header_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyNumber_Add(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_pos = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":358 - * elif isinstance(self.idxfile, basestring): - * pos = self.num_offsets * self.typesize + self.header_length - * self.idxh.seek(pos, 0) # <<<<<<<<<<<<<< - * - * prev_bits = 0 - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_seek); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_pos, __pyx_int_0}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 358, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_pos, __pyx_int_0}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 358, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_1) { - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __pyx_t_1 = NULL; - } - __Pyx_INCREF(__pyx_v_pos); - __Pyx_GIVEREF(__pyx_v_pos); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_v_pos); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_int_0); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":360 - * self.idxh.seek(pos, 0) - * - * prev_bits = 0 # <<<<<<<<<<<<<< - * prev_compressed_offset = 0 - * prev_uncompressed_offset = 0 - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_prev_bits = __pyx_int_0; - - /* "TextAdapter/textadapter/Index.pyx":361 - * - * prev_bits = 0 - * prev_compressed_offset = 0 # <<<<<<<<<<<<<< - * prev_uncompressed_offset = 0 - * prev_window = '' - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_prev_compressed_offset = __pyx_int_0; - - /* "TextAdapter/textadapter/Index.pyx":362 - * prev_bits = 0 - * prev_compressed_offset = 0 - * prev_uncompressed_offset = 0 # <<<<<<<<<<<<<< - * prev_window = '' - * - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_prev_uncompressed_offset = __pyx_int_0; - - /* "TextAdapter/textadapter/Index.pyx":363 - * prev_compressed_offset = 0 - * prev_uncompressed_offset = 0 - * prev_window = '' # <<<<<<<<<<<<<< - * - * for i in range(self.num_gzip_access_points): - */ - __Pyx_INCREF(__pyx_kp_s__25); - __pyx_v_prev_window = __pyx_kp_s__25; - - /* "TextAdapter/textadapter/Index.pyx":365 - * prev_window = '' - * - * for i in range(self.num_gzip_access_points): # <<<<<<<<<<<<<< - * bits = numpy.fromfile(self.idxh, dtype='u1', count=1)[0] - * compressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_gzip_access_points); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { - __pyx_t_9 = __pyx_t_5; __Pyx_INCREF(__pyx_t_9); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 365, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_9))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_9)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(1, 365, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_9)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(1, 365, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_7(__pyx_t_9); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 365, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":366 - * - * for i in range(self.num_gzip_access_points): - * bits = numpy.fromfile(self.idxh, dtype='u1', count=1)[0] # <<<<<<<<<<<<<< - * compressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] - * uncompressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_fromfile); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_n_s_u1) < 0) __PYX_ERR(1, 366, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_count, __pyx_int_1) < 0) __PYX_ERR(1, 366, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_bits, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":367 - * for i in range(self.num_gzip_access_points): - * bits = numpy.fromfile(self.idxh, dtype='u1', count=1)[0] - * compressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] # <<<<<<<<<<<<<< - * uncompressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] - * window = numpy.fromfile(self.idxh, dtype='S32768', count=1)[0] - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_fromfile); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 367, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_count, __pyx_int_1) < 0) __PYX_ERR(1, 367, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF_SET(__pyx_v_compressed_offset, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":368 - * bits = numpy.fromfile(self.idxh, dtype='u1', count=1)[0] - * compressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] - * uncompressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] # <<<<<<<<<<<<<< - * window = numpy.fromfile(self.idxh, dtype='S32768', count=1)[0] - * if offset == uncompressed_offset: - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_fromfile); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 368, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_count, __pyx_int_1) < 0) __PYX_ERR(1, 368, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_uncompressed_offset, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":369 - * compressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] - * uncompressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] - * window = numpy.fromfile(self.idxh, dtype='S32768', count=1)[0] # <<<<<<<<<<<<<< - * if offset == uncompressed_offset: - * return (bits, compressed_offset, uncompressed_offset, window) - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_fromfile); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_n_s_S32768) < 0) __PYX_ERR(1, 369, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_count, __pyx_int_1) < 0) __PYX_ERR(1, 369, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF_SET(__pyx_v_window, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":370 - * uncompressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] - * window = numpy.fromfile(self.idxh, dtype='S32768', count=1)[0] - * if offset == uncompressed_offset: # <<<<<<<<<<<<<< - * return (bits, compressed_offset, uncompressed_offset, window) - * elif offset < uncompressed_offset and i > 0: - */ - __pyx_t_5 = PyObject_RichCompare(__pyx_v_offset, __pyx_v_uncompressed_offset, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 370, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 370, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/Index.pyx":371 - * window = numpy.fromfile(self.idxh, dtype='S32768', count=1)[0] - * if offset == uncompressed_offset: - * return (bits, compressed_offset, uncompressed_offset, window) # <<<<<<<<<<<<<< - * elif offset < uncompressed_offset and i > 0: - * return (prev_bits, prev_compressed_offset, prev_uncompressed_offset, prev_window) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_bits); - __Pyx_GIVEREF(__pyx_v_bits); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_bits); - __Pyx_INCREF(__pyx_v_compressed_offset); - __Pyx_GIVEREF(__pyx_v_compressed_offset); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_compressed_offset); - __Pyx_INCREF(__pyx_v_uncompressed_offset); - __Pyx_GIVEREF(__pyx_v_uncompressed_offset); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_uncompressed_offset); - __Pyx_INCREF(__pyx_v_window); - __Pyx_GIVEREF(__pyx_v_window); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_window); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":370 - * uncompressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] - * window = numpy.fromfile(self.idxh, dtype='S32768', count=1)[0] - * if offset == uncompressed_offset: # <<<<<<<<<<<<<< - * return (bits, compressed_offset, uncompressed_offset, window) - * elif offset < uncompressed_offset and i > 0: - */ - } - - /* "TextAdapter/textadapter/Index.pyx":372 - * if offset == uncompressed_offset: - * return (bits, compressed_offset, uncompressed_offset, window) - * elif offset < uncompressed_offset and i > 0: # <<<<<<<<<<<<<< - * return (prev_bits, prev_compressed_offset, prev_uncompressed_offset, prev_window) - * prev_bits = bits - */ - __pyx_t_5 = PyObject_RichCompare(__pyx_v_offset, __pyx_v_uncompressed_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 372, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 372, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_3) { - } else { - __pyx_t_2 = __pyx_t_3; - goto __pyx_L12_bool_binop_done; - } - __pyx_t_5 = PyObject_RichCompare(__pyx_v_i, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 372, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 372, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __pyx_t_3; - __pyx_L12_bool_binop_done:; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/Index.pyx":373 - * return (bits, compressed_offset, uncompressed_offset, window) - * elif offset < uncompressed_offset and i > 0: - * return (prev_bits, prev_compressed_offset, prev_uncompressed_offset, prev_window) # <<<<<<<<<<<<<< - * prev_bits = bits - * prev_compressed_offset = compressed_offset - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_prev_bits); - __Pyx_GIVEREF(__pyx_v_prev_bits); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_prev_bits); - __Pyx_INCREF(__pyx_v_prev_compressed_offset); - __Pyx_GIVEREF(__pyx_v_prev_compressed_offset); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_prev_compressed_offset); - __Pyx_INCREF(__pyx_v_prev_uncompressed_offset); - __Pyx_GIVEREF(__pyx_v_prev_uncompressed_offset); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_prev_uncompressed_offset); - __Pyx_INCREF(__pyx_v_prev_window); - __Pyx_GIVEREF(__pyx_v_prev_window); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_prev_window); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":372 - * if offset == uncompressed_offset: - * return (bits, compressed_offset, uncompressed_offset, window) - * elif offset < uncompressed_offset and i > 0: # <<<<<<<<<<<<<< - * return (prev_bits, prev_compressed_offset, prev_uncompressed_offset, prev_window) - * prev_bits = bits - */ - } - - /* "TextAdapter/textadapter/Index.pyx":374 - * elif offset < uncompressed_offset and i > 0: - * return (prev_bits, prev_compressed_offset, prev_uncompressed_offset, prev_window) - * prev_bits = bits # <<<<<<<<<<<<<< - * prev_compressed_offset = compressed_offset - * prev_uncompressed_offset = uncompressed_offset - */ - __Pyx_INCREF(__pyx_v_bits); - __Pyx_DECREF_SET(__pyx_v_prev_bits, __pyx_v_bits); - - /* "TextAdapter/textadapter/Index.pyx":375 - * return (prev_bits, prev_compressed_offset, prev_uncompressed_offset, prev_window) - * prev_bits = bits - * prev_compressed_offset = compressed_offset # <<<<<<<<<<<<<< - * prev_uncompressed_offset = uncompressed_offset - * prev_window = window - */ - __Pyx_INCREF(__pyx_v_compressed_offset); - __Pyx_DECREF_SET(__pyx_v_prev_compressed_offset, __pyx_v_compressed_offset); - - /* "TextAdapter/textadapter/Index.pyx":376 - * prev_bits = bits - * prev_compressed_offset = compressed_offset - * prev_uncompressed_offset = uncompressed_offset # <<<<<<<<<<<<<< - * prev_window = window - * return (prev_bits, prev_compressed_offset, prev_uncompressed_offset, prev_window) - */ - __Pyx_INCREF(__pyx_v_uncompressed_offset); - __Pyx_DECREF_SET(__pyx_v_prev_uncompressed_offset, __pyx_v_uncompressed_offset); - - /* "TextAdapter/textadapter/Index.pyx":377 - * prev_compressed_offset = compressed_offset - * prev_uncompressed_offset = uncompressed_offset - * prev_window = window # <<<<<<<<<<<<<< - * return (prev_bits, prev_compressed_offset, prev_uncompressed_offset, prev_window) - * - */ - __Pyx_INCREF(__pyx_v_window); - __Pyx_DECREF_SET(__pyx_v_prev_window, __pyx_v_window); - - /* "TextAdapter/textadapter/Index.pyx":365 - * prev_window = '' - * - * for i in range(self.num_gzip_access_points): # <<<<<<<<<<<<<< - * bits = numpy.fromfile(self.idxh, dtype='u1', count=1)[0] - * compressed_offset = numpy.fromfile(self.idxh, dtype='u8', count=1)[0] - */ - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/Index.pyx":378 - * prev_uncompressed_offset = uncompressed_offset - * prev_window = window - * return (prev_bits, prev_compressed_offset, prev_uncompressed_offset, prev_window) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_prev_bits); - __Pyx_GIVEREF(__pyx_v_prev_bits); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_prev_bits); - __Pyx_INCREF(__pyx_v_prev_compressed_offset); - __Pyx_GIVEREF(__pyx_v_prev_compressed_offset); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_prev_compressed_offset); - __Pyx_INCREF(__pyx_v_prev_uncompressed_offset); - __Pyx_GIVEREF(__pyx_v_prev_uncompressed_offset); - PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_prev_uncompressed_offset); - __Pyx_INCREF(__pyx_v_prev_window); - __Pyx_GIVEREF(__pyx_v_prev_window); - PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_v_prev_window); - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":356 - * return self.gzip_access_points[i-1] - * return self.gzip_access_points[-1] - * elif isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * pos = self.num_offsets * self.typesize + self.header_length - * self.idxh.seek(pos, 0) - */ - } - - /* "TextAdapter/textadapter/Index.pyx":347 - * - * - * def get_gzip_access_point(self, offset): # <<<<<<<<<<<<<< - * - * if self.idxfile is None: - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.get_gzip_access_point", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_access_point); - __Pyx_XDECREF(__pyx_v_pos); - __Pyx_XDECREF(__pyx_v_prev_bits); - __Pyx_XDECREF(__pyx_v_prev_compressed_offset); - __Pyx_XDECREF(__pyx_v_prev_uncompressed_offset); - __Pyx_XDECREF(__pyx_v_prev_window); - __Pyx_XDECREF(__pyx_v_bits); - __Pyx_XDECREF(__pyx_v_compressed_offset); - __Pyx_XDECREF(__pyx_v_uncompressed_offset); - __Pyx_XDECREF(__pyx_v_window); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":381 - * - * - * def finalize(self, total_num_records): # <<<<<<<<<<<<<< - * """ - * This function is called by C parsing engine when parsing is finished. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_17finalize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_16finalize[] = "\n This function is called by C parsing engine when parsing is finished.\n Any post-indexing stuff should be put here.\n "; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_17finalize = {"finalize", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_17finalize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_16finalize}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_17finalize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_total_num_records = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("finalize (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_total_num_records,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_total_num_records)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("finalize", 1, 2, 2, 1); __PYX_ERR(1, 381, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "finalize") < 0)) __PYX_ERR(1, 381, __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_self = values[0]; - __pyx_v_total_num_records = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("finalize", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 381, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.finalize", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_16finalize(__pyx_self, __pyx_v_self, __pyx_v_total_num_records); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_16finalize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_total_num_records) { - PyObject *__pyx_v_pos = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - __Pyx_RefNannySetupContext("finalize", 0); - - /* "TextAdapter/textadapter/Index.pyx":387 - * """ - * - * self.total_num_records = total_num_records # <<<<<<<<<<<<<< - * - * if isinstance(self.idxfile, basestring): - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_total_num_records, __pyx_v_total_num_records) < 0) __PYX_ERR(1, 387, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":389 - * self.total_num_records = total_num_records - * - * if isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * # Save number of offsets and gzip access_points in file - * pos = self.idxh.tell() - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBaseString_Check(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":391 - * if isinstance(self.idxfile, basestring): - * # Save number of offsets and gzip access_points in file - * pos = self.idxh.tell() # <<<<<<<<<<<<<< - * - * self.idxh.seek(self.NUMOFFSETS_OFFSET, os.SEEK_SET) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 391, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_tell); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 391, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 391, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 391, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_pos = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":393 - * pos = self.idxh.tell() - * - * self.idxh.seek(self.NUMOFFSETS_OFFSET, os.SEEK_SET) # <<<<<<<<<<<<<< - * numpy.array(self.num_offsets, dtype='u8').tofile(self.idxh) - * self.idxh.seek(self.NUM_GZIP_ACCESS_POINTS_OFFSET, os.SEEK_SET) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_seek); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_NUMOFFSETS_OFFSET); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 393, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 393, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_7); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":394 - * - * self.idxh.seek(self.NUMOFFSETS_OFFSET, os.SEEK_SET) - * numpy.array(self.num_offsets, dtype='u8').tofile(self.idxh) # <<<<<<<<<<<<<< - * self.idxh.seek(self.NUM_GZIP_ACCESS_POINTS_OFFSET, os.SEEK_SET) - * numpy.array(self.num_gzip_access_points, dtype='u8').tofile(self.idxh) - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 394, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tofile); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":395 - * self.idxh.seek(self.NUMOFFSETS_OFFSET, os.SEEK_SET) - * numpy.array(self.num_offsets, dtype='u8').tofile(self.idxh) - * self.idxh.seek(self.NUM_GZIP_ACCESS_POINTS_OFFSET, os.SEEK_SET) # <<<<<<<<<<<<<< - * numpy.array(self.num_gzip_access_points, dtype='u8').tofile(self.idxh) - * self.idxh.seek(self.TOTAL_NUM_RECORDS_OFFSET, os.SEEK_SET) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 395, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_seek); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 395, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_NUM_GZIP_ACCESS_POINTS_OFFSET); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 395, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 395, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 395, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 395, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 395, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 395, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_t_7); - __pyx_t_4 = 0; - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 395, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":396 - * numpy.array(self.num_offsets, dtype='u8').tofile(self.idxh) - * self.idxh.seek(self.NUM_GZIP_ACCESS_POINTS_OFFSET, os.SEEK_SET) - * numpy.array(self.num_gzip_access_points, dtype='u8').tofile(self.idxh) # <<<<<<<<<<<<<< - * self.idxh.seek(self.TOTAL_NUM_RECORDS_OFFSET, os.SEEK_SET) - * numpy.array(total_num_records, dtype='u8').tofile(self.idxh) - */ - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_gzip_access_points); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 396, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_tofile); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":397 - * self.idxh.seek(self.NUM_GZIP_ACCESS_POINTS_OFFSET, os.SEEK_SET) - * numpy.array(self.num_gzip_access_points, dtype='u8').tofile(self.idxh) - * self.idxh.seek(self.TOTAL_NUM_RECORDS_OFFSET, os.SEEK_SET) # <<<<<<<<<<<<<< - * numpy.array(total_num_records, dtype='u8').tofile(self.idxh) - * - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 397, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_seek); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 397, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_TOTAL_NUM_RECORDS_OFFSET); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 397, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 397, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 397, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_9, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 397, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_9, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 397, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_t_7); - __pyx_t_9 = 0; - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 397, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":398 - * numpy.array(self.num_gzip_access_points, dtype='u8').tofile(self.idxh) - * self.idxh.seek(self.TOTAL_NUM_RECORDS_OFFSET, os.SEEK_SET) - * numpy.array(total_num_records, dtype='u8').tofile(self.idxh) # <<<<<<<<<<<<<< - * - * self.idxh.seek(pos, os.SEEK_SET) - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_total_num_records); - __Pyx_GIVEREF(__pyx_v_total_num_records); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_total_num_records); - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(1, 398, __pyx_L1_error) - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_tofile); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (!__pyx_t_6) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_9}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_9}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":400 - * numpy.array(total_num_records, dtype='u8').tofile(self.idxh) - * - * self.idxh.seek(pos, os.SEEK_SET) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 400, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_seek); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 400, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 400, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 400, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_pos, __pyx_t_9}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 400, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_pos, __pyx_t_9}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 400, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 400, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_INCREF(__pyx_v_pos); - __Pyx_GIVEREF(__pyx_v_pos); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_v_pos); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 400, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":389 - * self.total_num_records = total_num_records - * - * if isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * # Save number of offsets and gzip access_points in file - * pos = self.idxh.tell() - */ - } - - /* "TextAdapter/textadapter/Index.pyx":381 - * - * - * def finalize(self, total_num_records): # <<<<<<<<<<<<<< - * """ - * This function is called by C parsing engine when parsing is finished. - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.finalize", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_pos); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":403 - * - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.num_offsets - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_19__len__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_19__len__ = {"__len__", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_19__len__, METH_O, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_19__len__(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_18__len__(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_18__len__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__len__", 0); - - /* "TextAdapter/textadapter/Index.pyx":404 - * - * def __len__(self): - * return self.num_offsets # <<<<<<<<<<<<<< - * - * def get_density(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_offsets); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 404, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":403 - * - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.num_offsets - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":406 - * return self.num_offsets - * - * def get_density(self): # <<<<<<<<<<<<<< - * return self.density - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_21get_density(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_21get_density = {"get_density", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_21get_density, METH_O, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_21get_density(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_density (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_20get_density(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_20get_density(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_density", 0); - - /* "TextAdapter/textadapter/Index.pyx":407 - * - * def get_density(self): - * return self.density # <<<<<<<<<<<<<< - * - * def close(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_density); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":406 - * return self.num_offsets - * - * def get_density(self): # <<<<<<<<<<<<<< - * return self.density - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.get_density", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":409 - * return self.density - * - * def close(self): # <<<<<<<<<<<<<< - * if isinstance(self.idxfile, basestring): - * self.idxh.close() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_23close(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_23close = {"close", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_23close, METH_O, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_23close(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("close (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_22close(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_22close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("close", 0); - - /* "TextAdapter/textadapter/Index.pyx":410 - * - * def close(self): - * if isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * self.idxh.close() - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxfile); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 410, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBaseString_Check(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":411 - * def close(self): - * if isinstance(self.idxfile, basestring): - * self.idxh.close() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idxh); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 411, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 411, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":410 - * - * def close(self): - * if isinstance(self.idxfile, basestring): # <<<<<<<<<<<<<< - * self.idxh.close() - * - */ - } - - /* "TextAdapter/textadapter/Index.pyx":409 - * return self.density - * - * def close(self): # <<<<<<<<<<<<<< - * if isinstance(self.idxfile, basestring): - * self.idxh.close() - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ExactIndex.close", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":420 - * """Implementation of a fuzzy index""" - * - * def __init__(self, textfileh, skip): # <<<<<<<<<<<<<< - * self.textfileh = textfileh - * self.skip = skip - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_textfileh = 0; - PyObject *__pyx_v_skip = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_textfileh,&__pyx_n_s_skip,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_textfileh)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(1, 420, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_skip)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(1, 420, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 420, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_self = values[0]; - __pyx_v_textfileh = values[1]; - __pyx_v_skip = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 420, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FuzzyIdx.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx___init__(__pyx_self, __pyx_v_self, __pyx_v_textfileh, __pyx_v_skip); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_textfileh, PyObject *__pyx_v_skip) { - PyObject *__pyx_v_isizes = NULL; - PyObject *__pyx_v_esizes = NULL; - PyObject *__pyx_v_allsizes = NULL; - PyObject *__pyx_v_shmean = NULL; - 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)(PyObject *); - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "TextAdapter/textadapter/Index.pyx":421 - * - * def __init__(self, textfileh, skip): - * self.textfileh = textfileh # <<<<<<<<<<<<<< - * self.skip = skip - * # The filesize and the number of bytes to skip - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_textfileh, __pyx_v_textfileh) < 0) __PYX_ERR(1, 421, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":422 - * def __init__(self, textfileh, skip): - * self.textfileh = textfileh - * self.skip = skip # <<<<<<<<<<<<<< - * # The filesize and the number of bytes to skip - * self.filesize, self.skipbytes = self.get_size_skipbytes(skip) - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_skip, __pyx_v_skip) < 0) __PYX_ERR(1, 422, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":424 - * self.skip = skip - * # The filesize and the number of bytes to skip - * self.filesize, self.skipbytes = self.get_size_skipbytes(skip) # <<<<<<<<<<<<<< - * - * # Get a sensible chunksize for the retrieved blocks as well as the - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_size_skipbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_skip); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_skip}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_skip}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_skip); - __Pyx_GIVEREF(__pyx_v_skip); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_skip); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 424, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_4 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(1, 424, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(1, 424, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_filesize, __pyx_t_2) < 0) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_skipbytes, __pyx_t_4) < 0) __PYX_ERR(1, 424, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":428 - * # Get a sensible chunksize for the retrieved blocks as well as the - * # inital sizes - * self.chunksize, isizes = self.get_sample_chunksize() # <<<<<<<<<<<<<< - * # Get values at the end - * esizes = self.chunk_sizes(where=-1, chunksize=self.chunksize) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_sample_chunksize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 428, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 428, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 428, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 428, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_2 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 428, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 428, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 428, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(1, 428, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(1, 428, __pyx_L1_error) - __pyx_L6_unpacking_done:; - } - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_chunksize, __pyx_t_4) < 0) __PYX_ERR(1, 428, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_isizes = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":430 - * self.chunksize, isizes = self.get_sample_chunksize() - * # Get values at the end - * esizes = self.chunk_sizes(where=-1, chunksize=self.chunksize) # <<<<<<<<<<<<<< - * self.isizes, self.esizes = isizes, esizes[::-1] - * self.imean, self.emean = isizes.mean(), esizes.mean() - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_chunk_sizes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_where, __pyx_int_neg_1) < 0) __PYX_ERR(1, 430, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_chunksize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_chunksize, __pyx_t_4) < 0) __PYX_ERR(1, 430, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_esizes = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":431 - * # Get values at the end - * esizes = self.chunk_sizes(where=-1, chunksize=self.chunksize) - * self.isizes, self.esizes = isizes, esizes[::-1] # <<<<<<<<<<<<<< - * self.imean, self.emean = isizes.mean(), esizes.mean() - * self.istd, self.estd = isizes.std(), esizes.std() - */ - __pyx_t_4 = __pyx_v_isizes; - __Pyx_INCREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetItem(__pyx_v_esizes, __pyx_slice__26); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_isizes, __pyx_t_4) < 0) __PYX_ERR(1, 431, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_esizes, __pyx_t_2) < 0) __PYX_ERR(1, 431, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":432 - * esizes = self.chunk_sizes(where=-1, chunksize=self.chunksize) - * self.isizes, self.esizes = isizes, esizes[::-1] - * self.imean, self.emean = isizes.mean(), esizes.mean() # <<<<<<<<<<<<<< - * self.istd, self.estd = isizes.std(), esizes.std() - * #print "means:", self.imean, self.emean - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_isizes, __pyx_n_s_mean); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 432, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_1) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 432, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 432, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_esizes, __pyx_n_s_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_3) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 432, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 432, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_imean, __pyx_t_2) < 0) __PYX_ERR(1, 432, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_emean, __pyx_t_4) < 0) __PYX_ERR(1, 432, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/Index.pyx":433 - * self.isizes, self.esizes = isizes, esizes[::-1] - * self.imean, self.emean = isizes.mean(), esizes.mean() - * self.istd, self.estd = isizes.std(), esizes.std() # <<<<<<<<<<<<<< - * #print "means:", self.imean, self.emean - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_isizes, __pyx_n_s_std); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 433, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_1) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 433, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 433, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_esizes, __pyx_n_s_std); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 433, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_3) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 433, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 433, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_istd, __pyx_t_4) < 0) __PYX_ERR(1, 433, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_estd, __pyx_t_2) < 0) __PYX_ERR(1, 433, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":437 - * - * # Compute mean for all values - * allsizes = numpy.concatenate((isizes, esizes)) # <<<<<<<<<<<<<< - * self.std = allsizes.std() - * self.mean = allsizes.mean() - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_isizes); - __Pyx_GIVEREF(__pyx_v_isizes); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_isizes); - __Pyx_INCREF(__pyx_v_esizes); - __Pyx_GIVEREF(__pyx_v_esizes); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_esizes); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_3) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 437, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 437, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 437, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_allsizes = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":438 - * # Compute mean for all values - * allsizes = numpy.concatenate((isizes, esizes)) - * self.std = allsizes.std() # <<<<<<<<<<<<<< - * self.mean = allsizes.mean() - * # Shrink the mean by the stddev. This allows for a larger estimation - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_allsizes, __pyx_n_s_std); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_6) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 438, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 438, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_std, __pyx_t_2) < 0) __PYX_ERR(1, 438, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":439 - * allsizes = numpy.concatenate((isizes, esizes)) - * self.std = allsizes.std() - * self.mean = allsizes.mean() # <<<<<<<<<<<<<< - * # Shrink the mean by the stddev. This allows for a larger estimation - * # of the number of records, which can be beneficial (i.e. requires - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_allsizes, __pyx_n_s_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 439, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_6) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 439, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 439, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_mean, __pyx_t_2) < 0) __PYX_ERR(1, 439, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":444 - * # less enlargements) when creating a big recarray for keeping all the - * # data. - * shmean = self.mean - self.std # <<<<<<<<<<<<<< - * self.nrecords = int((self.filesize - self.skipbytes) / shmean) - * #print "skipbytes:", self.skipbytes - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mean); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_std); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_shmean = __pyx_t_6; - __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/Index.pyx":445 - * # data. - * shmean = self.mean - self.std - * self.nrecords = int((self.filesize - self.skipbytes) / shmean) # <<<<<<<<<<<<<< - * #print "skipbytes:", self.skipbytes - * #print "mean:", self.mean - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_filesize); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 445, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_skipbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 445, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 445, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_shmean); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 445, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 445, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nrecords, __pyx_t_2) < 0) __PYX_ERR(1, 445, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":420 - * """Implementation of a fuzzy index""" - * - * def __init__(self, textfileh, skip): # <<<<<<<<<<<<<< - * self.textfileh = textfileh - * self.skip = skip - */ - - /* function exit code */ - __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_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FuzzyIdx.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_isizes); - __Pyx_XDECREF(__pyx_v_esizes); - __Pyx_XDECREF(__pyx_v_allsizes); - __Pyx_XDECREF(__pyx_v_shmean); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":451 - * #print "nrecords:", self.nrecords - * - * def chunk_sizes(self, where=0, skipbytes=0, chunksize=CS): # <<<<<<<<<<<<<< - * """Return the sizes for records in a chunk of text.""" - * if where == 0: - */ - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8__defaults__(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__defaults__", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_int_0)); - __Pyx_GIVEREF(((PyObject *)__pyx_int_0)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_int_0)); - __Pyx_INCREF(((PyObject *)__pyx_int_0)); - __Pyx_GIVEREF(((PyObject *)__pyx_int_0)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_int_0)); - __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_chunksize); - __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_chunksize); - PyTuple_SET_ITEM(__pyx_t_1, 2, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_chunksize); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None); - __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_3chunk_sizes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_2chunk_sizes[] = "Return the sizes for records in a chunk of text."; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_3chunk_sizes = {"chunk_sizes", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_3chunk_sizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_2chunk_sizes}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_3chunk_sizes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_where = 0; - PyObject *__pyx_v_skipbytes = 0; - PyObject *__pyx_v_chunksize = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("chunk_sizes (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_where,&__pyx_n_s_skipbytes,&__pyx_n_s_chunksize,0}; - PyObject* values[4] = {0,0,0,0}; - __pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self); - values[1] = ((PyObject *)((PyObject *)__pyx_int_0)); - values[2] = ((PyObject *)((PyObject *)__pyx_int_0)); - values[3] = __pyx_dynamic_args->__pyx_arg_chunksize; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_where); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_skipbytes); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_chunksize); - if (value) { values[3] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chunk_sizes") < 0)) __PYX_ERR(1, 451, __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_self = values[0]; - __pyx_v_where = values[1]; - __pyx_v_skipbytes = values[2]; - __pyx_v_chunksize = values[3]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("chunk_sizes", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 451, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FuzzyIdx.chunk_sizes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_2chunk_sizes(__pyx_self, __pyx_v_self, __pyx_v_where, __pyx_v_skipbytes, __pyx_v_chunksize); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_2chunk_sizes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_where, PyObject *__pyx_v_skipbytes, PyObject *__pyx_v_chunksize) { - PyObject *__pyx_v_chunk = NULL; - PyObject *__pyx_v_start = NULL; - PyObject *__pyx_v_sizes = NULL; - PyObject *__pyx_v_end = NULL; - PyObject *__pyx_v_asizes = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - __Pyx_RefNannySetupContext("chunk_sizes", 0); - - /* "TextAdapter/textadapter/Index.pyx":453 - * def chunk_sizes(self, where=0, skipbytes=0, chunksize=CS): - * """Return the sizes for records in a chunk of text.""" - * if where == 0: # <<<<<<<<<<<<<< - * self.textfileh.seek(skipbytes, 0) - * chunk = self.textfileh.read(chunksize) - */ - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_where, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 453, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 453, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/Index.pyx":454 - * """Return the sizes for records in a chunk of text.""" - * if where == 0: - * self.textfileh.seek(skipbytes, 0) # <<<<<<<<<<<<<< - * chunk = self.textfileh.read(chunksize) - * chunk = chunk[:chunk.rfind('\n')] - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_textfileh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_seek); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_skipbytes, __pyx_int_0}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 454, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_skipbytes, __pyx_int_0}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 454, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_skipbytes); - __Pyx_GIVEREF(__pyx_v_skipbytes); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_skipbytes); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_int_0); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":455 - * if where == 0: - * self.textfileh.seek(skipbytes, 0) - * chunk = self.textfileh.read(chunksize) # <<<<<<<<<<<<<< - * chunk = chunk[:chunk.rfind('\n')] - * elif where == -1: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_textfileh); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_read); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_chunksize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_chunksize}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 455, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_chunksize}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 455, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_chunksize); - __Pyx_GIVEREF(__pyx_v_chunksize); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_chunksize); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_chunk = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":456 - * self.textfileh.seek(skipbytes, 0) - * chunk = self.textfileh.read(chunksize) - * chunk = chunk[:chunk.rfind('\n')] # <<<<<<<<<<<<<< - * elif where == -1: - * self.textfileh.seek(-chunksize, 2) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_chunk, __pyx_n_s_rfind); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_chunk, 0, 0, NULL, &__pyx_t_6, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF_SET(__pyx_v_chunk, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":453 - * def chunk_sizes(self, where=0, skipbytes=0, chunksize=CS): - * """Return the sizes for records in a chunk of text.""" - * if where == 0: # <<<<<<<<<<<<<< - * self.textfileh.seek(skipbytes, 0) - * chunk = self.textfileh.read(chunksize) - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/Index.pyx":457 - * chunk = self.textfileh.read(chunksize) - * chunk = chunk[:chunk.rfind('\n')] - * elif where == -1: # <<<<<<<<<<<<<< - * self.textfileh.seek(-chunksize, 2) - * chunk = self.textfileh.read(chunksize) - */ - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_where, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 457, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/Index.pyx":458 - * chunk = chunk[:chunk.rfind('\n')] - * elif where == -1: - * self.textfileh.seek(-chunksize, 2) # <<<<<<<<<<<<<< - * chunk = self.textfileh.read(chunksize) - * chunk = chunk[chunk.find('\n')+1:] - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_textfileh); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_seek); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Negative(__pyx_v_chunksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_6, __pyx_int_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 458, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_6, __pyx_int_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 458, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_5, __pyx_t_6); - __Pyx_INCREF(__pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_5, __pyx_int_2); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":459 - * elif where == -1: - * self.textfileh.seek(-chunksize, 2) - * chunk = self.textfileh.read(chunksize) # <<<<<<<<<<<<<< - * chunk = chunk[chunk.find('\n')+1:] - * else: - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_textfileh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 459, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_read); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 459, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_chunksize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 459, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_chunksize}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 459, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_chunksize}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 459, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 459, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_chunksize); - __Pyx_GIVEREF(__pyx_v_chunksize); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_chunksize); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 459, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_chunk = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":460 - * self.textfileh.seek(-chunksize, 2) - * chunk = self.textfileh.read(chunksize) - * chunk = chunk[chunk.find('\n')+1:] # <<<<<<<<<<<<<< - * else: - * raise NotImplementedError - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_chunk, __pyx_n_s_find); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 460, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 460, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_7, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 460, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_chunk, 0, 0, &__pyx_t_1, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 460, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_chunk, __pyx_t_7); - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/Index.pyx":457 - * chunk = self.textfileh.read(chunksize) - * chunk = chunk[:chunk.rfind('\n')] - * elif where == -1: # <<<<<<<<<<<<<< - * self.textfileh.seek(-chunksize, 2) - * chunk = self.textfileh.read(chunksize) - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/Index.pyx":462 - * chunk = chunk[chunk.find('\n')+1:] - * else: - * raise NotImplementedError # <<<<<<<<<<<<<< - * start = 0; sizes = [] - * while True: - */ - /*else*/ { - __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0); - __PYX_ERR(1, 462, __pyx_L1_error) - } - __pyx_L3:; - - /* "TextAdapter/textadapter/Index.pyx":463 - * else: - * raise NotImplementedError - * start = 0; sizes = [] # <<<<<<<<<<<<<< - * while True: - * end = chunk.find('\n', start) - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_start = __pyx_int_0; - __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 463, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_v_sizes = ((PyObject*)__pyx_t_7); - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/Index.pyx":464 - * raise NotImplementedError - * start = 0; sizes = [] - * while True: # <<<<<<<<<<<<<< - * end = chunk.find('\n', start) - * if end < 0: break - */ - while (1) { - - /* "TextAdapter/textadapter/Index.pyx":465 - * start = 0; sizes = [] - * while True: - * end = chunk.find('\n', start) # <<<<<<<<<<<<<< - * if end < 0: break - * sizes.append(end-start+1) # probably +2 for '\r\n' (Win) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_chunk, __pyx_n_s_find); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s__27, __pyx_v_start}; - __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 465, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_7); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s__27, __pyx_v_start}; - __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 465, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_7); - } else - #endif - { - __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_INCREF(__pyx_kp_s__27); - __Pyx_GIVEREF(__pyx_kp_s__27); - PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_kp_s__27); - __Pyx_INCREF(__pyx_v_start); - __Pyx_GIVEREF(__pyx_v_start); - PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_start); - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_7); - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/Index.pyx":466 - * while True: - * end = chunk.find('\n', start) - * if end < 0: break # <<<<<<<<<<<<<< - * sizes.append(end-start+1) # probably +2 for '\r\n' (Win) - * start = end+1 - */ - __pyx_t_7 = PyObject_RichCompare(__pyx_v_end, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 466, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 466, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_2) { - goto __pyx_L5_break; - } - - /* "TextAdapter/textadapter/Index.pyx":467 - * end = chunk.find('\n', start) - * if end < 0: break - * sizes.append(end-start+1) # probably +2 for '\r\n' (Win) # <<<<<<<<<<<<<< - * start = end+1 - * asizes = numpy.array(sizes, dtype='i4') - */ - __pyx_t_7 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 467, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_7, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 467, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_sizes, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(1, 467, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":468 - * if end < 0: break - * sizes.append(end-start+1) # probably +2 for '\r\n' (Win) - * start = end+1 # <<<<<<<<<<<<<< - * asizes = numpy.array(sizes, dtype='i4') - * return asizes - */ - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_end, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 468, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_1); - __pyx_t_1 = 0; - } - __pyx_L5_break:; - - /* "TextAdapter/textadapter/Index.pyx":469 - * sizes.append(end-start+1) # probably +2 for '\r\n' (Win) - * start = end+1 - * asizes = numpy.array(sizes, dtype='i4') # <<<<<<<<<<<<<< - * return asizes - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 469, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 469, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 469, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_sizes); - __Pyx_GIVEREF(__pyx_v_sizes); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sizes); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 469, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_i4) < 0) __PYX_ERR(1, 469, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 469, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_asizes = __pyx_t_6; - __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/Index.pyx":470 - * start = end+1 - * asizes = numpy.array(sizes, dtype='i4') - * return asizes # <<<<<<<<<<<<<< - * - * def get_sample_chunksize(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_asizes); - __pyx_r = __pyx_v_asizes; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":451 - * #print "nrecords:", self.nrecords - * - * def chunk_sizes(self, where=0, skipbytes=0, chunksize=CS): # <<<<<<<<<<<<<< - * """Return the sizes for records in a chunk of text.""" - * if where == 0: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FuzzyIdx.chunk_sizes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_chunk); - __Pyx_XDECREF(__pyx_v_start); - __Pyx_XDECREF(__pyx_v_sizes); - __Pyx_XDECREF(__pyx_v_end); - __Pyx_XDECREF(__pyx_v_asizes); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":472 - * return asizes - * - * def get_sample_chunksize(self): # <<<<<<<<<<<<<< - * isizes = numpy.empty(0, dtype='i4') - * chunksize = CS; skipbytes = self.skipbytes - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_5get_sample_chunksize(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_5get_sample_chunksize = {"get_sample_chunksize", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_5get_sample_chunksize, METH_O, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_5get_sample_chunksize(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_sample_chunksize (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_4get_sample_chunksize(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_4get_sample_chunksize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_v_isizes = NULL; - PyObject *__pyx_v_chunksize = NULL; - PyObject *__pyx_v_skipbytes = NULL; - PyObject *__pyx_v_asizes = NULL; - 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; - __Pyx_RefNannySetupContext("get_sample_chunksize", 0); - - /* "TextAdapter/textadapter/Index.pyx":473 - * - * def get_sample_chunksize(self): - * isizes = numpy.empty(0, dtype='i4') # <<<<<<<<<<<<<< - * chunksize = CS; skipbytes = self.skipbytes - * asizes = self.chunk_sizes( - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_i4) < 0) __PYX_ERR(1, 473, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__30, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_isizes = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":474 - * def get_sample_chunksize(self): - * isizes = numpy.empty(0, dtype='i4') - * chunksize = CS; skipbytes = self.skipbytes # <<<<<<<<<<<<<< - * asizes = self.chunk_sizes( - * where=0, skipbytes=skipbytes, chunksize=chunksize) - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_CS); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_chunksize = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_skipbytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_skipbytes = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":475 - * isizes = numpy.empty(0, dtype='i4') - * chunksize = CS; skipbytes = self.skipbytes - * asizes = self.chunk_sizes( # <<<<<<<<<<<<<< - * where=0, skipbytes=skipbytes, chunksize=chunksize) - * isizes = numpy.concatenate((isizes, asizes)) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_chunk_sizes); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "TextAdapter/textadapter/Index.pyx":476 - * chunksize = CS; skipbytes = self.skipbytes - * asizes = self.chunk_sizes( - * where=0, skipbytes=skipbytes, chunksize=chunksize) # <<<<<<<<<<<<<< - * isizes = numpy.concatenate((isizes, asizes)) - * return chunksize, isizes - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_where, __pyx_int_0) < 0) __PYX_ERR(1, 476, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_skipbytes, __pyx_v_skipbytes) < 0) __PYX_ERR(1, 476, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_chunksize, __pyx_v_chunksize) < 0) __PYX_ERR(1, 476, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":475 - * isizes = numpy.empty(0, dtype='i4') - * chunksize = CS; skipbytes = self.skipbytes - * asizes = self.chunk_sizes( # <<<<<<<<<<<<<< - * where=0, skipbytes=skipbytes, chunksize=chunksize) - * isizes = numpy.concatenate((isizes, asizes)) - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_asizes = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":477 - * asizes = self.chunk_sizes( - * where=0, skipbytes=skipbytes, chunksize=chunksize) - * isizes = numpy.concatenate((isizes, asizes)) # <<<<<<<<<<<<<< - * return chunksize, isizes - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_isizes); - __Pyx_GIVEREF(__pyx_v_isizes); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_isizes); - __Pyx_INCREF(__pyx_v_asizes); - __Pyx_GIVEREF(__pyx_v_asizes); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_asizes); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 477, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_1}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 477, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_1}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 477, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_isizes, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":478 - * where=0, skipbytes=skipbytes, chunksize=chunksize) - * isizes = numpy.concatenate((isizes, asizes)) - * return chunksize, isizes # <<<<<<<<<<<<<< - * - * def align_fuzzy(self, offset): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_chunksize); - __Pyx_GIVEREF(__pyx_v_chunksize); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chunksize); - __Pyx_INCREF(__pyx_v_isizes); - __Pyx_GIVEREF(__pyx_v_isizes); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_isizes); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":472 - * return asizes - * - * def get_sample_chunksize(self): # <<<<<<<<<<<<<< - * isizes = numpy.empty(0, dtype='i4') - * chunksize = CS; skipbytes = self.skipbytes - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FuzzyIdx.get_sample_chunksize", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_isizes); - __Pyx_XDECREF(__pyx_v_chunksize); - __Pyx_XDECREF(__pyx_v_skipbytes); - __Pyx_XDECREF(__pyx_v_asizes); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":480 - * return chunksize, isizes - * - * def align_fuzzy(self, offset): # <<<<<<<<<<<<<< - * """Aling an offset so that it starts after a newline.""" - * # The number of bytes to read (should be a multiple of 2) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_7align_fuzzy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_6align_fuzzy[] = "Aling an offset so that it starts after a newline."; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_7align_fuzzy = {"align_fuzzy", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_7align_fuzzy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_6align_fuzzy}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_7align_fuzzy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_offset = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("align_fuzzy (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_offset,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("align_fuzzy", 1, 2, 2, 1); __PYX_ERR(1, 480, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "align_fuzzy") < 0)) __PYX_ERR(1, 480, __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_self = values[0]; - __pyx_v_offset = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("align_fuzzy", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 480, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FuzzyIdx.align_fuzzy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_6align_fuzzy(__pyx_self, __pyx_v_self, __pyx_v_offset); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_6align_fuzzy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_offset) { - PyObject *__pyx_v_NB = NULL; - PyObject *__pyx_v_hnb = NULL; - PyObject *__pyx_v_chunk = NULL; - PyObject *__pyx_v_bpos = NULL; - PyObject *__pyx_v_fpos = NULL; - PyObject *__pyx_v_pos = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("align_fuzzy", 0); - - /* "TextAdapter/textadapter/Index.pyx":483 - * """Aling an offset so that it starts after a newline.""" - * # The number of bytes to read (should be a multiple of 2) - * NB = int(self.mean * 10) # Read a 10 lines window # <<<<<<<<<<<<<< - * hnb = NB / 2 - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_NB = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":484 - * # The number of bytes to read (should be a multiple of 2) - * NB = int(self.mean * 10) # Read a 10 lines window - * hnb = NB / 2 # <<<<<<<<<<<<<< - * - * # Position at the beginning of the NB window - */ - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_NB, __pyx_int_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 484, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_hnb = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":487 - * - * # Position at the beginning of the NB window - * if abs(offset) < hnb: # <<<<<<<<<<<<<< - * hnb = abs(offset) - * if offset >= 0: - */ - __pyx_t_1 = PyNumber_Absolute(__pyx_v_offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 487, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_hnb, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 487, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":488 - * # Position at the beginning of the NB window - * if abs(offset) < hnb: - * hnb = abs(offset) # <<<<<<<<<<<<<< - * if offset >= 0: - * self.textfileh.seek(offset - hnb, os.SEEK_SET) - */ - __pyx_t_2 = PyNumber_Absolute(__pyx_v_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 488, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_hnb, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":487 - * - * # Position at the beginning of the NB window - * if abs(offset) < hnb: # <<<<<<<<<<<<<< - * hnb = abs(offset) - * if offset >= 0: - */ - } - - /* "TextAdapter/textadapter/Index.pyx":489 - * if abs(offset) < hnb: - * hnb = abs(offset) - * if offset >= 0: # <<<<<<<<<<<<<< - * self.textfileh.seek(offset - hnb, os.SEEK_SET) - * else: - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_offset, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 489, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 489, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":490 - * hnb = abs(offset) - * if offset >= 0: - * self.textfileh.seek(offset - hnb, os.SEEK_SET) # <<<<<<<<<<<<<< - * else: - * self.textfileh.seek(offset - hnb, os.SEEK_END) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_textfileh); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_seek); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_v_offset, __pyx_v_hnb); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 490, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 490, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_6); - __pyx_t_1 = 0; - __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":489 - * if abs(offset) < hnb: - * hnb = abs(offset) - * if offset >= 0: # <<<<<<<<<<<<<< - * self.textfileh.seek(offset - hnb, os.SEEK_SET) - * else: - */ - goto __pyx_L4; - } - - /* "TextAdapter/textadapter/Index.pyx":492 - * self.textfileh.seek(offset - hnb, os.SEEK_SET) - * else: - * self.textfileh.seek(offset - hnb, os.SEEK_END) # <<<<<<<<<<<<<< - * # Read the window - * chunk = self.textfileh.read(NB) - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_textfileh); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_seek); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_v_offset, __pyx_v_hnb); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_SEEK_END); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_1}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 492, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_1}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 492, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_1); - __pyx_t_4 = 0; - __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L4:; - - /* "TextAdapter/textadapter/Index.pyx":494 - * self.textfileh.seek(offset - hnb, os.SEEK_END) - * # Read the window - * chunk = self.textfileh.read(NB) # <<<<<<<<<<<<<< - * - * # Start finding the '\\n' from the midpoint to backwards - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_textfileh); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_read); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_8) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_NB); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_NB}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 494, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_NB}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 494, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_INCREF(__pyx_v_NB); - __Pyx_GIVEREF(__pyx_v_NB); - PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_NB); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_chunk = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":497 - * - * # Start finding the '\\n' from the midpoint to backwards - * bpos = hnb - chunk[:hnb].rfind('\n') # <<<<<<<<<<<<<< - * if bpos > hnb: - * raise IOError("\\n not detected in the backward direction!") - */ - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_chunk, 0, 0, NULL, &__pyx_v_hnb, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_rfind); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Subtract(__pyx_v_hnb, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_bpos = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":498 - * # Start finding the '\\n' from the midpoint to backwards - * bpos = hnb - chunk[:hnb].rfind('\n') - * if bpos > hnb: # <<<<<<<<<<<<<< - * raise IOError("\\n not detected in the backward direction!") - * # Start finding the '\n' from the midpoint to forward - */ - __pyx_t_5 = PyObject_RichCompare(__pyx_v_bpos, __pyx_v_hnb, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 498, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 498, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":499 - * bpos = hnb - chunk[:hnb].rfind('\n') - * if bpos > hnb: - * raise IOError("\\n not detected in the backward direction!") # <<<<<<<<<<<<<< - * # Start finding the '\n' from the midpoint to forward - * fpos = chunk[hnb-1:].find('\n') - */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(1, 499, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":498 - * # Start finding the '\\n' from the midpoint to backwards - * bpos = hnb - chunk[:hnb].rfind('\n') - * if bpos > hnb: # <<<<<<<<<<<<<< - * raise IOError("\\n not detected in the backward direction!") - * # Start finding the '\n' from the midpoint to forward - */ - } - - /* "TextAdapter/textadapter/Index.pyx":501 - * raise IOError("\\n not detected in the backward direction!") - * # Start finding the '\n' from the midpoint to forward - * fpos = chunk[hnb-1:].find('\n') # <<<<<<<<<<<<<< - * if fpos < 0: - * raise IOError("\\n not detected in the forward direction!") - */ - __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_v_hnb, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_chunk, 0, 0, &__pyx_t_5, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_find); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_fpos = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":502 - * # Start finding the '\n' from the midpoint to forward - * fpos = chunk[hnb-1:].find('\n') - * if fpos < 0: # <<<<<<<<<<<<<< - * raise IOError("\\n not detected in the forward direction!") - * # Select the position nearest to the midpoint - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_fpos, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 502, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 502, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":503 - * fpos = chunk[hnb-1:].find('\n') - * if fpos < 0: - * raise IOError("\\n not detected in the forward direction!") # <<<<<<<<<<<<<< - * # Select the position nearest to the midpoint - * if bpos < fpos: - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 503, __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_ERR(1, 503, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":502 - * # Start finding the '\n' from the midpoint to forward - * fpos = chunk[hnb-1:].find('\n') - * if fpos < 0: # <<<<<<<<<<<<<< - * raise IOError("\\n not detected in the forward direction!") - * # Select the position nearest to the midpoint - */ - } - - /* "TextAdapter/textadapter/Index.pyx":505 - * raise IOError("\\n not detected in the forward direction!") - * # Select the position nearest to the midpoint - * if bpos < fpos: # <<<<<<<<<<<<<< - * # \n found before the midpoint - * pos = hnb - bpos + 1 - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_bpos, __pyx_v_fpos, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 505, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 505, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/Index.pyx":507 - * if bpos < fpos: - * # \n found before the midpoint - * pos = hnb - bpos + 1 # <<<<<<<<<<<<<< - * else: - * # \n found after the midpoint - */ - __pyx_t_2 = PyNumber_Subtract(__pyx_v_hnb, __pyx_v_bpos); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_pos = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/Index.pyx":505 - * raise IOError("\\n not detected in the forward direction!") - * # Select the position nearest to the midpoint - * if bpos < fpos: # <<<<<<<<<<<<<< - * # \n found before the midpoint - * pos = hnb - bpos + 1 - */ - goto __pyx_L7; - } - - /* "TextAdapter/textadapter/Index.pyx":510 - * else: - * # \n found after the midpoint - * pos = hnb + fpos # <<<<<<<<<<<<<< - * - * return offset - hnb + pos - */ - /*else*/ { - __pyx_t_5 = PyNumber_Add(__pyx_v_hnb, __pyx_v_fpos); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_pos = __pyx_t_5; - __pyx_t_5 = 0; - } - __pyx_L7:; - - /* "TextAdapter/textadapter/Index.pyx":512 - * pos = hnb + fpos - * - * return offset - hnb + pos # <<<<<<<<<<<<<< - * - * def seek_offset(self, rec_num): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_offset, __pyx_v_hnb); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_v_pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":480 - * return chunksize, isizes - * - * def align_fuzzy(self, offset): # <<<<<<<<<<<<<< - * """Aling an offset so that it starts after a newline.""" - * # The number of bytes to read (should be a multiple of 2) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FuzzyIdx.align_fuzzy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_NB); - __Pyx_XDECREF(__pyx_v_hnb); - __Pyx_XDECREF(__pyx_v_chunk); - __Pyx_XDECREF(__pyx_v_bpos); - __Pyx_XDECREF(__pyx_v_fpos); - __Pyx_XDECREF(__pyx_v_pos); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":514 - * return offset - hnb + pos - * - * def seek_offset(self, rec_num): # <<<<<<<<<<<<<< - * """Get the offset for `rec_num` *and* positionate there.""" - * if not -self.nrecords <= rec_num < self.nrecords: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_9seek_offset(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_8seek_offset[] = "Get the offset for `rec_num` *and* positionate there."; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_9seek_offset = {"seek_offset", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_9seek_offset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_8seek_offset}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_9seek_offset(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_rec_num = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("seek_offset (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rec_num,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rec_num)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("seek_offset", 1, 2, 2, 1); __PYX_ERR(1, 514, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "seek_offset") < 0)) __PYX_ERR(1, 514, __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_self = values[0]; - __pyx_v_rec_num = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("seek_offset", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 514, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FuzzyIdx.seek_offset", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_8seek_offset(__pyx_self, __pyx_v_self, __pyx_v_rec_num); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_8seek_offset(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rec_num) { - int __pyx_v_fuzzy; - PyObject *__pyx_v_offset = NULL; - PyObject *__pyx_v_inv_rec_num = NULL; - PyObject *__pyx_r = NULL; - __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; - Py_ssize_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - __Pyx_RefNannySetupContext("seek_offset", 0); - __Pyx_INCREF(__pyx_v_rec_num); - - /* "TextAdapter/textadapter/Index.pyx":516 - * def seek_offset(self, rec_num): - * """Get the offset for `rec_num` *and* positionate there.""" - * if not -self.nrecords <= rec_num < self.nrecords: # <<<<<<<<<<<<<< - * raise IndexError("index out ot range") - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nrecords); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_rec_num, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) - if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { - __Pyx_DECREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nrecords); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_rec_num, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 516, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = ((!__pyx_t_4) != 0); - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/Index.pyx":517 - * """Get the offset for `rec_num` *and* positionate there.""" - * if not -self.nrecords <= rec_num < self.nrecords: - * raise IndexError("index out ot range") # <<<<<<<<<<<<<< - * - * if rec_num > (self.nrecords / 2): - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 517, __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_ERR(1, 517, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":516 - * def seek_offset(self, rec_num): - * """Get the offset for `rec_num` *and* positionate there.""" - * if not -self.nrecords <= rec_num < self.nrecords: # <<<<<<<<<<<<<< - * raise IndexError("index out ot range") - * - */ - } - - /* "TextAdapter/textadapter/Index.pyx":519 - * raise IndexError("index out ot range") - * - * if rec_num > (self.nrecords / 2): # <<<<<<<<<<<<<< - * rec_num = -(self.nrecords - rec_num) - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nrecords); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_rec_num, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 519, __pyx_L1_error) - __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_ERR(1, 519, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/Index.pyx":520 - * - * if rec_num > (self.nrecords / 2): - * rec_num = -(self.nrecords - rec_num) # <<<<<<<<<<<<<< - * - * fuzzy = False - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nrecords); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_rec_num); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_rec_num, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":519 - * raise IndexError("index out ot range") - * - * if rec_num > (self.nrecords / 2): # <<<<<<<<<<<<<< - * rec_num = -(self.nrecords - rec_num) - * - */ - } - - /* "TextAdapter/textadapter/Index.pyx":522 - * rec_num = -(self.nrecords - rec_num) - * - * fuzzy = False # <<<<<<<<<<<<<< - * # Compute the bytes to skip - * if rec_num >= 0: - */ - __pyx_v_fuzzy = 0; - - /* "TextAdapter/textadapter/Index.pyx":524 - * fuzzy = False - * # Compute the bytes to skip - * if rec_num >= 0: # <<<<<<<<<<<<<< - * if rec_num < len(self.isizes): - * # Exact index - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_rec_num, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 524, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 524, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/Index.pyx":525 - * # Compute the bytes to skip - * if rec_num >= 0: - * if rec_num < len(self.isizes): # <<<<<<<<<<<<<< - * # Exact index - * offset = self.isizes[:rec_num].sum() + self.skipbytes - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_isizes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 525, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(1, 525, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 525, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_rec_num, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 525, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 525, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/Index.pyx":527 - * if rec_num < len(self.isizes): - * # Exact index - * offset = self.isizes[:rec_num].sum() + self.skipbytes # <<<<<<<<<<<<<< - * else: - * # Fuzzy index - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_isizes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 527, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, NULL, &__pyx_v_rec_num, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 527, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 527, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_3) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 527, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 527, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_skipbytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 527, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 527, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_offset = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":525 - * # Compute the bytes to skip - * if rec_num >= 0: - * if rec_num < len(self.isizes): # <<<<<<<<<<<<<< - * # Exact index - * offset = self.isizes[:rec_num].sum() + self.skipbytes - */ - goto __pyx_L6; - } - - /* "TextAdapter/textadapter/Index.pyx":530 - * else: - * # Fuzzy index - * offset = int(round(self.imean * rec_num + self.skipbytes)) # <<<<<<<<<<<<<< - * fuzzy = True - * else: - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imean); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_v_rec_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_skipbytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_offset = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/Index.pyx":531 - * # Fuzzy index - * offset = int(round(self.imean * rec_num + self.skipbytes)) - * fuzzy = True # <<<<<<<<<<<<<< - * else: - * # Complementary rec num - */ - __pyx_v_fuzzy = 1; - } - __pyx_L6:; - - /* "TextAdapter/textadapter/Index.pyx":524 - * fuzzy = False - * # Compute the bytes to skip - * if rec_num >= 0: # <<<<<<<<<<<<<< - * if rec_num < len(self.isizes): - * # Exact index - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/Index.pyx":534 - * else: - * # Complementary rec num - * inv_rec_num = -(rec_num + 1) # <<<<<<<<<<<<<< - * if inv_rec_num < len(self.esizes): - * # Exact index - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_rec_num, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_inv_rec_num = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/Index.pyx":535 - * # Complementary rec num - * inv_rec_num = -(rec_num + 1) - * if inv_rec_num < len(self.esizes): # <<<<<<<<<<<<<< - * # Exact index - * offset = -self.esizes[:inv_rec_num+1].sum() - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_esizes); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(1, 535, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_inv_rec_num, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 535, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 535, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/Index.pyx":537 - * if inv_rec_num < len(self.esizes): - * # Exact index - * offset = -self.esizes[:inv_rec_num+1].sum() # <<<<<<<<<<<<<< - * else: - * # Fuzzy index - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_esizes); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_inv_rec_num, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 0, NULL, &__pyx_t_1, NULL, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_7) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 537, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 537, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_offset = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":535 - * # Complementary rec num - * inv_rec_num = -(rec_num + 1) - * if inv_rec_num < len(self.esizes): # <<<<<<<<<<<<<< - * # Exact index - * offset = -self.esizes[:inv_rec_num+1].sum() - */ - goto __pyx_L7; - } - - /* "TextAdapter/textadapter/Index.pyx":540 - * else: - * # Fuzzy index - * offset = int(round(self.emean * rec_num)) # <<<<<<<<<<<<<< - * fuzzy = True - * - */ - /*else*/ { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_emean); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_rec_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_offset = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":541 - * # Fuzzy index - * offset = int(round(self.emean * rec_num)) - * fuzzy = True # <<<<<<<<<<<<<< - * - * if fuzzy: - */ - __pyx_v_fuzzy = 1; - } - __pyx_L7:; - } - __pyx_L5:; - - /* "TextAdapter/textadapter/Index.pyx":543 - * fuzzy = True - * - * if fuzzy: # <<<<<<<<<<<<<< - * # Properly align the fuzzy offset - * offset = self.align_fuzzy(offset) - */ - __pyx_t_5 = (__pyx_v_fuzzy != 0); - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/Index.pyx":545 - * if fuzzy: - * # Properly align the fuzzy offset - * offset = self.align_fuzzy(offset) # <<<<<<<<<<<<<< - * - * # Do a seek in file depending on the sign of the offset - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_align_fuzzy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_offset}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 545, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_offset}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 545, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_INCREF(__pyx_v_offset); - __Pyx_GIVEREF(__pyx_v_offset); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_offset); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_offset, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":543 - * fuzzy = True - * - * if fuzzy: # <<<<<<<<<<<<<< - * # Properly align the fuzzy offset - * offset = self.align_fuzzy(offset) - */ - } - - /* "TextAdapter/textadapter/Index.pyx":548 - * - * # Do a seek in file depending on the sign of the offset - * if offset >= 0: # <<<<<<<<<<<<<< - * self.textfileh.seek(offset, os.SEEK_SET) - * else: - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_offset, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 548, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 548, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/Index.pyx":549 - * # Do a seek in file depending on the sign of the offset - * if offset >= 0: - * self.textfileh.seek(offset, os.SEEK_SET) # <<<<<<<<<<<<<< - * else: - * self.textfileh.seek(offset, os.SEEK_END) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_textfileh); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_seek); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_offset, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 549, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_offset, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 549, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_offset); - __Pyx_GIVEREF(__pyx_v_offset); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_offset); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":548 - * - * # Do a seek in file depending on the sign of the offset - * if offset >= 0: # <<<<<<<<<<<<<< - * self.textfileh.seek(offset, os.SEEK_SET) - * else: - */ - goto __pyx_L9; - } - - /* "TextAdapter/textadapter/Index.pyx":551 - * self.textfileh.seek(offset, os.SEEK_SET) - * else: - * self.textfileh.seek(offset, os.SEEK_END) # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - /*else*/ { - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_textfileh); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_seek); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SEEK_END); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_offset, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 551, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_offset, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 551, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_INCREF(__pyx_v_offset); - __Pyx_GIVEREF(__pyx_v_offset); - PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_v_offset); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L9:; - - /* "TextAdapter/textadapter/Index.pyx":514 - * return offset - hnb + pos - * - * def seek_offset(self, rec_num): # <<<<<<<<<<<<<< - * """Get the offset for `rec_num` *and* positionate there.""" - * if not -self.nrecords <= rec_num < self.nrecords: - */ - - /* function exit code */ - __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_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FuzzyIdx.seek_offset", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_offset); - __Pyx_XDECREF(__pyx_v_inv_rec_num); - __Pyx_XDECREF(__pyx_v_rec_num); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":553 - * self.textfileh.seek(offset, os.SEEK_END) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.nrecords - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_11__len__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_11__len__ = {"__len__", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_11__len__, METH_O, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_11__len__(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_10__len__(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_10__len__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__len__", 0); - - /* "TextAdapter/textadapter/Index.pyx":554 - * - * def __len__(self): - * return self.nrecords # <<<<<<<<<<<<<< - * - * def close(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nrecords); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 554, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/Index.pyx":553 - * self.textfileh.seek(offset, os.SEEK_END) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.nrecords - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FuzzyIdx.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/Index.pyx":556 - * return self.nrecords - * - * def close(self): # <<<<<<<<<<<<<< - * pass - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_13close(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_13close = {"close", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_13close, METH_O, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_13close(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("close (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_12close(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_12close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("close", 0); - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/lib/Converters.pyx":5 - * - * - * cdef ConvertError str2str_object_converter(void *input_str, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * """ - * Wrapper function for calling string object converter function - */ - -static ConvertError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2str_object_converter(void *__pyx_v_input_str, uint32_t __pyx_v_input_len, CYTHON_UNUSED int __pyx_v_input_type, void *__pyx_v_output, CYTHON_UNUSED uint32_t __pyx_v_output_len, void *__pyx_v_arg) { - ConvertError __pyx_v_result; - PyObject **__pyx_v_object_ptr; - kh_string_t *__pyx_v_kh_string_table; - int __pyx_v_ret; - khiter_t __pyx_v_it; - PyObject *__pyx_v_temp = 0; - char *__pyx_v_input_str_copy; - CYTHON_UNUSED PyObject *__pyx_v_e = NULL; - ConvertError __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __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; - int __pyx_t_10; - __Pyx_RefNannySetupContext("str2str_object_converter", 0); - - /* "TextAdapter/lib/Converters.pyx":21 - * converted value as a python string object - * """ - * cdef ConvertError result = CONVERT_ERROR_OBJECT_CONVERTER # <<<<<<<<<<<<<< - * cdef PyObject **object_ptr - * object_ptr = output - */ - __pyx_v_result = CONVERT_ERROR_OBJECT_CONVERTER; - - /* "TextAdapter/lib/Converters.pyx":23 - * cdef ConvertError result = CONVERT_ERROR_OBJECT_CONVERTER - * cdef PyObject **object_ptr - * object_ptr = output # <<<<<<<<<<<<<< - * cdef kh_string_t *kh_string_table = arg - * cdef int ret - */ - __pyx_v_object_ptr = ((PyObject **)__pyx_v_output); - - /* "TextAdapter/lib/Converters.pyx":24 - * cdef PyObject **object_ptr - * object_ptr = output - * cdef kh_string_t *kh_string_table = arg # <<<<<<<<<<<<<< - * cdef int ret - * cdef khiter_t it - */ - __pyx_v_kh_string_table = ((kh_string_t *)__pyx_v_arg); - - /* "TextAdapter/lib/Converters.pyx":30 - * cdef char *input_str_copy - * - * try: # <<<<<<<<<<<<<< - * # Convert c string to Python string object and store in output array - * if object_ptr != NULL: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __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:*/ { - - /* "TextAdapter/lib/Converters.pyx":32 - * try: - * # Convert c string to Python string object and store in output array - * if object_ptr != NULL: # <<<<<<<<<<<<<< - * - * # string object hash table exists - */ - __pyx_t_4 = ((__pyx_v_object_ptr != NULL) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":35 - * - * # string object hash table exists - * if kh_string_table != NULL: # <<<<<<<<<<<<<< - * - * # Look for existing string object - */ - __pyx_t_4 = ((__pyx_v_kh_string_table != NULL) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":38 - * - * # Look for existing string object - * it = kh_get_string(kh_string_table, input_str) # <<<<<<<<<<<<<< - * - * # String object doesn't exist, so create and store in output - */ - __pyx_v_it = kh_get_string(__pyx_v_kh_string_table, ((char *)__pyx_v_input_str)); - - /* "TextAdapter/lib/Converters.pyx":42 - * # String object doesn't exist, so create and store in output - * # array and hash table - * if it == kh_string_table.n_buckets: # <<<<<<<<<<<<<< - * temp = (input_str)[0:input_len].decode(config['encoding']) - * object_ptr[0] = temp - */ - __pyx_t_4 = ((__pyx_v_it == __pyx_v_kh_string_table->n_buckets) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":43 - * # array and hash table - * if it == kh_string_table.n_buckets: - * temp = (input_str)[0:input_len].decode(config['encoding']) # <<<<<<<<<<<<<< - * object_ptr[0] = temp - * Py_INCREF(object_ptr[0]) - */ - __pyx_t_6 = __Pyx_PyBytes_FromStringAndSize(((char *)__pyx_v_input_str) + 0, __pyx_v_input_len - 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 43, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_decode); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 43, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_config); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 43, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PyObject_GetItem(__pyx_t_6, __pyx_n_s_encoding); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 43, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (!__pyx_t_6) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 43, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_8}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 43, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_8}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 43, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 43, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 43, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_temp = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":44 - * if it == kh_string_table.n_buckets: - * temp = (input_str)[0:input_len].decode(config['encoding']) - * object_ptr[0] = temp # <<<<<<<<<<<<<< - * Py_INCREF(object_ptr[0]) - * input_str_copy = malloc(input_len+1) - */ - (__pyx_v_object_ptr[0]) = ((PyObject *)__pyx_v_temp); - - /* "TextAdapter/lib/Converters.pyx":45 - * temp = (input_str)[0:input_len].decode(config['encoding']) - * object_ptr[0] = temp - * Py_INCREF(object_ptr[0]) # <<<<<<<<<<<<<< - * input_str_copy = malloc(input_len+1) - * strncpy(input_str_copy, input_str, input_len+1) - */ - __pyx_t_5 = ((PyObject *)(__pyx_v_object_ptr[0])); - __Pyx_INCREF(__pyx_t_5); - Py_INCREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":46 - * object_ptr[0] = temp - * Py_INCREF(object_ptr[0]) - * input_str_copy = malloc(input_len+1) # <<<<<<<<<<<<<< - * strncpy(input_str_copy, input_str, input_len+1) - * it = kh_put_string(kh_string_table, input_str_copy, &ret) - */ - __pyx_v_input_str_copy = ((char *)malloc((__pyx_v_input_len + 1))); - - /* "TextAdapter/lib/Converters.pyx":47 - * Py_INCREF(object_ptr[0]) - * input_str_copy = malloc(input_len+1) - * strncpy(input_str_copy, input_str, input_len+1) # <<<<<<<<<<<<<< - * it = kh_put_string(kh_string_table, input_str_copy, &ret) - * kh_string_table.vals[it] = object_ptr[0] - */ - strncpy(__pyx_v_input_str_copy, ((char *)__pyx_v_input_str), (__pyx_v_input_len + 1)); - - /* "TextAdapter/lib/Converters.pyx":48 - * input_str_copy = malloc(input_len+1) - * strncpy(input_str_copy, input_str, input_len+1) - * it = kh_put_string(kh_string_table, input_str_copy, &ret) # <<<<<<<<<<<<<< - * kh_string_table.vals[it] = object_ptr[0] - * - */ - __pyx_v_it = kh_put_string(__pyx_v_kh_string_table, ((char *)__pyx_v_input_str_copy), (&__pyx_v_ret)); - - /* "TextAdapter/lib/Converters.pyx":49 - * strncpy(input_str_copy, input_str, input_len+1) - * it = kh_put_string(kh_string_table, input_str_copy, &ret) - * kh_string_table.vals[it] = object_ptr[0] # <<<<<<<<<<<<<< - * - * # String object exists, so store existing object in array - */ - (__pyx_v_kh_string_table->vals[__pyx_v_it]) = ((PyObject *)(__pyx_v_object_ptr[0])); - - /* "TextAdapter/lib/Converters.pyx":42 - * # String object doesn't exist, so create and store in output - * # array and hash table - * if it == kh_string_table.n_buckets: # <<<<<<<<<<<<<< - * temp = (input_str)[0:input_len].decode(config['encoding']) - * object_ptr[0] = temp - */ - goto __pyx_L13; - } - - /* "TextAdapter/lib/Converters.pyx":53 - * # String object exists, so store existing object in array - * else: - * object_ptr[0] = kh_string_table.vals[it] # <<<<<<<<<<<<<< - * Py_INCREF(object_ptr[0]) - * - */ - /*else*/ { - (__pyx_v_object_ptr[0]) = (__pyx_v_kh_string_table->vals[__pyx_v_it]); - - /* "TextAdapter/lib/Converters.pyx":54 - * else: - * object_ptr[0] = kh_string_table.vals[it] - * Py_INCREF(object_ptr[0]) # <<<<<<<<<<<<<< - * - * # No string object hash table exists; just convert and store - */ - __pyx_t_5 = ((PyObject *)(__pyx_v_object_ptr[0])); - __Pyx_INCREF(__pyx_t_5); - Py_INCREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_L13:; - - /* "TextAdapter/lib/Converters.pyx":35 - * - * # string object hash table exists - * if kh_string_table != NULL: # <<<<<<<<<<<<<< - * - * # Look for existing string object - */ - goto __pyx_L12; - } - - /* "TextAdapter/lib/Converters.pyx":58 - * # No string object hash table exists; just convert and store - * else: - * temp = (input_str)[0:input_len].decode(config['encoding']) # <<<<<<<<<<<<<< - * object_ptr[0] = temp - * Py_INCREF(object_ptr[0]) - */ - /*else*/ { - __pyx_t_7 = __Pyx_PyBytes_FromStringAndSize(((char *)__pyx_v_input_str) + 0, __pyx_v_input_len - 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 58, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_decode); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 58, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_config); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 58, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetItem(__pyx_t_7, __pyx_n_s_encoding); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 58, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - if (!__pyx_t_7) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 58, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_8}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 58, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_8}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 58, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 58, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 58, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_temp = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":59 - * else: - * temp = (input_str)[0:input_len].decode(config['encoding']) - * object_ptr[0] = temp # <<<<<<<<<<<<<< - * Py_INCREF(object_ptr[0]) - * - */ - (__pyx_v_object_ptr[0]) = ((PyObject *)__pyx_v_temp); - - /* "TextAdapter/lib/Converters.pyx":60 - * temp = (input_str)[0:input_len].decode(config['encoding']) - * object_ptr[0] = temp - * Py_INCREF(object_ptr[0]) # <<<<<<<<<<<<<< - * - * # Try converting c string to Python string object (for type inference) - */ - __pyx_t_5 = ((PyObject *)(__pyx_v_object_ptr[0])); - __Pyx_INCREF(__pyx_t_5); - Py_INCREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_L12:; - - /* "TextAdapter/lib/Converters.pyx":32 - * try: - * # Convert c string to Python string object and store in output array - * if object_ptr != NULL: # <<<<<<<<<<<<<< - * - * # string object hash table exists - */ - goto __pyx_L11; - } - - /* "TextAdapter/lib/Converters.pyx":64 - * # Try converting c string to Python string object (for type inference) - * else: - * temp = (input_str)[0:input_len].decode(config['encoding']) # <<<<<<<<<<<<<< - * - * result = CONVERT_SUCCESS - */ - /*else*/ { - __pyx_t_9 = __Pyx_PyBytes_FromStringAndSize(((char *)__pyx_v_input_str) + 0, __pyx_v_input_len - 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 64, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_decode); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 64, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_config); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 64, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyObject_GetItem(__pyx_t_9, __pyx_n_s_encoding); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 64, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_9) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 64, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 64, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 64, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 64, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 64, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_temp = __pyx_t_5; - __pyx_t_5 = 0; - } - __pyx_L11:; - - /* "TextAdapter/lib/Converters.pyx":66 - * temp = (input_str)[0:input_len].decode(config['encoding']) - * - * result = CONVERT_SUCCESS # <<<<<<<<<<<<<< - * - * except Exception as e: - */ - __pyx_v_result = CONVERT_SUCCESS; - - /* "TextAdapter/lib/Converters.pyx":30 - * cdef char *input_str_copy - * - * try: # <<<<<<<<<<<<<< - * # Convert c string to Python string object and store in output array - * if object_ptr != NULL: - */ - } - __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_L10_try_end; - __pyx_L3_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":68 - * result = CONVERT_SUCCESS - * - * except Exception as e: # <<<<<<<<<<<<<< - * result = CONVERT_ERROR_OBJECT_CONVERTER - * - */ - __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_10) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.str2str_object_converter", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(3, 68, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_t_6); - __pyx_v_e = __pyx_t_6; - - /* "TextAdapter/lib/Converters.pyx":69 - * - * except Exception as e: - * result = CONVERT_ERROR_OBJECT_CONVERTER # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_v_result = CONVERT_ERROR_OBJECT_CONVERTER; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L4_exception_handled; - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "TextAdapter/lib/Converters.pyx":30 - * cdef char *input_str_copy - * - * try: # <<<<<<<<<<<<<< - * # Convert c string to Python string object and store in output array - * if object_ptr != NULL: - */ - __Pyx_PyThreadState_assign - __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_L4_exception_handled:; - __Pyx_PyThreadState_assign - __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_L10_try_end:; - } - - /* "TextAdapter/lib/Converters.pyx":71 - * result = CONVERT_ERROR_OBJECT_CONVERTER - * - * return result # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - /* "TextAdapter/lib/Converters.pyx":5 - * - * - * cdef ConvertError str2str_object_converter(void *input_str, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * """ - * Wrapper function for calling string object converter function - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_WriteUnraisable("TextAdapter.textadapter.TextAdapter.str2str_object_converter", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = (ConvertError) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_temp); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/lib/Converters.pyx":74 - * - * - * cdef ConvertError str2datetime_object_converter(void *input_str, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * """ - * Wrapper function for calling string object converter function - */ - -static ConvertError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2datetime_object_converter(void *__pyx_v_input_str, uint32_t __pyx_v_input_len, CYTHON_UNUSED int __pyx_v_input_type, void *__pyx_v_output, CYTHON_UNUSED uint32_t __pyx_v_output_len, CYTHON_UNUSED void *__pyx_v_arg) { - ConvertError __pyx_v_result; - PyObject **__pyx_v_object_ptr; - PyObject *__pyx_v_temp = 0; - CYTHON_UNUSED PyObject *__pyx_v_e = NULL; - ConvertError __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - __Pyx_RefNannySetupContext("str2datetime_object_converter", 0); - - /* "TextAdapter/lib/Converters.pyx":90 - * converted value as a python string object - * """ - * cdef ConvertError result = CONVERT_ERROR_OBJECT_CONVERTER # <<<<<<<<<<<<<< - * cdef PyObject **object_ptr - * object_ptr = output - */ - __pyx_v_result = CONVERT_ERROR_OBJECT_CONVERTER; - - /* "TextAdapter/lib/Converters.pyx":92 - * cdef ConvertError result = CONVERT_ERROR_OBJECT_CONVERTER - * cdef PyObject **object_ptr - * object_ptr = output # <<<<<<<<<<<<<< - * cdef object temp - * - */ - __pyx_v_object_ptr = ((PyObject **)__pyx_v_output); - - /* "TextAdapter/lib/Converters.pyx":95 - * cdef object temp - * - * try: # <<<<<<<<<<<<<< - * if object_ptr != NULL: - * temp = str((input_str)[0:input_len].encode()) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __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:*/ { - - /* "TextAdapter/lib/Converters.pyx":96 - * - * try: - * if object_ptr != NULL: # <<<<<<<<<<<<<< - * temp = str((input_str)[0:input_len].encode()) - * object_ptr[0] = temp - */ - __pyx_t_4 = ((__pyx_v_object_ptr != NULL) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":97 - * try: - * if object_ptr != NULL: - * temp = str((input_str)[0:input_len].encode()) # <<<<<<<<<<<<<< - * object_ptr[0] = temp - * Py_INCREF(object_ptr[0]) - */ - __pyx_t_6 = __Pyx_PyBytes_FromStringAndSize(((char *)__pyx_v_input_str) + 0, __pyx_v_input_len - 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 97, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 97, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (__pyx_t_6) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 97, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 97, __pyx_L3_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 97, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 97, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_temp = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":98 - * if object_ptr != NULL: - * temp = str((input_str)[0:input_len].encode()) - * object_ptr[0] = temp # <<<<<<<<<<<<<< - * Py_INCREF(object_ptr[0]) - * - */ - (__pyx_v_object_ptr[0]) = ((PyObject *)__pyx_v_temp); - - /* "TextAdapter/lib/Converters.pyx":99 - * temp = str((input_str)[0:input_len].encode()) - * object_ptr[0] = temp - * Py_INCREF(object_ptr[0]) # <<<<<<<<<<<<<< - * - * result = CONVERT_SUCCESS - */ - __pyx_t_5 = ((PyObject *)(__pyx_v_object_ptr[0])); - __Pyx_INCREF(__pyx_t_5); - Py_INCREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":96 - * - * try: - * if object_ptr != NULL: # <<<<<<<<<<<<<< - * temp = str((input_str)[0:input_len].encode()) - * object_ptr[0] = temp - */ - } - - /* "TextAdapter/lib/Converters.pyx":101 - * Py_INCREF(object_ptr[0]) - * - * result = CONVERT_SUCCESS # <<<<<<<<<<<<<< - * except Exception as e: - * result = CONVERT_ERROR_OBJECT_CONVERTER - */ - __pyx_v_result = CONVERT_SUCCESS; - - /* "TextAdapter/lib/Converters.pyx":95 - * cdef object temp - * - * try: # <<<<<<<<<<<<<< - * if object_ptr != NULL: - * temp = str((input_str)[0:input_len].encode()) - */ - } - __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_L10_try_end; - __pyx_L3_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":102 - * - * result = CONVERT_SUCCESS - * except Exception as e: # <<<<<<<<<<<<<< - * result = CONVERT_ERROR_OBJECT_CONVERTER - * - */ - __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_8) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.str2datetime_object_converter", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(3, 102, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __pyx_v_e = __pyx_t_7; - - /* "TextAdapter/lib/Converters.pyx":103 - * result = CONVERT_SUCCESS - * except Exception as e: - * result = CONVERT_ERROR_OBJECT_CONVERTER # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_v_result = CONVERT_ERROR_OBJECT_CONVERTER; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L4_exception_handled; - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "TextAdapter/lib/Converters.pyx":95 - * cdef object temp - * - * try: # <<<<<<<<<<<<<< - * if object_ptr != NULL: - * temp = str((input_str)[0:input_len].encode()) - */ - __Pyx_PyThreadState_assign - __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_L4_exception_handled:; - __Pyx_PyThreadState_assign - __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_L10_try_end:; - } - - /* "TextAdapter/lib/Converters.pyx":105 - * result = CONVERT_ERROR_OBJECT_CONVERTER - * - * return result # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - /* "TextAdapter/lib/Converters.pyx":74 - * - * - * cdef ConvertError str2datetime_object_converter(void *input_str, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * """ - * Wrapper function for calling string object converter function - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_WriteUnraisable("TextAdapter.textadapter.TextAdapter.str2datetime_object_converter", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = (ConvertError) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_temp); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/lib/Converters.pyx":108 - * - * - * cdef ConvertError str2datetime_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * """ - * Wrapper function for calling numpy datetime converter function - */ - -static ConvertError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2datetime_converter(void *__pyx_v_input, CYTHON_UNUSED uint32_t __pyx_v_input_len, CYTHON_UNUSED int __pyx_v_input_type, void *__pyx_v_output, CYTHON_UNUSED uint32_t __pyx_v_output_len, void *__pyx_v_arg) { - ConvertError __pyx_v_result; - npy_intp __pyx_v_dims[1]; - char *__pyx_v_temp; - PyObject *__pyx_v_dtype = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_v_array = NULL; - CYTHON_UNUSED PyObject *__pyx_v_e = NULL; - ConvertError __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - 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; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - __Pyx_RefNannySetupContext("str2datetime_converter", 0); - - /* "TextAdapter/lib/Converters.pyx":123 - * Convert result - * """ - * cdef ConvertError result = CONVERT_ERROR_OBJECT_CONVERTER # <<<<<<<<<<<<<< - * cdef numpy.npy_intp dims[1] - * cdef char *temp = input - */ - __pyx_v_result = CONVERT_ERROR_OBJECT_CONVERTER; - - /* "TextAdapter/lib/Converters.pyx":125 - * cdef ConvertError result = CONVERT_ERROR_OBJECT_CONVERTER - * cdef numpy.npy_intp dims[1] - * cdef char *temp = input # <<<<<<<<<<<<<< - * - * if arg == NULL: - */ - __pyx_v_temp = ((char *)__pyx_v_input); - - /* "TextAdapter/lib/Converters.pyx":127 - * cdef char *temp = input - * - * if arg == NULL: # <<<<<<<<<<<<<< - * return CONVERT_ERROR_OBJECT_CONVERTER - * - */ - __pyx_t_1 = ((__pyx_v_arg == NULL) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/lib/Converters.pyx":128 - * - * if arg == NULL: - * return CONVERT_ERROR_OBJECT_CONVERTER # <<<<<<<<<<<<<< - * - * try: - */ - __pyx_r = CONVERT_ERROR_OBJECT_CONVERTER; - goto __pyx_L0; - - /* "TextAdapter/lib/Converters.pyx":127 - * cdef char *temp = input - * - * if arg == NULL: # <<<<<<<<<<<<<< - * return CONVERT_ERROR_OBJECT_CONVERTER - * - */ - } - - /* "TextAdapter/lib/Converters.pyx":130 - * return CONVERT_ERROR_OBJECT_CONVERTER - * - * try: # <<<<<<<<<<<<<< - * dtype = arg - * value = dtype.type(temp) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { - - /* "TextAdapter/lib/Converters.pyx":131 - * - * try: - * dtype = arg # <<<<<<<<<<<<<< - * value = dtype.type(temp) - * if output != NULL: - */ - __pyx_t_5 = ((PyObject *)__pyx_v_arg); - __Pyx_INCREF(__pyx_t_5); - __pyx_v_dtype = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":132 - * try: - * dtype = arg - * value = dtype.type(temp) # <<<<<<<<<<<<<< - * if output != NULL: - * dims[0] = 1 - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 132, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_v_temp); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 132, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_8) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 132, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 132, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 132, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 132, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_t_7)); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 132, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_value = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":133 - * dtype = arg - * value = dtype.type(temp) - * if output != NULL: # <<<<<<<<<<<<<< - * dims[0] = 1 - * array = numpy.PyArray_SimpleNewFromData(1, dims, value.dtype.num, output) - */ - __pyx_t_1 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/lib/Converters.pyx":134 - * value = dtype.type(temp) - * if output != NULL: - * dims[0] = 1 # <<<<<<<<<<<<<< - * array = numpy.PyArray_SimpleNewFromData(1, dims, value.dtype.num, output) - * array.dtype = numpy.dtype(dtype) - */ - (__pyx_v_dims[0]) = 1; - - /* "TextAdapter/lib/Converters.pyx":135 - * if output != NULL: - * dims[0] = 1 - * array = numpy.PyArray_SimpleNewFromData(1, dims, value.dtype.num, output) # <<<<<<<<<<<<<< - * array.dtype = numpy.dtype(dtype) - * array[0] = value - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 135, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_num); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 135, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 135, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyArray_SimpleNewFromData(1, __pyx_v_dims, __pyx_t_10, __pyx_v_output); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 135, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_array = __pyx_t_6; - __pyx_t_6 = 0; - - /* "TextAdapter/lib/Converters.pyx":136 - * dims[0] = 1 - * array = numpy.PyArray_SimpleNewFromData(1, dims, value.dtype.num, output) - * array.dtype = numpy.dtype(dtype) # <<<<<<<<<<<<<< - * array[0] = value - * result = CONVERT_SUCCESS - */ - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 136, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_dtype); - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 136, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_array, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(3, 136, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":137 - * array = numpy.PyArray_SimpleNewFromData(1, dims, value.dtype.num, output) - * array.dtype = numpy.dtype(dtype) - * array[0] = value # <<<<<<<<<<<<<< - * result = CONVERT_SUCCESS - * except Exception as e: - */ - if (unlikely(__Pyx_SetItemInt(__pyx_v_array, 0, __pyx_v_value, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(3, 137, __pyx_L4_error) - - /* "TextAdapter/lib/Converters.pyx":133 - * dtype = arg - * value = dtype.type(temp) - * if output != NULL: # <<<<<<<<<<<<<< - * dims[0] = 1 - * array = numpy.PyArray_SimpleNewFromData(1, dims, value.dtype.num, output) - */ - } - - /* "TextAdapter/lib/Converters.pyx":138 - * array.dtype = numpy.dtype(dtype) - * array[0] = value - * result = CONVERT_SUCCESS # <<<<<<<<<<<<<< - * except Exception as e: - * result = CONVERT_ERROR_OBJECT_CONVERTER - */ - __pyx_v_result = CONVERT_SUCCESS; - - /* "TextAdapter/lib/Converters.pyx":130 - * return CONVERT_ERROR_OBJECT_CONVERTER - * - * try: # <<<<<<<<<<<<<< - * dtype = arg - * value = dtype.type(temp) - */ - } - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L11_try_end; - __pyx_L4_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":139 - * array[0] = value - * result = CONVERT_SUCCESS - * except Exception as e: # <<<<<<<<<<<<<< - * result = CONVERT_ERROR_OBJECT_CONVERTER - * - */ - __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_10) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.str2datetime_converter", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_9) < 0) __PYX_ERR(3, 139, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_t_6); - __pyx_v_e = __pyx_t_6; - - /* "TextAdapter/lib/Converters.pyx":140 - * result = CONVERT_SUCCESS - * except Exception as e: - * result = CONVERT_ERROR_OBJECT_CONVERTER # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_v_result = CONVERT_ERROR_OBJECT_CONVERTER; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L5_exception_handled; - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; - - /* "TextAdapter/lib/Converters.pyx":130 - * return CONVERT_ERROR_OBJECT_CONVERTER - * - * try: # <<<<<<<<<<<<<< - * dtype = arg - * value = dtype.type(temp) - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L5_exception_handled:; - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - __pyx_L11_try_end:; - } - - /* "TextAdapter/lib/Converters.pyx":142 - * result = CONVERT_ERROR_OBJECT_CONVERTER - * - * return result # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - /* "TextAdapter/lib/Converters.pyx":108 - * - * - * cdef ConvertError str2datetime_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * """ - * Wrapper function for calling numpy datetime converter function - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_WriteUnraisable("TextAdapter.textadapter.TextAdapter.str2datetime_converter", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = (ConvertError) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_dtype); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_array); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/lib/Converters.pyx":145 - * - * - * cdef ConvertError python_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * """ - * Wrapper function for calling python converter function from low level C api. - */ - -static ConvertError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_python_converter(void *__pyx_v_input, uint32_t __pyx_v_input_len, CYTHON_UNUSED int __pyx_v_input_type, void *__pyx_v_output, uint32_t __pyx_v_output_len, void *__pyx_v_arg) { - npy_intp __pyx_v_dims[1]; - char *__pyx_v_temp; - PyObject *__pyx_v_py_string = 0; - ConvertError __pyx_v_result; - PyObject *__pyx_v_func = NULL; - PyObject *__pyx_v_new_value = NULL; - PyObject *__pyx_v_data = NULL; - PyObject *__pyx_v_array = NULL; - ConvertError __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; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - int __pyx_t_9; - char *__pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - char const *__pyx_t_13; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; - __Pyx_RefNannySetupContext("python_converter", 0); - - /* "TextAdapter/lib/Converters.pyx":160 - * """ - * cdef numpy.npy_intp dims[1] - * cdef char *temp = calloc(1, input_len+1) # <<<<<<<<<<<<<< - * cdef bytes py_string - * cdef ConvertError result = CONVERT_ERROR_USER_CONVERTER - */ - __pyx_v_temp = ((char *)calloc(1, (__pyx_v_input_len + 1))); - - /* "TextAdapter/lib/Converters.pyx":162 - * cdef char *temp = calloc(1, input_len+1) - * cdef bytes py_string - * cdef ConvertError result = CONVERT_ERROR_USER_CONVERTER # <<<<<<<<<<<<<< - * # "input" contains a long string (char*). We only copy "input_len" and make - * # sure that there is a null byte at the end (by using calloc with - */ - __pyx_v_result = CONVERT_ERROR_USER_CONVERTER; - - /* "TextAdapter/lib/Converters.pyx":166 - * # sure that there is a null byte at the end (by using calloc with - * # input_len+1 above) - * memcpy(temp, input, input_len) # <<<<<<<<<<<<<< - * - * try: - */ - memcpy(__pyx_v_temp, __pyx_v_input, __pyx_v_input_len); - - /* "TextAdapter/lib/Converters.pyx":168 - * memcpy(temp, input, input_len) - * - * try: # <<<<<<<<<<<<<< - * # Convert "temp" to a Python string (bytes in fact) - * py_string = temp - */ - /*try:*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __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:*/ { - - /* "TextAdapter/lib/Converters.pyx":170 - * try: - * # Convert "temp" to a Python string (bytes in fact) - * py_string = temp # <<<<<<<<<<<<<< - * # Convert "arg" to Python callable: - * func = arg - */ - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_temp); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 170, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_py_string = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/lib/Converters.pyx":172 - * py_string = temp - * # Convert "arg" to Python callable: - * func = arg # <<<<<<<<<<<<<< - * # call python callable object to convert input value - * new_value = func(py_string) - */ - __pyx_t_4 = ((PyObject *)__pyx_v_arg); - __Pyx_INCREF(__pyx_t_4); - __pyx_v_func = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/lib/Converters.pyx":174 - * func = arg - * # call python callable object to convert input value - * new_value = func(py_string) # <<<<<<<<<<<<<< - * - * if isinstance(new_value, numpy.generic): - */ - __Pyx_INCREF(__pyx_v_func); - __pyx_t_5 = __pyx_v_func; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_6) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_py_string); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 174, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_py_string}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 174, __pyx_L6_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_py_string}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 174, __pyx_L6_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 174, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_INCREF(__pyx_v_py_string); - __Pyx_GIVEREF(__pyx_v_py_string); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_py_string); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 174, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_new_value = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/lib/Converters.pyx":176 - * new_value = func(py_string) - * - * if isinstance(new_value, numpy.generic): # <<<<<<<<<<<<<< - * data = bytes(new_value.data) - * if output != NULL: - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 176, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_generic); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 176, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = PyObject_IsInstance(__pyx_v_new_value, __pyx_t_5); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(3, 176, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_9 = (__pyx_t_8 != 0); - if (__pyx_t_9) { - - /* "TextAdapter/lib/Converters.pyx":177 - * - * if isinstance(new_value, numpy.generic): - * data = bytes(new_value.data) # <<<<<<<<<<<<<< - * if output != NULL: - * memcpy(output, data, output_len) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_value, __pyx_n_s_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 177, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 177, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyBytes_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 177, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_data = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":178 - * if isinstance(new_value, numpy.generic): - * data = bytes(new_value.data) - * if output != NULL: # <<<<<<<<<<<<<< - * memcpy(output, data, output_len) - * result = CONVERT_SUCCESS - */ - __pyx_t_9 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_9) { - - /* "TextAdapter/lib/Converters.pyx":179 - * data = bytes(new_value.data) - * if output != NULL: - * memcpy(output, data, output_len) # <<<<<<<<<<<<<< - * result = CONVERT_SUCCESS - * # JNB: not sure if there is a better way to store objects in numpy object array - */ - __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_data); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(3, 179, __pyx_L6_error) - memcpy(__pyx_v_output, ((char *)__pyx_t_10), __pyx_v_output_len); - - /* "TextAdapter/lib/Converters.pyx":178 - * if isinstance(new_value, numpy.generic): - * data = bytes(new_value.data) - * if output != NULL: # <<<<<<<<<<<<<< - * memcpy(output, data, output_len) - * result = CONVERT_SUCCESS - */ - } - - /* "TextAdapter/lib/Converters.pyx":180 - * if output != NULL: - * memcpy(output, data, output_len) - * result = CONVERT_SUCCESS # <<<<<<<<<<<<<< - * # JNB: not sure if there is a better way to store objects in numpy object array - * elif isinstance(new_value, object): - */ - __pyx_v_result = CONVERT_SUCCESS; - - /* "TextAdapter/lib/Converters.pyx":176 - * new_value = func(py_string) - * - * if isinstance(new_value, numpy.generic): # <<<<<<<<<<<<<< - * data = bytes(new_value.data) - * if output != NULL: - */ - goto __pyx_L14; - } - - /* "TextAdapter/lib/Converters.pyx":182 - * result = CONVERT_SUCCESS - * # JNB: not sure if there is a better way to store objects in numpy object array - * elif isinstance(new_value, object): # <<<<<<<<<<<<<< - * if output != NULL: - * dims[0] = 1 - */ - __pyx_t_9 = PyObject_IsInstance(__pyx_v_new_value, __pyx_builtin_object); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(3, 182, __pyx_L6_error) - __pyx_t_8 = (__pyx_t_9 != 0); - if (__pyx_t_8) { - - /* "TextAdapter/lib/Converters.pyx":183 - * # JNB: not sure if there is a better way to store objects in numpy object array - * elif isinstance(new_value, object): - * if output != NULL: # <<<<<<<<<<<<<< - * dims[0] = 1 - * array = numpy.PyArray_SimpleNewFromData(1, dims, numpy.NPY_OBJECT, output) - */ - __pyx_t_8 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_8) { - - /* "TextAdapter/lib/Converters.pyx":184 - * elif isinstance(new_value, object): - * if output != NULL: - * dims[0] = 1 # <<<<<<<<<<<<<< - * array = numpy.PyArray_SimpleNewFromData(1, dims, numpy.NPY_OBJECT, output) - * array[0] = new_value - */ - (__pyx_v_dims[0]) = 1; - - /* "TextAdapter/lib/Converters.pyx":185 - * if output != NULL: - * dims[0] = 1 - * array = numpy.PyArray_SimpleNewFromData(1, dims, numpy.NPY_OBJECT, output) # <<<<<<<<<<<<<< - * array[0] = new_value - * result = CONVERT_SUCCESS - */ - __pyx_t_5 = PyArray_SimpleNewFromData(1, __pyx_v_dims, NPY_OBJECT, __pyx_v_output); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 185, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_array = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":186 - * dims[0] = 1 - * array = numpy.PyArray_SimpleNewFromData(1, dims, numpy.NPY_OBJECT, output) - * array[0] = new_value # <<<<<<<<<<<<<< - * result = CONVERT_SUCCESS - * else: - */ - if (unlikely(__Pyx_SetItemInt(__pyx_v_array, 0, __pyx_v_new_value, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(3, 186, __pyx_L6_error) - - /* "TextAdapter/lib/Converters.pyx":183 - * # JNB: not sure if there is a better way to store objects in numpy object array - * elif isinstance(new_value, object): - * if output != NULL: # <<<<<<<<<<<<<< - * dims[0] = 1 - * array = numpy.PyArray_SimpleNewFromData(1, dims, numpy.NPY_OBJECT, output) - */ - } - - /* "TextAdapter/lib/Converters.pyx":187 - * array = numpy.PyArray_SimpleNewFromData(1, dims, numpy.NPY_OBJECT, output) - * array[0] = new_value - * result = CONVERT_SUCCESS # <<<<<<<<<<<<<< - * else: - * result = CONVERT_ERROR_USER_CONVERTER - */ - __pyx_v_result = CONVERT_SUCCESS; - - /* "TextAdapter/lib/Converters.pyx":182 - * result = CONVERT_SUCCESS - * # JNB: not sure if there is a better way to store objects in numpy object array - * elif isinstance(new_value, object): # <<<<<<<<<<<<<< - * if output != NULL: - * dims[0] = 1 - */ - goto __pyx_L14; - } - - /* "TextAdapter/lib/Converters.pyx":189 - * result = CONVERT_SUCCESS - * else: - * result = CONVERT_ERROR_USER_CONVERTER # <<<<<<<<<<<<<< - * - * except: - */ - /*else*/ { - __pyx_v_result = CONVERT_ERROR_USER_CONVERTER; - } - __pyx_L14:; - - /* "TextAdapter/lib/Converters.pyx":168 - * memcpy(temp, input, input_len) - * - * try: # <<<<<<<<<<<<<< - * # Convert "temp" to a Python string (bytes in fact) - * py_string = temp - */ - } - __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_L6_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":191 - * result = CONVERT_ERROR_USER_CONVERTER - * - * except: # <<<<<<<<<<<<<< - * result = CONVERT_ERROR_USER_CONVERTER - * finally: - */ - /*except:*/ { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.python_converter", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(3, 191, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_7); - - /* "TextAdapter/lib/Converters.pyx":192 - * - * except: - * result = CONVERT_ERROR_USER_CONVERTER # <<<<<<<<<<<<<< - * finally: - * free(temp) - */ - __pyx_v_result = CONVERT_ERROR_USER_CONVERTER; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L7_exception_handled; - } - __pyx_L8_except_error:; - - /* "TextAdapter/lib/Converters.pyx":168 - * memcpy(temp, input, input_len) - * - * try: # <<<<<<<<<<<<<< - * # Convert "temp" to a Python string (bytes in fact) - * py_string = temp - */ - __Pyx_PyThreadState_assign - __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_L4_error; - __pyx_L7_exception_handled:; - __Pyx_PyThreadState_assign - __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:; - } - } - - /* "TextAdapter/lib/Converters.pyx":194 - * result = CONVERT_ERROR_USER_CONVERTER - * finally: - * free(temp) # <<<<<<<<<<<<<< - * - * return result - */ - /*finally:*/ { - /*normal exit:*/{ - free(__pyx_v_temp); - goto __pyx_L5; - } - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __pyx_L4_error:; - __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_15); - __Pyx_XGOTREF(__pyx_t_16); - __pyx_t_11 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename; - { - free(__pyx_v_temp); - } - __Pyx_PyThreadState_assign - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); - } - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1); - __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; - __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13; - goto __pyx_L1_error; - } - __pyx_L5:; - } - - /* "TextAdapter/lib/Converters.pyx":196 - * free(temp) - * - * return result # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - /* "TextAdapter/lib/Converters.pyx":145 - * - * - * cdef ConvertError python_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * """ - * Wrapper function for calling python converter function from low level C api. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_WriteUnraisable("TextAdapter.textadapter.TextAdapter.python_converter", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = (ConvertError) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_py_string); - __Pyx_XDECREF(__pyx_v_func); - __Pyx_XDECREF(__pyx_v_new_value); - __Pyx_XDECREF(__pyx_v_data); - __Pyx_XDECREF(__pyx_v_array); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/lib/Converters.pyx":205 - * ctypedef int64_t (*datetime_numba_func_ptr)(char *) - * - * cdef ConvertError str2uint_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * cdef uint_numba_func_ptr numba_func = arg - * cdef uint64_t *output_ptr64 = output - */ - -static ConvertError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2uint_numba_converter(void *__pyx_v_input, CYTHON_UNUSED uint32_t __pyx_v_input_len, CYTHON_UNUSED int __pyx_v_input_type, void *__pyx_v_output, uint32_t __pyx_v_output_len, void *__pyx_v_arg) { - __pyx_t_5TextAdapter_11textadapter_11TextAdapter_uint_numba_func_ptr __pyx_v_numba_func; - uint64_t *__pyx_v_output_ptr64; - uint32_t *__pyx_v_output_ptr32; - uint16_t *__pyx_v_output_ptr16; - uint8_t *__pyx_v_output_ptr8; - uint64_t __pyx_v_value; - ConvertError __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("str2uint_numba_converter", 0); - - /* "TextAdapter/lib/Converters.pyx":206 - * - * cdef ConvertError str2uint_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - * cdef uint_numba_func_ptr numba_func = arg # <<<<<<<<<<<<<< - * cdef uint64_t *output_ptr64 = output - * cdef uint32_t *output_ptr32 = output - */ - __pyx_v_numba_func = ((__pyx_t_5TextAdapter_11textadapter_11TextAdapter_uint_numba_func_ptr)((long)__pyx_v_arg)); - - /* "TextAdapter/lib/Converters.pyx":207 - * cdef ConvertError str2uint_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - * cdef uint_numba_func_ptr numba_func = arg - * cdef uint64_t *output_ptr64 = output # <<<<<<<<<<<<<< - * cdef uint32_t *output_ptr32 = output - * cdef uint16_t *output_ptr16 = output - */ - __pyx_v_output_ptr64 = ((uint64_t *)__pyx_v_output); - - /* "TextAdapter/lib/Converters.pyx":208 - * cdef uint_numba_func_ptr numba_func = arg - * cdef uint64_t *output_ptr64 = output - * cdef uint32_t *output_ptr32 = output # <<<<<<<<<<<<<< - * cdef uint16_t *output_ptr16 = output - * cdef uint8_t *output_ptr8 = output - */ - __pyx_v_output_ptr32 = ((uint32_t *)__pyx_v_output); - - /* "TextAdapter/lib/Converters.pyx":209 - * cdef uint64_t *output_ptr64 = output - * cdef uint32_t *output_ptr32 = output - * cdef uint16_t *output_ptr16 = output # <<<<<<<<<<<<<< - * cdef uint8_t *output_ptr8 = output - * cdef uint64_t value - */ - __pyx_v_output_ptr16 = ((uint16_t *)__pyx_v_output); - - /* "TextAdapter/lib/Converters.pyx":210 - * cdef uint32_t *output_ptr32 = output - * cdef uint16_t *output_ptr16 = output - * cdef uint8_t *output_ptr8 = output # <<<<<<<<<<<<<< - * cdef uint64_t value - * - */ - __pyx_v_output_ptr8 = ((uint8_t *)__pyx_v_output); - - /* "TextAdapter/lib/Converters.pyx":213 - * cdef uint64_t value - * - * try: # <<<<<<<<<<<<<< - * if output_len == 8: - * value = numba_func(input) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __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:*/ { - - /* "TextAdapter/lib/Converters.pyx":214 - * - * try: - * if output_len == 8: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if output != NULL: - */ - switch (__pyx_v_output_len) { - case 8: - - /* "TextAdapter/lib/Converters.pyx":215 - * try: - * if output_len == 8: - * value = numba_func(input) # <<<<<<<<<<<<<< - * if output != NULL: - * output_ptr64[0] = value - */ - __pyx_v_value = ((uint64_t)__pyx_v_numba_func(((char *)__pyx_v_input))); - - /* "TextAdapter/lib/Converters.pyx":216 - * if output_len == 8: - * value = numba_func(input) - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr64[0] = value - * elif output_len == 4: - */ - __pyx_t_4 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":217 - * value = numba_func(input) - * if output != NULL: - * output_ptr64[0] = value # <<<<<<<<<<<<<< - * elif output_len == 4: - * value = numba_func(input) - */ - (__pyx_v_output_ptr64[0]) = __pyx_v_value; - - /* "TextAdapter/lib/Converters.pyx":216 - * if output_len == 8: - * value = numba_func(input) - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr64[0] = value - * elif output_len == 4: - */ - } - - /* "TextAdapter/lib/Converters.pyx":214 - * - * try: - * if output_len == 8: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if output != NULL: - */ - break; - - /* "TextAdapter/lib/Converters.pyx":218 - * if output != NULL: - * output_ptr64[0] = value - * elif output_len == 4: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if value > 0xffffffff: - */ - case 4: - - /* "TextAdapter/lib/Converters.pyx":219 - * output_ptr64[0] = value - * elif output_len == 4: - * value = numba_func(input) # <<<<<<<<<<<<<< - * if value > 0xffffffff: - * return CONVERT_ERROR_NUMBA - */ - __pyx_v_value = ((uint32_t)__pyx_v_numba_func(((char *)__pyx_v_input))); - - /* "TextAdapter/lib/Converters.pyx":220 - * elif output_len == 4: - * value = numba_func(input) - * if value > 0xffffffff: # <<<<<<<<<<<<<< - * return CONVERT_ERROR_NUMBA - * if output != NULL: - */ - __pyx_t_5 = __Pyx_PyInt_From_uint64_t(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 220, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_int_4294967295, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 220, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(3, 220, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":221 - * value = numba_func(input) - * if value > 0xffffffff: - * return CONVERT_ERROR_NUMBA # <<<<<<<<<<<<<< - * if output != NULL: - * output_ptr32[0] = value - */ - __pyx_r = CONVERT_ERROR_NUMBA; - goto __pyx_L7_try_return; - - /* "TextAdapter/lib/Converters.pyx":220 - * elif output_len == 4: - * value = numba_func(input) - * if value > 0xffffffff: # <<<<<<<<<<<<<< - * return CONVERT_ERROR_NUMBA - * if output != NULL: - */ - } - - /* "TextAdapter/lib/Converters.pyx":222 - * if value > 0xffffffff: - * return CONVERT_ERROR_NUMBA - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr32[0] = value - * elif output_len == 2: - */ - __pyx_t_4 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":223 - * return CONVERT_ERROR_NUMBA - * if output != NULL: - * output_ptr32[0] = value # <<<<<<<<<<<<<< - * elif output_len == 2: - * value = numba_func(input) - */ - (__pyx_v_output_ptr32[0]) = __pyx_v_value; - - /* "TextAdapter/lib/Converters.pyx":222 - * if value > 0xffffffff: - * return CONVERT_ERROR_NUMBA - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr32[0] = value - * elif output_len == 2: - */ - } - - /* "TextAdapter/lib/Converters.pyx":218 - * if output != NULL: - * output_ptr64[0] = value - * elif output_len == 4: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if value > 0xffffffff: - */ - break; - - /* "TextAdapter/lib/Converters.pyx":224 - * if output != NULL: - * output_ptr32[0] = value - * elif output_len == 2: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if value > 0xffff: - */ - case 2: - - /* "TextAdapter/lib/Converters.pyx":225 - * output_ptr32[0] = value - * elif output_len == 2: - * value = numba_func(input) # <<<<<<<<<<<<<< - * if value > 0xffff: - * return CONVERT_ERROR_NUMBA - */ - __pyx_v_value = ((uint16_t)__pyx_v_numba_func(((char *)__pyx_v_input))); - - /* "TextAdapter/lib/Converters.pyx":226 - * elif output_len == 2: - * value = numba_func(input) - * if value > 0xffff: # <<<<<<<<<<<<<< - * return CONVERT_ERROR_NUMBA - * if output != NULL: - */ - __pyx_t_4 = ((__pyx_v_value > 0xffff) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":227 - * value = numba_func(input) - * if value > 0xffff: - * return CONVERT_ERROR_NUMBA # <<<<<<<<<<<<<< - * if output != NULL: - * output_ptr16[0] = value - */ - __pyx_r = CONVERT_ERROR_NUMBA; - goto __pyx_L7_try_return; - - /* "TextAdapter/lib/Converters.pyx":226 - * elif output_len == 2: - * value = numba_func(input) - * if value > 0xffff: # <<<<<<<<<<<<<< - * return CONVERT_ERROR_NUMBA - * if output != NULL: - */ - } - - /* "TextAdapter/lib/Converters.pyx":228 - * if value > 0xffff: - * return CONVERT_ERROR_NUMBA - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr16[0] = value - * elif output_len == 1: - */ - __pyx_t_4 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":229 - * return CONVERT_ERROR_NUMBA - * if output != NULL: - * output_ptr16[0] = value # <<<<<<<<<<<<<< - * elif output_len == 1: - * value = numba_func(input) - */ - (__pyx_v_output_ptr16[0]) = __pyx_v_value; - - /* "TextAdapter/lib/Converters.pyx":228 - * if value > 0xffff: - * return CONVERT_ERROR_NUMBA - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr16[0] = value - * elif output_len == 1: - */ - } - - /* "TextAdapter/lib/Converters.pyx":224 - * if output != NULL: - * output_ptr32[0] = value - * elif output_len == 2: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if value > 0xffff: - */ - break; - - /* "TextAdapter/lib/Converters.pyx":230 - * if output != NULL: - * output_ptr16[0] = value - * elif output_len == 1: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if value > 0xff: - */ - case 1: - - /* "TextAdapter/lib/Converters.pyx":231 - * output_ptr16[0] = value - * elif output_len == 1: - * value = numba_func(input) # <<<<<<<<<<<<<< - * if value > 0xff: - * return CONVERT_ERROR_NUMBA - */ - __pyx_v_value = ((uint8_t)__pyx_v_numba_func(((char *)__pyx_v_input))); - - /* "TextAdapter/lib/Converters.pyx":232 - * elif output_len == 1: - * value = numba_func(input) - * if value > 0xff: # <<<<<<<<<<<<<< - * return CONVERT_ERROR_NUMBA - * if output != NULL: - */ - __pyx_t_4 = ((__pyx_v_value > 0xff) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":233 - * value = numba_func(input) - * if value > 0xff: - * return CONVERT_ERROR_NUMBA # <<<<<<<<<<<<<< - * if output != NULL: - * output_ptr8[0] = value - */ - __pyx_r = CONVERT_ERROR_NUMBA; - goto __pyx_L7_try_return; - - /* "TextAdapter/lib/Converters.pyx":232 - * elif output_len == 1: - * value = numba_func(input) - * if value > 0xff: # <<<<<<<<<<<<<< - * return CONVERT_ERROR_NUMBA - * if output != NULL: - */ - } - - /* "TextAdapter/lib/Converters.pyx":234 - * if value > 0xff: - * return CONVERT_ERROR_NUMBA - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr8[0] = value - * else: - */ - __pyx_t_4 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":235 - * return CONVERT_ERROR_NUMBA - * if output != NULL: - * output_ptr8[0] = value # <<<<<<<<<<<<<< - * else: - * return CONVERT_ERROR_NUMBA - */ - (__pyx_v_output_ptr8[0]) = __pyx_v_value; - - /* "TextAdapter/lib/Converters.pyx":234 - * if value > 0xff: - * return CONVERT_ERROR_NUMBA - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr8[0] = value - * else: - */ - } - - /* "TextAdapter/lib/Converters.pyx":230 - * if output != NULL: - * output_ptr16[0] = value - * elif output_len == 1: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if value > 0xff: - */ - break; - default: - - /* "TextAdapter/lib/Converters.pyx":237 - * output_ptr8[0] = value - * else: - * return CONVERT_ERROR_NUMBA # <<<<<<<<<<<<<< - * except: - * return CONVERT_ERROR_NUMBA - */ - __pyx_r = CONVERT_ERROR_NUMBA; - goto __pyx_L7_try_return; - break; - } - - /* "TextAdapter/lib/Converters.pyx":213 - * cdef uint64_t value - * - * try: # <<<<<<<<<<<<<< - * if output_len == 8: - * value = numba_func(input) - */ - } - __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_L10_try_end; - __pyx_L3_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "TextAdapter/lib/Converters.pyx":238 - * else: - * return CONVERT_ERROR_NUMBA - * except: # <<<<<<<<<<<<<< - * return CONVERT_ERROR_NUMBA - * return CONVERT_SUCCESS - */ - /*except:*/ { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.str2uint_numba_converter", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(3, 238, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_7); - - /* "TextAdapter/lib/Converters.pyx":239 - * return CONVERT_ERROR_NUMBA - * except: - * return CONVERT_ERROR_NUMBA # <<<<<<<<<<<<<< - * return CONVERT_SUCCESS - * - */ - __pyx_r = CONVERT_ERROR_NUMBA; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L6_except_return; - } - __pyx_L5_except_error:; - - /* "TextAdapter/lib/Converters.pyx":213 - * cdef uint64_t value - * - * try: # <<<<<<<<<<<<<< - * if output_len == 8: - * value = numba_func(input) - */ - __Pyx_PyThreadState_assign - __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_try_return:; - __Pyx_PyThreadState_assign - __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_except_return:; - __Pyx_PyThreadState_assign - __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_L10_try_end:; - } - - /* "TextAdapter/lib/Converters.pyx":240 - * except: - * return CONVERT_ERROR_NUMBA - * return CONVERT_SUCCESS # <<<<<<<<<<<<<< - * - * cdef ConvertError str2float_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - */ - __pyx_r = CONVERT_SUCCESS; - goto __pyx_L0; - - /* "TextAdapter/lib/Converters.pyx":205 - * ctypedef int64_t (*datetime_numba_func_ptr)(char *) - * - * cdef ConvertError str2uint_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * cdef uint_numba_func_ptr numba_func = arg - * cdef uint64_t *output_ptr64 = output - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_WriteUnraisable("TextAdapter.textadapter.TextAdapter.str2uint_numba_converter", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = (ConvertError) 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/lib/Converters.pyx":242 - * return CONVERT_SUCCESS - * - * cdef ConvertError str2float_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * cdef float_numba_func_ptr numba_func = arg - * cdef float *output_ptr32 = output - */ - -static ConvertError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2float_numba_converter(void *__pyx_v_input, CYTHON_UNUSED uint32_t __pyx_v_input_len, CYTHON_UNUSED int __pyx_v_input_type, void *__pyx_v_output, uint32_t __pyx_v_output_len, void *__pyx_v_arg) { - __pyx_t_5TextAdapter_11textadapter_11TextAdapter_float_numba_func_ptr __pyx_v_numba_func; - float *__pyx_v_output_ptr32; - double *__pyx_v_output_ptr64; - double __pyx_v_value; - ConvertError __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - __Pyx_RefNannySetupContext("str2float_numba_converter", 0); - - /* "TextAdapter/lib/Converters.pyx":243 - * - * cdef ConvertError str2float_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - * cdef float_numba_func_ptr numba_func = arg # <<<<<<<<<<<<<< - * cdef float *output_ptr32 = output - * cdef double *output_ptr64 = output - */ - __pyx_v_numba_func = ((__pyx_t_5TextAdapter_11textadapter_11TextAdapter_float_numba_func_ptr)((long)__pyx_v_arg)); - - /* "TextAdapter/lib/Converters.pyx":244 - * cdef ConvertError str2float_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - * cdef float_numba_func_ptr numba_func = arg - * cdef float *output_ptr32 = output # <<<<<<<<<<<<<< - * cdef double *output_ptr64 = output - * cdef double value - */ - __pyx_v_output_ptr32 = ((float *)__pyx_v_output); - - /* "TextAdapter/lib/Converters.pyx":245 - * cdef float_numba_func_ptr numba_func = arg - * cdef float *output_ptr32 = output - * cdef double *output_ptr64 = output # <<<<<<<<<<<<<< - * cdef double value - * - */ - __pyx_v_output_ptr64 = ((double *)__pyx_v_output); - - /* "TextAdapter/lib/Converters.pyx":248 - * cdef double value - * - * try: # <<<<<<<<<<<<<< - * if output_len == 4: - * value = numba_func(input) - */ - { - if (__pyx_t_1||__pyx_t_2||__pyx_t_3); else {/*mark used*/} - /*try:*/ { - - /* "TextAdapter/lib/Converters.pyx":249 - * - * try: - * if output_len == 4: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if output != NULL: - */ - switch (__pyx_v_output_len) { - case 4: - - /* "TextAdapter/lib/Converters.pyx":250 - * try: - * if output_len == 4: - * value = numba_func(input) # <<<<<<<<<<<<<< - * if output != NULL: - * output_ptr32[0] = value - */ - __pyx_v_value = ((float)__pyx_v_numba_func(((char *)__pyx_v_input))); - - /* "TextAdapter/lib/Converters.pyx":251 - * if output_len == 4: - * value = numba_func(input) - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr32[0] = value - * elif output_len == 8: - */ - __pyx_t_4 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":252 - * value = numba_func(input) - * if output != NULL: - * output_ptr32[0] = value # <<<<<<<<<<<<<< - * elif output_len == 8: - * value = numba_func(input) - */ - (__pyx_v_output_ptr32[0]) = __pyx_v_value; - - /* "TextAdapter/lib/Converters.pyx":251 - * if output_len == 4: - * value = numba_func(input) - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr32[0] = value - * elif output_len == 8: - */ - } - - /* "TextAdapter/lib/Converters.pyx":249 - * - * try: - * if output_len == 4: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if output != NULL: - */ - break; - - /* "TextAdapter/lib/Converters.pyx":253 - * if output != NULL: - * output_ptr32[0] = value - * elif output_len == 8: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if output != NULL: - */ - case 8: - - /* "TextAdapter/lib/Converters.pyx":254 - * output_ptr32[0] = value - * elif output_len == 8: - * value = numba_func(input) # <<<<<<<<<<<<<< - * if output != NULL: - * output_ptr64[0] = value - */ - __pyx_v_value = ((double)__pyx_v_numba_func(((char *)__pyx_v_input))); - - /* "TextAdapter/lib/Converters.pyx":255 - * elif output_len == 8: - * value = numba_func(input) - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr64[0] = value - * else: - */ - __pyx_t_4 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":256 - * value = numba_func(input) - * if output != NULL: - * output_ptr64[0] = value # <<<<<<<<<<<<<< - * else: - * return CONVERT_ERROR_NUMBA - */ - (__pyx_v_output_ptr64[0]) = __pyx_v_value; - - /* "TextAdapter/lib/Converters.pyx":255 - * elif output_len == 8: - * value = numba_func(input) - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr64[0] = value - * else: - */ - } - - /* "TextAdapter/lib/Converters.pyx":253 - * if output != NULL: - * output_ptr32[0] = value - * elif output_len == 8: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if output != NULL: - */ - break; - default: - - /* "TextAdapter/lib/Converters.pyx":258 - * output_ptr64[0] = value - * else: - * return CONVERT_ERROR_NUMBA # <<<<<<<<<<<<<< - * except: - * return CONVERT_ERROR_NUMBA - */ - __pyx_r = CONVERT_ERROR_NUMBA; - goto __pyx_L7_try_return; - break; - } - - /* "TextAdapter/lib/Converters.pyx":248 - * cdef double value - * - * try: # <<<<<<<<<<<<<< - * if output_len == 4: - * value = numba_func(input) - */ - } - goto __pyx_L10_try_end; - __pyx_L7_try_return:; - goto __pyx_L0; - __pyx_L10_try_end:; - } - - /* "TextAdapter/lib/Converters.pyx":261 - * except: - * return CONVERT_ERROR_NUMBA - * return CONVERT_SUCCESS # <<<<<<<<<<<<<< - * - * cdef ConvertError str2datetime_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - */ - __pyx_r = CONVERT_SUCCESS; - goto __pyx_L0; - - /* "TextAdapter/lib/Converters.pyx":242 - * return CONVERT_SUCCESS - * - * cdef ConvertError str2float_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * cdef float_numba_func_ptr numba_func = arg - * cdef float *output_ptr32 = output - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/lib/Converters.pyx":263 - * return CONVERT_SUCCESS - * - * cdef ConvertError str2datetime_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * cdef datetime_numba_func_ptr numba_func = arg - * cdef int64_t *output_ptr = output - */ - -static ConvertError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2datetime_numba_converter(void *__pyx_v_input, CYTHON_UNUSED uint32_t __pyx_v_input_len, CYTHON_UNUSED int __pyx_v_input_type, void *__pyx_v_output, uint32_t __pyx_v_output_len, void *__pyx_v_arg) { - __pyx_t_5TextAdapter_11textadapter_11TextAdapter_datetime_numba_func_ptr __pyx_v_numba_func; - int64_t *__pyx_v_output_ptr; - int64_t __pyx_v_value; - ConvertError __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - __Pyx_RefNannySetupContext("str2datetime_numba_converter", 0); - - /* "TextAdapter/lib/Converters.pyx":264 - * - * cdef ConvertError str2datetime_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - * cdef datetime_numba_func_ptr numba_func = arg # <<<<<<<<<<<<<< - * cdef int64_t *output_ptr = output - * cdef int64_t value - */ - __pyx_v_numba_func = ((__pyx_t_5TextAdapter_11textadapter_11TextAdapter_datetime_numba_func_ptr)((long)__pyx_v_arg)); - - /* "TextAdapter/lib/Converters.pyx":265 - * cdef ConvertError str2datetime_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - * cdef datetime_numba_func_ptr numba_func = arg - * cdef int64_t *output_ptr = output # <<<<<<<<<<<<<< - * cdef int64_t value - * - */ - __pyx_v_output_ptr = ((int64_t *)__pyx_v_output); - - /* "TextAdapter/lib/Converters.pyx":268 - * cdef int64_t value - * - * try: # <<<<<<<<<<<<<< - * if output_len == 8: - * value = numba_func(input) - */ - { - if (__pyx_t_1||__pyx_t_2||__pyx_t_3); else {/*mark used*/} - /*try:*/ { - - /* "TextAdapter/lib/Converters.pyx":269 - * - * try: - * if output_len == 8: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if output != NULL: - */ - __pyx_t_4 = ((__pyx_v_output_len == 8) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":270 - * try: - * if output_len == 8: - * value = numba_func(input) # <<<<<<<<<<<<<< - * if output != NULL: - * output_ptr[0] = value - */ - __pyx_v_value = ((int64_t)__pyx_v_numba_func(((char *)__pyx_v_input))); - - /* "TextAdapter/lib/Converters.pyx":271 - * if output_len == 8: - * value = numba_func(input) - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr[0] = value - * else: - */ - __pyx_t_4 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_4) { - - /* "TextAdapter/lib/Converters.pyx":272 - * value = numba_func(input) - * if output != NULL: - * output_ptr[0] = value # <<<<<<<<<<<<<< - * else: - * return CONVERT_ERROR_NUMBA - */ - (__pyx_v_output_ptr[0]) = __pyx_v_value; - - /* "TextAdapter/lib/Converters.pyx":271 - * if output_len == 8: - * value = numba_func(input) - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr[0] = value - * else: - */ - } - - /* "TextAdapter/lib/Converters.pyx":269 - * - * try: - * if output_len == 8: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if output != NULL: - */ - goto __pyx_L11; - } - - /* "TextAdapter/lib/Converters.pyx":274 - * output_ptr[0] = value - * else: - * return CONVERT_ERROR_NUMBA # <<<<<<<<<<<<<< - * except: - * return CONVERT_ERROR_NUMBA - */ - /*else*/ { - __pyx_r = CONVERT_ERROR_NUMBA; - goto __pyx_L7_try_return; - } - __pyx_L11:; - - /* "TextAdapter/lib/Converters.pyx":268 - * cdef int64_t value - * - * try: # <<<<<<<<<<<<<< - * if output_len == 8: - * value = numba_func(input) - */ - } - goto __pyx_L10_try_end; - __pyx_L7_try_return:; - goto __pyx_L0; - __pyx_L10_try_end:; - } - - /* "TextAdapter/lib/Converters.pyx":277 - * except: - * return CONVERT_ERROR_NUMBA - * return CONVERT_SUCCESS # <<<<<<<<<<<<<< - * - * cdef ConvertError str2object_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - */ - __pyx_r = CONVERT_SUCCESS; - goto __pyx_L0; - - /* "TextAdapter/lib/Converters.pyx":263 - * return CONVERT_SUCCESS - * - * cdef ConvertError str2datetime_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * cdef datetime_numba_func_ptr numba_func = arg - * cdef int64_t *output_ptr = output - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/lib/Converters.pyx":279 - * return CONVERT_SUCCESS - * - * cdef ConvertError str2object_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * cdef object_numba_func_ptr numba_func = arg - * cdef PyObject **output_ptr = output - */ - -static ConvertError __pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2object_numba_converter(void *__pyx_v_input, CYTHON_UNUSED uint32_t __pyx_v_input_len, CYTHON_UNUSED int __pyx_v_input_type, void *__pyx_v_output, CYTHON_UNUSED uint32_t __pyx_v_output_len, void *__pyx_v_arg) { - __pyx_t_5TextAdapter_11textadapter_11TextAdapter_object_numba_func_ptr __pyx_v_numba_func; - PyObject **__pyx_v_output_ptr; - PyObject *__pyx_v_value = 0; - ConvertError __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - __Pyx_RefNannySetupContext("str2object_numba_converter", 0); - - /* "TextAdapter/lib/Converters.pyx":280 - * - * cdef ConvertError str2object_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - * cdef object_numba_func_ptr numba_func = arg # <<<<<<<<<<<<<< - * cdef PyObject **output_ptr = output - * cdef object value - */ - __pyx_v_numba_func = ((__pyx_t_5TextAdapter_11textadapter_11TextAdapter_object_numba_func_ptr)((long)__pyx_v_arg)); - - /* "TextAdapter/lib/Converters.pyx":281 - * cdef ConvertError str2object_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): - * cdef object_numba_func_ptr numba_func = arg - * cdef PyObject **output_ptr = output # <<<<<<<<<<<<<< - * cdef object value - * - */ - __pyx_v_output_ptr = ((PyObject **)__pyx_v_output); - - /* "TextAdapter/lib/Converters.pyx":284 - * cdef object value - * - * try: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if output != NULL: - */ - { - if (__pyx_t_1||__pyx_t_2||__pyx_t_3); else {/*mark used*/} - /*try:*/ { - - /* "TextAdapter/lib/Converters.pyx":285 - * - * try: - * value = numba_func(input) # <<<<<<<<<<<<<< - * if output != NULL: - * output_ptr[0] = value - */ - __pyx_t_4 = __pyx_v_numba_func(((char *)__pyx_v_input)); - __pyx_t_5 = ((PyObject *)__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __pyx_v_value = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/lib/Converters.pyx":286 - * try: - * value = numba_func(input) - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr[0] = value - * except: - */ - __pyx_t_6 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_6) { - - /* "TextAdapter/lib/Converters.pyx":287 - * value = numba_func(input) - * if output != NULL: - * output_ptr[0] = value # <<<<<<<<<<<<<< - * except: - * return CONVERT_ERROR_NUMBA - */ - (__pyx_v_output_ptr[0]) = ((PyObject *)__pyx_v_value); - - /* "TextAdapter/lib/Converters.pyx":286 - * try: - * value = numba_func(input) - * if output != NULL: # <<<<<<<<<<<<<< - * output_ptr[0] = value - * except: - */ - } - - /* "TextAdapter/lib/Converters.pyx":284 - * cdef object value - * - * try: # <<<<<<<<<<<<<< - * value = numba_func(input) - * if output != NULL: - */ - } - } - - /* "TextAdapter/lib/Converters.pyx":291 - * return CONVERT_ERROR_NUMBA - * - * return CONVERT_SUCCESS # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = CONVERT_SUCCESS; - goto __pyx_L0; - - /* "TextAdapter/lib/Converters.pyx":279 - * return CONVERT_SUCCESS - * - * cdef ConvertError str2object_numba_converter(void *input, uint32_t input_len, int input_type, void *output, uint32_t output_len, void *arg): # <<<<<<<<<<<<<< - * cdef object_numba_func_ptr numba_func = arg - * cdef PyObject **output_ptr = output - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_value); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":65 - * cdef void* data - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self.data = NULL - * - */ - -/* Python wrapper */ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - 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; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc___cinit__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":66 - * - * def __cinit__(self): - * self.data = NULL # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_v_self->data = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":65 - * cdef void* data - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self.data = NULL - * - */ - - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":68 - * self.data = NULL - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * if self.data: - * free(self.data) - */ - -/* Python wrapper */ -static void __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc_2__dealloc__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc_2__dealloc__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc *__pyx_v_self) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":69 - * - * def __dealloc__(self): - * if self.data: # <<<<<<<<<<<<<< - * free(self.data) - * - */ - __pyx_t_1 = (__pyx_v_self->data != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":70 - * def __dealloc__(self): - * if self.data: - * free(self.data) # <<<<<<<<<<<<<< - * - * - */ - free(__pyx_v_self->data); - - /* "TextAdapter/textadapter/TextAdapter.pyx":69 - * - * def __dealloc__(self): - * if self.data: # <<<<<<<<<<<<<< - * free(self.data) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":68 - * self.data = NULL - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * if self.data: - * free(self.data) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":102 - * cdef object dtype - * - * def __cinit__(self, converter, dtype): # <<<<<<<<<<<<<< - * self.converter = converter - * self.dtype = dtype - */ - -/* Python wrapper */ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_converter = 0; - PyObject *__pyx_v_dtype = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_converter,&__pyx_n_s_dtype,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_converter)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dtype)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 102, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 102, __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_converter = values[0]; - __pyx_v_dtype = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 102, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ConverterDecorator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator___cinit__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *)__pyx_v_self), __pyx_v_converter, __pyx_v_dtype); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *__pyx_v_self, PyObject *__pyx_v_converter, PyObject *__pyx_v_dtype) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":103 - * - * def __cinit__(self, converter, dtype): - * self.converter = converter # <<<<<<<<<<<<<< - * self.dtype = dtype - * def __call__(self, value): - */ - __Pyx_INCREF(__pyx_v_converter); - __Pyx_GIVEREF(__pyx_v_converter); - __Pyx_GOTREF(__pyx_v_self->converter); - __Pyx_DECREF(__pyx_v_self->converter); - __pyx_v_self->converter = __pyx_v_converter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":104 - * def __cinit__(self, converter, dtype): - * self.converter = converter - * self.dtype = dtype # <<<<<<<<<<<<<< - * def __call__(self, value): - * return self.dtype.type(self.converter(value)) - */ - __Pyx_INCREF(__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - __Pyx_GOTREF(__pyx_v_self->dtype); - __Pyx_DECREF(__pyx_v_self->dtype); - __pyx_v_self->dtype = __pyx_v_dtype; - - /* "TextAdapter/textadapter/TextAdapter.pyx":102 - * cdef object dtype - * - * def __cinit__(self, converter, dtype): # <<<<<<<<<<<<<< - * self.converter = converter - * self.dtype = dtype - */ - - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":105 - * self.converter = converter - * self.dtype = dtype - * def __call__(self, value): # <<<<<<<<<<<<<< - * return self.dtype.type(self.converter(value)) - * cdef getSize(self): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_value = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 105, __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_value = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 105, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ConverterDecorator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_2__call__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *)__pyx_v_self), __pyx_v_value); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_2__call__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *__pyx_v_self, PyObject *__pyx_v_value) { - 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; - __Pyx_RefNannySetupContext("__call__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":106 - * self.dtype = dtype - * def __call__(self, value): - * return self.dtype.type(self.converter(value)) # <<<<<<<<<<<<<< - * cdef getSize(self): - * return self.dtype.itemsize - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->dtype, __pyx_n_s_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_self->converter); - __pyx_t_4 = __pyx_v_self->converter; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_value}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_value}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_value); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":105 - * self.converter = converter - * self.dtype = dtype - * def __call__(self, value): # <<<<<<<<<<<<<< - * return self.dtype.type(self.converter(value)) - * cdef getSize(self): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ConverterDecorator.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":107 - * def __call__(self, value): - * return self.dtype.type(self.converter(value)) - * cdef getSize(self): # <<<<<<<<<<<<<< - * return self.dtype.itemsize - * - */ - -static PyObject *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_getSize(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("getSize", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":108 - * return self.dtype.type(self.converter(value)) - * cdef getSize(self): - * return self.dtype.itemsize # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":107 - * def __call__(self, value): - * return self.dtype.type(self.converter(value)) - * cdef getSize(self): # <<<<<<<<<<<<<< - * return self.dtype.itemsize - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.ConverterDecorator.getSize", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":169 - * cdef object data - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * if type(self) == TextAdapter: - * raise errors.AdapterException('TextAdapter cannot be used directly. ' - */ - -/* Python wrapper */ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - 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; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter___cinit__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":170 - * - * def __cinit__(self): - * if type(self) == TextAdapter: # <<<<<<<<<<<<<< - * raise errors.AdapterException('TextAdapter cannot be used directly. ' - * 'Use CSVTextAdapter, FixedWidthTextAdapter, RegexTextAdapter,' - */ - __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), ((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":171 - * def __cinit__(self): - * if type(self) == TextAdapter: - * raise errors.AdapterException('TextAdapter cannot be used directly. ' # <<<<<<<<<<<<<< - * 'Use CSVTextAdapter, FixedWidthTextAdapter, RegexTextAdapter,' - * 'or JSONTextAdapter') - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_AdapterException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 171, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":170 - * - * def __cinit__(self): - * if type(self) == TextAdapter: # <<<<<<<<<<<<<< - * raise errors.AdapterException('TextAdapter cannot be used directly. ' - * 'Use CSVTextAdapter, FixedWidthTextAdapter, RegexTextAdapter,' - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":169 - * cdef object data - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * if type(self) == TextAdapter: - * raise errors.AdapterException('TextAdapter cannot be used directly. ' - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":176 - * - * - * def __init_text_adapter(self, fh, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', num_records=0, header=0, footer=0, - * indexing=False, index_name=None, output='ndarray', - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_3__init_text_adapter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_2__init_text_adapter[] = "\n Construct new TextAdapter object.\n\n Args:\n fh: filename, file object, StringIO object, BytesIO object, S3 key,\n http url, or python generator\n encoding: type of character encoding (current ascii and utf8 are supported)\n compression : type of data compression (currently only gzip is supported)\n comment: character used to indicate comment line\n quote: character used to quote fields\n num_records: limits parsing to specified number of records; defaults\n to all records\n header: number of lines in file header; these lines are skipped when parsing\n footer: number of lines in file footer; these lines are skipped when parsing\n indexing: create record index on the fly as characters are read\n index_name: name of file to write index to\n output: type of output object (NumPy array or Pandas DataFrame)\n "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_3__init_text_adapter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fh = 0; - PyObject *__pyx_v_encoding = 0; - PyObject *__pyx_v_compression = 0; - PyObject *__pyx_v_comment = 0; - PyObject *__pyx_v_quote = 0; - PyObject *__pyx_v_num_records = 0; - PyObject *__pyx_v_header = 0; - CYTHON_UNUSED PyObject *__pyx_v_footer = 0; - PyObject *__pyx_v_indexing = 0; - PyObject *__pyx_v_index_name = 0; - PyObject *__pyx_v_output = 0; - PyObject *__pyx_v_debug = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init_text_adapter (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fh,&__pyx_n_s_encoding,&__pyx_n_s_compression,&__pyx_n_s_comment,&__pyx_n_s_quote,&__pyx_n_s_num_records,&__pyx_n_s_header,&__pyx_n_s_footer,&__pyx_n_s_indexing,&__pyx_n_s_index_name,&__pyx_n_s_output,&__pyx_n_s_debug,0}; - PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; - values[1] = ((PyObject *)__pyx_n_s_utf_8); - values[2] = ((PyObject *)Py_None); - values[3] = ((PyObject *)__pyx_kp_s__37); - values[4] = ((PyObject *)__pyx_kp_s__38); - values[5] = ((PyObject *)__pyx_int_0); - values[6] = ((PyObject *)__pyx_int_0); - values[7] = ((PyObject *)__pyx_int_0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":178 - * def __init_text_adapter(self, fh, encoding='utf_8', compression=None, - * comment='#', quote='"', num_records=0, header=0, footer=0, - * indexing=False, index_name=None, output='ndarray', # <<<<<<<<<<<<<< - * debug=False): - * """ - */ - values[8] = ((PyObject *)Py_False); - values[9] = ((PyObject *)Py_None); - values[10] = ((PyObject *)__pyx_n_s_ndarray); - - /* "TextAdapter/textadapter/TextAdapter.pyx":179 - * comment='#', quote='"', num_records=0, header=0, footer=0, - * indexing=False, index_name=None, output='ndarray', - * debug=False): # <<<<<<<<<<<<<< - * """ - * Construct new TextAdapter object. - */ - values[11] = ((PyObject *)Py_False); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fh)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_encoding); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compression); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comment); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_quote); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_records); - if (value) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_header); - if (value) { values[6] = value; kw_args--; } - } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_footer); - if (value) { values[7] = value; kw_args--; } - } - case 8: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indexing); - if (value) { values[8] = value; kw_args--; } - } - case 9: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_name); - if (value) { values[9] = value; kw_args--; } - } - case 10: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output); - if (value) { values[10] = value; kw_args--; } - } - case 11: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_debug); - if (value) { values[11] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init_text_adapter") < 0)) __PYX_ERR(0, 176, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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_fh = values[0]; - __pyx_v_encoding = values[1]; - __pyx_v_compression = values[2]; - __pyx_v_comment = values[3]; - __pyx_v_quote = values[4]; - __pyx_v_num_records = values[5]; - __pyx_v_header = values[6]; - __pyx_v_footer = values[7]; - __pyx_v_indexing = values[8]; - __pyx_v_index_name = values[9]; - __pyx_v_output = values[10]; - __pyx_v_debug = values[11]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init_text_adapter", 0, 1, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 176, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__init_text_adapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_2__init_text_adapter(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), __pyx_v_fh, __pyx_v_encoding, __pyx_v_compression, __pyx_v_comment, __pyx_v_quote, __pyx_v_num_records, __pyx_v_header, __pyx_v_footer, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug); - - /* "TextAdapter/textadapter/TextAdapter.pyx":176 - * - * - * def __init_text_adapter(self, fh, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', num_records=0, header=0, footer=0, - * indexing=False, index_name=None, output='ndarray', - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_2__init_text_adapter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_fh, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_comment, PyObject *__pyx_v_quote, PyObject *__pyx_v_num_records, PyObject *__pyx_v_header, CYTHON_UNUSED PyObject *__pyx_v_footer, PyObject *__pyx_v_indexing, PyObject *__pyx_v_index_name, PyObject *__pyx_v_output, PyObject *__pyx_v_debug) { - InputData *__pyx_v_input_data; - PyObject *__pyx_v_url_socket = NULL; - PyObject *__pyx_v_temp = NULL; - PyObject *__pyx_v_error_msg = NULL; - PyObject *__pyx_v_offset = NULL; - PyObject *__pyx_v_line_iter = NULL; - CYTHON_UNUSED PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_x = NULL; - 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; - int __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - char *__pyx_t_9; - Py_ssize_t __pyx_t_10; - char const *__pyx_t_11; - PyObject *(*__pyx_t_12)(PyObject *); - uint64_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - long __pyx_t_15; - __Pyx_RefNannySetupContext("__init_text_adapter", 0); - __Pyx_INCREF(__pyx_v_fh); - __Pyx_INCREF(__pyx_v_encoding); - __Pyx_INCREF(__pyx_v_compression); - - /* "TextAdapter/textadapter/TextAdapter.pyx":200 - * cdef InputData *input_data - * - * self.adapter = NULL # <<<<<<<<<<<<<< - * self._field_names = None - * self.mapping = {} - */ - __pyx_v_self->adapter = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":201 - * - * self.adapter = NULL - * self._field_names = None # <<<<<<<<<<<<<< - * self.mapping = {} - * self.compression = compression - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->_field_names); - __Pyx_DECREF(__pyx_v_self->_field_names); - __pyx_v_self->_field_names = Py_None; - - /* "TextAdapter/textadapter/TextAdapter.pyx":202 - * self.adapter = NULL - * self._field_names = None - * self.mapping = {} # <<<<<<<<<<<<<< - * self.compression = compression - * self._field_filter = None - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->mapping); - __Pyx_DECREF(__pyx_v_self->mapping); - __pyx_v_self->mapping = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":203 - * self._field_names = None - * self.mapping = {} - * self.compression = compression # <<<<<<<<<<<<<< - * self._field_filter = None - * - */ - __Pyx_INCREF(__pyx_v_compression); - __Pyx_GIVEREF(__pyx_v_compression); - __Pyx_GOTREF(__pyx_v_self->compression); - __Pyx_DECREF(__pyx_v_self->compression); - __pyx_v_self->compression = __pyx_v_compression; - - /* "TextAdapter/textadapter/TextAdapter.pyx":204 - * self.mapping = {} - * self.compression = compression - * self._field_filter = None # <<<<<<<<<<<<<< - * - * # Number of numpy records to allocate at a time as more rows of text - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->_field_filter); - __Pyx_DECREF(__pyx_v_self->_field_filter); - __pyx_v_self->_field_filter = Py_None; - - /* "TextAdapter/textadapter/TextAdapter.pyx":209 - * # are parsed. This number was arrived at after some very rough - * # benchmarking and is not in any way scientific. - * self.REC_CHUNK_SIZE = 100000 # <<<<<<<<<<<<<< - * - * encoding = encodings.normalize_encoding(encoding) - */ - __Pyx_INCREF(__pyx_int_100000); - __Pyx_GIVEREF(__pyx_int_100000); - __Pyx_GOTREF(__pyx_v_self->REC_CHUNK_SIZE); - __Pyx_DECREF(__pyx_v_self->REC_CHUNK_SIZE); - __pyx_v_self->REC_CHUNK_SIZE = __pyx_int_100000; - - /* "TextAdapter/textadapter/TextAdapter.pyx":211 - * self.REC_CHUNK_SIZE = 100000 - * - * encoding = encodings.normalize_encoding(encoding) # <<<<<<<<<<<<<< - * if encoding in encodings.aliases.aliases.keys(): - * encoding = encodings.aliases.aliases[encoding] - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_encodings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_normalize_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_encoding); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_encoding}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_encoding}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_encoding); - __Pyx_GIVEREF(__pyx_v_encoding); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_encoding); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":212 - * - * encoding = encodings.normalize_encoding(encoding) - * if encoding in encodings.aliases.aliases.keys(): # <<<<<<<<<<<<<< - * encoding = encodings.aliases.aliases[encoding] - * if encoding not in supported_encodings: - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_encodings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_aliases); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_aliases); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_encoding, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":213 - * encoding = encodings.normalize_encoding(encoding) - * if encoding in encodings.aliases.aliases.keys(): - * encoding = encodings.aliases.aliases[encoding] # <<<<<<<<<<<<<< - * if encoding not in supported_encodings: - * raise ValueError('{0} encoding not supported yet '.format(encoding)) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_encodings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_aliases); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_aliases); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetItem(__pyx_t_1, __pyx_v_encoding); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":212 - * - * encoding = encodings.normalize_encoding(encoding) - * if encoding in encodings.aliases.aliases.keys(): # <<<<<<<<<<<<<< - * encoding = encodings.aliases.aliases[encoding] - * if encoding not in supported_encodings: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":214 - * if encoding in encodings.aliases.aliases.keys(): - * encoding = encodings.aliases.aliases[encoding] - * if encoding not in supported_encodings: # <<<<<<<<<<<<<< - * raise ValueError('{0} encoding not supported yet '.format(encoding)) - * config['encoding'] = encoding - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_supported_encodings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_encoding, __pyx_t_4, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = (__pyx_t_6 != 0); - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":215 - * encoding = encodings.aliases.aliases[encoding] - * if encoding not in supported_encodings: - * raise ValueError('{0} encoding not supported yet '.format(encoding)) # <<<<<<<<<<<<<< - * config['encoding'] = encoding - * self.encoding = encoding - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_encoding_not_supported_yet, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_3) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_encoding); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_encoding}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_encoding}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_encoding); - __Pyx_GIVEREF(__pyx_v_encoding); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_encoding); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 215, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":214 - * if encoding in encodings.aliases.aliases.keys(): - * encoding = encodings.aliases.aliases[encoding] - * if encoding not in supported_encodings: # <<<<<<<<<<<<<< - * raise ValueError('{0} encoding not supported yet '.format(encoding)) - * config['encoding'] = encoding - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":216 - * if encoding not in supported_encodings: - * raise ValueError('{0} encoding not supported yet '.format(encoding)) - * config['encoding'] = encoding # <<<<<<<<<<<<<< - * self.encoding = encoding - * - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_config); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_encoding, __pyx_v_encoding) < 0)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":217 - * raise ValueError('{0} encoding not supported yet '.format(encoding)) - * config['encoding'] = encoding - * self.encoding = encoding # <<<<<<<<<<<<<< - * - * self.logger = logging.getLogger('TextAdapter') - */ - __Pyx_INCREF(__pyx_v_encoding); - __Pyx_GIVEREF(__pyx_v_encoding); - __Pyx_GOTREF(__pyx_v_self->encoding); - __Pyx_DECREF(__pyx_v_self->encoding); - __pyx_v_self->encoding = __pyx_v_encoding; - - /* "TextAdapter/textadapter/TextAdapter.pyx":219 - * self.encoding = encoding - * - * self.logger = logging.getLogger('TextAdapter') # <<<<<<<<<<<<<< - * if debug: - * self.logger.setLevel(logging.DEBUG) - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_v_self->logger); - __Pyx_DECREF(__pyx_v_self->logger); - __pyx_v_self->logger = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":220 - * - * self.logger = logging.getLogger('TextAdapter') - * if debug: # <<<<<<<<<<<<<< - * self.logger.setLevel(logging.DEBUG) - * else: - */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_debug); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 220, __pyx_L1_error) - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":221 - * self.logger = logging.getLogger('TextAdapter') - * if debug: - * self.logger.setLevel(logging.DEBUG) # <<<<<<<<<<<<<< - * else: - * self.logger.setLevel(logging.INFO) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->logger, __pyx_n_s_setLevel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DEBUG); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_2) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":220 - * - * self.logger = logging.getLogger('TextAdapter') - * if debug: # <<<<<<<<<<<<<< - * self.logger.setLevel(logging.DEBUG) - * else: - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":223 - * self.logger.setLevel(logging.DEBUG) - * else: - * self.logger.setLevel(logging.INFO) # <<<<<<<<<<<<<< - * - * if output == 'dataframe' and not pandas_installed: - */ - /*else*/ { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->logger, __pyx_n_s_setLevel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_INFO); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_7) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_3}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_3}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __pyx_L5:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":225 - * self.logger.setLevel(logging.INFO) - * - * if output == 'dataframe' and not pandas_installed: # <<<<<<<<<<<<<< - * raise warnings.warn('Pandas module is not installed. ' - * 'Output type will be set to numpy array.') - */ - __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_v_output, __pyx_n_s_dataframe, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 225, __pyx_L1_error) - if (__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pandas_installed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = ((!__pyx_t_6) != 0); - __pyx_t_5 = __pyx_t_8; - __pyx_L7_bool_binop_done:; - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":226 - * - * if output == 'dataframe' and not pandas_installed: - * raise warnings.warn('Pandas module is not installed. ' # <<<<<<<<<<<<<< - * 'Output type will be set to numpy array.') - * self.default_output = 'ndarray' - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_warnings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 226, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":225 - * self.logger.setLevel(logging.INFO) - * - * if output == 'dataframe' and not pandas_installed: # <<<<<<<<<<<<<< - * raise warnings.warn('Pandas module is not installed. ' - * 'Output type will be set to numpy array.') - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":230 - * self.default_output = 'ndarray' - * else: - * self.default_output = output # <<<<<<<<<<<<<< - * - * # TODO: download and parse remote text file in chunks - */ - /*else*/ { - __Pyx_INCREF(__pyx_v_output); - __Pyx_GIVEREF(__pyx_v_output); - __Pyx_GOTREF(__pyx_v_self->default_output); - __Pyx_DECREF(__pyx_v_self->default_output); - __pyx_v_self->default_output = __pyx_v_output; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":233 - * - * # TODO: download and parse remote text file in chunks - * if isinstance(fh, string_types) and \ # <<<<<<<<<<<<<< - * (fh[0:7] == 'http://' or fh[0:6] == 'ftp://'): - * url_socket = urlopen(fh) - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_string_types); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyObject_IsInstance(__pyx_v_fh, __pyx_t_4); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 233, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = (__pyx_t_8 != 0); - if (__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L10_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":234 - * # TODO: download and parse remote text file in chunks - * if isinstance(fh, string_types) and \ - * (fh[0:7] == 'http://' or fh[0:6] == 'ftp://'): # <<<<<<<<<<<<<< - * url_socket = urlopen(fh) - * fh = io.BytesIO(url_socket.read()) - */ - __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_fh, 0, 7, NULL, NULL, &__pyx_slice__41, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s_http, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_fh, 0, 6, NULL, NULL, &__pyx_slice__42, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s_ftp, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_t_6; - __pyx_L10_bool_binop_done:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":233 - * - * # TODO: download and parse remote text file in chunks - * if isinstance(fh, string_types) and \ # <<<<<<<<<<<<<< - * (fh[0:7] == 'http://' or fh[0:6] == 'ftp://'): - * url_socket = urlopen(fh) - */ - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":235 - * if isinstance(fh, string_types) and \ - * (fh[0:7] == 'http://' or fh[0:6] == 'ftp://'): - * url_socket = urlopen(fh) # <<<<<<<<<<<<<< - * fh = io.BytesIO(url_socket.read()) - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_urlopen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_2) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_fh); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_fh}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_fh}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_fh); - __Pyx_GIVEREF(__pyx_v_fh); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_fh); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_url_socket = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":236 - * (fh[0:7] == 'http://' or fh[0:6] == 'ftp://'): - * url_socket = urlopen(fh) - * fh = io.BytesIO(url_socket.read()) # <<<<<<<<<<<<<< - * - * # Setup IO functions and input data. - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_io); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_BytesIO); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_url_socket, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_2) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_1}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_1}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_fh, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":233 - * - * # TODO: download and parse remote text file in chunks - * if isinstance(fh, string_types) and \ # <<<<<<<<<<<<<< - * (fh[0:7] == 'http://' or fh[0:6] == 'ftp://'): - * url_socket = urlopen(fh) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":242 - * # seek, read, and close functions, and returns a pointer to an - * # InputData struct. - * if isinstance(fh, (StringIO, io.StringIO, io.BytesIO)): # <<<<<<<<<<<<<< - * if isinstance(fh, (StringIO, io.StringIO)): - * self.data = fh.read().encode('utf_8') - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_StringIO); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_io); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_StringIO); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_io); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_BytesIO); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = PyObject_IsInstance(__pyx_v_fh, __pyx_t_4); - __pyx_t_8 = (__pyx_t_6 != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_5 = __pyx_t_8; - goto __pyx_L14_bool_binop_done; - } - __pyx_t_8 = PyObject_IsInstance(__pyx_v_fh, __pyx_t_7); - __pyx_t_6 = (__pyx_t_8 != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L14_bool_binop_done; - } - __pyx_t_6 = PyObject_IsInstance(__pyx_v_fh, __pyx_t_1); - __pyx_t_8 = (__pyx_t_6 != 0); - __pyx_t_5 = __pyx_t_8; - __pyx_L14_bool_binop_done:; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = (__pyx_t_5 != 0); - if (__pyx_t_8) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":243 - * # InputData struct. - * if isinstance(fh, (StringIO, io.StringIO, io.BytesIO)): - * if isinstance(fh, (StringIO, io.StringIO)): # <<<<<<<<<<<<<< - * self.data = fh.read().encode('utf_8') - * else: - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_StringIO); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 243, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_io); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 243, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_StringIO); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_5 = PyObject_IsInstance(__pyx_v_fh, __pyx_t_4); - __pyx_t_6 = (__pyx_t_5 != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_8 = __pyx_t_6; - goto __pyx_L18_bool_binop_done; - } - __pyx_t_6 = PyObject_IsInstance(__pyx_v_fh, __pyx_t_1); - __pyx_t_5 = (__pyx_t_6 != 0); - __pyx_t_8 = __pyx_t_5; - __pyx_L18_bool_binop_done:; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = (__pyx_t_8 != 0); - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":244 - * if isinstance(fh, (StringIO, io.StringIO, io.BytesIO)): - * if isinstance(fh, (StringIO, io.StringIO)): - * self.data = fh.read().encode('utf_8') # <<<<<<<<<<<<<< - * else: - * self.data = fh.read() - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fh, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_7) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_v_self->data); - __Pyx_DECREF(__pyx_v_self->data); - __pyx_v_self->data = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":243 - * # InputData struct. - * if isinstance(fh, (StringIO, io.StringIO, io.BytesIO)): - * if isinstance(fh, (StringIO, io.StringIO)): # <<<<<<<<<<<<<< - * self.data = fh.read().encode('utf_8') - * else: - */ - goto __pyx_L17; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":246 - * self.data = fh.read().encode('utf_8') - * else: - * self.data = fh.read() # <<<<<<<<<<<<<< - * input_data = open_memmap(self.data, len(self.data)) - * elif boto_installed and isinstance(fh, key.Key): - */ - /*else*/ { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fh, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_7) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_v_self->data); - __Pyx_DECREF(__pyx_v_self->data); - __pyx_v_self->data = __pyx_t_4; - __pyx_t_4 = 0; - } - __pyx_L17:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":247 - * else: - * self.data = fh.read() - * input_data = open_memmap(self.data, len(self.data)) # <<<<<<<<<<<<<< - * elif boto_installed and isinstance(fh, key.Key): - * self.data['s3_key'] = fh - */ - __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_v_self->data); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error) - __pyx_t_4 = __pyx_v_self->data; - __Pyx_INCREF(__pyx_t_4); - __pyx_t_10 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 247, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_input_data = open_memmap(__pyx_t_9, __pyx_t_10); - - /* "TextAdapter/textadapter/TextAdapter.pyx":242 - * # seek, read, and close functions, and returns a pointer to an - * # InputData struct. - * if isinstance(fh, (StringIO, io.StringIO, io.BytesIO)): # <<<<<<<<<<<<<< - * if isinstance(fh, (StringIO, io.StringIO)): - * self.data = fh.read().encode('utf_8') - */ - goto __pyx_L13; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":248 - * self.data = fh.read() - * input_data = open_memmap(self.data, len(self.data)) - * elif boto_installed and isinstance(fh, key.Key): # <<<<<<<<<<<<<< - * self.data['s3_key'] = fh - * self.data['offset'] = 0 - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_boto_installed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { - } else { - __pyx_t_5 = __pyx_t_8; - goto __pyx_L20_bool_binop_done; - } - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = PyObject_IsInstance(__pyx_v_fh, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = (__pyx_t_8 != 0); - __pyx_t_5 = __pyx_t_6; - __pyx_L20_bool_binop_done:; - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":249 - * input_data = open_memmap(self.data, len(self.data)) - * elif boto_installed and isinstance(fh, key.Key): - * self.data['s3_key'] = fh # <<<<<<<<<<<<<< - * self.data['offset'] = 0 - * input_data = open_s3(self.data) - */ - if (unlikely(PyObject_SetItem(__pyx_v_self->data, __pyx_n_s_s3_key, __pyx_v_fh) < 0)) __PYX_ERR(0, 249, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":250 - * elif boto_installed and isinstance(fh, key.Key): - * self.data['s3_key'] = fh - * self.data['offset'] = 0 # <<<<<<<<<<<<<< - * input_data = open_s3(self.data) - * elif isinstance(fh, string_types): - */ - if (unlikely(PyObject_SetItem(__pyx_v_self->data, __pyx_n_s_offset, __pyx_int_0) < 0)) __PYX_ERR(0, 250, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":251 - * self.data['s3_key'] = fh - * self.data['offset'] = 0 - * input_data = open_s3(self.data) # <<<<<<<<<<<<<< - * elif isinstance(fh, string_types): - * input_data = open_file(fh.encode('ascii')) - */ - __pyx_t_1 = __pyx_v_self->data; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_input_data = __pyx_f_5TextAdapter_11textadapter_11TextAdapter_open_s3(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":248 - * self.data = fh.read() - * input_data = open_memmap(self.data, len(self.data)) - * elif boto_installed and isinstance(fh, key.Key): # <<<<<<<<<<<<<< - * self.data['s3_key'] = fh - * self.data['offset'] = 0 - */ - goto __pyx_L13; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":252 - * self.data['offset'] = 0 - * input_data = open_s3(self.data) - * elif isinstance(fh, string_types): # <<<<<<<<<<<<<< - * input_data = open_file(fh.encode('ascii')) - * if compression is None and fh.endswith('.gz'): - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_string_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_IsInstance(__pyx_v_fh, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 252, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":253 - * input_data = open_s3(self.data) - * elif isinstance(fh, string_types): - * input_data = open_file(fh.encode('ascii')) # <<<<<<<<<<<<<< - * if compression is None and fh.endswith('.gz'): - * compression = 'gzip' - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fh, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L1_error) - __pyx_v_input_data = open_file(__pyx_t_11); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":254 - * elif isinstance(fh, string_types): - * input_data = open_file(fh.encode('ascii')) - * if compression is None and fh.endswith('.gz'): # <<<<<<<<<<<<<< - * compression = 'gzip' - * elif isinstance(fh, types.GeneratorType): - */ - __pyx_t_5 = (__pyx_v_compression == Py_None); - __pyx_t_8 = (__pyx_t_5 != 0); - if (__pyx_t_8) { - } else { - __pyx_t_6 = __pyx_t_8; - goto __pyx_L23_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fh, __pyx_n_s_endswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __pyx_t_8; - __pyx_L23_bool_binop_done:; - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":255 - * input_data = open_file(fh.encode('ascii')) - * if compression is None and fh.endswith('.gz'): - * compression = 'gzip' # <<<<<<<<<<<<<< - * elif isinstance(fh, types.GeneratorType): - * # TODO: Figure out better way to do this - */ - __Pyx_INCREF(__pyx_n_s_gzip); - __Pyx_DECREF_SET(__pyx_v_compression, __pyx_n_s_gzip); - - /* "TextAdapter/textadapter/TextAdapter.pyx":254 - * elif isinstance(fh, string_types): - * input_data = open_file(fh.encode('ascii')) - * if compression is None and fh.endswith('.gz'): # <<<<<<<<<<<<<< - * compression = 'gzip' - * elif isinstance(fh, types.GeneratorType): - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":252 - * self.data['offset'] = 0 - * input_data = open_s3(self.data) - * elif isinstance(fh, string_types): # <<<<<<<<<<<<<< - * input_data = open_file(fh.encode('ascii')) - * if compression is None and fh.endswith('.gz'): - */ - goto __pyx_L13; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":256 - * if compression is None and fh.endswith('.gz'): - * compression = 'gzip' - * elif isinstance(fh, types.GeneratorType): # <<<<<<<<<<<<<< - * # TODO: Figure out better way to do this - * temp = [x for x in fh] - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_GeneratorType); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = PyObject_IsInstance(__pyx_v_fh, __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 256, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = (__pyx_t_6 != 0); - if (__pyx_t_8) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":258 - * elif isinstance(fh, types.GeneratorType): - * # TODO: Figure out better way to do this - * temp = [x for x in fh] # <<<<<<<<<<<<<< - * if isinstance(temp[0], string_types): - * temp = '\n'.join(temp) - */ - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (likely(PyList_CheckExact(__pyx_v_fh)) || PyTuple_CheckExact(__pyx_v_fh)) { - __pyx_t_1 = __pyx_v_fh; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0; - __pyx_t_12 = NULL; - } else { - __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_fh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 258, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_12)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 258, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } else { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 258, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } - } else { - __pyx_t_7 = __pyx_t_12(__pyx_t_1); - if (unlikely(!__pyx_t_7)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 258, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_7); - __pyx_t_7 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_v_x))) __PYX_ERR(0, 258, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_temp = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":259 - * # TODO: Figure out better way to do this - * temp = [x for x in fh] - * if isinstance(temp[0], string_types): # <<<<<<<<<<<<<< - * temp = '\n'.join(temp) - * self.data = temp.encode('utf_8') - */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_temp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_string_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyObject_IsInstance(__pyx_t_4, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = (__pyx_t_8 != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":260 - * temp = [x for x in fh] - * if isinstance(temp[0], string_types): - * temp = '\n'.join(temp) # <<<<<<<<<<<<<< - * self.data = temp.encode('utf_8') - * else: - */ - __pyx_t_1 = __Pyx_PyString_Join(__pyx_kp_s__27, __pyx_v_temp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_temp, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":261 - * if isinstance(temp[0], string_types): - * temp = '\n'.join(temp) - * self.data = temp.encode('utf_8') # <<<<<<<<<<<<<< - * else: - * self.data = b'\n'.join(temp) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_temp, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_v_self->data); - __Pyx_DECREF(__pyx_v_self->data); - __pyx_v_self->data = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":259 - * # TODO: Figure out better way to do this - * temp = [x for x in fh] - * if isinstance(temp[0], string_types): # <<<<<<<<<<<<<< - * temp = '\n'.join(temp) - * self.data = temp.encode('utf_8') - */ - goto __pyx_L27; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":263 - * self.data = temp.encode('utf_8') - * else: - * self.data = b'\n'.join(temp) # <<<<<<<<<<<<<< - * input_data = open_memmap(self.data, len(self.data)) - * else: - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyBytes_Join(__pyx_kp_b__27, __pyx_v_temp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_v_self->data); - __Pyx_DECREF(__pyx_v_self->data); - __pyx_v_self->data = __pyx_t_4; - __pyx_t_4 = 0; - } - __pyx_L27:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":264 - * else: - * self.data = b'\n'.join(temp) - * input_data = open_memmap(self.data, len(self.data)) # <<<<<<<<<<<<<< - * else: - * raise TypeError('Cannot open data source of type %s ' - */ - __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_v_self->data); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 264, __pyx_L1_error) - __pyx_t_4 = __pyx_v_self->data; - __Pyx_INCREF(__pyx_t_4); - __pyx_t_10 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 264, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_input_data = open_memmap(__pyx_t_9, __pyx_t_10); - - /* "TextAdapter/textadapter/TextAdapter.pyx":256 - * if compression is None and fh.endswith('.gz'): - * compression = 'gzip' - * elif isinstance(fh, types.GeneratorType): # <<<<<<<<<<<<<< - * # TODO: Figure out better way to do this - * temp = [x for x in fh] - */ - goto __pyx_L13; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":266 - * input_data = open_memmap(self.data, len(self.data)) - * else: - * raise TypeError('Cannot open data source of type %s ' # <<<<<<<<<<<<<< - * 'must be file name, url, StringIO, BytesIO, ' - * 'or generator ' % str(type(fh))) - */ - /*else*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":268 - * raise TypeError('Cannot open data source of type %s ' - * 'must be file name, url, StringIO, BytesIO, ' - * 'or generator ' % str(type(fh))) # <<<<<<<<<<<<<< - * - * if input_data == NULL: - */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_fh))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_fh))); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(__pyx_v_fh))); - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Cannot_open_data_source_of_type, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":266 - * input_data = open_memmap(self.data, len(self.data)) - * else: - * raise TypeError('Cannot open data source of type %s ' # <<<<<<<<<<<<<< - * 'must be file name, url, StringIO, BytesIO, ' - * 'or generator ' % str(type(fh))) - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 266, __pyx_L1_error) - } - __pyx_L13:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":270 - * 'or generator ' % str(type(fh))) - * - * if input_data == NULL: # <<<<<<<<<<<<<< - * raise IOError('Could not initialize data source') - * - */ - __pyx_t_6 = ((__pyx_v_input_data == NULL) != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":271 - * - * if input_data == NULL: - * raise IOError('Could not initialize data source') # <<<<<<<<<<<<<< - * - * # Setup read/seek functions for compressed data. Functions pointers - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 271, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":270 - * 'or generator ' % str(type(fh))) - * - * if input_data == NULL: # <<<<<<<<<<<<<< - * raise IOError('Could not initialize data source') - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":279 - * # buffer for compressed raw data before it is decompressed into the - * # main buffer. - * input_data.compressed_input = NULL # <<<<<<<<<<<<<< - * input_data.compressed_prebuffer = NULL - * if compression == 'gzip': - */ - __pyx_v_input_data->compressed_input = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":280 - * # main buffer. - * input_data.compressed_input = NULL - * input_data.compressed_prebuffer = NULL # <<<<<<<<<<<<<< - * if compression == 'gzip': - * init_gzip(input_data) - */ - __pyx_v_input_data->compressed_prebuffer = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":281 - * input_data.compressed_input = NULL - * input_data.compressed_prebuffer = NULL - * if compression == 'gzip': # <<<<<<<<<<<<<< - * init_gzip(input_data) - * elif compression != None: - */ - __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_v_compression, __pyx_n_s_gzip, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 281, __pyx_L1_error) - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":282 - * input_data.compressed_prebuffer = NULL - * if compression == 'gzip': - * init_gzip(input_data) # <<<<<<<<<<<<<< - * elif compression != None: - * error_msg = 'unknown compression type {0}'.format(compression) - */ - init_gzip(__pyx_v_input_data); - - /* "TextAdapter/textadapter/TextAdapter.pyx":281 - * input_data.compressed_input = NULL - * input_data.compressed_prebuffer = NULL - * if compression == 'gzip': # <<<<<<<<<<<<<< - * init_gzip(input_data) - * elif compression != None: - */ - goto __pyx_L29; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":283 - * if compression == 'gzip': - * init_gzip(input_data) - * elif compression != None: # <<<<<<<<<<<<<< - * error_msg = 'unknown compression type {0}'.format(compression) - * raise errors.ArgumentError(error_msg) - */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_compression, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 283, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":284 - * init_gzip(input_data) - * elif compression != None: - * error_msg = 'unknown compression type {0}'.format(compression) # <<<<<<<<<<<<<< - * raise errors.ArgumentError(error_msg) - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_unknown_compression_type_0, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_7) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_compression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_compression}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_compression}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_INCREF(__pyx_v_compression); - __Pyx_GIVEREF(__pyx_v_compression); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_compression); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_error_msg = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":285 - * elif compression != None: - * error_msg = 'unknown compression type {0}'.format(compression) - * raise errors.ArgumentError(error_msg) # <<<<<<<<<<<<<< - * - * # Create and initialize low level TextAdapter C struct - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ArgumentError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_1) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_error_msg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_error_msg}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_error_msg}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL; - __Pyx_INCREF(__pyx_v_error_msg); - __Pyx_GIVEREF(__pyx_v_error_msg); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_error_msg); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 285, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":283 - * if compression == 'gzip': - * init_gzip(input_data) - * elif compression != None: # <<<<<<<<<<<<<< - * error_msg = 'unknown compression type {0}'.format(compression) - * raise errors.ArgumentError(error_msg) - */ - } - __pyx_L29:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":288 - * - * # Create and initialize low level TextAdapter C struct - * self.adapter = open_text_adapter(input_data) # <<<<<<<<<<<<<< - * if self.adapter == NULL: - * raise IOError('Could not initialize text adapter') - */ - __pyx_v_self->adapter = open_text_adapter(__pyx_v_input_data); - - /* "TextAdapter/textadapter/TextAdapter.pyx":289 - * # Create and initialize low level TextAdapter C struct - * self.adapter = open_text_adapter(input_data) - * if self.adapter == NULL: # <<<<<<<<<<<<<< - * raise IOError('Could not initialize text adapter') - * - */ - __pyx_t_6 = ((__pyx_v_self->adapter == NULL) != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":290 - * self.adapter = open_text_adapter(input_data) - * if self.adapter == NULL: - * raise IOError('Could not initialize text adapter') # <<<<<<<<<<<<<< - * - * # num_records sets a hard limit on the number of records read. - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 290, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":289 - * # Create and initialize low level TextAdapter C struct - * self.adapter = open_text_adapter(input_data) - * if self.adapter == NULL: # <<<<<<<<<<<<<< - * raise IOError('Could not initialize text adapter') - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":293 - * - * # num_records sets a hard limit on the number of records read. - * self.adapter.num_records = num_records # <<<<<<<<<<<<<< - * - * self.indexing = indexing - */ - __pyx_t_13 = __Pyx_PyInt_As_uint64_t(__pyx_v_num_records); if (unlikely((__pyx_t_13 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L1_error) - __pyx_v_self->adapter->num_records = __pyx_t_13; - - /* "TextAdapter/textadapter/TextAdapter.pyx":295 - * self.adapter.num_records = num_records - * - * self.indexing = indexing # <<<<<<<<<<<<<< - * if indexing is False and index_name is not None: - * self.indexing = True - */ - __Pyx_INCREF(__pyx_v_indexing); - __Pyx_GIVEREF(__pyx_v_indexing); - __Pyx_GOTREF(__pyx_v_self->indexing); - __Pyx_DECREF(__pyx_v_self->indexing); - __pyx_v_self->indexing = __pyx_v_indexing; - - /* "TextAdapter/textadapter/TextAdapter.pyx":296 - * - * self.indexing = indexing - * if indexing is False and index_name is not None: # <<<<<<<<<<<<<< - * self.indexing = True - * - */ - __pyx_t_8 = (__pyx_v_indexing == Py_False); - __pyx_t_5 = (__pyx_t_8 != 0); - if (__pyx_t_5) { - } else { - __pyx_t_6 = __pyx_t_5; - goto __pyx_L32_bool_binop_done; - } - __pyx_t_5 = (__pyx_v_index_name != Py_None); - __pyx_t_8 = (__pyx_t_5 != 0); - __pyx_t_6 = __pyx_t_8; - __pyx_L32_bool_binop_done:; - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":297 - * self.indexing = indexing - * if indexing is False and index_name is not None: - * self.indexing = True # <<<<<<<<<<<<<< - * - * if self.indexing is True: - */ - __Pyx_INCREF(Py_True); - __Pyx_GIVEREF(Py_True); - __Pyx_GOTREF(__pyx_v_self->indexing); - __Pyx_DECREF(__pyx_v_self->indexing); - __pyx_v_self->indexing = Py_True; - - /* "TextAdapter/textadapter/TextAdapter.pyx":296 - * - * self.indexing = indexing - * if indexing is False and index_name is not None: # <<<<<<<<<<<<<< - * self.indexing = True - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":299 - * self.indexing = True - * - * if self.indexing is True: # <<<<<<<<<<<<<< - * self.exact_index = ExactIndex(index_name=index_name, - * density = DEFAULT_INDEX_DENSITY, num_records=num_records) - */ - __pyx_t_6 = (__pyx_v_self->indexing == Py_True); - __pyx_t_8 = (__pyx_t_6 != 0); - if (__pyx_t_8) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":300 - * - * if self.indexing is True: - * self.exact_index = ExactIndex(index_name=index_name, # <<<<<<<<<<<<<< - * density = DEFAULT_INDEX_DENSITY, num_records=num_records) - * self.adapter.index = self.exact_index - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ExactIndex); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_index_name, __pyx_v_index_name) < 0) __PYX_ERR(0, 300, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":301 - * if self.indexing is True: - * self.exact_index = ExactIndex(index_name=index_name, - * density = DEFAULT_INDEX_DENSITY, num_records=num_records) # <<<<<<<<<<<<<< - * self.adapter.index = self.exact_index - * self.adapter.input_data.index = self.exact_index - */ - __pyx_t_7 = __Pyx_PyInt_From_int(DEFAULT_INDEX_DENSITY); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_density, __pyx_t_7) < 0) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_num_records, __pyx_v_num_records) < 0) __PYX_ERR(0, 300, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":300 - * - * if self.indexing is True: - * self.exact_index = ExactIndex(index_name=index_name, # <<<<<<<<<<<<<< - * density = DEFAULT_INDEX_DENSITY, num_records=num_records) - * self.adapter.index = self.exact_index - */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_v_self->exact_index); - __Pyx_DECREF(__pyx_v_self->exact_index); - __pyx_v_self->exact_index = __pyx_t_7; - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":302 - * self.exact_index = ExactIndex(index_name=index_name, - * density = DEFAULT_INDEX_DENSITY, num_records=num_records) - * self.adapter.index = self.exact_index # <<<<<<<<<<<<<< - * self.adapter.input_data.index = self.exact_index - * self.adapter.index_density = self.exact_index.get_density() - */ - __pyx_v_self->adapter->index = ((void *)__pyx_v_self->exact_index); - - /* "TextAdapter/textadapter/TextAdapter.pyx":303 - * density = DEFAULT_INDEX_DENSITY, num_records=num_records) - * self.adapter.index = self.exact_index - * self.adapter.input_data.index = self.exact_index # <<<<<<<<<<<<<< - * self.adapter.index_density = self.exact_index.get_density() - * self.adapter.indexer = &indexer_callback - */ - __pyx_v_self->adapter->input_data->index = ((void *)__pyx_v_self->exact_index); - - /* "TextAdapter/textadapter/TextAdapter.pyx":304 - * self.adapter.index = self.exact_index - * self.adapter.input_data.index = self.exact_index - * self.adapter.index_density = self.exact_index.get_density() # <<<<<<<<<<<<<< - * self.adapter.indexer = &indexer_callback - * self.adapter.index_lookup = &index_lookup_callback - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->exact_index, __pyx_n_s_get_density); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_4) { - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 304, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_13 = __Pyx_PyInt_As_uint64_t(__pyx_t_7); if (unlikely((__pyx_t_13 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_self->adapter->index_density = __pyx_t_13; - - /* "TextAdapter/textadapter/TextAdapter.pyx":305 - * self.adapter.input_data.index = self.exact_index - * self.adapter.index_density = self.exact_index.get_density() - * self.adapter.indexer = &indexer_callback # <<<<<<<<<<<<<< - * self.adapter.index_lookup = &index_lookup_callback - * if self.compression == 'gzip': - */ - __pyx_v_self->adapter->indexer = (&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_indexer_callback); - - /* "TextAdapter/textadapter/TextAdapter.pyx":306 - * self.adapter.index_density = self.exact_index.get_density() - * self.adapter.indexer = &indexer_callback - * self.adapter.index_lookup = &index_lookup_callback # <<<<<<<<<<<<<< - * if self.compression == 'gzip': - * self.adapter.add_gzip_access_point = &add_gzip_access_point_callback - */ - __pyx_v_self->adapter->index_lookup = (&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_index_lookup_callback); - - /* "TextAdapter/textadapter/TextAdapter.pyx":307 - * self.adapter.indexer = &indexer_callback - * self.adapter.index_lookup = &index_lookup_callback - * if self.compression == 'gzip': # <<<<<<<<<<<<<< - * self.adapter.add_gzip_access_point = &add_gzip_access_point_callback - * self.adapter.input_data.get_gzip_access_point = &get_gzip_access_point_callback - */ - __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_v_self->compression, __pyx_n_s_gzip, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 307, __pyx_L1_error) - if (__pyx_t_8) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":308 - * self.adapter.index_lookup = &index_lookup_callback - * if self.compression == 'gzip': - * self.adapter.add_gzip_access_point = &add_gzip_access_point_callback # <<<<<<<<<<<<<< - * self.adapter.input_data.get_gzip_access_point = &get_gzip_access_point_callback - * else: - */ - __pyx_v_self->adapter->add_gzip_access_point = (&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_add_gzip_access_point_callback); - - /* "TextAdapter/textadapter/TextAdapter.pyx":309 - * if self.compression == 'gzip': - * self.adapter.add_gzip_access_point = &add_gzip_access_point_callback - * self.adapter.input_data.get_gzip_access_point = &get_gzip_access_point_callback # <<<<<<<<<<<<<< - * else: - * self.adapter.add_gzip_access_point = NULL - */ - __pyx_v_self->adapter->input_data->get_gzip_access_point = (&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_get_gzip_access_point_callback); - - /* "TextAdapter/textadapter/TextAdapter.pyx":307 - * self.adapter.indexer = &indexer_callback - * self.adapter.index_lookup = &index_lookup_callback - * if self.compression == 'gzip': # <<<<<<<<<<<<<< - * self.adapter.add_gzip_access_point = &add_gzip_access_point_callback - * self.adapter.input_data.get_gzip_access_point = &get_gzip_access_point_callback - */ - goto __pyx_L35; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":311 - * self.adapter.input_data.get_gzip_access_point = &get_gzip_access_point_callback - * else: - * self.adapter.add_gzip_access_point = NULL # <<<<<<<<<<<<<< - * self.adapter.input_data.get_gzip_access_point = NULL - * self.adapter.num_records = self.exact_index.total_num_records - */ - /*else*/ { - __pyx_v_self->adapter->add_gzip_access_point = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":312 - * else: - * self.adapter.add_gzip_access_point = NULL - * self.adapter.input_data.get_gzip_access_point = NULL # <<<<<<<<<<<<<< - * self.adapter.num_records = self.exact_index.total_num_records - * else: - */ - __pyx_v_self->adapter->input_data->get_gzip_access_point = NULL; - } - __pyx_L35:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":313 - * self.adapter.add_gzip_access_point = NULL - * self.adapter.input_data.get_gzip_access_point = NULL - * self.adapter.num_records = self.exact_index.total_num_records # <<<<<<<<<<<<<< - * else: - * self.exact_index = None - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->exact_index, __pyx_n_s_total_num_records); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_13 = __Pyx_PyInt_As_uint64_t(__pyx_t_7); if (unlikely((__pyx_t_13 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_self->adapter->num_records = __pyx_t_13; - - /* "TextAdapter/textadapter/TextAdapter.pyx":299 - * self.indexing = True - * - * if self.indexing is True: # <<<<<<<<<<<<<< - * self.exact_index = ExactIndex(index_name=index_name, - * density = DEFAULT_INDEX_DENSITY, num_records=num_records) - */ - goto __pyx_L34; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":315 - * self.adapter.num_records = self.exact_index.total_num_records - * else: - * self.exact_index = None # <<<<<<<<<<<<<< - * self.adapter.index = NULL - * self.adapter.input_data.index = NULL - */ - /*else*/ { - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->exact_index); - __Pyx_DECREF(__pyx_v_self->exact_index); - __pyx_v_self->exact_index = Py_None; - - /* "TextAdapter/textadapter/TextAdapter.pyx":316 - * else: - * self.exact_index = None - * self.adapter.index = NULL # <<<<<<<<<<<<<< - * self.adapter.input_data.index = NULL - * self.adapter.index_density = 0 - */ - __pyx_v_self->adapter->index = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":317 - * self.exact_index = None - * self.adapter.index = NULL - * self.adapter.input_data.index = NULL # <<<<<<<<<<<<<< - * self.adapter.index_density = 0 - * self.adapter.indexer = NULL - */ - __pyx_v_self->adapter->input_data->index = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":318 - * self.adapter.index = NULL - * self.adapter.input_data.index = NULL - * self.adapter.index_density = 0 # <<<<<<<<<<<<<< - * self.adapter.indexer = NULL - * self.adapter.index_lookup = NULL - */ - __pyx_v_self->adapter->index_density = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":319 - * self.adapter.input_data.index = NULL - * self.adapter.index_density = 0 - * self.adapter.indexer = NULL # <<<<<<<<<<<<<< - * self.adapter.index_lookup = NULL - * self.adapter.add_gzip_access_point = NULL - */ - __pyx_v_self->adapter->indexer = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":320 - * self.adapter.index_density = 0 - * self.adapter.indexer = NULL - * self.adapter.index_lookup = NULL # <<<<<<<<<<<<<< - * self.adapter.add_gzip_access_point = NULL - * self.adapter.input_data.get_gzip_access_point = NULL - */ - __pyx_v_self->adapter->index_lookup = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":321 - * self.adapter.indexer = NULL - * self.adapter.index_lookup = NULL - * self.adapter.add_gzip_access_point = NULL # <<<<<<<<<<<<<< - * self.adapter.input_data.get_gzip_access_point = NULL - * - */ - __pyx_v_self->adapter->add_gzip_access_point = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":322 - * self.adapter.index_lookup = NULL - * self.adapter.add_gzip_access_point = NULL - * self.adapter.input_data.get_gzip_access_point = NULL # <<<<<<<<<<<<<< - * - * # initialize number of fields to 1 because we're first going to parse - */ - __pyx_v_self->adapter->input_data->get_gzip_access_point = NULL; - } - __pyx_L34:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":329 - * # returns, the child class constructor will figure out the correct - * # number of fields and call set_num_fields again. - * set_num_fields(self.adapter.fields, 1) # <<<<<<<<<<<<<< - * - * # skip header lines - */ - set_num_fields(__pyx_v_self->adapter->fields, 1); - - /* "TextAdapter/textadapter/TextAdapter.pyx":332 - * - * # skip header lines - * offset = 0 # <<<<<<<<<<<<<< - * if header > 0: - * line_iter = create_line_iter(self.adapter) - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_offset = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":333 - * # skip header lines - * offset = 0 - * if header > 0: # <<<<<<<<<<<<<< - * line_iter = create_line_iter(self.adapter) - * for i in range(header): - */ - __pyx_t_7 = PyObject_RichCompare(__pyx_v_header, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_8) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":334 - * offset = 0 - * if header > 0: - * line_iter = create_line_iter(self.adapter) # <<<<<<<<<<<<<< - * for i in range(header): - * offset += len(line_iter.__next__()) - */ - __pyx_t_7 = __pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_line_iter(__pyx_v_self->adapter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 334, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_v_line_iter = __pyx_t_7; - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":335 - * if header > 0: - * line_iter = create_line_iter(self.adapter) - * for i in range(header): # <<<<<<<<<<<<<< - * offset += len(line_iter.__next__()) - * self.adapter.input_data.header = offset - */ - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_v_header); - __Pyx_GIVEREF(__pyx_v_header); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_header); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_7 = __pyx_t_3; __Pyx_INCREF(__pyx_t_7); __pyx_t_10 = 0; - __pyx_t_12 = NULL; - } else { - __pyx_t_10 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_12 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 335, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_12)) { - if (likely(PyList_CheckExact(__pyx_t_7))) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_7)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 335, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_7, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_7)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 335, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_7, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_12(__pyx_t_7); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 335, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3); - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":336 - * line_iter = create_line_iter(self.adapter) - * for i in range(header): - * offset += len(line_iter.__next__()) # <<<<<<<<<<<<<< - * self.adapter.input_data.header = offset - * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_line_iter, __pyx_n_s_next); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_1) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_14 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 336, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_offset, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_offset, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":335 - * if header > 0: - * line_iter = create_line_iter(self.adapter) - * for i in range(header): # <<<<<<<<<<<<<< - * offset += len(line_iter.__next__()) - * self.adapter.input_data.header = offset - */ - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":333 - * # skip header lines - * offset = 0 - * if header > 0: # <<<<<<<<<<<<<< - * line_iter = create_line_iter(self.adapter) - * for i in range(header): - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":337 - * for i in range(header): - * offset += len(line_iter.__next__()) - * self.adapter.input_data.header = offset # <<<<<<<<<<<<<< - * - * self.adapter.comment_char = ord('\0') - */ - __pyx_t_13 = __Pyx_PyInt_As_uint64_t(__pyx_v_offset); if (unlikely((__pyx_t_13 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 337, __pyx_L1_error) - __pyx_v_self->adapter->input_data->header = __pyx_t_13; - - /* "TextAdapter/textadapter/TextAdapter.pyx":339 - * self.adapter.input_data.header = offset - * - * self.adapter.comment_char = ord('\0') # <<<<<<<<<<<<<< - * if comment is not None: - * self.adapter.comment_char = ord(comment[0]) - */ - __pyx_v_self->adapter->comment_char = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":340 - * - * self.adapter.comment_char = ord('\0') - * if comment is not None: # <<<<<<<<<<<<<< - * self.adapter.comment_char = ord(comment[0]) - * - */ - __pyx_t_8 = (__pyx_v_comment != Py_None); - __pyx_t_6 = (__pyx_t_8 != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":341 - * self.adapter.comment_char = ord('\0') - * if comment is not None: - * self.adapter.comment_char = ord(comment[0]) # <<<<<<<<<<<<<< - * - * self.adapter.quote_char = 0 - */ - __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_comment, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_15 = __Pyx_PyObject_Ord(__pyx_t_7); if (unlikely(__pyx_t_15 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_self->adapter->comment_char = __pyx_t_15; - - /* "TextAdapter/textadapter/TextAdapter.pyx":340 - * - * self.adapter.comment_char = ord('\0') - * if comment is not None: # <<<<<<<<<<<<<< - * self.adapter.comment_char = ord(comment[0]) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":343 - * self.adapter.comment_char = ord(comment[0]) - * - * self.adapter.quote_char = 0 # <<<<<<<<<<<<<< - * if quote is not None: - * self.adapter.quote_char = ord(quote[0]) - */ - __pyx_v_self->adapter->quote_char = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":344 - * - * self.adapter.quote_char = 0 - * if quote is not None: # <<<<<<<<<<<<<< - * self.adapter.quote_char = ord(quote[0]) - * - */ - __pyx_t_6 = (__pyx_v_quote != Py_None); - __pyx_t_8 = (__pyx_t_6 != 0); - if (__pyx_t_8) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":345 - * self.adapter.quote_char = 0 - * if quote is not None: - * self.adapter.quote_char = ord(quote[0]) # <<<<<<<<<<<<<< - * - * default_converters[STRING_OBJECT_CONVERTER_FUNC] = \ - */ - __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_quote, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_15 = __Pyx_PyObject_Ord(__pyx_t_7); if (unlikely(__pyx_t_15 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_self->adapter->quote_char = __pyx_t_15; - - /* "TextAdapter/textadapter/TextAdapter.pyx":344 - * - * self.adapter.quote_char = 0 - * if quote is not None: # <<<<<<<<<<<<<< - * self.adapter.quote_char = ord(quote[0]) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":347 - * self.adapter.quote_char = ord(quote[0]) - * - * default_converters[STRING_OBJECT_CONVERTER_FUNC] = \ # <<<<<<<<<<<<<< - * &str2str_object_converter; - * self.build_converter = {} - */ - (default_converters[((unsigned int)STRING_OBJECT_CONVERTER_FUNC)]) = ((converter_func_ptr)(&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2str_object_converter)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":349 - * default_converters[STRING_OBJECT_CONVERTER_FUNC] = \ - * &str2str_object_converter; - * self.build_converter = {} # <<<<<<<<<<<<<< - * self.converter_objects = [] - * - */ - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 349, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_v_self->build_converter); - __Pyx_DECREF(__pyx_v_self->build_converter); - __pyx_v_self->build_converter = __pyx_t_7; - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":350 - * &str2str_object_converter; - * self.build_converter = {} - * self.converter_objects = [] # <<<<<<<<<<<<<< - * - * # Initialize hash table for interning string objects that have been - */ - __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_v_self->converter_objects); - __Pyx_DECREF(__pyx_v_self->converter_objects); - __pyx_v_self->converter_objects = __pyx_t_7; - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":357 - * # numpy array result. Hash table implementation comes from Klib project - * # (https://github.com/attractivechaos/klib). - * self.kh_string_table = kh_init_string() # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->kh_string_table = kh_init_string(); - - /* "TextAdapter/textadapter/TextAdapter.pyx":176 - * - * - * def __init_text_adapter(self, fh, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', num_records=0, header=0, footer=0, - * indexing=False, index_name=None, output='ndarray', - */ - - /* function exit code */ - __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_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__init_text_adapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_url_socket); - __Pyx_XDECREF(__pyx_v_temp); - __Pyx_XDECREF(__pyx_v_error_msg); - __Pyx_XDECREF(__pyx_v_offset); - __Pyx_XDECREF(__pyx_v_line_iter); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_x); - __Pyx_XDECREF(__pyx_v_fh); - __Pyx_XDECREF(__pyx_v_encoding); - __Pyx_XDECREF(__pyx_v_compression); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":360 - * - * - * def close(self): # <<<<<<<<<<<<<< - * - * if self.indexing is True: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("close (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_4close(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_4close(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("close", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":362 - * def close(self): - * - * if self.indexing is True: # <<<<<<<<<<<<<< - * self.exact_index.close() - * self.indexing = False - */ - __pyx_t_1 = (__pyx_v_self->indexing == Py_True); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":363 - * - * if self.indexing is True: - * self.exact_index.close() # <<<<<<<<<<<<<< - * self.indexing = False - * self.exact_index = None - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->exact_index, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":364 - * if self.indexing is True: - * self.exact_index.close() - * self.indexing = False # <<<<<<<<<<<<<< - * self.exact_index = None - * self.adapter.index = NULL - */ - __Pyx_INCREF(Py_False); - __Pyx_GIVEREF(Py_False); - __Pyx_GOTREF(__pyx_v_self->indexing); - __Pyx_DECREF(__pyx_v_self->indexing); - __pyx_v_self->indexing = Py_False; - - /* "TextAdapter/textadapter/TextAdapter.pyx":365 - * self.exact_index.close() - * self.indexing = False - * self.exact_index = None # <<<<<<<<<<<<<< - * self.adapter.index = NULL - * self.adapter.input_data.index = NULL - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->exact_index); - __Pyx_DECREF(__pyx_v_self->exact_index); - __pyx_v_self->exact_index = Py_None; - - /* "TextAdapter/textadapter/TextAdapter.pyx":366 - * self.indexing = False - * self.exact_index = None - * self.adapter.index = NULL # <<<<<<<<<<<<<< - * self.adapter.input_data.index = NULL - * self.adapter.index_density = 0 - */ - __pyx_v_self->adapter->index = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":367 - * self.exact_index = None - * self.adapter.index = NULL - * self.adapter.input_data.index = NULL # <<<<<<<<<<<<<< - * self.adapter.index_density = 0 - * self.adapter.indexer = NULL - */ - __pyx_v_self->adapter->input_data->index = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":368 - * self.adapter.index = NULL - * self.adapter.input_data.index = NULL - * self.adapter.index_density = 0 # <<<<<<<<<<<<<< - * self.adapter.indexer = NULL - * self.adapter.index_lookup = NULL - */ - __pyx_v_self->adapter->index_density = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":369 - * self.adapter.input_data.index = NULL - * self.adapter.index_density = 0 - * self.adapter.indexer = NULL # <<<<<<<<<<<<<< - * self.adapter.index_lookup = NULL - * self.adapter.add_gzip_access_point = NULL - */ - __pyx_v_self->adapter->indexer = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":370 - * self.adapter.index_density = 0 - * self.adapter.indexer = NULL - * self.adapter.index_lookup = NULL # <<<<<<<<<<<<<< - * self.adapter.add_gzip_access_point = NULL - * self.adapter.input_data.get_gzip_access_point = NULL - */ - __pyx_v_self->adapter->index_lookup = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":371 - * self.adapter.indexer = NULL - * self.adapter.index_lookup = NULL - * self.adapter.add_gzip_access_point = NULL # <<<<<<<<<<<<<< - * self.adapter.input_data.get_gzip_access_point = NULL - * - */ - __pyx_v_self->adapter->add_gzip_access_point = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":372 - * self.adapter.index_lookup = NULL - * self.adapter.add_gzip_access_point = NULL - * self.adapter.input_data.get_gzip_access_point = NULL # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->adapter->input_data->get_gzip_access_point = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":362 - * def close(self): - * - * if self.indexing is True: # <<<<<<<<<<<<<< - * self.exact_index.close() - * self.indexing = False - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":360 - * - * - * def close(self): # <<<<<<<<<<<<<< - * - * if self.indexing is True: - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.close", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":375 - * - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * - * # keys in string hash table are copies of input strings; - */ - -/* Python wrapper */ -static void __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_7__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_7__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_6__dealloc__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_6__dealloc__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - khint_t __pyx_v_i; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - khint_t __pyx_t_2; - khint_t __pyx_t_3; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":379 - * # keys in string hash table are copies of input strings; - * # we still need to delete them - * if self.kh_string_table != NULL: # <<<<<<<<<<<<<< - * for i in range(self.kh_string_table.n_buckets): - * if kh_exist(self.kh_string_table, i): - */ - __pyx_t_1 = ((__pyx_v_self->kh_string_table != NULL) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":380 - * # we still need to delete them - * if self.kh_string_table != NULL: - * for i in range(self.kh_string_table.n_buckets): # <<<<<<<<<<<<<< - * if kh_exist(self.kh_string_table, i): - * free(self.kh_string_table.keys[i]) - */ - __pyx_t_2 = __pyx_v_self->kh_string_table->n_buckets; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "TextAdapter/textadapter/TextAdapter.pyx":381 - * if self.kh_string_table != NULL: - * for i in range(self.kh_string_table.n_buckets): - * if kh_exist(self.kh_string_table, i): # <<<<<<<<<<<<<< - * free(self.kh_string_table.keys[i]) - * kh_destroy_string(self.kh_string_table) - */ - __pyx_t_1 = (kh_exist(__pyx_v_self->kh_string_table, __pyx_v_i) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":382 - * for i in range(self.kh_string_table.n_buckets): - * if kh_exist(self.kh_string_table, i): - * free(self.kh_string_table.keys[i]) # <<<<<<<<<<<<<< - * kh_destroy_string(self.kh_string_table) - * - */ - free((__pyx_v_self->kh_string_table->keys[__pyx_v_i])); - - /* "TextAdapter/textadapter/TextAdapter.pyx":381 - * if self.kh_string_table != NULL: - * for i in range(self.kh_string_table.n_buckets): - * if kh_exist(self.kh_string_table, i): # <<<<<<<<<<<<<< - * free(self.kh_string_table.keys[i]) - * kh_destroy_string(self.kh_string_table) - */ - } - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":383 - * if kh_exist(self.kh_string_table, i): - * free(self.kh_string_table.keys[i]) - * kh_destroy_string(self.kh_string_table) # <<<<<<<<<<<<<< - * - * if self.adapter != NULL: - */ - kh_destroy_string(__pyx_v_self->kh_string_table); - - /* "TextAdapter/textadapter/TextAdapter.pyx":379 - * # keys in string hash table are copies of input strings; - * # we still need to delete them - * if self.kh_string_table != NULL: # <<<<<<<<<<<<<< - * for i in range(self.kh_string_table.n_buckets): - * if kh_exist(self.kh_string_table, i): - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":385 - * kh_destroy_string(self.kh_string_table) - * - * if self.adapter != NULL: # <<<<<<<<<<<<<< - * if self.adapter.input_data.compressed_input != NULL: - * close_gzip(self.adapter.input_data) - */ - __pyx_t_1 = ((__pyx_v_self->adapter != NULL) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":386 - * - * if self.adapter != NULL: - * if self.adapter.input_data.compressed_input != NULL: # <<<<<<<<<<<<<< - * close_gzip(self.adapter.input_data) - * if self.adapter.input_data.close != NULL: - */ - __pyx_t_1 = ((__pyx_v_self->adapter->input_data->compressed_input != NULL) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":387 - * if self.adapter != NULL: - * if self.adapter.input_data.compressed_input != NULL: - * close_gzip(self.adapter.input_data) # <<<<<<<<<<<<<< - * if self.adapter.input_data.close != NULL: - * self.adapter.input_data.close(self.adapter.input_data) - */ - close_gzip(__pyx_v_self->adapter->input_data); - - /* "TextAdapter/textadapter/TextAdapter.pyx":386 - * - * if self.adapter != NULL: - * if self.adapter.input_data.compressed_input != NULL: # <<<<<<<<<<<<<< - * close_gzip(self.adapter.input_data) - * if self.adapter.input_data.close != NULL: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":388 - * if self.adapter.input_data.compressed_input != NULL: - * close_gzip(self.adapter.input_data) - * if self.adapter.input_data.close != NULL: # <<<<<<<<<<<<<< - * self.adapter.input_data.close(self.adapter.input_data) - * close_text_adapter(self.adapter) - */ - __pyx_t_1 = ((__pyx_v_self->adapter->input_data->close != NULL) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":389 - * close_gzip(self.adapter.input_data) - * if self.adapter.input_data.close != NULL: - * self.adapter.input_data.close(self.adapter.input_data) # <<<<<<<<<<<<<< - * close_text_adapter(self.adapter) - * - */ - __pyx_v_self->adapter->input_data->close(__pyx_v_self->adapter->input_data); - - /* "TextAdapter/textadapter/TextAdapter.pyx":388 - * if self.adapter.input_data.compressed_input != NULL: - * close_gzip(self.adapter.input_data) - * if self.adapter.input_data.close != NULL: # <<<<<<<<<<<<<< - * self.adapter.input_data.close(self.adapter.input_data) - * close_text_adapter(self.adapter) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":390 - * if self.adapter.input_data.close != NULL: - * self.adapter.input_data.close(self.adapter.input_data) - * close_text_adapter(self.adapter) # <<<<<<<<<<<<<< - * - * - */ - close_text_adapter(__pyx_v_self->adapter); - - /* "TextAdapter/textadapter/TextAdapter.pyx":385 - * kh_destroy_string(self.kh_string_table) - * - * if self.adapter != NULL: # <<<<<<<<<<<<<< - * if self.adapter.input_data.compressed_input != NULL: - * close_gzip(self.adapter.input_data) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":375 - * - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * - * # keys in string hash table are copies of input strings; - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":394 - * - * @property - * def size(self): # <<<<<<<<<<<<<< - * """ Returns number of records in data. """ - * cdef uint64_t num_recs_read = 0 - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_4size_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_4size___get__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_4size___get__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - uint64_t __pyx_v_num_recs_read; - tokenize_func_ptr __pyx_v_tokenizer; - uint32_t __pyx_v_num_fields; - AdapterError __pyx_v_result; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - tokenize_func_ptr __pyx_t_3; - uint32_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":396 - * def size(self): - * """ Returns number of records in data. """ - * cdef uint64_t num_recs_read = 0 # <<<<<<<<<<<<<< - * if self.adapter.num_records > 0: - * return self.adapter.num_records - */ - __pyx_v_num_recs_read = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":397 - * """ Returns number of records in data. """ - * cdef uint64_t num_recs_read = 0 - * if self.adapter.num_records > 0: # <<<<<<<<<<<<<< - * return self.adapter.num_records - * else: - */ - __pyx_t_1 = ((__pyx_v_self->adapter->num_records > 0) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":398 - * cdef uint64_t num_recs_read = 0 - * if self.adapter.num_records > 0: - * return self.adapter.num_records # <<<<<<<<<<<<<< - * else: - * # If number of records is not known, parse data and count records - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->adapter->num_records); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":397 - * """ Returns number of records in data. """ - * cdef uint64_t num_recs_read = 0 - * if self.adapter.num_records > 0: # <<<<<<<<<<<<<< - * return self.adapter.num_records - * else: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":401 - * else: - * # If number of records is not known, parse data and count records - * tokenizer = self.adapter.tokenize # <<<<<<<<<<<<<< - * if self.adapter.tokenize == &json_tokenizer: - * self.adapter.tokenize = &json_record_tokenizer - */ - /*else*/ { - __pyx_t_3 = __pyx_v_self->adapter->tokenize; - __pyx_v_tokenizer = __pyx_t_3; - - /* "TextAdapter/textadapter/TextAdapter.pyx":402 - * # If number of records is not known, parse data and count records - * tokenizer = self.adapter.tokenize - * if self.adapter.tokenize == &json_tokenizer: # <<<<<<<<<<<<<< - * self.adapter.tokenize = &json_record_tokenizer - * else: - */ - __pyx_t_1 = ((__pyx_v_self->adapter->tokenize == (&json_tokenizer)) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":403 - * tokenizer = self.adapter.tokenize - * if self.adapter.tokenize == &json_tokenizer: - * self.adapter.tokenize = &json_record_tokenizer # <<<<<<<<<<<<<< - * else: - * self.adapter.tokenize = &record_tokenizer - */ - __pyx_v_self->adapter->tokenize = (&json_record_tokenizer); - - /* "TextAdapter/textadapter/TextAdapter.pyx":402 - * # If number of records is not known, parse data and count records - * tokenizer = self.adapter.tokenize - * if self.adapter.tokenize == &json_tokenizer: # <<<<<<<<<<<<<< - * self.adapter.tokenize = &json_record_tokenizer - * else: - */ - goto __pyx_L4; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":405 - * self.adapter.tokenize = &json_record_tokenizer - * else: - * self.adapter.tokenize = &record_tokenizer # <<<<<<<<<<<<<< - * num_fields = self.adapter.fields.num_fields - * self.adapter.fields.num_fields = 1 - */ - /*else*/ { - __pyx_v_self->adapter->tokenize = (&record_tokenizer); - } - __pyx_L4:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":406 - * else: - * self.adapter.tokenize = &record_tokenizer - * num_fields = self.adapter.fields.num_fields # <<<<<<<<<<<<<< - * self.adapter.fields.num_fields = 1 - * - */ - __pyx_t_4 = __pyx_v_self->adapter->fields->num_fields; - __pyx_v_num_fields = __pyx_t_4; - - /* "TextAdapter/textadapter/TextAdapter.pyx":407 - * self.adapter.tokenize = &record_tokenizer - * num_fields = self.adapter.fields.num_fields - * self.adapter.fields.num_fields = 1 # <<<<<<<<<<<<<< - * - * result = seek_record(self.adapter, 0) - */ - __pyx_v_self->adapter->fields->num_fields = 1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":409 - * self.adapter.fields.num_fields = 1 - * - * result = seek_record(self.adapter, 0) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * self.__raise_adapter_exception(result) - */ - __pyx_v_result = seek_record(__pyx_v_self->adapter, 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":410 - * - * result = seek_record(self.adapter, 0) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * result = read_records(self.adapter, UINT64_MAX, 1, NULL, &num_recs_read) - */ - __pyx_t_1 = ((__pyx_v_result != ADAPTER_SUCCESS) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":411 - * result = seek_record(self.adapter, 0) - * if result != ADAPTER_SUCCESS: - * self.__raise_adapter_exception(result) # <<<<<<<<<<<<<< - * result = read_records(self.adapter, UINT64_MAX, 1, NULL, &num_recs_read) - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_adapter_exception); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_7) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":410 - * - * result = seek_record(self.adapter, 0) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * result = read_records(self.adapter, UINT64_MAX, 1, NULL, &num_recs_read) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":412 - * if result != ADAPTER_SUCCESS: - * self.__raise_adapter_exception(result) - * result = read_records(self.adapter, UINT64_MAX, 1, NULL, &num_recs_read) # <<<<<<<<<<<<<< - * - * self.adapter.tokenize = tokenizer - */ - __pyx_v_result = read_records(__pyx_v_self->adapter, UINT64_MAX, 1, NULL, (&__pyx_v_num_recs_read)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":414 - * result = read_records(self.adapter, UINT64_MAX, 1, NULL, &num_recs_read) - * - * self.adapter.tokenize = tokenizer # <<<<<<<<<<<<<< - * self.adapter.fields.num_fields = num_fields - * self.adapter.num_records = num_recs_read - */ - __pyx_v_self->adapter->tokenize = __pyx_v_tokenizer; - - /* "TextAdapter/textadapter/TextAdapter.pyx":415 - * - * self.adapter.tokenize = tokenizer - * self.adapter.fields.num_fields = num_fields # <<<<<<<<<<<<<< - * self.adapter.num_records = num_recs_read - * return num_recs_read - */ - __pyx_v_self->adapter->fields->num_fields = __pyx_v_num_fields; - - /* "TextAdapter/textadapter/TextAdapter.pyx":416 - * self.adapter.tokenize = tokenizer - * self.adapter.fields.num_fields = num_fields - * self.adapter.num_records = num_recs_read # <<<<<<<<<<<<<< - * return num_recs_read - * - */ - __pyx_v_self->adapter->num_records = __pyx_v_num_recs_read; - - /* "TextAdapter/textadapter/TextAdapter.pyx":417 - * self.adapter.fields.num_fields = num_fields - * self.adapter.num_records = num_recs_read - * return num_recs_read # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_num_recs_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":394 - * - * @property - * def size(self): # <<<<<<<<<<<<<< - * """ Returns number of records in data. """ - * cdef uint64_t num_recs_read = 0 - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":421 - * - * @property - * def field_count(self): # <<<<<<<<<<<<<< - * """ Returns number of fields in data. """ - * return self.adapter.fields.num_fields - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11field_count_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11field_count_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11field_count___get__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11field_count___get__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":423 - * def field_count(self): - * """ Returns number of fields in data. """ - * return self.adapter.fields.num_fields # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->adapter->fields->num_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":421 - * - * @property - * def field_count(self): # <<<<<<<<<<<<<< - * """ Returns number of fields in data. """ - * return self.adapter.fields.num_fields - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.field_count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":426 - * - * - * def get_field_filter(self): # <<<<<<<<<<<<<< - * """ Returns list of field names or field indices that will be read. """ - * return self._field_filter - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_9get_field_filter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_8get_field_filter[] = " Returns list of field names or field indices that will be read. "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_9get_field_filter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_field_filter (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_8get_field_filter(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_8get_field_filter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_field_filter", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":428 - * def get_field_filter(self): - * """ Returns list of field names or field indices that will be read. """ - * return self._field_filter # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_field_filter); - __pyx_r = __pyx_v_self->_field_filter; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":426 - * - * - * def get_field_filter(self): # <<<<<<<<<<<<<< - * """ Returns list of field names or field indices that will be read. """ - * return self._field_filter - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":431 - * - * - * def set_field_filter(self, fields): # <<<<<<<<<<<<<< - * """ - * Set fields to read. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11set_field_filter(PyObject *__pyx_v_self, PyObject *__pyx_v_fields); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_10set_field_filter[] = "\n Set fields to read.\n\n Args:\n fields: list of field names or indices to read\n "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11set_field_filter(PyObject *__pyx_v_self, PyObject *__pyx_v_fields) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_field_filter (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_10set_field_filter(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_fields)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_gb_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_16set_field_filter_2generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "TextAdapter/textadapter/TextAdapter.pyx":455 - * self._field_filter = sorted(field_filter) - * self.logger.debug('set_field_filter() setting field filter to [{0}]' - * .format(','.join(str(x) for x in self._field_filter))) # <<<<<<<<<<<<<< - * - * - */ - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_16set_field_filter_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *)__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 455, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *) __pyx_self; - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_16set_field_filter_2generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_set_field_filter_locals_genexpr, __pyx_n_s_TextAdapter_textadapter_TextAdapter); if (unlikely(!gen)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_field_filter.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_gb_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_16set_field_filter_2generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - case 1: goto __pyx_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 455, __pyx_L1_error) - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 455, __pyx_L1_error) } - if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_field_filter)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_field_filter)) { - __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_field_filter; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_field_filter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 455, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 455, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 455, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_x); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_x); - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 455, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (1); else __pyx_cur_scope = __pyx_cur_scope; - - /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); __pyx_r = 0; - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":431 - * - * - * def set_field_filter(self, fields): # <<<<<<<<<<<<<< - * """ - * Set fields to read. - */ - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_10set_field_filter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_fields) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *__pyx_cur_scope; - PyObject *__pyx_v_field_filter = NULL; - PyObject *__pyx_v_field = NULL; - PyObject *__pyx_v_index = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *(*__pyx_t_7)(PyObject *); - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - __Pyx_RefNannySetupContext("set_field_filter", 0); - __pyx_cur_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *)__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 431, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - - /* "TextAdapter/textadapter/TextAdapter.pyx":439 - * """ - * - * if fields is None or len(fields) == 0: # <<<<<<<<<<<<<< - * self._field_filter = range(self.field_count) - * else: - */ - __pyx_t_2 = (__pyx_v_fields == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = PyObject_Length(__pyx_v_fields); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 439, __pyx_L1_error) - __pyx_t_3 = ((__pyx_t_4 == 0) != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":440 - * - * if fields is None or len(fields) == 0: - * self._field_filter = range(self.field_count) # <<<<<<<<<<<<<< - * else: - * field_filter = [] - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->_field_filter); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->_field_filter); - __pyx_cur_scope->__pyx_v_self->_field_filter = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":439 - * """ - * - * if fields is None or len(fields) == 0: # <<<<<<<<<<<<<< - * self._field_filter = range(self.field_count) - * else: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":442 - * self._field_filter = range(self.field_count) - * else: - * field_filter = [] # <<<<<<<<<<<<<< - * for field in fields: - * if isinstance(field, (int, long)): - */ - /*else*/ { - __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 442, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_field_filter = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":443 - * else: - * field_filter = [] - * for field in fields: # <<<<<<<<<<<<<< - * if isinstance(field, (int, long)): - * field_filter.append(field) - */ - if (likely(PyList_CheckExact(__pyx_v_fields)) || PyTuple_CheckExact(__pyx_v_fields)) { - __pyx_t_5 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_5); __pyx_t_4 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_fields); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 443, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 443, __pyx_L1_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 443, __pyx_L1_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } - } else { - __pyx_t_6 = __pyx_t_7(__pyx_t_5); - if (unlikely(!__pyx_t_6)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 443, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_6); - __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":444 - * field_filter = [] - * for field in fields: - * if isinstance(field, (int, long)): # <<<<<<<<<<<<<< - * field_filter.append(field) - * elif isinstance(field, string_types): - */ - __pyx_t_3 = PyInt_Check(__pyx_v_field); - __pyx_t_2 = (__pyx_t_3 != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_2 = PyLong_Check(__pyx_v_field); - __pyx_t_3 = (__pyx_t_2 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L9_bool_binop_done:; - __pyx_t_3 = (__pyx_t_1 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":445 - * for field in fields: - * if isinstance(field, (int, long)): - * field_filter.append(field) # <<<<<<<<<<<<<< - * elif isinstance(field, string_types): - * if field not in self._field_names: - */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_field_filter, __pyx_v_field); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 445, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":444 - * field_filter = [] - * for field in fields: - * if isinstance(field, (int, long)): # <<<<<<<<<<<<<< - * field_filter.append(field) - * elif isinstance(field, string_types): - */ - goto __pyx_L8; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":446 - * if isinstance(field, (int, long)): - * field_filter.append(field) - * elif isinstance(field, string_types): # <<<<<<<<<<<<<< - * if field not in self._field_names: - * raise IndexError(field + ' is not a valid field name') - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_string_types); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyObject_IsInstance(__pyx_v_field, __pyx_t_6); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_1 = (__pyx_t_3 != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":447 - * field_filter.append(field) - * elif isinstance(field, string_types): - * if field not in self._field_names: # <<<<<<<<<<<<<< - * raise IndexError(field + ' is not a valid field name') - * index = self._field_names.index(field) - */ - __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_field, __pyx_cur_scope->__pyx_v_self->_field_names, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 447, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_1 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":448 - * elif isinstance(field, string_types): - * if field not in self._field_names: - * raise IndexError(field + ' is not a valid field name') # <<<<<<<<<<<<<< - * index = self._field_names.index(field) - * field_filter.append(index) - */ - __pyx_t_6 = PyNumber_Add(__pyx_v_field, __pyx_kp_s_is_not_a_valid_field_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 448, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":447 - * field_filter.append(field) - * elif isinstance(field, string_types): - * if field not in self._field_names: # <<<<<<<<<<<<<< - * raise IndexError(field + ' is not a valid field name') - * index = self._field_names.index(field) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":449 - * if field not in self._field_names: - * raise IndexError(field + ' is not a valid field name') - * index = self._field_names.index(field) # <<<<<<<<<<<<<< - * field_filter.append(index) - * else: - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_field_names, __pyx_n_s_index); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - if (!__pyx_t_10) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_field); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_field}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_field}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else - #endif - { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_INCREF(__pyx_v_field); - __Pyx_GIVEREF(__pyx_v_field); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_field); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_6); - __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":450 - * raise IndexError(field + ' is not a valid field name') - * index = self._field_names.index(field) - * field_filter.append(index) # <<<<<<<<<<<<<< - * else: - * raise TypeError('Field must be int or string') - */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_field_filter, __pyx_v_index); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 450, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":446 - * if isinstance(field, (int, long)): - * field_filter.append(field) - * elif isinstance(field, string_types): # <<<<<<<<<<<<<< - * if field not in self._field_names: - * raise IndexError(field + ' is not a valid field name') - */ - goto __pyx_L8; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":452 - * field_filter.append(index) - * else: - * raise TypeError('Field must be int or string') # <<<<<<<<<<<<<< - * self._field_filter = sorted(field_filter) - * self.logger.debug('set_field_filter() setting field filter to [{0}]' - */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 452, __pyx_L1_error) - } - __pyx_L8:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":443 - * else: - * field_filter = [] - * for field in fields: # <<<<<<<<<<<<<< - * if isinstance(field, (int, long)): - * field_filter.append(field) - */ - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":453 - * else: - * raise TypeError('Field must be int or string') - * self._field_filter = sorted(field_filter) # <<<<<<<<<<<<<< - * self.logger.debug('set_field_filter() setting field filter to [{0}]' - * .format(','.join(str(x) for x in self._field_filter))) - */ - __pyx_t_6 = PySequence_List(__pyx_v_field_filter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = ((PyObject*)__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_8 = PyList_Sort(__pyx_t_5); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->_field_filter); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->_field_filter); - __pyx_cur_scope->__pyx_v_self->_field_filter = __pyx_t_5; - __pyx_t_5 = 0; - } - __pyx_L3:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":454 - * raise TypeError('Field must be int or string') - * self._field_filter = sorted(field_filter) - * self.logger.debug('set_field_filter() setting field filter to [{0}]' # <<<<<<<<<<<<<< - * .format(','.join(str(x) for x in self._field_filter))) - * - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->logger, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - - /* "TextAdapter/textadapter/TextAdapter.pyx":455 - * self._field_filter = sorted(field_filter) - * self.logger.debug('set_field_filter() setting field filter to [{0}]' - * .format(','.join(str(x) for x in self._field_filter))) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_set_field_filter_setting_field_f, __pyx_n_s_format); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_16set_field_filter_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = __Pyx_PyString_Join(__pyx_kp_s__50, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - } - } - if (!__pyx_t_10) { - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_11)) { - PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_12}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) { - PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_12}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_12); - __pyx_t_12 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_13, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_11) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_9}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_9}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":431 - * - * - * def set_field_filter(self, fields): # <<<<<<<<<<<<<< - * """ - * Set fields to read. - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_field_filter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_field_filter); - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":461 - * - * - * def get_field_names(self): # <<<<<<<<<<<<<< - * """ Returns list of field names. """ - * return self._field_names - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_13get_field_names(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_12get_field_names[] = " Returns list of field names. "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_13get_field_names(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_field_names (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_12get_field_names(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_12get_field_names(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_field_names", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":463 - * def get_field_names(self): - * """ Returns list of field names. """ - * return self._field_names # <<<<<<<<<<<<<< - * - * def set_field_names(self, field_names): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_field_names); - __pyx_r = __pyx_v_self->_field_names; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":461 - * - * - * def get_field_names(self): # <<<<<<<<<<<<<< - * """ Returns list of field names. """ - * return self._field_names - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":465 - * return self._field_names - * - * def set_field_names(self, field_names): # <<<<<<<<<<<<<< - * """ - * Set field names - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_names(PyObject *__pyx_v_self, PyObject *__pyx_v_field_names); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_14set_field_names[] = "\n Set field names\n\n Args:\n field_names: list of field names. A name must be supplied for every\n field in data.\n "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_names(PyObject *__pyx_v_self, PyObject *__pyx_v_field_names) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_field_names (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_14set_field_names(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_field_names)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_gb_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_names_2generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "TextAdapter/textadapter/TextAdapter.pyx":478 - * self._field_names = field_names - * self.logger.debug('set_field_names() setting field names to [{0}]' - * .format(','.join(str(x) for x in self._field_names))) # <<<<<<<<<<<<<< - * - * field_names = property(get_field_names, set_field_names) - */ - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_names_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *)__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 478, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *) __pyx_self; - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_names_2generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_set_field_names_locals_genexpr, __pyx_n_s_TextAdapter_textadapter_TextAdapter); if (unlikely(!gen)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_field_names.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_gb_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_names_2generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - case 1: goto __pyx_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 478, __pyx_L1_error) - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 478, __pyx_L1_error) } - if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_field_names)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_field_names)) { - __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_field_names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_field_names); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 478, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 478, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 478, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 478, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_x); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_x); - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 478, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (1); else __pyx_cur_scope = __pyx_cur_scope; - - /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); __pyx_r = 0; - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":465 - * return self._field_names - * - * def set_field_names(self, field_names): # <<<<<<<<<<<<<< - * """ - * Set field names - */ - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_14set_field_names(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_field_names) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - __Pyx_RefNannySetupContext("set_field_names", 0); - __pyx_cur_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *)__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 465, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - - /* "TextAdapter/textadapter/TextAdapter.pyx":473 - * field in data. - * """ - * if len(field_names) != self.field_count: # <<<<<<<<<<<<<< - * raise ValueError('Number of field names ({0}) does not match number of ' - * 'fields ({1}) in data source'.format(len(field_names), self.field_count)) - */ - __pyx_t_1 = PyObject_Length(__pyx_v_field_names); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 473, __pyx_L1_error) - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":475 - * if len(field_names) != self.field_count: - * raise ValueError('Number of field names ({0}) does not match number of ' - * 'fields ({1}) in data source'.format(len(field_names), self.field_count)) # <<<<<<<<<<<<<< - * self._field_names = field_names - * self.logger.debug('set_field_names() setting field names to [{0}]' - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Number_of_field_names_0_does_not, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Length(__pyx_v_field_names); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 475, __pyx_L1_error) - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_2, __pyx_t_6}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_2, __pyx_t_6}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6); - __pyx_t_2 = 0; - __pyx_t_6 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":474 - * """ - * if len(field_names) != self.field_count: - * raise ValueError('Number of field names ({0}) does not match number of ' # <<<<<<<<<<<<<< - * 'fields ({1}) in data source'.format(len(field_names), self.field_count)) - * self._field_names = field_names - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 474, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":473 - * field in data. - * """ - * if len(field_names) != self.field_count: # <<<<<<<<<<<<<< - * raise ValueError('Number of field names ({0}) does not match number of ' - * 'fields ({1}) in data source'.format(len(field_names), self.field_count)) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":476 - * raise ValueError('Number of field names ({0}) does not match number of ' - * 'fields ({1}) in data source'.format(len(field_names), self.field_count)) - * self._field_names = field_names # <<<<<<<<<<<<<< - * self.logger.debug('set_field_names() setting field names to [{0}]' - * .format(','.join(str(x) for x in self._field_names))) - */ - __Pyx_INCREF(__pyx_v_field_names); - __Pyx_GIVEREF(__pyx_v_field_names); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->_field_names); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->_field_names); - __pyx_cur_scope->__pyx_v_self->_field_names = __pyx_v_field_names; - - /* "TextAdapter/textadapter/TextAdapter.pyx":477 - * 'fields ({1}) in data source'.format(len(field_names), self.field_count)) - * self._field_names = field_names - * self.logger.debug('set_field_names() setting field names to [{0}]' # <<<<<<<<<<<<<< - * .format(','.join(str(x) for x in self._field_names))) - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->logger, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "TextAdapter/textadapter/TextAdapter.pyx":478 - * self._field_names = field_names - * self.logger.debug('set_field_names() setting field names to [{0}]' - * .format(','.join(str(x) for x in self._field_names))) # <<<<<<<<<<<<<< - * - * field_names = property(get_field_names, set_field_names) - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_set_field_names_setting_field_na, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_names_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyString_Join(__pyx_kp_s__50, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_2) { - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_7}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_7}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_6) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_9}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_9}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":465 - * return self._field_names - * - * def set_field_names(self, field_names): # <<<<<<<<<<<<<< - * """ - * Set field names - */ - - /* function exit code */ - __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_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_field_names", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":483 - * - * - * def get_field_types(self): # <<<<<<<<<<<<<< - * """ Returns dict of fields and field dtypes. """ - * return self.mapping - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_17get_field_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_16get_field_types[] = " Returns dict of fields and field dtypes. "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_17get_field_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_field_types (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_16get_field_types(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_16get_field_types(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_field_types", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":485 - * def get_field_types(self): - * """ Returns dict of fields and field dtypes. """ - * return self.mapping # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->mapping); - __pyx_r = __pyx_v_self->mapping; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":483 - * - * - * def get_field_types(self): # <<<<<<<<<<<<<< - * """ Returns dict of fields and field dtypes. """ - * return self.mapping - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":488 - * - * - * def set_field_types(self, types=None): # <<<<<<<<<<<<<< - * """ - * Set field dtype for each field. dtype should be in NumPy dtype format. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_19set_field_types(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_18set_field_types[] = "\n Set field dtype for each field. dtype should be in NumPy dtype format.\n\n Args:\n types: dict of mapping between field name or index, and field type\n "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_19set_field_types(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_types = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_field_types (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_types,0}; - PyObject* values[1] = {0}; - values[0] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_types); - if (value) { values[0] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_field_types") < 0)) __PYX_ERR(0, 488, __pyx_L3_error) - } - } else { - 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; - } - } - __pyx_v_types = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_field_types", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 488, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_field_types", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_18set_field_types(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), __pyx_v_types); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_gb_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_types_2generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "TextAdapter/textadapter/TextAdapter.pyx":517 - * 'or None to reset field types') - * self.logger.debug('set_field_types() setting dtypes to {0}' - * .format(','.join(str(field) + ':' + str(dtype) for field,dtype in self.mapping.iteritems()))) # <<<<<<<<<<<<<< - * - * - */ - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_types_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *)__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 517, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *) __pyx_self; - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_types_2generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_set_field_types_locals_genexpr, __pyx_n_s_TextAdapter_textadapter_TextAdapter); if (unlikely(!gen)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_field_types.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_gb_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_types_2generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - case 1: goto __pyx_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 517, __pyx_L1_error) - __pyx_t_2 = 0; - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 517, __pyx_L1_error) } - if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->mapping == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); - __PYX_ERR(0, 517, __pyx_L1_error) - } - __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->mapping, 0, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_5; - __pyx_t_5 = 0; - while (1) { - __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4); - if (unlikely(__pyx_t_7 == 0)) break; - if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_field); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_field, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_dtype); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_dtype, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_field); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_field); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_field); - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_kp_s__51); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_dtype); - __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_3 = __pyx_t_4; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_3; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 517, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (1); else __pyx_cur_scope = __pyx_cur_scope; - - /* function exit code */ - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); __pyx_r = 0; - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":488 - * - * - * def set_field_types(self, types=None): # <<<<<<<<<<<<<< - * """ - * Set field dtype for each field. dtype should be in NumPy dtype format. - */ - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_18set_field_types(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_types) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *__pyx_cur_scope; - PyObject *__pyx_v_field = NULL; - PyObject *__pyx_v_dtype = NULL; - PyObject *__pyx_v_numpy_dtype = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *(*__pyx_t_11)(PyObject *); - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - __Pyx_RefNannySetupContext("set_field_types", 0); - __pyx_cur_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *)__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 488, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - - /* "TextAdapter/textadapter/TextAdapter.pyx":495 - * types: dict of mapping between field name or index, and field type - * """ - * if self.adapter.fields.num_fields == 0: # <<<<<<<<<<<<<< - * raise errors.ConfigurationError('Adapter has no fields specified') - * - */ - __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_self->adapter->fields->num_fields == 0) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":496 - * """ - * if self.adapter.fields.num_fields == 0: - * raise errors.ConfigurationError('Adapter has no fields specified') # <<<<<<<<<<<<<< - * - * # Reset field types to type infer and default to u8 - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ConfigurationError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__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_ERR(0, 496, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":495 - * types: dict of mapping between field name or index, and field type - * """ - * if self.adapter.fields.num_fields == 0: # <<<<<<<<<<<<<< - * raise errors.ConfigurationError('Adapter has no fields specified') - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":499 - * - * # Reset field types to type infer and default to u8 - * self.mapping = {} # <<<<<<<<<<<<<< - * for field in range(self.adapter.fields.num_fields): - * self.adapter.fields.field_info[field].infer_type = 1 - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->mapping); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->mapping); - __pyx_cur_scope->__pyx_v_self->mapping = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":500 - * # Reset field types to type infer and default to u8 - * self.mapping = {} - * for field in range(self.adapter.fields.num_fields): # <<<<<<<<<<<<<< - * self.adapter.fields.field_info[field].infer_type = 1 - * - */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_self->adapter->fields->num_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 500, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 500, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 500, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 500, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":501 - * self.mapping = {} - * for field in range(self.adapter.fields.num_fields): - * self.adapter.fields.field_info[field].infer_type = 1 # <<<<<<<<<<<<<< - * - * if isinstance(types, dict): - */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_field); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 501, __pyx_L1_error) - (__pyx_cur_scope->__pyx_v_self->adapter->fields->field_info[__pyx_t_6]).infer_type = 1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":500 - * # Reset field types to type infer and default to u8 - * self.mapping = {} - * for field in range(self.adapter.fields.num_fields): # <<<<<<<<<<<<<< - * self.adapter.fields.field_info[field].infer_type = 1 - * - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":503 - * self.adapter.fields.field_info[field].infer_type = 1 - * - * if isinstance(types, dict): # <<<<<<<<<<<<<< - * for field, dtype in types.items(): - * if isinstance(field, string_types): - */ - __pyx_t_1 = PyDict_Check(__pyx_v_types); - __pyx_t_7 = (__pyx_t_1 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":504 - * - * if isinstance(types, dict): - * for field, dtype in types.items(): # <<<<<<<<<<<<<< - * if isinstance(field, string_types): - * field = self._field_names.index(field) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_types, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_8) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(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_ERR(0, 504, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 504, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 504, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 504, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_5(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 504, __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 !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 504, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_8 = PyList_GET_ITEM(sequence, 0); - __pyx_t_9 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - #else - __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 504, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 504, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 504, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; - index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 504, __pyx_L1_error) - __pyx_t_11 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L10_unpacking_done; - __pyx_L9_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 504, __pyx_L1_error) - __pyx_L10_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_8); - __pyx_t_8 = 0; - __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_9); - __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":505 - * if isinstance(types, dict): - * for field, dtype in types.items(): - * if isinstance(field, string_types): # <<<<<<<<<<<<<< - * field = self._field_names.index(field) - * numpy_dtype = numpy.dtype(dtype) - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_string_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyObject_IsInstance(__pyx_v_field, __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = (__pyx_t_7 != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":506 - * for field, dtype in types.items(): - * if isinstance(field, string_types): - * field = self._field_names.index(field) # <<<<<<<<<<<<<< - * numpy_dtype = numpy.dtype(dtype) - * if numpy.version.version[0:3] == '1.6' and \ - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_field_names, __pyx_n_s_index); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - if (!__pyx_t_8) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_field); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_field}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_field}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_INCREF(__pyx_v_field); - __Pyx_GIVEREF(__pyx_v_field); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_field); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF_SET(__pyx_v_field, __pyx_t_3); - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":505 - * if isinstance(types, dict): - * for field, dtype in types.items(): - * if isinstance(field, string_types): # <<<<<<<<<<<<<< - * field = self._field_names.index(field) - * numpy_dtype = numpy.dtype(dtype) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":507 - * if isinstance(field, string_types): - * field = self._field_names.index(field) - * numpy_dtype = numpy.dtype(dtype) # <<<<<<<<<<<<<< - * if numpy.version.version[0:3] == '1.6' and \ - * (numpy_dtype.kind == 'M' or numpy_dtype.kind == 'm'): - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dtype); - __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_3, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_numpy_dtype, __pyx_t_9); - __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":508 - * field = self._field_names.index(field) - * numpy_dtype = numpy.dtype(dtype) - * if numpy.version.version[0:3] == '1.6' and \ # <<<<<<<<<<<<<< - * (numpy_dtype.kind == 'M' or numpy_dtype.kind == 'm'): - * raise TypeError('NumPy 1.6 datetime/timedelta not supported') - */ - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_version); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_9, 0, 3, NULL, NULL, &__pyx_slice__53, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s_1_6, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { - } else { - __pyx_t_1 = __pyx_t_7; - goto __pyx_L13_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":509 - * numpy_dtype = numpy.dtype(dtype) - * if numpy.version.version[0:3] == '1.6' and \ - * (numpy_dtype.kind == 'M' or numpy_dtype.kind == 'm'): # <<<<<<<<<<<<<< - * raise TypeError('NumPy 1.6 datetime/timedelta not supported') - * self.mapping[int(field)] = numpy_dtype - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_numpy_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 509, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_M, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 509, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_7) { - } else { - __pyx_t_1 = __pyx_t_7; - goto __pyx_L13_bool_binop_done; - } - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_numpy_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 509, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_m, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 509, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __pyx_t_7; - __pyx_L13_bool_binop_done:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":508 - * field = self._field_names.index(field) - * numpy_dtype = numpy.dtype(dtype) - * if numpy.version.version[0:3] == '1.6' and \ # <<<<<<<<<<<<<< - * (numpy_dtype.kind == 'M' or numpy_dtype.kind == 'm'): - * raise TypeError('NumPy 1.6 datetime/timedelta not supported') - */ - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":510 - * if numpy.version.version[0:3] == '1.6' and \ - * (numpy_dtype.kind == 'M' or numpy_dtype.kind == 'm'): - * raise TypeError('NumPy 1.6 datetime/timedelta not supported') # <<<<<<<<<<<<<< - * self.mapping[int(field)] = numpy_dtype - * self.adapter.fields.field_info[field].infer_type = 0 - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __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_ERR(0, 510, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":508 - * field = self._field_names.index(field) - * numpy_dtype = numpy.dtype(dtype) - * if numpy.version.version[0:3] == '1.6' and \ # <<<<<<<<<<<<<< - * (numpy_dtype.kind == 'M' or numpy_dtype.kind == 'm'): - * raise TypeError('NumPy 1.6 datetime/timedelta not supported') - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":511 - * (numpy_dtype.kind == 'M' or numpy_dtype.kind == 'm'): - * raise TypeError('NumPy 1.6 datetime/timedelta not supported') - * self.mapping[int(field)] = numpy_dtype # <<<<<<<<<<<<<< - * self.adapter.fields.field_info[field].infer_type = 0 - * elif types is not None: - */ - __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_field); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_self->mapping, __pyx_t_3, __pyx_v_numpy_dtype) < 0)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":512 - * raise TypeError('NumPy 1.6 datetime/timedelta not supported') - * self.mapping[int(field)] = numpy_dtype - * self.adapter.fields.field_info[field].infer_type = 0 # <<<<<<<<<<<<<< - * elif types is not None: - * raise TypeError('types must be dict of fields/dtypes, ' - */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_field); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 512, __pyx_L1_error) - (__pyx_cur_scope->__pyx_v_self->adapter->fields->field_info[__pyx_t_6]).infer_type = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":504 - * - * if isinstance(types, dict): - * for field, dtype in types.items(): # <<<<<<<<<<<<<< - * if isinstance(field, string_types): - * field = self._field_names.index(field) - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":503 - * self.adapter.fields.field_info[field].infer_type = 1 - * - * if isinstance(types, dict): # <<<<<<<<<<<<<< - * for field, dtype in types.items(): - * if isinstance(field, string_types): - */ - goto __pyx_L6; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":513 - * self.mapping[int(field)] = numpy_dtype - * self.adapter.fields.field_info[field].infer_type = 0 - * elif types is not None: # <<<<<<<<<<<<<< - * raise TypeError('types must be dict of fields/dtypes, ' - * 'or None to reset field types') - */ - __pyx_t_1 = (__pyx_v_types != Py_None); - __pyx_t_7 = (__pyx_t_1 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":514 - * self.adapter.fields.field_info[field].infer_type = 0 - * elif types is not None: - * raise TypeError('types must be dict of fields/dtypes, ' # <<<<<<<<<<<<<< - * 'or None to reset field types') - * self.logger.debug('set_field_types() setting dtypes to {0}' - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __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_ERR(0, 514, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":513 - * self.mapping[int(field)] = numpy_dtype - * self.adapter.fields.field_info[field].infer_type = 0 - * elif types is not None: # <<<<<<<<<<<<<< - * raise TypeError('types must be dict of fields/dtypes, ' - * 'or None to reset field types') - */ - } - __pyx_L6:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":516 - * raise TypeError('types must be dict of fields/dtypes, ' - * 'or None to reset field types') - * self.logger.debug('set_field_types() setting dtypes to {0}' # <<<<<<<<<<<<<< - * .format(','.join(str(field) + ':' + str(dtype) for field,dtype in self.mapping.iteritems()))) - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->logger, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "TextAdapter/textadapter/TextAdapter.pyx":517 - * 'or None to reset field types') - * self.logger.debug('set_field_types() setting dtypes to {0}' - * .format(','.join(str(field) + ':' + str(dtype) for field,dtype in self.mapping.iteritems()))) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_set_field_types_setting_dtypes_t, __pyx_n_s_format); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_types_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = __Pyx_PyString_Join(__pyx_kp_s__50, __pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - if (!__pyx_t_8) { - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_12}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_12}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_12); - __pyx_t_12 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_13, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_10) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_9}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_9}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":488 - * - * - * def set_field_types(self, types=None): # <<<<<<<<<<<<<< - * """ - * Set field dtype for each field. dtype should be in NumPy dtype format. - */ - - /* function exit code */ - __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_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_field_types", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XDECREF(__pyx_v_dtype); - __Pyx_XDECREF(__pyx_v_numpy_dtype); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":523 - * - * - * def create_index(self, index_name=None, density=DEFAULT_INDEX_DENSITY): # <<<<<<<<<<<<<< - * """ - * Build index of record offsets to allow fast random access. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_21create_index(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_20create_index[] = "\n Build index of record offsets to allow fast random access.\n\n Args:\n index_name: Name of file to save index to (default is None which does\n not save to disk).\n density: Density of index. Value of 1 will index every record,\n value of 2 will index every other record, etc.\n "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_21create_index(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_index_name = 0; - PyObject *__pyx_v_density = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("create_index (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index_name,&__pyx_n_s_density,0}; - PyObject* values[2] = {0,0}; - values[0] = ((PyObject *)Py_None); - values[1] = __pyx_k__56; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_name); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_density); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_index") < 0)) __PYX_ERR(0, 523, __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); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_index_name = values[0]; - __pyx_v_density = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("create_index", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 523, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.create_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_20create_index(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), __pyx_v_index_name, __pyx_v_density); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_20create_index(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_index_name, PyObject *__pyx_v_density) { - AdapterError __pyx_v_result; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - uint64_t __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("create_index", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":535 - * cdef AdapterError result - * - * if index_name is not None: # <<<<<<<<<<<<<< - * if os.path.exists(index_name): - * os.remove(index_name) - */ - __pyx_t_1 = (__pyx_v_index_name != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":536 - * - * if index_name is not None: - * if os.path.exists(index_name): # <<<<<<<<<<<<<< - * os.remove(index_name) - * - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exists); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_index_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_index_name}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_index_name}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_index_name); - __Pyx_GIVEREF(__pyx_v_index_name); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_index_name); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":537 - * if index_name is not None: - * if os.path.exists(index_name): - * os.remove(index_name) # <<<<<<<<<<<<<< - * - * self.indexing = True - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_remove); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_index_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_index_name}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_index_name}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_index_name); - __Pyx_GIVEREF(__pyx_v_index_name); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_index_name); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":536 - * - * if index_name is not None: - * if os.path.exists(index_name): # <<<<<<<<<<<<<< - * os.remove(index_name) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":535 - * cdef AdapterError result - * - * if index_name is not None: # <<<<<<<<<<<<<< - * if os.path.exists(index_name): - * os.remove(index_name) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":539 - * os.remove(index_name) - * - * self.indexing = True # <<<<<<<<<<<<<< - * self.exact_index = ExactIndex(index_name=index_name, density = density) - * self.adapter.index = self.exact_index - */ - __Pyx_INCREF(Py_True); - __Pyx_GIVEREF(Py_True); - __Pyx_GOTREF(__pyx_v_self->indexing); - __Pyx_DECREF(__pyx_v_self->indexing); - __pyx_v_self->indexing = Py_True; - - /* "TextAdapter/textadapter/TextAdapter.pyx":540 - * - * self.indexing = True - * self.exact_index = ExactIndex(index_name=index_name, density = density) # <<<<<<<<<<<<<< - * self.adapter.index = self.exact_index - * self.adapter.input_data.index = self.exact_index - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ExactIndex); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_index_name, __pyx_v_index_name) < 0) __PYX_ERR(0, 540, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_density, __pyx_v_density) < 0) __PYX_ERR(0, 540, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_v_self->exact_index); - __Pyx_DECREF(__pyx_v_self->exact_index); - __pyx_v_self->exact_index = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":541 - * self.indexing = True - * self.exact_index = ExactIndex(index_name=index_name, density = density) - * self.adapter.index = self.exact_index # <<<<<<<<<<<<<< - * self.adapter.input_data.index = self.exact_index - * self.adapter.index_density = density - */ - __pyx_v_self->adapter->index = ((void *)__pyx_v_self->exact_index); - - /* "TextAdapter/textadapter/TextAdapter.pyx":542 - * self.exact_index = ExactIndex(index_name=index_name, density = density) - * self.adapter.index = self.exact_index - * self.adapter.input_data.index = self.exact_index # <<<<<<<<<<<<<< - * self.adapter.index_density = density - * self.adapter.indexer = &indexer_callback - */ - __pyx_v_self->adapter->input_data->index = ((void *)__pyx_v_self->exact_index); - - /* "TextAdapter/textadapter/TextAdapter.pyx":543 - * self.adapter.index = self.exact_index - * self.adapter.input_data.index = self.exact_index - * self.adapter.index_density = density # <<<<<<<<<<<<<< - * self.adapter.indexer = &indexer_callback - * self.adapter.index_lookup = &index_lookup_callback - */ - __pyx_t_7 = __Pyx_PyInt_As_uint64_t(__pyx_v_density); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L1_error) - __pyx_v_self->adapter->index_density = __pyx_t_7; - - /* "TextAdapter/textadapter/TextAdapter.pyx":544 - * self.adapter.input_data.index = self.exact_index - * self.adapter.index_density = density - * self.adapter.indexer = &indexer_callback # <<<<<<<<<<<<<< - * self.adapter.index_lookup = &index_lookup_callback - * if self.compression == 'gzip': - */ - __pyx_v_self->adapter->indexer = (&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_indexer_callback); - - /* "TextAdapter/textadapter/TextAdapter.pyx":545 - * self.adapter.index_density = density - * self.adapter.indexer = &indexer_callback - * self.adapter.index_lookup = &index_lookup_callback # <<<<<<<<<<<<<< - * if self.compression == 'gzip': - * self.adapter.add_gzip_access_point = &add_gzip_access_point_callback - */ - __pyx_v_self->adapter->index_lookup = (&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_index_lookup_callback); - - /* "TextAdapter/textadapter/TextAdapter.pyx":546 - * self.adapter.indexer = &indexer_callback - * self.adapter.index_lookup = &index_lookup_callback - * if self.compression == 'gzip': # <<<<<<<<<<<<<< - * self.adapter.add_gzip_access_point = &add_gzip_access_point_callback - * self.adapter.input_data.get_gzip_access_point = &get_gzip_access_point_callback - */ - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_self->compression, __pyx_n_s_gzip, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 546, __pyx_L1_error) - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":547 - * self.adapter.index_lookup = &index_lookup_callback - * if self.compression == 'gzip': - * self.adapter.add_gzip_access_point = &add_gzip_access_point_callback # <<<<<<<<<<<<<< - * self.adapter.input_data.get_gzip_access_point = &get_gzip_access_point_callback - * else: - */ - __pyx_v_self->adapter->add_gzip_access_point = (&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_add_gzip_access_point_callback); - - /* "TextAdapter/textadapter/TextAdapter.pyx":548 - * if self.compression == 'gzip': - * self.adapter.add_gzip_access_point = &add_gzip_access_point_callback - * self.adapter.input_data.get_gzip_access_point = &get_gzip_access_point_callback # <<<<<<<<<<<<<< - * else: - * self.adapter.add_gzip_access_point = NULL - */ - __pyx_v_self->adapter->input_data->get_gzip_access_point = (&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_get_gzip_access_point_callback); - - /* "TextAdapter/textadapter/TextAdapter.pyx":546 - * self.adapter.indexer = &indexer_callback - * self.adapter.index_lookup = &index_lookup_callback - * if self.compression == 'gzip': # <<<<<<<<<<<<<< - * self.adapter.add_gzip_access_point = &add_gzip_access_point_callback - * self.adapter.input_data.get_gzip_access_point = &get_gzip_access_point_callback - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":550 - * self.adapter.input_data.get_gzip_access_point = &get_gzip_access_point_callback - * else: - * self.adapter.add_gzip_access_point = NULL # <<<<<<<<<<<<<< - * self.adapter.input_data.get_gzip_access_point = NULL - * - */ - /*else*/ { - __pyx_v_self->adapter->add_gzip_access_point = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":551 - * else: - * self.adapter.add_gzip_access_point = NULL - * self.adapter.input_data.get_gzip_access_point = NULL # <<<<<<<<<<<<<< - * - * result = seek_record(self.adapter, 0) - */ - __pyx_v_self->adapter->input_data->get_gzip_access_point = NULL; - } - __pyx_L5:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":553 - * self.adapter.input_data.get_gzip_access_point = NULL - * - * result = seek_record(self.adapter, 0) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * self.__raise_adapter_exception(result) - */ - __pyx_v_result = seek_record(__pyx_v_self->adapter, 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":554 - * - * result = seek_record(self.adapter, 0) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * - */ - __pyx_t_2 = ((__pyx_v_result != ADAPTER_SUCCESS) != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":555 - * result = seek_record(self.adapter, 0) - * if result != ADAPTER_SUCCESS: - * self.__raise_adapter_exception(result) # <<<<<<<<<<<<<< - * - * if self.compression == 'gzip': - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_adapter_exception); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 555, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 555, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_4) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 555, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 555, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 555, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 555, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 555, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":554 - * - * result = seek_record(self.adapter, 0) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":557 - * self.__raise_adapter_exception(result) - * - * if self.compression == 'gzip': # <<<<<<<<<<<<<< - * build_gzip_index(self.adapter) - * else: - */ - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_self->compression, __pyx_n_s_gzip, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 557, __pyx_L1_error) - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":558 - * - * if self.compression == 'gzip': - * build_gzip_index(self.adapter) # <<<<<<<<<<<<<< - * else: - * build_index(self.adapter) - */ - build_gzip_index(__pyx_v_self->adapter); - - /* "TextAdapter/textadapter/TextAdapter.pyx":557 - * self.__raise_adapter_exception(result) - * - * if self.compression == 'gzip': # <<<<<<<<<<<<<< - * build_gzip_index(self.adapter) - * else: - */ - goto __pyx_L7; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":560 - * build_gzip_index(self.adapter) - * else: - * build_index(self.adapter) # <<<<<<<<<<<<<< - * - * self.exact_index.finalize(self.adapter.num_records) - */ - /*else*/ { - build_index(__pyx_v_self->adapter); - } - __pyx_L7:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":562 - * build_index(self.adapter) - * - * self.exact_index.finalize(self.adapter.num_records) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->exact_index, __pyx_n_s_finalize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->adapter->num_records); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_3) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_8}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_8}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":523 - * - * - * def create_index(self, index_name=None, density=DEFAULT_INDEX_DENSITY): # <<<<<<<<<<<<<< - * """ - * Build index of record offsets to allow fast random access. - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.create_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":565 - * - * - * def set_converter(self, field, converter): # <<<<<<<<<<<<<< - * """ - * Set converter function for field. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_23set_converter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_22set_converter[] = "\n Set converter function for field.\n\n Args:\n field: field to apply converter function\n converter: python function object, or function pointer as longint object\n "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_23set_converter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_field = 0; - PyObject *__pyx_v_converter = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_converter (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,&__pyx_n_s_converter,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_converter)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_converter", 1, 2, 2, 1); __PYX_ERR(0, 565, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_converter") < 0)) __PYX_ERR(0, 565, __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_field = values[0]; - __pyx_v_converter = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_converter", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 565, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_converter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_22set_converter(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), __pyx_v_field, __pyx_v_converter); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":586 - * - * self.build_converter[field] = \ - * lambda: self.__build_python_converter(field, converter) # <<<<<<<<<<<<<< - * - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_13set_converter_lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_13set_converter_lambda3 = {"lambda3", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_13set_converter_lambda3, METH_NOARGS, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_13set_converter_lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *__pyx_cur_scope; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *__pyx_outer_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("lambda3", 0); - __pyx_outer_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 586, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_build_python_converter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(!__pyx_cur_scope->__pyx_v_field)) { __Pyx_RaiseClosureNameError("field"); __PYX_ERR(0, 586, __pyx_L1_error) } - if (unlikely(!__pyx_cur_scope->__pyx_v_converter)) { __Pyx_RaiseClosureNameError("converter"); __PYX_ERR(0, 586, __pyx_L1_error) } - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_field, __pyx_cur_scope->__pyx_v_converter}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_field, __pyx_cur_scope->__pyx_v_converter}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_field); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_field); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_field); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_converter); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_converter); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_converter); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_converter.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":565 - * - * - * def set_converter(self, field, converter): # <<<<<<<<<<<<<< - * """ - * Set converter function for field. - */ - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_22set_converter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_converter) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("set_converter", 0); - __pyx_cur_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *)__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 565, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __pyx_cur_scope->__pyx_v_field = __pyx_v_field; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_field); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_field); - __pyx_cur_scope->__pyx_v_converter = __pyx_v_converter; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_converter); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_converter); - - /* "TextAdapter/textadapter/TextAdapter.pyx":574 - * """ - * - * if isinstance(field, (int, long)): # <<<<<<<<<<<<<< - * if field < 0 or field > self.field_count: - * raise ValueError('Invalid field number') - */ - __pyx_t_2 = __pyx_cur_scope->__pyx_v_field; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = PyInt_Check(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = (__pyx_t_3 != 0); - if (!__pyx_t_4) { - } else { - __pyx_t_1 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = __pyx_cur_scope->__pyx_v_field; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_4 = PyLong_Check(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = (__pyx_t_4 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L4_bool_binop_done:; - __pyx_t_3 = (__pyx_t_1 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":575 - * - * if isinstance(field, (int, long)): - * if field < 0 or field > self.field_count: # <<<<<<<<<<<<<< - * raise ValueError('Invalid field number') - * elif isinstance(field, string_types): - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_field, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 575, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!__pyx_t_1) { - } else { - __pyx_t_3 = __pyx_t_1; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_field, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 575, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 575, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __pyx_t_1; - __pyx_L7_bool_binop_done:; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":576 - * if isinstance(field, (int, long)): - * if field < 0 or field > self.field_count: - * raise ValueError('Invalid field number') # <<<<<<<<<<<<<< - * elif isinstance(field, string_types): - * if field in self._field_names: - */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 576, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":575 - * - * if isinstance(field, (int, long)): - * if field < 0 or field > self.field_count: # <<<<<<<<<<<<<< - * raise ValueError('Invalid field number') - * elif isinstance(field, string_types): - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":574 - * """ - * - * if isinstance(field, (int, long)): # <<<<<<<<<<<<<< - * if field < 0 or field > self.field_count: - * raise ValueError('Invalid field number') - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":577 - * if field < 0 or field > self.field_count: - * raise ValueError('Invalid field number') - * elif isinstance(field, string_types): # <<<<<<<<<<<<<< - * if field in self._field_names: - * field = self._field_names.index(field) - */ - __pyx_t_5 = __pyx_cur_scope->__pyx_v_field; - __Pyx_INCREF(__pyx_t_5); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_string_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_IsInstance(__pyx_t_5, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 577, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = (__pyx_t_3 != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":578 - * raise ValueError('Invalid field number') - * elif isinstance(field, string_types): - * if field in self._field_names: # <<<<<<<<<<<<<< - * field = self._field_names.index(field) - * else: - */ - __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_cur_scope->__pyx_v_field, __pyx_cur_scope->__pyx_v_self->_field_names, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 578, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_1 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":579 - * elif isinstance(field, string_types): - * if field in self._field_names: - * field = self._field_names.index(field) # <<<<<<<<<<<<<< - * else: - * raise ValueError('Invalid field name') - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->_field_names, __pyx_n_s_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_6) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_field); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_field}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_field}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_field); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_field); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_cur_scope->__pyx_v_field); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_field); - __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_field, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":578 - * raise ValueError('Invalid field number') - * elif isinstance(field, string_types): - * if field in self._field_names: # <<<<<<<<<<<<<< - * field = self._field_names.index(field) - * else: - */ - goto __pyx_L9; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":581 - * field = self._field_names.index(field) - * else: - * raise ValueError('Invalid field name') # <<<<<<<<<<<<<< - * else: - * raise TypeError('field must be int in string') - */ - /*else*/ { - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __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_ERR(0, 581, __pyx_L1_error) - } - __pyx_L9:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":577 - * if field < 0 or field > self.field_count: - * raise ValueError('Invalid field number') - * elif isinstance(field, string_types): # <<<<<<<<<<<<<< - * if field in self._field_names: - * field = self._field_names.index(field) - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":583 - * raise ValueError('Invalid field name') - * else: - * raise TypeError('field must be int in string') # <<<<<<<<<<<<<< - * - * self.build_converter[field] = \ - */ - /*else*/ { - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __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_ERR(0, 583, __pyx_L1_error) - } - __pyx_L3:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":586 - * - * self.build_converter[field] = \ - * lambda: self.__build_python_converter(field, converter) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_13set_converter_lambda3, 0, __pyx_n_s_set_converter_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "TextAdapter/textadapter/TextAdapter.pyx":585 - * raise TypeError('field must be int in string') - * - * self.build_converter[field] = \ # <<<<<<<<<<<<<< - * lambda: self.__build_python_converter(field, converter) - * - */ - if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_self->build_converter, __pyx_cur_scope->__pyx_v_field, __pyx_t_2) < 0)) __PYX_ERR(0, 585, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":565 - * - * - * def set_converter(self, field, converter): # <<<<<<<<<<<<<< - * """ - * Set converter function for field. - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_converter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":589 - * - * - * def __build_python_converter(self, field, converter): # <<<<<<<<<<<<<< - * # wrap converter function with function to convert output - * # to proper dtype - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_25__build_python_converter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_25__build_python_converter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_field = 0; - PyObject *__pyx_v_converter = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__build_python_converter (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,&__pyx_n_s_converter,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_converter)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__build_python_converter", 1, 2, 2, 1); __PYX_ERR(0, 589, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__build_python_converter") < 0)) __PYX_ERR(0, 589, __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_field = values[0]; - __pyx_v_converter = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__build_python_converter", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 589, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__build_python_converter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_24__build_python_converter(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), __pyx_v_field, __pyx_v_converter); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_24__build_python_converter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_converter) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *__pyx_v_dec = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - uint32_t __pyx_t_4; - uint32_t __pyx_t_5; - __Pyx_RefNannySetupContext("__build_python_converter", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":592 - * # wrap converter function with function to convert output - * # to proper dtype - * dec = ConverterDecorator(converter, self.mapping[field]) # <<<<<<<<<<<<<< - * self.converter_objects.append(dec) - * set_converter(self.adapter.fields, field, NULL, - */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_self->mapping, __pyx_v_field); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_converter); - __Pyx_GIVEREF(__pyx_v_converter); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_converter); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_dec = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":593 - * # to proper dtype - * dec = ConverterDecorator(converter, self.mapping[field]) - * self.converter_objects.append(dec) # <<<<<<<<<<<<<< - * set_converter(self.adapter.fields, field, NULL, - * self.mapping[field].itemsize, - */ - __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_self->converter_objects, ((PyObject *)__pyx_v_dec)); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 593, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":594 - * dec = ConverterDecorator(converter, self.mapping[field]) - * self.converter_objects.append(dec) - * set_converter(self.adapter.fields, field, NULL, # <<<<<<<<<<<<<< - * self.mapping[field].itemsize, - * &python_converter, dec) - */ - __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_field); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 594, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":595 - * self.converter_objects.append(dec) - * set_converter(self.adapter.fields, field, NULL, - * self.mapping[field].itemsize, # <<<<<<<<<<<<<< - * &python_converter, dec) - * - */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_self->mapping, __pyx_v_field); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":594 - * dec = ConverterDecorator(converter, self.mapping[field]) - * self.converter_objects.append(dec) - * set_converter(self.adapter.fields, field, NULL, # <<<<<<<<<<<<<< - * self.mapping[field].itemsize, - * &python_converter, dec) - */ - set_converter(__pyx_v_self->adapter->fields, __pyx_t_4, NULL, __pyx_t_5, ((converter_func_ptr)(&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_python_converter)), ((void *)__pyx_v_dec)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":589 - * - * - * def __build_python_converter(self, field, converter): # <<<<<<<<<<<<<< - * # wrap converter function with function to convert output - * # to proper dtype - */ - - /* function exit code */ - __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("TextAdapter.textadapter.TextAdapter.TextAdapter.__build_python_converter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_dec); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":599 - * - * - * def set_missing_values(self, missing_values): # <<<<<<<<<<<<<< - * """ - * Set strings for each field that represents a missing value. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_27set_missing_values(PyObject *__pyx_v_self, PyObject *__pyx_v_missing_values); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_26set_missing_values[] = "\n Set strings for each field that represents a missing value.\n\n Arguments:\n missing_values - dict, list, tuple, or comma separated list of strings\n that represent missing values. If list, tuple, or comma separated\n string,the nth entry is a list of missing value strings for the nth\n field. If dict, each key is a field number or field name, with the\n value being a list of missing value strings for that field.\n "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_27set_missing_values(PyObject *__pyx_v_self, PyObject *__pyx_v_missing_values) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_missing_values (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_26set_missing_values(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_missing_values)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_26set_missing_values(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_missing_values) { - PyObject *__pyx_v_key = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_v_v = NULL; - PyObject *__pyx_v_values = NULL; - PyObject *__pyx_v_field = NULL; - PyObject *__pyx_v_error_msg = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *(*__pyx_t_10)(PyObject *); - Py_ssize_t __pyx_t_11; - PyObject *(*__pyx_t_12)(PyObject *); - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - uint64_t __pyx_t_16; - char *__pyx_t_17; - Py_ssize_t __pyx_t_18; - __Pyx_RefNannySetupContext("set_missing_values", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":610 - * value being a list of missing value strings for that field. - * """ - * if isinstance(missing_values, dict): # <<<<<<<<<<<<<< - * self.missing_values = {} - * for key, value in missing_values.items(): - */ - __pyx_t_1 = PyDict_Check(__pyx_v_missing_values); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":611 - * """ - * if isinstance(missing_values, dict): - * self.missing_values = {} # <<<<<<<<<<<<<< - * for key, value in missing_values.items(): - * for v in value: - */ - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->missing_values); - __Pyx_DECREF(__pyx_v_self->missing_values); - __pyx_v_self->missing_values = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":612 - * if isinstance(missing_values, dict): - * self.missing_values = {} - * for key, value in missing_values.items(): # <<<<<<<<<<<<<< - * for v in value: - * if key not in self.missing_values.keys(): - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_missing_values, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 612, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 612, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 612, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 612, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 612, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 612, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 612, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 612, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 612, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_7(__pyx_t_4); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 612, __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 !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 612, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 612, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 612, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 612, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 612, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L7_unpacking_done; - __pyx_L6_unpacking_failed:; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 612, __pyx_L1_error) - __pyx_L7_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8); - __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":613 - * self.missing_values = {} - * for key, value in missing_values.items(): - * for v in value: # <<<<<<<<<<<<<< - * if key not in self.missing_values.keys(): - * self.missing_values[key] = [] - */ - if (likely(PyList_CheckExact(__pyx_v_value)) || PyTuple_CheckExact(__pyx_v_value)) { - __pyx_t_3 = __pyx_v_value; __Pyx_INCREF(__pyx_t_3); __pyx_t_11 = 0; - __pyx_t_12 = NULL; - } else { - __pyx_t_11 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 613, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_12)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_11); __Pyx_INCREF(__pyx_t_8); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 613, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } else { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_11); __Pyx_INCREF(__pyx_t_8); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 613, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } - } else { - __pyx_t_8 = __pyx_t_12(__pyx_t_3); - if (unlikely(!__pyx_t_8)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 613, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8); - __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":614 - * for key, value in missing_values.items(): - * for v in value: - * if key not in self.missing_values.keys(): # <<<<<<<<<<<<<< - * self.missing_values[key] = [] - * self.missing_values[key].append(v.encode(self.encoding)) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->missing_values, __pyx_n_s_keys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_9) { - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 614, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_t_8, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":615 - * for v in value: - * if key not in self.missing_values.keys(): - * self.missing_values[key] = [] # <<<<<<<<<<<<<< - * self.missing_values[key].append(v.encode(self.encoding)) - * for (key, values) in self.missing_values.items(): - */ - __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely(PyObject_SetItem(__pyx_v_self->missing_values, __pyx_v_key, __pyx_t_8) < 0)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":614 - * for key, value in missing_values.items(): - * for v in value: - * if key not in self.missing_values.keys(): # <<<<<<<<<<<<<< - * self.missing_values[key] = [] - * self.missing_values[key].append(v.encode(self.encoding)) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":616 - * if key not in self.missing_values.keys(): - * self.missing_values[key] = [] - * self.missing_values[key].append(v.encode(self.encoding)) # <<<<<<<<<<<<<< - * for (key, values) in self.missing_values.items(): - * field = key - */ - __pyx_t_8 = PyObject_GetItem(__pyx_v_self->missing_values, __pyx_v_key); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_encode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_13 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - if (!__pyx_t_13) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_self->encoding); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_v_self->encoding}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_v_self->encoding}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - { - __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; - __Pyx_INCREF(__pyx_v_self->encoding); - __Pyx_GIVEREF(__pyx_v_self->encoding); - PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_self->encoding); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_15 = __Pyx_PyObject_Append(__pyx_t_8, __pyx_t_5); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":613 - * self.missing_values = {} - * for key, value in missing_values.items(): - * for v in value: # <<<<<<<<<<<<<< - * if key not in self.missing_values.keys(): - * self.missing_values[key] = [] - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":612 - * if isinstance(missing_values, dict): - * self.missing_values = {} - * for key, value in missing_values.items(): # <<<<<<<<<<<<<< - * for v in value: - * if key not in self.missing_values.keys(): - */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":617 - * self.missing_values[key] = [] - * self.missing_values[key].append(v.encode(self.encoding)) - * for (key, values) in self.missing_values.items(): # <<<<<<<<<<<<<< - * field = key - * if isinstance(key, string_types): - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->missing_values, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_5) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 617, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 617, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 617, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 617, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_7(__pyx_t_3); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 617, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { - PyObject* sequence = __pyx_t_4; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 617, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L13_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L13_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 617, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L14_unpacking_done; - __pyx_L13_unpacking_failed:; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 617, __pyx_L1_error) - __pyx_L14_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_values, __pyx_t_8); - __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":618 - * self.missing_values[key].append(v.encode(self.encoding)) - * for (key, values) in self.missing_values.items(): - * field = key # <<<<<<<<<<<<<< - * if isinstance(key, string_types): - * field = self._field_names.index(key) - */ - __Pyx_INCREF(__pyx_v_key); - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_v_key); - - /* "TextAdapter/textadapter/TextAdapter.pyx":619 - * for (key, values) in self.missing_values.items(): - * field = key - * if isinstance(key, string_types): # <<<<<<<<<<<<<< - * field = self._field_names.index(key) - * if field < 0 or field >= self.adapter.fields.num_fields: - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_string_types); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_IsInstance(__pyx_v_key, __pyx_t_4); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":620 - * field = key - * if isinstance(key, string_types): - * field = self._field_names.index(key) # <<<<<<<<<<<<<< - * if field < 0 or field >= self.adapter.fields.num_fields: - * raise errors.NoSuchFieldError('invalid field number ' + str(field)) - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_field_names, __pyx_n_s_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - if (!__pyx_t_5) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_key}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_key}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_key); - __Pyx_GIVEREF(__pyx_v_key); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_key); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_field, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":619 - * for (key, values) in self.missing_values.items(): - * field = key - * if isinstance(key, string_types): # <<<<<<<<<<<<<< - * field = self._field_names.index(key) - * if field < 0 or field >= self.adapter.fields.num_fields: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":621 - * if isinstance(key, string_types): - * field = self._field_names.index(key) - * if field < 0 or field >= self.adapter.fields.num_fields: # <<<<<<<<<<<<<< - * raise errors.NoSuchFieldError('invalid field number ' + str(field)) - * if isinstance(values, string_types): - */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_field, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 621, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 621, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L17_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->adapter->fields->num_fields); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyObject_RichCompare(__pyx_v_field, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 621, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 621, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_2 = __pyx_t_1; - __pyx_L17_bool_binop_done:; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":622 - * field = self._field_names.index(key) - * if field < 0 or field >= self.adapter.fields.num_fields: - * raise errors.NoSuchFieldError('invalid field number ' + str(field)) # <<<<<<<<<<<<<< - * if isinstance(values, string_types): - * values = [values] - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_NoSuchFieldError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_field); - __Pyx_GIVEREF(__pyx_v_field); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_field); - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_kp_s_invalid_field_number, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - if (!__pyx_t_5) { - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_8); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(0, 622, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":621 - * if isinstance(key, string_types): - * field = self._field_names.index(key) - * if field < 0 or field >= self.adapter.fields.num_fields: # <<<<<<<<<<<<<< - * raise errors.NoSuchFieldError('invalid field number ' + str(field)) - * if isinstance(values, string_types): - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":623 - * if field < 0 or field >= self.adapter.fields.num_fields: - * raise errors.NoSuchFieldError('invalid field number ' + str(field)) - * if isinstance(values, string_types): # <<<<<<<<<<<<<< - * values = [values] - * elif values is None: - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_string_types); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 623, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_values, __pyx_t_8); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 623, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":624 - * raise errors.NoSuchFieldError('invalid field number ' + str(field)) - * if isinstance(values, string_types): - * values = [values] # <<<<<<<<<<<<<< - * elif values is None: - * init_missing_values(self.adapter.fields, NULL, field, 0) - */ - __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_values); - __Pyx_GIVEREF(__pyx_v_values); - PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_values); - __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_8); - __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":623 - * if field < 0 or field >= self.adapter.fields.num_fields: - * raise errors.NoSuchFieldError('invalid field number ' + str(field)) - * if isinstance(values, string_types): # <<<<<<<<<<<<<< - * values = [values] - * elif values is None: - */ - goto __pyx_L19; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":625 - * if isinstance(values, string_types): - * values = [values] - * elif values is None: # <<<<<<<<<<<<<< - * init_missing_values(self.adapter.fields, NULL, field, 0) - * return - */ - __pyx_t_1 = (__pyx_v_values == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":626 - * values = [values] - * elif values is None: - * init_missing_values(self.adapter.fields, NULL, field, 0) # <<<<<<<<<<<<<< - * return - * if len(values) == 0: - */ - __pyx_t_16 = __Pyx_PyInt_As_uint64_t(__pyx_v_field); if (unlikely((__pyx_t_16 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 626, __pyx_L1_error) - init_missing_values(__pyx_v_self->adapter->fields, NULL, ((uint64_t)__pyx_t_16), 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":627 - * elif values is None: - * init_missing_values(self.adapter.fields, NULL, field, 0) - * return # <<<<<<<<<<<<<< - * if len(values) == 0: - * error_msg = 'No missing values specified for field ' + str(field) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":625 - * if isinstance(values, string_types): - * values = [values] - * elif values is None: # <<<<<<<<<<<<<< - * init_missing_values(self.adapter.fields, NULL, field, 0) - * return - */ - } - __pyx_L19:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":628 - * init_missing_values(self.adapter.fields, NULL, field, 0) - * return - * if len(values) == 0: # <<<<<<<<<<<<<< - * error_msg = 'No missing values specified for field ' + str(field) - * raise errors.ArgumentError(error_msg) - */ - __pyx_t_11 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 628, __pyx_L1_error) - __pyx_t_2 = ((__pyx_t_11 == 0) != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":629 - * return - * if len(values) == 0: - * error_msg = 'No missing values specified for field ' + str(field) # <<<<<<<<<<<<<< - * raise errors.ArgumentError(error_msg) - * init_missing_values(self.adapter.fields, NULL, field, - */ - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 629, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_field); - __Pyx_GIVEREF(__pyx_v_field); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_field); - __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 629, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Add(__pyx_kp_s_No_missing_values_specified_for, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 629, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_error_msg = __pyx_t_8; - __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":630 - * if len(values) == 0: - * error_msg = 'No missing values specified for field ' + str(field) - * raise errors.ArgumentError(error_msg) # <<<<<<<<<<<<<< - * init_missing_values(self.adapter.fields, NULL, field, - * len(values)) - */ - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 630, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_ArgumentError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 630, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_14); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); - } - } - if (!__pyx_t_9) { - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_error_msg); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 630, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_14)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_error_msg}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 630, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_8); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_error_msg}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 630, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_8); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 630, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_INCREF(__pyx_v_error_msg); - __Pyx_GIVEREF(__pyx_v_error_msg); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_error_msg); - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 630, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(0, 630, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":628 - * init_missing_values(self.adapter.fields, NULL, field, 0) - * return - * if len(values) == 0: # <<<<<<<<<<<<<< - * error_msg = 'No missing values specified for field ' + str(field) - * raise errors.ArgumentError(error_msg) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":631 - * error_msg = 'No missing values specified for field ' + str(field) - * raise errors.ArgumentError(error_msg) - * init_missing_values(self.adapter.fields, NULL, field, # <<<<<<<<<<<<<< - * len(values)) - * for v in values: - */ - __pyx_t_16 = __Pyx_PyInt_As_uint64_t(__pyx_v_field); if (unlikely((__pyx_t_16 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 631, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":632 - * raise errors.ArgumentError(error_msg) - * init_missing_values(self.adapter.fields, NULL, field, - * len(values)) # <<<<<<<<<<<<<< - * for v in values: - * if isinstance(v, string_types): - */ - __pyx_t_11 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 632, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":631 - * error_msg = 'No missing values specified for field ' + str(field) - * raise errors.ArgumentError(error_msg) - * init_missing_values(self.adapter.fields, NULL, field, # <<<<<<<<<<<<<< - * len(values)) - * for v in values: - */ - init_missing_values(__pyx_v_self->adapter->fields, NULL, ((uint64_t)__pyx_t_16), ((uint32_t)__pyx_t_11)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":633 - * init_missing_values(self.adapter.fields, NULL, field, - * len(values)) - * for v in values: # <<<<<<<<<<<<<< - * if isinstance(v, string_types): - * v = v.encode(self.encoding) - */ - if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) { - __pyx_t_8 = __pyx_v_values; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = 0; - __pyx_t_12 = NULL; - } else { - __pyx_t_11 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 633, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_12)) { - if (likely(PyList_CheckExact(__pyx_t_8))) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_8)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_14 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_14); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 633, __pyx_L1_error) - #else - __pyx_t_14 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - #endif - } else { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_8)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_14); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 633, __pyx_L1_error) - #else - __pyx_t_14 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - #endif - } - } else { - __pyx_t_14 = __pyx_t_12(__pyx_t_8); - if (unlikely(!__pyx_t_14)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 633, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_14); - } - __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_14); - __pyx_t_14 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":634 - * len(values)) - * for v in values: - * if isinstance(v, string_types): # <<<<<<<<<<<<<< - * v = v.encode(self.encoding) - * elif not isinstance(v, bytes): - */ - __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_string_types); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_v, __pyx_t_14); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":635 - * for v in values: - * if isinstance(v, string_types): - * v = v.encode(self.encoding) # <<<<<<<<<<<<<< - * elif not isinstance(v, bytes): - * error_msg = ('Invalid missing value; must be string ' - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_9) { - __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self->encoding); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_self->encoding}; - __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_14); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_self->encoding}; - __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_14); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_INCREF(__pyx_v_self->encoding); - __Pyx_GIVEREF(__pyx_v_self->encoding); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_self->encoding); - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_14); - __pyx_t_14 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":634 - * len(values)) - * for v in values: - * if isinstance(v, string_types): # <<<<<<<<<<<<<< - * v = v.encode(self.encoding) - * elif not isinstance(v, bytes): - */ - goto __pyx_L23; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":636 - * if isinstance(v, string_types): - * v = v.encode(self.encoding) - * elif not isinstance(v, bytes): # <<<<<<<<<<<<<< - * error_msg = ('Invalid missing value; must be string ' - * '(is {0})'.format(str(type(v)))) - */ - __pyx_t_1 = PyBytes_Check(__pyx_v_v); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":638 - * elif not isinstance(v, bytes): - * error_msg = ('Invalid missing value; must be string ' - * '(is {0})'.format(str(type(v)))) # <<<<<<<<<<<<<< - * raise errors.ArgumentError(error_msg) - * add_missing_value(self.adapter.fields, NULL, field, - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Invalid_missing_value_must_be_st, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_v))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_v))); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(__pyx_v_v))); - __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_5) { - __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_14); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_9}; - __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_9}; - __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_error_msg = __pyx_t_14; - __pyx_t_14 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":639 - * error_msg = ('Invalid missing value; must be string ' - * '(is {0})'.format(str(type(v)))) - * raise errors.ArgumentError(error_msg) # <<<<<<<<<<<<<< - * add_missing_value(self.adapter.fields, NULL, field, - * v, len(v)) - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ArgumentError); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); - } - } - if (!__pyx_t_4) { - __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_error_msg); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_error_msg}; - __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_14); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_error_msg}; - __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_14); - } else - #endif - { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_error_msg); - __Pyx_GIVEREF(__pyx_v_error_msg); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_error_msg); - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_9, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_Raise(__pyx_t_14, 0, 0, 0); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __PYX_ERR(0, 639, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":636 - * if isinstance(v, string_types): - * v = v.encode(self.encoding) - * elif not isinstance(v, bytes): # <<<<<<<<<<<<<< - * error_msg = ('Invalid missing value; must be string ' - * '(is {0})'.format(str(type(v)))) - */ - } - __pyx_L23:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":640 - * '(is {0})'.format(str(type(v)))) - * raise errors.ArgumentError(error_msg) - * add_missing_value(self.adapter.fields, NULL, field, # <<<<<<<<<<<<<< - * v, len(v)) - * else: - */ - __pyx_t_16 = __Pyx_PyInt_As_uint64_t(__pyx_v_field); if (unlikely((__pyx_t_16 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":641 - * raise errors.ArgumentError(error_msg) - * add_missing_value(self.adapter.fields, NULL, field, - * v, len(v)) # <<<<<<<<<<<<<< - * else: - * raise errors.ArgumentError('missing values must be dict of field ' - */ - __pyx_t_17 = __Pyx_PyObject_AsString(__pyx_v_v); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 641, __pyx_L1_error) - __pyx_t_18 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_18 == -1)) __PYX_ERR(0, 641, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":640 - * '(is {0})'.format(str(type(v)))) - * raise errors.ArgumentError(error_msg) - * add_missing_value(self.adapter.fields, NULL, field, # <<<<<<<<<<<<<< - * v, len(v)) - * else: - */ - add_missing_value(__pyx_v_self->adapter->fields, NULL, ((uint64_t)__pyx_t_16), ((char *)__pyx_t_17), ((uint64_t)__pyx_t_18)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":633 - * init_missing_values(self.adapter.fields, NULL, field, - * len(values)) - * for v in values: # <<<<<<<<<<<<<< - * if isinstance(v, string_types): - * v = v.encode(self.encoding) - */ - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":617 - * self.missing_values[key] = [] - * self.missing_values[key].append(v.encode(self.encoding)) - * for (key, values) in self.missing_values.items(): # <<<<<<<<<<<<<< - * field = key - * if isinstance(key, string_types): - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":610 - * value being a list of missing value strings for that field. - * """ - * if isinstance(missing_values, dict): # <<<<<<<<<<<<<< - * self.missing_values = {} - * for key, value in missing_values.items(): - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":643 - * v, len(v)) - * else: - * raise errors.ArgumentError('missing values must be dict of field ' # <<<<<<<<<<<<<< - * 'numbers and missing value strings ' - * '(is {0})'.format(str(type(missing_values)))) - */ - /*else*/ { - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_ArgumentError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":645 - * raise errors.ArgumentError('missing values must be dict of field ' - * 'numbers and missing value strings ' - * '(is {0})'.format(str(type(missing_values)))) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_missing_values_must_be_dict_of_f, __pyx_n_s_format); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_missing_values))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_missing_values))); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)Py_TYPE(__pyx_v_missing_values))); - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); - } - } - if (!__pyx_t_9) { - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_8); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_4}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_4}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); - } - } - if (!__pyx_t_13) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_14)) { - PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_8}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) { - PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_8}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_13); __pyx_t_13 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 643, __pyx_L1_error) - } - __pyx_L3:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":599 - * - * - * def set_missing_values(self, missing_values): # <<<<<<<<<<<<<< - * """ - * Set strings for each field that represents a missing value. - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_missing_values", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_v); - __Pyx_XDECREF(__pyx_v_values); - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XDECREF(__pyx_v_error_msg); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":648 - * - * - * def set_fill_values(self, fill_values, loose=False): # <<<<<<<<<<<<<< - * """ - * Set fill values for each field. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_29set_fill_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_28set_fill_values[] = "\n Set fill values for each field.\n\n Arguments:\n fill_values - dict, list, or tuple of values for each field, or single fill\n value to use for all fields. If list or tuple, the nth entry is a fill\n value for the nth field. If dict, each key is a field number or field\n name, with the value being a fill value used for that field.\n "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_29set_fill_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fill_values = 0; - PyObject *__pyx_v_loose = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_fill_values (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fill_values,&__pyx_n_s_loose,0}; - PyObject* values[2] = {0,0}; - values[1] = ((PyObject *)Py_False); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fill_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_loose); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_fill_values") < 0)) __PYX_ERR(0, 648, __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_fill_values = values[0]; - __pyx_v_loose = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_fill_values", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 648, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.set_fill_values", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_28set_fill_values(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), __pyx_v_fill_values, __pyx_v_loose); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_28set_fill_values(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_fill_values, PyObject *__pyx_v_loose) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_fill_values", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":658 - * name, with the value being a fill value used for that field. - * """ - * self.fill_values = fill_values # <<<<<<<<<<<<<< - * self.loose_fill = loose - * - */ - __Pyx_INCREF(__pyx_v_fill_values); - __Pyx_GIVEREF(__pyx_v_fill_values); - __Pyx_GOTREF(__pyx_v_self->fill_values); - __Pyx_DECREF(__pyx_v_self->fill_values); - __pyx_v_self->fill_values = __pyx_v_fill_values; - - /* "TextAdapter/textadapter/TextAdapter.pyx":659 - * """ - * self.fill_values = fill_values - * self.loose_fill = loose # <<<<<<<<<<<<<< - * - * - */ - __Pyx_INCREF(__pyx_v_loose); - __Pyx_GIVEREF(__pyx_v_loose); - __Pyx_GOTREF(__pyx_v_self->loose_fill); - __Pyx_DECREF(__pyx_v_self->loose_fill); - __pyx_v_self->loose_fill = __pyx_v_loose; - - /* "TextAdapter/textadapter/TextAdapter.pyx":648 - * - * - * def set_fill_values(self, fill_values, loose=False): # <<<<<<<<<<<<<< - * """ - * Set fill values for each field. - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":662 - * - * - * def __set_fill_values(self, fill_values): # <<<<<<<<<<<<<< - * - * cdef numpy.ndarray carray - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_31__set_fill_values(PyObject *__pyx_v_self, PyObject *__pyx_v_fill_values); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_31__set_fill_values(PyObject *__pyx_v_self, PyObject *__pyx_v_fill_values) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set_fill_values (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_30__set_fill_values(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_fill_values)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_30__set_fill_values(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_fill_values) { - PyArrayObject *__pyx_v_carray = 0; - void *__pyx_v_fill_value; - int __pyx_v_loose; - PyObject *__pyx_v_field = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_v_a = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - uint64_t __pyx_t_10; - uint32_t __pyx_t_11; - __Pyx_RefNannySetupContext("__set_fill_values", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":666 - * cdef numpy.ndarray carray - * cdef void *fill_value - * cdef int loose = 0 # <<<<<<<<<<<<<< - * - * for field in self._field_filter: - */ - __pyx_v_loose = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":668 - * cdef int loose = 0 - * - * for field in self._field_filter: # <<<<<<<<<<<<<< - * - * if fill_values is None: - */ - if (likely(PyList_CheckExact(__pyx_v_self->_field_filter)) || PyTuple_CheckExact(__pyx_v_self->_field_filter)) { - __pyx_t_1 = __pyx_v_self->_field_filter; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->_field_filter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 668, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 668, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 668, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 668, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":670 - * for field in self._field_filter: - * - * if fill_values is None: # <<<<<<<<<<<<<< - * value = default_fill_values[self.mapping[field].kind] - * elif field in fill_values.keys(): - */ - __pyx_t_5 = (__pyx_v_fill_values == Py_None); - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":671 - * - * if fill_values is None: - * value = default_fill_values[self.mapping[field].kind] # <<<<<<<<<<<<<< - * elif field in fill_values.keys(): - * value = fill_values[field] - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_default_fill_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetItem(__pyx_v_self->mapping, __pyx_v_field); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_kind); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_GetItem(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7); - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":670 - * for field in self._field_filter: - * - * if fill_values is None: # <<<<<<<<<<<<<< - * value = default_fill_values[self.mapping[field].kind] - * elif field in fill_values.keys(): - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":672 - * if fill_values is None: - * value = default_fill_values[self.mapping[field].kind] - * elif field in fill_values.keys(): # <<<<<<<<<<<<<< - * value = fill_values[field] - * elif self._field_names[field] in fill_values.keys(): - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_fill_values, __pyx_n_s_keys); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - if (__pyx_t_4) { - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 672, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_field, __pyx_t_7, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_5 = (__pyx_t_6 != 0); - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":673 - * value = default_fill_values[self.mapping[field].kind] - * elif field in fill_values.keys(): - * value = fill_values[field] # <<<<<<<<<<<<<< - * elif self._field_names[field] in fill_values.keys(): - * value = fill_values[self._field_names[field]] - */ - __pyx_t_7 = PyObject_GetItem(__pyx_v_fill_values, __pyx_v_field); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 673, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7); - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":672 - * if fill_values is None: - * value = default_fill_values[self.mapping[field].kind] - * elif field in fill_values.keys(): # <<<<<<<<<<<<<< - * value = fill_values[field] - * elif self._field_names[field] in fill_values.keys(): - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":674 - * elif field in fill_values.keys(): - * value = fill_values[field] - * elif self._field_names[field] in fill_values.keys(): # <<<<<<<<<<<<<< - * value = fill_values[self._field_names[field]] - * else: - */ - __pyx_t_7 = PyObject_GetItem(__pyx_v_self->_field_names, __pyx_v_field); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 674, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fill_values, __pyx_n_s_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 674, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_9) { - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 674, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 674, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_t_7, __pyx_t_8, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 674, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":675 - * value = fill_values[field] - * elif self._field_names[field] in fill_values.keys(): - * value = fill_values[self._field_names[field]] # <<<<<<<<<<<<<< - * else: - * value = default_fill_values[self.mapping[field].kind] - */ - __pyx_t_8 = PyObject_GetItem(__pyx_v_self->_field_names, __pyx_v_field); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_GetItem(__pyx_v_fill_values, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7); - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":674 - * elif field in fill_values.keys(): - * value = fill_values[field] - * elif self._field_names[field] in fill_values.keys(): # <<<<<<<<<<<<<< - * value = fill_values[self._field_names[field]] - * else: - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":677 - * value = fill_values[self._field_names[field]] - * else: - * value = default_fill_values[self.mapping[field].kind] # <<<<<<<<<<<<<< - * - * if value is None: - */ - /*else*/ { - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_default_fill_values); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetItem(__pyx_v_self->mapping, __pyx_v_field); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_kind); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_GetItem(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8); - __pyx_t_8 = 0; - } - __pyx_L5:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":679 - * value = default_fill_values[self.mapping[field].kind] - * - * if value is None: # <<<<<<<<<<<<<< - * set_fill_value(self.adapter.fields, NULL, field, - * NULL, 0, loose) - */ - __pyx_t_6 = (__pyx_v_value == Py_None); - __pyx_t_5 = (__pyx_t_6 != 0); - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":680 - * - * if value is None: - * set_fill_value(self.adapter.fields, NULL, field, # <<<<<<<<<<<<<< - * NULL, 0, loose) - * return - */ - __pyx_t_10 = __Pyx_PyInt_As_uint64_t(__pyx_v_field); if (unlikely((__pyx_t_10 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 680, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":681 - * if value is None: - * set_fill_value(self.adapter.fields, NULL, field, - * NULL, 0, loose) # <<<<<<<<<<<<<< - * return - * - */ - set_fill_value(__pyx_v_self->adapter->fields, NULL, ((uint64_t)__pyx_t_10), NULL, 0, __pyx_v_loose); - - /* "TextAdapter/textadapter/TextAdapter.pyx":682 - * set_fill_value(self.adapter.fields, NULL, field, - * NULL, 0, loose) - * return # <<<<<<<<<<<<<< - * - * if self.loose_fill: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":679 - * value = default_fill_values[self.mapping[field].kind] - * - * if value is None: # <<<<<<<<<<<<<< - * set_fill_value(self.adapter.fields, NULL, field, - * NULL, 0, loose) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":684 - * return - * - * if self.loose_fill: # <<<<<<<<<<<<<< - * loose = 1 - * - */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->loose_fill); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 684, __pyx_L1_error) - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":685 - * - * if self.loose_fill: - * loose = 1 # <<<<<<<<<<<<<< - * - * a = numpy.array([value], dtype=self.mapping[field]) - */ - __pyx_v_loose = 1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":684 - * return - * - * if self.loose_fill: # <<<<<<<<<<<<<< - * loose = 1 - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":687 - * loose = 1 - * - * a = numpy.array([value], dtype=self.mapping[field]) # <<<<<<<<<<<<<< - * carray = a - * fill_value = carray.data - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_value); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetItem(__pyx_v_self->mapping, __pyx_v_field); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 687, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_9); - __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":688 - * - * a = numpy.array([value], dtype=self.mapping[field]) - * carray = a # <<<<<<<<<<<<<< - * fill_value = carray.data - * set_fill_value(self.adapter.fields, NULL, field, fill_value, - */ - if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 688, __pyx_L1_error) - __pyx_t_9 = __pyx_v_a; - __Pyx_INCREF(__pyx_t_9); - __Pyx_XDECREF_SET(__pyx_v_carray, ((PyArrayObject *)__pyx_t_9)); - __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":689 - * a = numpy.array([value], dtype=self.mapping[field]) - * carray = a - * fill_value = carray.data # <<<<<<<<<<<<<< - * set_fill_value(self.adapter.fields, NULL, field, fill_value, - * get_field_size(self.adapter.fields, NULL, field), loose) - */ - __pyx_v_fill_value = ((void *)__pyx_v_carray->data); - - /* "TextAdapter/textadapter/TextAdapter.pyx":690 - * carray = a - * fill_value = carray.data - * set_fill_value(self.adapter.fields, NULL, field, fill_value, # <<<<<<<<<<<<<< - * get_field_size(self.adapter.fields, NULL, field), loose) - * - */ - __pyx_t_10 = __Pyx_PyInt_As_uint64_t(__pyx_v_field); if (unlikely((__pyx_t_10 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 690, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":691 - * fill_value = carray.data - * set_fill_value(self.adapter.fields, NULL, field, fill_value, - * get_field_size(self.adapter.fields, NULL, field), loose) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_11 = __Pyx_PyInt_As_uint32_t(__pyx_v_field); if (unlikely((__pyx_t_11 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":690 - * carray = a - * fill_value = carray.data - * set_fill_value(self.adapter.fields, NULL, field, fill_value, # <<<<<<<<<<<<<< - * get_field_size(self.adapter.fields, NULL, field), loose) - * - */ - set_fill_value(__pyx_v_self->adapter->fields, NULL, ((uint64_t)__pyx_t_10), __pyx_v_fill_value, get_field_size(__pyx_v_self->adapter->fields, NULL, __pyx_t_11), __pyx_v_loose); - - /* "TextAdapter/textadapter/TextAdapter.pyx":668 - * cdef int loose = 0 - * - * for field in self._field_filter: # <<<<<<<<<<<<<< - * - * if fill_values is None: - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":662 - * - * - * def __set_fill_values(self, fill_values): # <<<<<<<<<<<<<< - * - * cdef numpy.ndarray carray - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__set_fill_values", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_carray); - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_a); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":694 - * - * - * def to_array(self): # <<<<<<<<<<<<<< - * """ Read all records and return numpy array """ - * if infer_types(self.adapter.fields): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_33to_array(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_32to_array[] = " Read all records and return numpy array "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_33to_array(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("to_array (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_32to_array(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_32to_array(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - PyObject *__pyx_v_array = NULL; - 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; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - uint64_t __pyx_t_8; - __Pyx_RefNannySetupContext("to_array", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":696 - * def to_array(self): - * """ Read all records and return numpy array """ - * if infer_types(self.adapter.fields): # <<<<<<<<<<<<<< - * array = self.__read_slice_infer_types(0, self.adapter.num_records, 1) - * else: - */ - __pyx_t_1 = (infer_types(__pyx_v_self->adapter->fields) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":697 - * """ Read all records and return numpy array """ - * if infer_types(self.adapter.fields): - * array = self.__read_slice_infer_types(0, self.adapter.num_records, 1) # <<<<<<<<<<<<<< - * else: - * array = self.__read_slice(0, self.adapter.num_records, 1) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_slice_infer_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 697, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->adapter->num_records); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 697, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_int_0, __pyx_t_4, __pyx_int_1}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 697, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_int_0, __pyx_t_4, __pyx_int_1}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 697, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 697, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); - __Pyx_INCREF(__pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_int_1); - __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 697, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_array = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":696 - * def to_array(self): - * """ Read all records and return numpy array """ - * if infer_types(self.adapter.fields): # <<<<<<<<<<<<<< - * array = self.__read_slice_infer_types(0, self.adapter.num_records, 1) - * else: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":699 - * array = self.__read_slice_infer_types(0, self.adapter.num_records, 1) - * else: - * array = self.__read_slice(0, self.adapter.num_records, 1) # <<<<<<<<<<<<<< - * if self.adapter.num_records == 0: - * self.adapter.num_records = array.size - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_slice); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 699, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->adapter->num_records); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 699, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_int_0, __pyx_t_7, __pyx_int_1}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_int_0, __pyx_t_7, __pyx_int_1}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_7); - __Pyx_INCREF(__pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_int_1); - __pyx_t_7 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_array = __pyx_t_2; - __pyx_t_2 = 0; - } - __pyx_L3:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":700 - * else: - * array = self.__read_slice(0, self.adapter.num_records, 1) - * if self.adapter.num_records == 0: # <<<<<<<<<<<<<< - * self.adapter.num_records = array.size - * return array - */ - __pyx_t_1 = ((__pyx_v_self->adapter->num_records == 0) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":701 - * array = self.__read_slice(0, self.adapter.num_records, 1) - * if self.adapter.num_records == 0: - * self.adapter.num_records = array.size # <<<<<<<<<<<<<< - * return array - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_array, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyInt_As_uint64_t(__pyx_t_2); if (unlikely((__pyx_t_8 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 701, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_self->adapter->num_records = __pyx_t_8; - - /* "TextAdapter/textadapter/TextAdapter.pyx":700 - * else: - * array = self.__read_slice(0, self.adapter.num_records, 1) - * if self.adapter.num_records == 0: # <<<<<<<<<<<<<< - * self.adapter.num_records = array.size - * return array - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":702 - * if self.adapter.num_records == 0: - * self.adapter.num_records = array.size - * return array # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_array); - __pyx_r = __pyx_v_array; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":694 - * - * - * def to_array(self): # <<<<<<<<<<<<<< - * """ Read all records and return numpy array """ - * if infer_types(self.adapter.fields): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.to_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_array); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":705 - * - * - * def to_dataframe(self): # <<<<<<<<<<<<<< - * """ Read all records and return Pandas dataframe """ - * if not pandas_installed: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_35to_dataframe(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_34to_dataframe[] = " Read all records and return Pandas dataframe "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_35to_dataframe(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("to_dataframe (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_34to_dataframe(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_34to_dataframe(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("to_dataframe", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":707 - * def to_dataframe(self): - * """ Read all records and return Pandas dataframe """ - * if not pandas_installed: # <<<<<<<<<<<<<< - * raise errors.AdapterException('Pandas module is not installed.') - * return pandas.DataFrame.from_records(self.to_array()) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pandas_installed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 707, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!__pyx_t_2) != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":708 - * """ Read all records and return Pandas dataframe """ - * if not pandas_installed: - * raise errors.AdapterException('Pandas module is not installed.') # <<<<<<<<<<<<<< - * return pandas.DataFrame.from_records(self.to_array()) - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_AdapterException); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 708, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":707 - * def to_dataframe(self): - * """ Read all records and return Pandas dataframe """ - * if not pandas_installed: # <<<<<<<<<<<<<< - * raise errors.AdapterException('Pandas module is not installed.') - * return pandas.DataFrame.from_records(self.to_array()) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":709 - * if not pandas_installed: - * raise errors.AdapterException('Pandas module is not installed.') - * return pandas.DataFrame.from_records(self.to_array()) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pandas); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_from_records); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (__pyx_t_7) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 709, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_6) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":705 - * - * - * def to_dataframe(self): # <<<<<<<<<<<<<< - * """ Read all records and return Pandas dataframe """ - * if not pandas_installed: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.to_dataframe", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":712 - * - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * """ Read records by record number or slice """ - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_37__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_36__getitem__[] = " Read records by record number or slice "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_36__getitem__; -#endif -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_37__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_36__getitem__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":717 - * class TextAdapterFields(object): - * - * def __init__(self, adapter, fields): # <<<<<<<<<<<<<< - * self.adapter = adapter - * self.default_field_filter = self.adapter.field_filter - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_adapter = 0; - PyObject *__pyx_v_fields = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_adapter,&__pyx_n_s_fields,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_adapter)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 717, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fields)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 717, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 717, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_self = values[0]; - __pyx_v_adapter = values[1]; - __pyx_v_fields = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 717, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__getitem__.TextAdapterFields.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields___init__(__pyx_self, __pyx_v_self, __pyx_v_adapter, __pyx_v_fields); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_adapter, PyObject *__pyx_v_fields) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":718 - * - * def __init__(self, adapter, fields): - * self.adapter = adapter # <<<<<<<<<<<<<< - * self.default_field_filter = self.adapter.field_filter - * self.temp_field_filter = fields - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_adapter, __pyx_v_adapter) < 0) __PYX_ERR(0, 718, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":719 - * def __init__(self, adapter, fields): - * self.adapter = adapter - * self.default_field_filter = self.adapter.field_filter # <<<<<<<<<<<<<< - * self.temp_field_filter = fields - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_adapter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_field_filter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_field_filter, __pyx_t_2) < 0) __PYX_ERR(0, 719, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":720 - * self.adapter = adapter - * self.default_field_filter = self.adapter.field_filter - * self.temp_field_filter = fields # <<<<<<<<<<<<<< - * - * def __getitem__(self, index): - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_temp_field_filter, __pyx_v_fields) < 0) __PYX_ERR(0, 720, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":717 - * class TextAdapterFields(object): - * - * def __init__(self, adapter, fields): # <<<<<<<<<<<<<< - * self.adapter = adapter - * self.default_field_filter = self.adapter.field_filter - */ - - /* function exit code */ - __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("TextAdapter.textadapter.TextAdapter.TextAdapter.__getitem__.TextAdapterFields.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":722 - * self.temp_field_filter = fields - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * - * self.adapter.field_filter = self.temp_field_filter - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_3__getitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_3__getitem__ = {"__getitem__", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_3__getitem__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_3__getitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_index = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_index,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, 1); __PYX_ERR(0, 722, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__getitem__") < 0)) __PYX_ERR(0, 722, __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_self = values[0]; - __pyx_v_index = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 722, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__getitem__.TextAdapterFields.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_2__getitem__(__pyx_self, __pyx_v_self, __pyx_v_index); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_array = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":724 - * def __getitem__(self, index): - * - * self.adapter.field_filter = self.temp_field_filter # <<<<<<<<<<<<<< - * array = self.adapter[index] - * self.adapter.field_filter = self.default_field_filter - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_temp_field_filter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_adapter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_t_2, __pyx_n_s_field_filter, __pyx_t_1) < 0) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":725 - * - * self.adapter.field_filter = self.temp_field_filter - * array = self.adapter[index] # <<<<<<<<<<<<<< - * self.adapter.field_filter = self.default_field_filter - * return array - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_adapter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_array = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":726 - * self.adapter.field_filter = self.temp_field_filter - * array = self.adapter[index] - * self.adapter.field_filter = self.default_field_filter # <<<<<<<<<<<<<< - * return array - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_default_field_filter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_adapter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_t_2, __pyx_n_s_field_filter, __pyx_t_1) < 0) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":727 - * array = self.adapter[index] - * self.adapter.field_filter = self.default_field_filter - * return array # <<<<<<<<<<<<<< - * - * array = numpy.empty(0) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_array); - __pyx_r = __pyx_v_array; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":722 - * self.temp_field_filter = fields - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * - * self.adapter.field_filter = self.temp_field_filter - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__getitem__.TextAdapterFields.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_array); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":712 - * - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * """ Read records by record number or slice """ - * - */ - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_36__getitem__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_TextAdapterFields = NULL; - PyObject *__pyx_v_array = NULL; - PyObject *__pyx_v_recstart = NULL; - PyObject *__pyx_v_recstop = NULL; - PyObject *__pyx_v_recstep = NULL; - 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; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *(*__pyx_t_10)(PyObject *); - uint64_t __pyx_t_11; - __Pyx_RefNannySetupContext("__getitem__", 0); - __Pyx_INCREF(__pyx_v_index); - - /* "TextAdapter/textadapter/TextAdapter.pyx":715 - * """ Read records by record number or slice """ - * - * class TextAdapterFields(object): # <<<<<<<<<<<<<< - * - * def __init__(self, adapter, fields): - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_builtin_object); - __Pyx_GIVEREF(__pyx_builtin_object); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object); - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_TextAdapterFields, __pyx_n_s_getitem___locals_TextAdapterFi, (PyObject *) NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "TextAdapter/textadapter/TextAdapter.pyx":717 - * class TextAdapterFields(object): - * - * def __init__(self, adapter, fields): # <<<<<<<<<<<<<< - * self.adapter = adapter - * self.default_field_filter = self.adapter.field_filter - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_1__init__, 0, __pyx_n_s_getitem___locals_TextAdapterFi_2, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 717, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 717, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":722 - * self.temp_field_filter = fields - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * - * self.adapter.field_filter = self.temp_field_filter - */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11__getitem___17TextAdapterFields_3__getitem__, 0, __pyx_n_s_getitem___locals_TextAdapterFi_3, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 722, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_getitem, __pyx_t_4) < 0) __PYX_ERR(0, 722, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":715 - * """ Read records by record number or slice """ - * - * class TextAdapterFields(object): # <<<<<<<<<<<<<< - * - * def __init__(self, adapter, fields): - */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_TextAdapterFields, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_TextAdapterFields = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":729 - * return array - * - * array = numpy.empty(0) # <<<<<<<<<<<<<< - * - * if isinstance(index, (int, long)): - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__65, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_array = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":731 - * array = numpy.empty(0) - * - * if isinstance(index, (int, long)): # <<<<<<<<<<<<<< - * - * # If we want to read from end of file, - */ - __pyx_t_6 = PyInt_Check(__pyx_v_index); - __pyx_t_7 = (__pyx_t_6 != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_5 = __pyx_t_7; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = PyLong_Check(__pyx_v_index); - __pyx_t_6 = (__pyx_t_7 != 0); - __pyx_t_5 = __pyx_t_6; - __pyx_L4_bool_binop_done:; - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":735 - * # If we want to read from end of file, - * # first build index of record offsets. - * if index < 0: # <<<<<<<<<<<<<< - * # calculate index from beginning of file - * index = self.size + index - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_index, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":737 - * if index < 0: - * # calculate index from beginning of file - * index = self.size + index # <<<<<<<<<<<<<< - * if infer_types(self.adapter.fields): - * array = self.__read_slice_infer_types(index, index + 1, 1) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":735 - * # If we want to read from end of file, - * # first build index of record offsets. - * if index < 0: # <<<<<<<<<<<<<< - * # calculate index from beginning of file - * index = self.size + index - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":738 - * # calculate index from beginning of file - * index = self.size + index - * if infer_types(self.adapter.fields): # <<<<<<<<<<<<<< - * array = self.__read_slice_infer_types(index, index + 1, 1) - * else: - */ - __pyx_t_6 = (infer_types(__pyx_v_self->adapter->fields) != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":739 - * index = self.size + index - * if infer_types(self.adapter.fields): - * array = self.__read_slice_infer_types(index, index + 1, 1) # <<<<<<<<<<<<<< - * else: - * array = self.__read_slice(index, index + 1, 1) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_slice_infer_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 739, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_index, __pyx_t_3, __pyx_int_1}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_index, __pyx_t_3, __pyx_int_1}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 739, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_index); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_3); - __Pyx_INCREF(__pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_int_1); - __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_array, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":738 - * # calculate index from beginning of file - * index = self.size + index - * if infer_types(self.adapter.fields): # <<<<<<<<<<<<<< - * array = self.__read_slice_infer_types(index, index + 1, 1) - * else: - */ - goto __pyx_L7; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":741 - * array = self.__read_slice_infer_types(index, index + 1, 1) - * else: - * array = self.__read_slice(index, index + 1, 1) # <<<<<<<<<<<<<< - * - * elif isinstance(index, slice): - */ - /*else*/ { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_slice); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 741, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_index, __pyx_t_9, __pyx_int_1}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_index, __pyx_t_9, __pyx_int_1}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 741, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_v_index); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_9); - __Pyx_INCREF(__pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_8, __pyx_int_1); - __pyx_t_9 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_array, __pyx_t_2); - __pyx_t_2 = 0; - } - __pyx_L7:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":731 - * array = numpy.empty(0) - * - * if isinstance(index, (int, long)): # <<<<<<<<<<<<<< - * - * # If we want to read from end of file, - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":743 - * array = self.__read_slice(index, index + 1, 1) - * - * elif isinstance(index, slice): # <<<<<<<<<<<<<< - * - * recstart, recstop, recstep = self.__parse_slice(index) - */ - __pyx_t_6 = PySlice_Check(__pyx_v_index); - __pyx_t_5 = (__pyx_t_6 != 0); - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":745 - * elif isinstance(index, slice): - * - * recstart, recstop, recstep = self.__parse_slice(index) # <<<<<<<<<<<<<< - * if recstop == 0 and self.adapter.num_records > 0: - * recstop = self.adapter.num_records - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_parse_slice); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_index}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_index}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_index); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { - PyObject* sequence = __pyx_t_2; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 745, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_1 = PyList_GET_ITEM(sequence, 0); - __pyx_t_9 = PyList_GET_ITEM(sequence, 1); - __pyx_t_4 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_1 = __pyx_t_10(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed; - __Pyx_GOTREF(__pyx_t_1); - index = 1; __pyx_t_9 = __pyx_t_10(__pyx_t_3); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 2; __pyx_t_4 = __pyx_t_10(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_3), 3) < 0) __PYX_ERR(0, 745, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L9_unpacking_done; - __pyx_L8_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_10 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 745, __pyx_L1_error) - __pyx_L9_unpacking_done:; - } - __pyx_v_recstart = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_v_recstop = __pyx_t_9; - __pyx_t_9 = 0; - __pyx_v_recstep = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":746 - * - * recstart, recstop, recstep = self.__parse_slice(index) - * if recstop == 0 and self.adapter.num_records > 0: # <<<<<<<<<<<<<< - * recstop = self.adapter.num_records - * - */ - __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_recstop, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 746, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_6 = ((__pyx_v_self->adapter->num_records > 0) != 0); - __pyx_t_5 = __pyx_t_6; - __pyx_L11_bool_binop_done:; - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":747 - * recstart, recstop, recstep = self.__parse_slice(index) - * if recstop == 0 and self.adapter.num_records > 0: - * recstop = self.adapter.num_records # <<<<<<<<<<<<<< - * - * if infer_types(self.adapter.fields): - */ - __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->adapter->num_records); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_recstop, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":746 - * - * recstart, recstop, recstep = self.__parse_slice(index) - * if recstop == 0 and self.adapter.num_records > 0: # <<<<<<<<<<<<<< - * recstop = self.adapter.num_records - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":749 - * recstop = self.adapter.num_records - * - * if infer_types(self.adapter.fields): # <<<<<<<<<<<<<< - * array = self.__read_slice_infer_types(recstart, recstop, recstep) - * else: - */ - __pyx_t_5 = (infer_types(__pyx_v_self->adapter->fields) != 0); - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":750 - * - * if infer_types(self.adapter.fields): - * array = self.__read_slice_infer_types(recstart, recstop, recstep) # <<<<<<<<<<<<<< - * else: - * array = self.__read_slice(recstart, recstop, recstep) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_slice_infer_types); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_recstart, __pyx_v_recstop, __pyx_v_recstep}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_recstart, __pyx_v_recstop, __pyx_v_recstep}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_1 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_INCREF(__pyx_v_recstart); - __Pyx_GIVEREF(__pyx_v_recstart); - PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_8, __pyx_v_recstart); - __Pyx_INCREF(__pyx_v_recstop); - __Pyx_GIVEREF(__pyx_v_recstop); - PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_8, __pyx_v_recstop); - __Pyx_INCREF(__pyx_v_recstep); - __Pyx_GIVEREF(__pyx_v_recstep); - PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_8, __pyx_v_recstep); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_array, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":749 - * recstop = self.adapter.num_records - * - * if infer_types(self.adapter.fields): # <<<<<<<<<<<<<< - * array = self.__read_slice_infer_types(recstart, recstop, recstep) - * else: - */ - goto __pyx_L13; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":752 - * array = self.__read_slice_infer_types(recstart, recstop, recstep) - * else: - * array = self.__read_slice(recstart, recstop, recstep) # <<<<<<<<<<<<<< - * if recstart == 0 and recstop == 0 and recstep == 1 and self.adapter.num_records == 0: - * self.adapter.num_records = array.size - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_slice); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_recstart, __pyx_v_recstop, __pyx_v_recstep}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_recstart, __pyx_v_recstop, __pyx_v_recstep}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_1) { - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); __pyx_t_1 = NULL; - } - __Pyx_INCREF(__pyx_v_recstart); - __Pyx_GIVEREF(__pyx_v_recstart); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_recstart); - __Pyx_INCREF(__pyx_v_recstop); - __Pyx_GIVEREF(__pyx_v_recstop); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_recstop); - __Pyx_INCREF(__pyx_v_recstep); - __Pyx_GIVEREF(__pyx_v_recstep); - PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_recstep); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_array, __pyx_t_2); - __pyx_t_2 = 0; - } - __pyx_L13:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":753 - * else: - * array = self.__read_slice(recstart, recstop, recstep) - * if recstart == 0 and recstop == 0 and recstep == 1 and self.adapter.num_records == 0: # <<<<<<<<<<<<<< - * self.adapter.num_records = array.size - * - */ - __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_recstart, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_recstop, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_recstep, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_6 = ((__pyx_v_self->adapter->num_records == 0) != 0); - __pyx_t_5 = __pyx_t_6; - __pyx_L15_bool_binop_done:; - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":754 - * array = self.__read_slice(recstart, recstop, recstep) - * if recstart == 0 and recstop == 0 and recstep == 1 and self.adapter.num_records == 0: - * self.adapter.num_records = array.size # <<<<<<<<<<<<<< - * - * elif isinstance(index, string_types): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_array, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_2); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_self->adapter->num_records = __pyx_t_11; - - /* "TextAdapter/textadapter/TextAdapter.pyx":753 - * else: - * array = self.__read_slice(recstart, recstop, recstep) - * if recstart == 0 and recstop == 0 and recstep == 1 and self.adapter.num_records == 0: # <<<<<<<<<<<<<< - * self.adapter.num_records = array.size - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":743 - * array = self.__read_slice(index, index + 1, 1) - * - * elif isinstance(index, slice): # <<<<<<<<<<<<<< - * - * recstart, recstop, recstep = self.__parse_slice(index) - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":756 - * self.adapter.num_records = array.size - * - * elif isinstance(index, string_types): # <<<<<<<<<<<<<< - * return TextAdapterFields(self, [index]) - * elif isinstance(index, (list, tuple)): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_string_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_IsInstance(__pyx_v_index, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":757 - * - * elif isinstance(index, string_types): - * return TextAdapterFields(self, [index]) # <<<<<<<<<<<<<< - * elif isinstance(index, (list, tuple)): - * return TextAdapterFields(self, index) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 757, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_index); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 757, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_TextAdapterFields, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 757, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":756 - * self.adapter.num_records = array.size - * - * elif isinstance(index, string_types): # <<<<<<<<<<<<<< - * return TextAdapterFields(self, [index]) - * elif isinstance(index, (list, tuple)): - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":758 - * elif isinstance(index, string_types): - * return TextAdapterFields(self, [index]) - * elif isinstance(index, (list, tuple)): # <<<<<<<<<<<<<< - * return TextAdapterFields(self, index) - * else: - */ - __pyx_t_5 = PyList_Check(__pyx_v_index); - __pyx_t_7 = (__pyx_t_5 != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L19_bool_binop_done; - } - __pyx_t_7 = PyTuple_Check(__pyx_v_index); - __pyx_t_5 = (__pyx_t_7 != 0); - __pyx_t_6 = __pyx_t_5; - __pyx_L19_bool_binop_done:; - __pyx_t_5 = (__pyx_t_6 != 0); - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":759 - * return TextAdapterFields(self, [index]) - * elif isinstance(index, (list, tuple)): - * return TextAdapterFields(self, index) # <<<<<<<<<<<<<< - * else: - * raise IndexError('index must be int, slice, fancy indexing, or field name') - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_index); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_TextAdapterFields, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 759, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":758 - * elif isinstance(index, string_types): - * return TextAdapterFields(self, [index]) - * elif isinstance(index, (list, tuple)): # <<<<<<<<<<<<<< - * return TextAdapterFields(self, index) - * else: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":761 - * return TextAdapterFields(self, index) - * else: - * raise IndexError('index must be int, slice, fancy indexing, or field name') # <<<<<<<<<<<<<< - * - * array.shape = (-1,) - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__66, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 761, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 761, __pyx_L1_error) - } - __pyx_L3:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":763 - * raise IndexError('index must be int, slice, fancy indexing, or field name') - * - * array.shape = (-1,) # <<<<<<<<<<<<<< - * - * if self.default_output == 'dataframe': - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_array, __pyx_n_s_shape, __pyx_tuple__67) < 0) __PYX_ERR(0, 763, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":765 - * array.shape = (-1,) - * - * if self.default_output == 'dataframe': # <<<<<<<<<<<<<< - * return pandas.DataFrame.from_records(array) - * else: - */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_self->default_output, __pyx_n_s_dataframe, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 765, __pyx_L1_error) - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":766 - * - * if self.default_output == 'dataframe': - * return pandas.DataFrame.from_records(array) # <<<<<<<<<<<<<< - * else: - * return array - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pandas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_from_records); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_9) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_array}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_array}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_INCREF(__pyx_v_array); - __Pyx_GIVEREF(__pyx_v_array); - PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_array); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":765 - * array.shape = (-1,) - * - * if self.default_output == 'dataframe': # <<<<<<<<<<<<<< - * return pandas.DataFrame.from_records(array) - * else: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":768 - * return pandas.DataFrame.from_records(array) - * else: - * return array # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_array); - __pyx_r = __pyx_v_array; - goto __pyx_L0; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":712 - * - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * """ Read records by record number or slice """ - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_TextAdapterFields); - __Pyx_XDECREF(__pyx_v_array); - __Pyx_XDECREF(__pyx_v_recstart); - __Pyx_XDECREF(__pyx_v_recstop); - __Pyx_XDECREF(__pyx_v_recstep); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":771 - * - * - * def __parse_slice(self, index): # <<<<<<<<<<<<<< - * - * recstart = index.start - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_39__parse_slice(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_39__parse_slice(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__parse_slice (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_38__parse_slice(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_38__parse_slice(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_recstart = NULL; - PyObject *__pyx_v_recstop = NULL; - PyObject *__pyx_v_recstep = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("__parse_slice", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":773 - * def __parse_slice(self, index): - * - * recstart = index.start # <<<<<<<<<<<<<< - * recstop = index.stop - * recstep = index.step - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_recstart = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":774 - * - * recstart = index.start - * recstop = index.stop # <<<<<<<<<<<<<< - * recstep = index.step - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_recstop = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":775 - * recstart = index.start - * recstop = index.stop - * recstep = index.step # <<<<<<<<<<<<<< - * - * if recstart is None: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_recstep = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":777 - * recstep = index.step - * - * if recstart is None: # <<<<<<<<<<<<<< - * recstart = 0 - * else: - */ - __pyx_t_2 = (__pyx_v_recstart == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":778 - * - * if recstart is None: - * recstart = 0 # <<<<<<<<<<<<<< - * else: - * if recstart < 0: - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_DECREF_SET(__pyx_v_recstart, __pyx_int_0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":777 - * recstep = index.step - * - * if recstart is None: # <<<<<<<<<<<<<< - * recstart = 0 - * else: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":780 - * recstart = 0 - * else: - * if recstart < 0: # <<<<<<<<<<<<<< - * recstart = self.size + recstart - * - */ - /*else*/ { - __pyx_t_1 = PyObject_RichCompare(__pyx_v_recstart, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":781 - * else: - * if recstart < 0: - * recstart = self.size + recstart # <<<<<<<<<<<<<< - * - * if recstop is None: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_v_recstart); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_recstart, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":780 - * recstart = 0 - * else: - * if recstart < 0: # <<<<<<<<<<<<<< - * recstart = self.size + recstart - * - */ - } - } - __pyx_L3:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":783 - * recstart = self.size + recstart - * - * if recstop is None: # <<<<<<<<<<<<<< - * recstop = 0 - * else: - */ - __pyx_t_3 = (__pyx_v_recstop == Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":784 - * - * if recstop is None: - * recstop = 0 # <<<<<<<<<<<<<< - * else: - * if recstop < 0: - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_DECREF_SET(__pyx_v_recstop, __pyx_int_0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":783 - * recstart = self.size + recstart - * - * if recstop is None: # <<<<<<<<<<<<<< - * recstop = 0 - * else: - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":786 - * recstop = 0 - * else: - * if recstop < 0: # <<<<<<<<<<<<<< - * recstop = self.size + recstop - * - */ - /*else*/ { - __pyx_t_4 = PyObject_RichCompare(__pyx_v_recstop, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 786, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":787 - * else: - * if recstop < 0: - * recstop = self.size + recstop # <<<<<<<<<<<<<< - * - * if recstep is None: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_v_recstop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 787, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_recstop, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":786 - * recstop = 0 - * else: - * if recstop < 0: # <<<<<<<<<<<<<< - * recstop = self.size + recstop - * - */ - } - } - __pyx_L5:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":789 - * recstop = self.size + recstop - * - * if recstep is None: # <<<<<<<<<<<<<< - * recstep = 1 - * else: - */ - __pyx_t_2 = (__pyx_v_recstep == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":790 - * - * if recstep is None: - * recstep = 1 # <<<<<<<<<<<<<< - * else: - * if recstep < 0: - */ - __Pyx_INCREF(__pyx_int_1); - __Pyx_DECREF_SET(__pyx_v_recstep, __pyx_int_1); - - /* "TextAdapter/textadapter/TextAdapter.pyx":789 - * recstop = self.size + recstop - * - * if recstep is None: # <<<<<<<<<<<<<< - * recstep = 1 - * else: - */ - goto __pyx_L7; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":792 - * recstep = 1 - * else: - * if recstep < 0: # <<<<<<<<<<<<<< - * raise NotImplementedError('reverse stepping not implemented yet') - * - */ - /*else*/ { - __pyx_t_1 = PyObject_RichCompare(__pyx_v_recstep, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 792, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 792, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":793 - * else: - * if recstep < 0: - * raise NotImplementedError('reverse stepping not implemented yet') # <<<<<<<<<<<<<< - * - * return (recstart, recstop, recstep) - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__68, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 793, __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_ERR(0, 793, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":792 - * recstep = 1 - * else: - * if recstep < 0: # <<<<<<<<<<<<<< - * raise NotImplementedError('reverse stepping not implemented yet') - * - */ - } - } - __pyx_L7:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":795 - * raise NotImplementedError('reverse stepping not implemented yet') - * - * return (recstart, recstop, recstep) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 795, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_recstart); - __Pyx_GIVEREF(__pyx_v_recstart); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_recstart); - __Pyx_INCREF(__pyx_v_recstop); - __Pyx_GIVEREF(__pyx_v_recstop); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_recstop); - __Pyx_INCREF(__pyx_v_recstep); - __Pyx_GIVEREF(__pyx_v_recstep); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_recstep); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":771 - * - * - * def __parse_slice(self, index): # <<<<<<<<<<<<<< - * - * recstart = index.start - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__parse_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_recstart); - __Pyx_XDECREF(__pyx_v_recstop); - __Pyx_XDECREF(__pyx_v_recstep); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":798 - * - * - * def __read_slice_infer_types(self, start_rec, stop_rec, step_rec): # <<<<<<<<<<<<<< - * """ Read records by slice and infer dtypes """ - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_41__read_slice_infer_types(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_40__read_slice_infer_types[] = " Read records by slice and infer dtypes "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_41__read_slice_infer_types(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_start_rec = 0; - PyObject *__pyx_v_stop_rec = 0; - PyObject *__pyx_v_step_rec = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__read_slice_infer_types (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_start_rec,&__pyx_n_s_stop_rec,&__pyx_n_s_step_rec,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_rec)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop_rec)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__read_slice_infer_types", 1, 3, 3, 1); __PYX_ERR(0, 798, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step_rec)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__read_slice_infer_types", 1, 3, 3, 2); __PYX_ERR(0, 798, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__read_slice_infer_types") < 0)) __PYX_ERR(0, 798, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_start_rec = values[0]; - __pyx_v_stop_rec = values[1]; - __pyx_v_step_rec = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__read_slice_infer_types", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 798, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__read_slice_infer_types", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_40__read_slice_infer_types(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), __pyx_v_start_rec, __pyx_v_stop_rec, __pyx_v_step_rec); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_40__read_slice_infer_types(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_start_rec, PyObject *__pyx_v_stop_rec, PyObject *__pyx_v_step_rec) { - PyObject *__pyx_v_field = NULL; - AdapterError __pyx_v_result; - PyObject *__pyx_v_array = NULL; - PyObject *__pyx_v_e = NULL; - PyObject *__pyx_v_num_recs = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - uint64_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - __Pyx_RefNannySetupContext("__read_slice_infer_types", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":802 - * - * # Set default dtypes for fields not set with set_field_types - * for field in self._field_filter: # <<<<<<<<<<<<<< - * if self.adapter.fields.field_info[field].infer_type: - * self.mapping[field] = numpy.dtype('u8') - */ - if (likely(PyList_CheckExact(__pyx_v_self->_field_filter)) || PyTuple_CheckExact(__pyx_v_self->_field_filter)) { - __pyx_t_1 = __pyx_v_self->_field_filter; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->_field_filter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 802, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 802, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 802, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 802, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 802, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 802, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":803 - * # Set default dtypes for fields not set with set_field_types - * for field in self._field_filter: - * if self.adapter.fields.field_info[field].infer_type: # <<<<<<<<<<<<<< - * self.mapping[field] = numpy.dtype('u8') - * self.__build_converters() - */ - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_field); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 803, __pyx_L1_error) - __pyx_t_6 = ((__pyx_v_self->adapter->fields->field_info[__pyx_t_5]).infer_type != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":804 - * for field in self._field_filter: - * if self.adapter.fields.field_info[field].infer_type: - * self.mapping[field] = numpy.dtype('u8') # <<<<<<<<<<<<<< - * self.__build_converters() - * self.__set_fill_values(None) - */ - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_tuple__69, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyObject_SetItem(__pyx_v_self->mapping, __pyx_v_field, __pyx_t_4) < 0)) __PYX_ERR(0, 804, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":803 - * # Set default dtypes for fields not set with set_field_types - * for field in self._field_filter: - * if self.adapter.fields.field_info[field].infer_type: # <<<<<<<<<<<<<< - * self.mapping[field] = numpy.dtype('u8') - * self.__build_converters() - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":802 - * - * # Set default dtypes for fields not set with set_field_types - * for field in self._field_filter: # <<<<<<<<<<<<<< - * if self.adapter.fields.field_info[field].infer_type: - * self.mapping[field] = numpy.dtype('u8') - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":805 - * if self.adapter.fields.field_info[field].infer_type: - * self.mapping[field] = numpy.dtype('u8') - * self.__build_converters() # <<<<<<<<<<<<<< - * self.__set_fill_values(None) - * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_build_converters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":806 - * self.mapping[field] = numpy.dtype('u8') - * self.__build_converters() - * self.__set_fill_values(None) # <<<<<<<<<<<<<< - * - * # Try to make a good guess about the field dtypes from first 1000 records. - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_fill_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__70, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 806, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":810 - * # Try to make a good guess about the field dtypes from first 1000 records. - * # If we're reading less than 1000 records then don't bother with guess. - * if stop_rec == 0 or (stop_rec > 0 and stop_rec - start_rec > 1000): # <<<<<<<<<<<<<< - * result = seek_record(self.adapter, start_rec) - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: - */ - __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_stop_rec, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_8) { - } else { - __pyx_t_6 = __pyx_t_8; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_4 = PyObject_RichCompare(__pyx_v_stop_rec, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 810, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { - } else { - __pyx_t_6 = __pyx_t_8; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_4 = PyNumber_Subtract(__pyx_v_stop_rec, __pyx_v_start_rec); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1000, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __pyx_t_8; - __pyx_L7_bool_binop_done:; - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":811 - * # If we're reading less than 1000 records then don't bother with guess. - * if stop_rec == 0 or (stop_rec > 0 and stop_rec - start_rec > 1000): - * result = seek_record(self.adapter, start_rec) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: - * self.__raise_adapter_exception(result) - */ - __pyx_t_9 = __Pyx_PyInt_As_uint64_t(__pyx_v_start_rec); if (unlikely((__pyx_t_9 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 811, __pyx_L1_error) - __pyx_v_result = seek_record(__pyx_v_self->adapter, __pyx_t_9); - - /* "TextAdapter/textadapter/TextAdapter.pyx":812 - * if stop_rec == 0 or (stop_rec > 0 and stop_rec - start_rec > 1000): - * result = seek_record(self.adapter, start_rec) - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * self.__infer_types(start_rec, 1000, step_rec) - */ - switch (__pyx_v_result) { - case ADAPTER_SUCCESS: - case ADAPTER_ERROR_READ_EOF: - __pyx_t_6 = 0; - break; - default: - __pyx_t_6 = 1; - break; - } - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":813 - * result = seek_record(self.adapter, start_rec) - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: - * self.__raise_adapter_exception(result) # <<<<<<<<<<<<<< - * self.__infer_types(start_rec, 1000, step_rec) - * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_adapter_exception); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 813, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 813, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_10) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 813, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":812 - * if stop_rec == 0 or (stop_rec > 0 and stop_rec - start_rec > 1000): - * result = seek_record(self.adapter, start_rec) - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * self.__infer_types(start_rec, 1000, step_rec) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":814 - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: - * self.__raise_adapter_exception(result) - * self.__infer_types(start_rec, 1000, step_rec) # <<<<<<<<<<<<<< - * - * try: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_infer_types); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 814, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_start_rec, __pyx_int_1000, __pyx_v_step_rec}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_start_rec, __pyx_int_1000, __pyx_v_step_rec}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_7 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 814, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_11); __pyx_t_11 = NULL; - } - __Pyx_INCREF(__pyx_v_start_rec); - __Pyx_GIVEREF(__pyx_v_start_rec); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_12, __pyx_v_start_rec); - __Pyx_INCREF(__pyx_int_1000); - __Pyx_GIVEREF(__pyx_int_1000); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_12, __pyx_int_1000); - __Pyx_INCREF(__pyx_v_step_rec); - __Pyx_GIVEREF(__pyx_v_step_rec); - PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_12, __pyx_v_step_rec); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":810 - * # Try to make a good guess about the field dtypes from first 1000 records. - * # If we're reading less than 1000 records then don't bother with guess. - * if stop_rec == 0 or (stop_rec > 0 and stop_rec - start_rec > 1000): # <<<<<<<<<<<<<< - * result = seek_record(self.adapter, start_rec) - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":816 - * self.__infer_types(start_rec, 1000, step_rec) - * - * try: # <<<<<<<<<<<<<< - * array = self.__read_slice(start_rec, stop_rec, step_rec) - * except errors.DataTypeError as e: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_15); - /*try:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":817 - * - * try: - * array = self.__read_slice(start_rec, stop_rec, step_rec) # <<<<<<<<<<<<<< - * except errors.DataTypeError as e: - * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_slice); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 817, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_start_rec, __pyx_v_stop_rec, __pyx_v_step_rec}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L11_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_start_rec, __pyx_v_stop_rec, __pyx_v_step_rec}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L11_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_11 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 817, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_11); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_INCREF(__pyx_v_start_rec); - __Pyx_GIVEREF(__pyx_v_start_rec); - PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_12, __pyx_v_start_rec); - __Pyx_INCREF(__pyx_v_stop_rec); - __Pyx_GIVEREF(__pyx_v_stop_rec); - PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_12, __pyx_v_stop_rec); - __Pyx_INCREF(__pyx_v_step_rec); - __Pyx_GIVEREF(__pyx_v_step_rec); - PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_12, __pyx_v_step_rec); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_array = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":816 - * self.__infer_types(start_rec, 1000, step_rec) - * - * try: # <<<<<<<<<<<<<< - * array = self.__read_slice(start_rec, stop_rec, step_rec) - * except errors.DataTypeError as e: - */ - } - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - goto __pyx_L18_try_end; - __pyx_L11_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":818 - * try: - * array = self.__read_slice(start_rec, stop_rec, step_rec) - * except errors.DataTypeError as e: # <<<<<<<<<<<<<< - * - * num_recs = 0 - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_DataTypeError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 818, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_12) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__read_slice_infer_types", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_11) < 0) __PYX_ERR(0, 818, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_11); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_e = __pyx_t_1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":820 - * except errors.DataTypeError as e: - * - * num_recs = 0 # <<<<<<<<<<<<<< - * if stop_rec > 0: - * num_recs = stop_rec - e.record - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_num_recs = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":821 - * - * num_recs = 0 - * if stop_rec > 0: # <<<<<<<<<<<<<< - * num_recs = stop_rec - e.record - * - */ - __pyx_t_7 = PyObject_RichCompare(__pyx_v_stop_rec, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 821, __pyx_L13_except_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 821, __pyx_L13_except_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":822 - * num_recs = 0 - * if stop_rec > 0: - * num_recs = stop_rec - e.record # <<<<<<<<<<<<<< - * - * self.__infer_types(e.record, num_recs, step_rec) - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_record); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 822, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = PyNumber_Subtract(__pyx_v_stop_rec, __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 822, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF_SET(__pyx_v_num_recs, __pyx_t_10); - __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":821 - * - * num_recs = 0 - * if stop_rec > 0: # <<<<<<<<<<<<<< - * num_recs = stop_rec - e.record - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":824 - * num_recs = stop_rec - e.record - * - * self.__infer_types(e.record, num_recs, step_rec) # <<<<<<<<<<<<<< - * array = self.__read_slice(start_rec, stop_rec, step_rec) - * - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_infer_types); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 824, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_record); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 824, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_17 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_17)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_17); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[4] = {__pyx_t_17, __pyx_t_16, __pyx_v_num_recs, __pyx_v_step_rec}; - __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 824, __pyx_L13_except_error) - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[4] = {__pyx_t_17, __pyx_t_16, __pyx_v_num_recs, __pyx_v_step_rec}; - __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 824, __pyx_L13_except_error) - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } else - #endif - { - __pyx_t_18 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 824, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_18); - if (__pyx_t_17) { - __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17); __pyx_t_17 = NULL; - } - __Pyx_GIVEREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_12, __pyx_t_16); - __Pyx_INCREF(__pyx_v_num_recs); - __Pyx_GIVEREF(__pyx_v_num_recs); - PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_12, __pyx_v_num_recs); - __Pyx_INCREF(__pyx_v_step_rec); - __Pyx_GIVEREF(__pyx_v_step_rec); - PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_12, __pyx_v_step_rec); - __pyx_t_16 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_18, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 824, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":825 - * - * self.__infer_types(e.record, num_recs, step_rec) - * array = self.__read_slice(start_rec, stop_rec, step_rec) # <<<<<<<<<<<<<< - * - * return array - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_slice); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 825, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_18 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_18)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_18); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[4] = {__pyx_t_18, __pyx_v_start_rec, __pyx_v_stop_rec, __pyx_v_step_rec}; - __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 825, __pyx_L13_except_error) - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_GOTREF(__pyx_t_10); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[4] = {__pyx_t_18, __pyx_v_start_rec, __pyx_v_stop_rec, __pyx_v_step_rec}; - __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 825, __pyx_L13_except_error) - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_GOTREF(__pyx_t_10); - } else - #endif - { - __pyx_t_16 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 825, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_16); - if (__pyx_t_18) { - __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_18); __pyx_t_18 = NULL; - } - __Pyx_INCREF(__pyx_v_start_rec); - __Pyx_GIVEREF(__pyx_v_start_rec); - PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_12, __pyx_v_start_rec); - __Pyx_INCREF(__pyx_v_stop_rec); - __Pyx_GIVEREF(__pyx_v_stop_rec); - PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_12, __pyx_v_stop_rec); - __Pyx_INCREF(__pyx_v_step_rec); - __Pyx_GIVEREF(__pyx_v_step_rec); - PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_12, __pyx_v_step_rec); - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_16, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 825, __pyx_L13_except_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF_SET(__pyx_v_array, __pyx_t_10); - __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L12_exception_handled; - } - goto __pyx_L13_except_error; - __pyx_L13_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":816 - * self.__infer_types(start_rec, 1000, step_rec) - * - * try: # <<<<<<<<<<<<<< - * array = self.__read_slice(start_rec, stop_rec, step_rec) - * except errors.DataTypeError as e: - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); - goto __pyx_L1_error; - __pyx_L12_exception_handled:; - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); - __pyx_L18_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":827 - * array = self.__read_slice(start_rec, stop_rec, step_rec) - * - * return array # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_array); - __pyx_r = __pyx_v_array; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":798 - * - * - * def __read_slice_infer_types(self, start_rec, stop_rec, step_rec): # <<<<<<<<<<<<<< - * """ Read records by slice and infer dtypes """ - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__read_slice_infer_types", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XDECREF(__pyx_v_array); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_XDECREF(__pyx_v_num_recs); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":830 - * - * - * def __infer_types(self, start_rec, num_recs, step_rec): # <<<<<<<<<<<<<< - * """ infer types for first x records """ - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_43__infer_types(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_42__infer_types[] = " infer types for first x records "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_43__infer_types(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_start_rec = 0; - PyObject *__pyx_v_num_recs = 0; - PyObject *__pyx_v_step_rec = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__infer_types (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_start_rec,&__pyx_n_s_num_recs,&__pyx_n_s_step_rec,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_rec)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_recs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__infer_types", 1, 3, 3, 1); __PYX_ERR(0, 830, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step_rec)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__infer_types", 1, 3, 3, 2); __PYX_ERR(0, 830, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__infer_types") < 0)) __PYX_ERR(0, 830, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_start_rec = values[0]; - __pyx_v_num_recs = values[1]; - __pyx_v_step_rec = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__infer_types", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 830, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__infer_types", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_42__infer_types(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), __pyx_v_start_rec, __pyx_v_num_recs, __pyx_v_step_rec); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_42__infer_types(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_start_rec, PyObject *__pyx_v_num_recs, PyObject *__pyx_v_step_rec) { - uint64_t __pyx_v_recs_read; - AdapterError __pyx_v_result; - PyObject *__pyx_v_mapping = NULL; - PyObject *__pyx_v_field = NULL; - PyObject *__pyx_v_dtype = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - uint64_t __pyx_t_1; - int __pyx_t_2; - 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; - uint64_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - PyObject *(*__pyx_t_11)(PyObject *); - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - PyObject *__pyx_t_16 = NULL; - __Pyx_RefNannySetupContext("__infer_types", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":833 - * """ infer types for first x records """ - * - * cdef uint64_t recs_read = 0 # <<<<<<<<<<<<<< - * - * result = seek_record(self.adapter, start_rec) - */ - __pyx_v_recs_read = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":835 - * cdef uint64_t recs_read = 0 - * - * result = seek_record(self.adapter, start_rec) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * self.__raise_adapter_exception(result) - */ - __pyx_t_1 = __Pyx_PyInt_As_uint64_t(__pyx_v_start_rec); if (unlikely((__pyx_t_1 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 835, __pyx_L1_error) - __pyx_v_result = seek_record(__pyx_v_self->adapter, __pyx_t_1); - - /* "TextAdapter/textadapter/TextAdapter.pyx":836 - * - * result = seek_record(self.adapter, start_rec) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * - */ - __pyx_t_2 = ((__pyx_v_result != ADAPTER_SUCCESS) != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":837 - * result = seek_record(self.adapter, start_rec) - * if result != ADAPTER_SUCCESS: - * self.__raise_adapter_exception(result) # <<<<<<<<<<<<<< - * - * self.adapter.infer_types_mode = 1 - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_adapter_exception); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":836 - * - * result = seek_record(self.adapter, start_rec) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":839 - * self.__raise_adapter_exception(result) - * - * self.adapter.infer_types_mode = 1 # <<<<<<<<<<<<<< - * result = read_records(self.adapter, num_recs, step_rec, NULL, &recs_read) - * self.adapter.infer_types_mode = 0 - */ - __pyx_v_self->adapter->infer_types_mode = 1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":840 - * - * self.adapter.infer_types_mode = 1 - * result = read_records(self.adapter, num_recs, step_rec, NULL, &recs_read) # <<<<<<<<<<<<<< - * self.adapter.infer_types_mode = 0 - * - */ - __pyx_t_1 = __Pyx_PyInt_As_uint64_t(__pyx_v_num_recs); if (unlikely((__pyx_t_1 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 840, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyInt_As_uint64_t(__pyx_v_step_rec); if (unlikely((__pyx_t_8 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 840, __pyx_L1_error) - __pyx_v_result = read_records(__pyx_v_self->adapter, __pyx_t_1, __pyx_t_8, NULL, (&__pyx_v_recs_read)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":841 - * self.adapter.infer_types_mode = 1 - * result = read_records(self.adapter, num_recs, step_rec, NULL, &recs_read) - * self.adapter.infer_types_mode = 0 # <<<<<<<<<<<<<< - * - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: - */ - __pyx_v_self->adapter->infer_types_mode = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":843 - * self.adapter.infer_types_mode = 0 - * - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * - */ - switch (__pyx_v_result) { - case ADAPTER_SUCCESS: - case ADAPTER_ERROR_READ_EOF: - __pyx_t_2 = 0; - break; - default: - __pyx_t_2 = 1; - break; - } - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":844 - * - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: - * self.__raise_adapter_exception(result) # <<<<<<<<<<<<<< - * - * # Now we know correct dtypes for first 1000 records. - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_adapter_exception); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_7}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_7}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":843 - * self.adapter.infer_types_mode = 0 - * - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":848 - * # Now we know correct dtypes for first 1000 records. - * # Set field/dtype mapping. - * mapping = self.__get_mapping_from_converters() # <<<<<<<<<<<<<< - * for field, dtype in mapping.items(): - * self.mapping[field] = numpy.dtype(dtype) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_mapping_from_converters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_mapping = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":849 - * # Set field/dtype mapping. - * mapping = self.__get_mapping_from_converters() - * for field, dtype in mapping.items(): # <<<<<<<<<<<<<< - * self.mapping[field] = numpy.dtype(dtype) - * self.logger.debug('__infer_types() setting dtype {0} for field {1}' - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_mapping, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 849, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 849, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 849, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 849, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_10(__pyx_t_4); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 849, __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 !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 849, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); - } else { - __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); - #else - __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; - index = 0; __pyx_t_6 = __pyx_t_11(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed; - __Pyx_GOTREF(__pyx_t_6); - index = 1; __pyx_t_7 = __pyx_t_11(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed; - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_5), 2) < 0) __PYX_ERR(0, 849, __pyx_L1_error) - __pyx_t_11 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L8_unpacking_done; - __pyx_L7_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_11 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 849, __pyx_L1_error) - __pyx_L8_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_7); - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":850 - * mapping = self.__get_mapping_from_converters() - * for field, dtype in mapping.items(): - * self.mapping[field] = numpy.dtype(dtype) # <<<<<<<<<<<<<< - * self.logger.debug('__infer_types() setting dtype {0} for field {1}' - * .format(self.mapping[field].str, str(field))) - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 850, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dtype); - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 850, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_self->mapping, __pyx_v_field, __pyx_t_7) < 0)) __PYX_ERR(0, 850, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":851 - * for field, dtype in mapping.items(): - * self.mapping[field] = numpy.dtype(dtype) - * self.logger.debug('__infer_types() setting dtype {0} for field {1}' # <<<<<<<<<<<<<< - * .format(self.mapping[field].str, str(field))) - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->logger, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "TextAdapter/textadapter/TextAdapter.pyx":852 - * self.mapping[field] = numpy.dtype(dtype) - * self.logger.debug('__infer_types() setting dtype {0} for field {1}' - * .format(self.mapping[field].str, str(field))) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_infer_types_setting_dtype_0_fo, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_12 = PyObject_GetItem(__pyx_v_self->mapping, __pyx_v_field); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_str); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_v_field); - __Pyx_GIVEREF(__pyx_v_field); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_field); - __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_12, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - __pyx_t_15 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_15 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_13, __pyx_t_14}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_13, __pyx_t_14}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else - #endif - { - __pyx_t_16 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_12); __pyx_t_12 = NULL; - } - __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_t_14); - __pyx_t_13 = 0; - __pyx_t_14 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_5) { - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_7); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6}; - __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6}; - __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_16, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":849 - * # Set field/dtype mapping. - * mapping = self.__get_mapping_from_converters() - * for field, dtype in mapping.items(): # <<<<<<<<<<<<<< - * self.mapping[field] = numpy.dtype(dtype) - * self.logger.debug('__infer_types() setting dtype {0} for field {1}' - */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":830 - * - * - * def __infer_types(self, start_rec, num_recs, step_rec): # <<<<<<<<<<<<<< - * """ infer types for first x records """ - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__infer_types", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_mapping); - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XDECREF(__pyx_v_dtype); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":855 - * - * - * def __read_slice(self, start_rec, stop_rec, step_rec): # <<<<<<<<<<<<<< - * """ Read records by slice """ - * cdef uint64_t recs_read = 0 - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_45__read_slice(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_44__read_slice[] = " Read records by slice "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_45__read_slice(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_start_rec = 0; - PyObject *__pyx_v_stop_rec = 0; - PyObject *__pyx_v_step_rec = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__read_slice (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_start_rec,&__pyx_n_s_stop_rec,&__pyx_n_s_step_rec,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_rec)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop_rec)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__read_slice", 1, 3, 3, 1); __PYX_ERR(0, 855, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step_rec)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__read_slice", 1, 3, 3, 2); __PYX_ERR(0, 855, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__read_slice") < 0)) __PYX_ERR(0, 855, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_start_rec = values[0]; - __pyx_v_stop_rec = values[1]; - __pyx_v_step_rec = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__read_slice", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 855, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__read_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_44__read_slice(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), __pyx_v_start_rec, __pyx_v_stop_rec, __pyx_v_step_rec); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_44__read_slice(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_start_rec, PyObject *__pyx_v_stop_rec, PyObject *__pyx_v_step_rec) { - uint64_t __pyx_v_recs_read; - AdapterError __pyx_v_result; - char *__pyx_v_data; - PyObject *__pyx_v_field_names = NULL; - PyObject *__pyx_v_field_namesDict = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_dtype = NULL; - PyObject *__pyx_v_field = NULL; - PyObject *__pyx_v_warning = NULL; - PyObject *__pyx_v_rec_size = NULL; - PyObject *__pyx_v_num_recs = NULL; - PyObject *__pyx_v_offset = NULL; - PyObject *__pyx_v_array = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - uint64_t __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - int __pyx_t_16; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - PyObject *__pyx_t_20 = NULL; - uint32_t __pyx_t_21; - size_t __pyx_t_22; - size_t __pyx_t_23; - uint64_t __pyx_t_24; - uint64_t __pyx_t_25; - __Pyx_RefNannySetupContext("__read_slice", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":857 - * def __read_slice(self, start_rec, stop_rec, step_rec): - * """ Read records by slice """ - * cdef uint64_t recs_read = 0 # <<<<<<<<<<<<<< - * cdef AdapterError result - * cdef ConvertErrorInfo info - */ - __pyx_v_recs_read = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":865 - * # If number of fields is zero, then field/dtype mapping was - * # probably not set up. - * if self.mapping is None or \ # <<<<<<<<<<<<<< - * (isinstance(self.mapping, dict) and len(self.mapping.keys()) == 0): - * self.__raise_adapter_exception(ADAPTER_ERROR_NO_FIELDS); - */ - __pyx_t_2 = (__pyx_v_self->mapping == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":866 - * # probably not set up. - * if self.mapping is None or \ - * (isinstance(self.mapping, dict) and len(self.mapping.keys()) == 0): # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(ADAPTER_ERROR_NO_FIELDS); - * self.__build_converters() - */ - __pyx_t_4 = __pyx_v_self->mapping; - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = PyDict_Check(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->mapping, __pyx_n_s_keys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 866, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_6) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 866, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 866, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 866, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = ((__pyx_t_7 == 0) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":865 - * # If number of fields is zero, then field/dtype mapping was - * # probably not set up. - * if self.mapping is None or \ # <<<<<<<<<<<<<< - * (isinstance(self.mapping, dict) and len(self.mapping.keys()) == 0): - * self.__raise_adapter_exception(ADAPTER_ERROR_NO_FIELDS); - */ - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":867 - * if self.mapping is None or \ - * (isinstance(self.mapping, dict) and len(self.mapping.keys()) == 0): - * self.__raise_adapter_exception(ADAPTER_ERROR_NO_FIELDS); # <<<<<<<<<<<<<< - * self.__build_converters() - * self.__set_fill_values(self.fill_values) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_adapter_exception); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_NO_FIELDS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_8) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":865 - * # If number of fields is zero, then field/dtype mapping was - * # probably not set up. - * if self.mapping is None or \ # <<<<<<<<<<<<<< - * (isinstance(self.mapping, dict) and len(self.mapping.keys()) == 0): - * self.__raise_adapter_exception(ADAPTER_ERROR_NO_FIELDS); - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":868 - * (isinstance(self.mapping, dict) and len(self.mapping.keys()) == 0): - * self.__raise_adapter_exception(ADAPTER_ERROR_NO_FIELDS); - * self.__build_converters() # <<<<<<<<<<<<<< - * self.__set_fill_values(self.fill_values) - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_build_converters); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 868, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_9) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 868, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 868, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":869 - * self.__raise_adapter_exception(ADAPTER_ERROR_NO_FIELDS); - * self.__build_converters() - * self.__set_fill_values(self.fill_values) # <<<<<<<<<<<<<< - * - * result = seek_record(self.adapter, start_rec) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_fill_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 869, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_9) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_self->fill_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 869, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_self->fill_values}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 869, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_self->fill_values}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 869, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 869, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_INCREF(__pyx_v_self->fill_values); - __Pyx_GIVEREF(__pyx_v_self->fill_values); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_self->fill_values); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 869, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":871 - * self.__set_fill_values(self.fill_values) - * - * result = seek_record(self.adapter, start_rec) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * self.__raise_adapter_exception(result) - */ - __pyx_t_10 = __Pyx_PyInt_As_uint64_t(__pyx_v_start_rec); if (unlikely((__pyx_t_10 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 871, __pyx_L1_error) - __pyx_v_result = seek_record(__pyx_v_self->adapter, __pyx_t_10); - - /* "TextAdapter/textadapter/TextAdapter.pyx":872 - * - * result = seek_record(self.adapter, start_rec) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * - */ - __pyx_t_1 = ((__pyx_v_result != ADAPTER_SUCCESS) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":873 - * result = seek_record(self.adapter, start_rec) - * if result != ADAPTER_SUCCESS: - * self.__raise_adapter_exception(result) # <<<<<<<<<<<<<< - * - * # setup field names for dtype - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_adapter_exception); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 873, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 873, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_9) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 873, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_6}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 873, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_6}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 873, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 873, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 873, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":872 - * - * result = seek_record(self.adapter, start_rec) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":876 - * - * # setup field names for dtype - * if self._field_names is None: # <<<<<<<<<<<<<< - * field_names = ['f' + str(i) for i in range(self.field_count)] - * else: - */ - __pyx_t_1 = (__pyx_v_self->_field_names == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":877 - * # setup field names for dtype - * if self._field_names is None: - * field_names = ['f' + str(i) for i in range(self.field_count)] # <<<<<<<<<<<<<< - * else: - * field_names = self._field_names - */ - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { - __pyx_t_8 = __pyx_t_5; __Pyx_INCREF(__pyx_t_8); __pyx_t_7 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_11 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 877, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_8))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_8)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 877, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_8)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 877, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_11(__pyx_t_8); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 877, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i); - __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_n_s_f, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_field_names = __pyx_t_4; - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":876 - * - * # setup field names for dtype - * if self._field_names is None: # <<<<<<<<<<<<<< - * field_names = ['f' + str(i) for i in range(self.field_count)] - * else: - */ - goto __pyx_L8; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":879 - * field_names = ['f' + str(i) for i in range(self.field_count)] - * else: - * field_names = self._field_names # <<<<<<<<<<<<<< - * - * # Make sure there are no duplicate field names - */ - /*else*/ { - __pyx_t_4 = __pyx_v_self->_field_names; - __Pyx_INCREF(__pyx_t_4); - __pyx_v_field_names = __pyx_t_4; - __pyx_t_4 = 0; - } - __pyx_L8:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":883 - * # Make sure there are no duplicate field names - * # (duplicate blank or None is okay) - * field_namesDict = {} # <<<<<<<<<<<<<< - * for i, name in enumerate(field_names): - * if name is None or name == '': - */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 883, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_field_namesDict = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":884 - * # (duplicate blank or None is okay) - * field_namesDict = {} - * for i, name in enumerate(field_names): # <<<<<<<<<<<<<< - * if name is None or name == '': - * continue - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_4 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_field_names)) || PyTuple_CheckExact(__pyx_v_field_names)) { - __pyx_t_8 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_8); __pyx_t_7 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 884, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_11 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 884, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_8))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_8)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 884, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 884, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_8)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 884, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 884, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_11(__pyx_t_8); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 884, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 884, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); - __pyx_t_4 = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":885 - * field_namesDict = {} - * for i, name in enumerate(field_names): - * if name is None or name == '': # <<<<<<<<<<<<<< - * continue - * if name in field_namesDict: - */ - __pyx_t_1 = (__pyx_v_name == Py_None); - __pyx_t_3 = (__pyx_t_1 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_2 = __pyx_t_3; - goto __pyx_L14_bool_binop_done; - } - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_kp_s__25, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 885, __pyx_L1_error) - __pyx_t_2 = __pyx_t_3; - __pyx_L14_bool_binop_done:; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":886 - * for i, name in enumerate(field_names): - * if name is None or name == '': - * continue # <<<<<<<<<<<<<< - * if name in field_namesDict: - * field_namesDict[name] += 1 - */ - goto __pyx_L11_continue; - - /* "TextAdapter/textadapter/TextAdapter.pyx":885 - * field_namesDict = {} - * for i, name in enumerate(field_names): - * if name is None or name == '': # <<<<<<<<<<<<<< - * continue - * if name in field_namesDict: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":887 - * if name is None or name == '': - * continue - * if name in field_namesDict: # <<<<<<<<<<<<<< - * field_namesDict[name] += 1 - * field_names[i] = name + str(field_namesDict[name]) - */ - __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_field_namesDict, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 887, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":888 - * continue - * if name in field_namesDict: - * field_namesDict[name] += 1 # <<<<<<<<<<<<<< - * field_names[i] = name + str(field_namesDict[name]) - * else: - */ - __Pyx_INCREF(__pyx_v_name); - __pyx_t_5 = __pyx_v_name; - __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_field_namesDict, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 888, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 888, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(PyDict_SetItem(__pyx_v_field_namesDict, __pyx_t_5, __pyx_t_9) < 0)) __PYX_ERR(0, 888, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":889 - * if name in field_namesDict: - * field_namesDict[name] += 1 - * field_names[i] = name + str(field_namesDict[name]) # <<<<<<<<<<<<<< - * else: - * field_namesDict[name] = 0 - */ - __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_field_namesDict, __pyx_v_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Add(__pyx_v_name, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_field_names, __pyx_v_i, __pyx_t_9) < 0)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":887 - * if name is None or name == '': - * continue - * if name in field_namesDict: # <<<<<<<<<<<<<< - * field_namesDict[name] += 1 - * field_names[i] = name + str(field_namesDict[name]) - */ - goto __pyx_L16; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":891 - * field_names[i] = name + str(field_namesDict[name]) - * else: - * field_namesDict[name] = 0 # <<<<<<<<<<<<<< - * - * # create proper record dtype from field names and dtypes list - */ - /*else*/ { - if (unlikely(PyDict_SetItem(__pyx_v_field_namesDict, __pyx_v_name, __pyx_int_0) < 0)) __PYX_ERR(0, 891, __pyx_L1_error) - } - __pyx_L16:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":884 - * # (duplicate blank or None is okay) - * field_namesDict = {} - * for i, name in enumerate(field_names): # <<<<<<<<<<<<<< - * if name is None or name == '': - * continue - */ - __pyx_L11_continue:; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":894 - * - * # create proper record dtype from field names and dtypes list - * dtype = [] # <<<<<<<<<<<<<< - * try: - * for field in self._field_filter: - */ - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 894, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_dtype = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":895 - * # create proper record dtype from field names and dtypes list - * dtype = [] - * try: # <<<<<<<<<<<<<< - * for field in self._field_filter: - * dtype.append((field_names[field], self.mapping[field])) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_14); - /*try:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":896 - * dtype = [] - * try: - * for field in self._field_filter: # <<<<<<<<<<<<<< - * dtype.append((field_names[field], self.mapping[field])) - * except IndexError: - */ - if (likely(PyList_CheckExact(__pyx_v_self->_field_filter)) || PyTuple_CheckExact(__pyx_v_self->_field_filter)) { - __pyx_t_4 = __pyx_v_self->_field_filter; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self->_field_filter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 896, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 896, __pyx_L17_error) - } - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 896, __pyx_L17_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 896, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 896, __pyx_L17_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 896, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } - } else { - __pyx_t_8 = __pyx_t_11(__pyx_t_4); - if (unlikely(!__pyx_t_8)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 896, __pyx_L17_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_8); - __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":897 - * try: - * for field in self._field_filter: - * dtype.append((field_names[field], self.mapping[field])) # <<<<<<<<<<<<<< - * except IndexError: - * # leave field names blank as a last resort - */ - __pyx_t_8 = PyObject_GetItem(__pyx_v_field_names, __pyx_v_field); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 897, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetItem(__pyx_v_self->mapping, __pyx_v_field); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 897, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 897, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_9); - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_dtype, __pyx_t_5); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 897, __pyx_L17_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":896 - * dtype = [] - * try: - * for field in self._field_filter: # <<<<<<<<<<<<<< - * dtype.append((field_names[field], self.mapping[field])) - * except IndexError: - */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":895 - * # create proper record dtype from field names and dtypes list - * dtype = [] - * try: # <<<<<<<<<<<<<< - * for field in self._field_filter: - * dtype.append((field_names[field], self.mapping[field])) - */ - } - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - goto __pyx_L24_try_end; - __pyx_L17_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":898 - * for field in self._field_filter: - * dtype.append((field_names[field], self.mapping[field])) - * except IndexError: # <<<<<<<<<<<<<< - * # leave field names blank as a last resort - * dtype = [('', self.mapping[field]) for field in self._field_filter] - */ - __pyx_t_16 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError); - if (__pyx_t_16) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__read_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_9) < 0) __PYX_ERR(0, 898, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_9); - - /* "TextAdapter/textadapter/TextAdapter.pyx":900 - * except IndexError: - * # leave field names blank as a last resort - * dtype = [('', self.mapping[field]) for field in self._field_filter] # <<<<<<<<<<<<<< - * warning = ('Invalid index {0} for field names [{1}]. Default field ' - * 'names will be used.'.format(str(field), ','.join(field_names))) - */ - __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 900, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_8); - if (likely(PyList_CheckExact(__pyx_v_self->_field_filter)) || PyTuple_CheckExact(__pyx_v_self->_field_filter)) { - __pyx_t_6 = __pyx_v_self->_field_filter; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_self->_field_filter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 900, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 900, __pyx_L19_except_error) - } - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_6))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_17 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_17); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 900, __pyx_L19_except_error) - #else - __pyx_t_17 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 900, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_17); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_17); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 900, __pyx_L19_except_error) - #else - __pyx_t_17 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 900, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_17); - #endif - } - } else { - __pyx_t_17 = __pyx_t_11(__pyx_t_6); - if (unlikely(!__pyx_t_17)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 900, __pyx_L19_except_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_17); - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_17); - __pyx_t_17 = 0; - __pyx_t_17 = PyObject_GetItem(__pyx_v_self->mapping, __pyx_v_field); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 900, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 900, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_INCREF(__pyx_kp_s__25); - __Pyx_GIVEREF(__pyx_kp_s__25); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_kp_s__25); - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17); - __pyx_t_17 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_18))) __PYX_ERR(0, 900, __pyx_L19_except_error) - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF_SET(__pyx_v_dtype, ((PyObject*)__pyx_t_8)); - __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":902 - * dtype = [('', self.mapping[field]) for field in self._field_filter] - * warning = ('Invalid index {0} for field names [{1}]. Default field ' - * 'names will be used.'.format(str(field), ','.join(field_names))) # <<<<<<<<<<<<<< - * self.logger.warning(warning) - * - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Invalid_index_0_for_field_names, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 902, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(!__pyx_v_field)) { __Pyx_RaiseUnboundLocalError("field"); __PYX_ERR(0, 902, __pyx_L19_except_error) } - __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 902, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_INCREF(__pyx_v_field); - __Pyx_GIVEREF(__pyx_v_field); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_v_field); - __pyx_t_17 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_18, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 902, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = __Pyx_PyString_Join(__pyx_kp_s__50, __pyx_v_field_names); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 902, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_19 = NULL; - __pyx_t_16 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_16 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_17, __pyx_t_18}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 902, __pyx_L19_except_error) - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_17, __pyx_t_18}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 902, __pyx_L19_except_error) - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - { - __pyx_t_20 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 902, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_20); - if (__pyx_t_19) { - __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); __pyx_t_19 = NULL; - } - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_16, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_16, __pyx_t_18); - __pyx_t_17 = 0; - __pyx_t_18 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_20, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 902, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_warning = __pyx_t_8; - __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":903 - * warning = ('Invalid index {0} for field names [{1}]. Default field ' - * 'names will be used.'.format(str(field), ','.join(field_names))) - * self.logger.warning(warning) # <<<<<<<<<<<<<< - * - * # calculate record size in bytes - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->logger, __pyx_n_s_warning); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 903, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_20 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_20)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_20); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_20) { - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_warning); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 903, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_8); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_20, __pyx_v_warning}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 903, __pyx_L19_except_error) - __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_GOTREF(__pyx_t_8); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_20, __pyx_v_warning}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 903, __pyx_L19_except_error) - __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_GOTREF(__pyx_t_8); - } else - #endif - { - __pyx_t_18 = PyTuple_New(1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 903, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_20); __pyx_t_20 = NULL; - __Pyx_INCREF(__pyx_v_warning); - __Pyx_GIVEREF(__pyx_v_warning); - PyTuple_SET_ITEM(__pyx_t_18, 0+1, __pyx_v_warning); - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_18, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 903, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L18_exception_handled; - } - goto __pyx_L19_except_error; - __pyx_L19_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":895 - * # create proper record dtype from field names and dtypes list - * dtype = [] - * try: # <<<<<<<<<<<<<< - * for field in self._field_filter: - * dtype.append((field_names[field], self.mapping[field])) - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); - goto __pyx_L1_error; - __pyx_L18_exception_handled:; - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); - __pyx_L24_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":906 - * - * # calculate record size in bytes - * rec_size = 0 # <<<<<<<<<<<<<< - * for field in self._field_filter: - * rec_size = rec_size + get_field_size(self.adapter.fields, NULL, field) - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_rec_size = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":907 - * # calculate record size in bytes - * rec_size = 0 - * for field in self._field_filter: # <<<<<<<<<<<<<< - * rec_size = rec_size + get_field_size(self.adapter.fields, NULL, field) - * - */ - if (likely(PyList_CheckExact(__pyx_v_self->_field_filter)) || PyTuple_CheckExact(__pyx_v_self->_field_filter)) { - __pyx_t_9 = __pyx_v_self->_field_filter; __Pyx_INCREF(__pyx_t_9); __pyx_t_7 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_self->_field_filter); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 907, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 907, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_9))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 907, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 907, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 907, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 907, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_11(__pyx_t_9); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 907, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":908 - * rec_size = 0 - * for field in self._field_filter: - * rec_size = rec_size + get_field_size(self.adapter.fields, NULL, field) # <<<<<<<<<<<<<< - * - * # If we want to read whole file but don't know the number of records, - */ - __pyx_t_21 = __Pyx_PyInt_As_uint32_t(__pyx_v_field); if (unlikely((__pyx_t_21 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 908, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyInt_From_uint32_t(get_field_size(__pyx_v_self->adapter->fields, NULL, __pyx_t_21)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 908, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Add(__pyx_v_rec_size, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 908, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_rec_size, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":907 - * # calculate record size in bytes - * rec_size = 0 - * for field in self._field_filter: # <<<<<<<<<<<<<< - * rec_size = rec_size + get_field_size(self.adapter.fields, NULL, field) - * - */ - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":912 - * # If we want to read whole file but don't know the number of records, - * # read REC_CHUNK_SIZE records at a time until we reach eof. - * if stop_rec == -1 or stop_rec == 0: # <<<<<<<<<<<<<< - * - * data = calloc(self.REC_CHUNK_SIZE, rec_size) - */ - __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_v_stop_rec, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L34_bool_binop_done; - } - __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_v_stop_rec, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_3 = __pyx_t_2; - __pyx_L34_bool_binop_done:; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":914 - * if stop_rec == -1 or stop_rec == 0: - * - * data = calloc(self.REC_CHUNK_SIZE, rec_size) # <<<<<<<<<<<<<< - * if data == 0: - * raise MemoryError('out of memory') - */ - __pyx_t_22 = __Pyx_PyInt_As_size_t(__pyx_v_self->REC_CHUNK_SIZE); if (unlikely((__pyx_t_22 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 914, __pyx_L1_error) - __pyx_t_23 = __Pyx_PyInt_As_size_t(__pyx_v_rec_size); if (unlikely((__pyx_t_23 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 914, __pyx_L1_error) - __pyx_v_data = ((char *)calloc(__pyx_t_22, __pyx_t_23)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":915 - * - * data = calloc(self.REC_CHUNK_SIZE, rec_size) - * if data == 0: # <<<<<<<<<<<<<< - * raise MemoryError('out of memory') - * - */ - __pyx_t_3 = ((((int)__pyx_v_data) == 0) != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":916 - * data = calloc(self.REC_CHUNK_SIZE, rec_size) - * if data == 0: - * raise MemoryError('out of memory') # <<<<<<<<<<<<<< - * - * num_recs = 0 - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__71, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 916, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 916, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":915 - * - * data = calloc(self.REC_CHUNK_SIZE, rec_size) - * if data == 0: # <<<<<<<<<<<<<< - * raise MemoryError('out of memory') - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":918 - * raise MemoryError('out of memory') - * - * num_recs = 0 # <<<<<<<<<<<<<< - * offset = 0 - * while True: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_num_recs = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":919 - * - * num_recs = 0 - * offset = 0 # <<<<<<<<<<<<<< - * while True: - * result = read_records(self.adapter, self.REC_CHUNK_SIZE, step_rec, - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_offset = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":920 - * num_recs = 0 - * offset = 0 - * while True: # <<<<<<<<<<<<<< - * result = read_records(self.adapter, self.REC_CHUNK_SIZE, step_rec, - * (data+offset), &recs_read) - */ - while (1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":921 - * offset = 0 - * while True: - * result = read_records(self.adapter, self.REC_CHUNK_SIZE, step_rec, # <<<<<<<<<<<<<< - * (data+offset), &recs_read) - * - */ - __pyx_t_10 = __Pyx_PyInt_As_uint64_t(__pyx_v_self->REC_CHUNK_SIZE); if (unlikely((__pyx_t_10 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 921, __pyx_L1_error) - __pyx_t_24 = __Pyx_PyInt_As_uint64_t(__pyx_v_step_rec); if (unlikely((__pyx_t_24 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 921, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":922 - * while True: - * result = read_records(self.adapter, self.REC_CHUNK_SIZE, step_rec, - * (data+offset), &recs_read) # <<<<<<<<<<<<<< - * - * # Don't worry about EOF error because we don't know how many - */ - __pyx_t_25 = __Pyx_PyInt_As_uint64_t(__pyx_v_offset); if (unlikely((__pyx_t_25 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":921 - * offset = 0 - * while True: - * result = read_records(self.adapter, self.REC_CHUNK_SIZE, step_rec, # <<<<<<<<<<<<<< - * (data+offset), &recs_read) - * - */ - __pyx_v_result = read_records(__pyx_v_self->adapter, __pyx_t_10, __pyx_t_24, ((char *)(__pyx_v_data + ((uint64_t)__pyx_t_25))), (&__pyx_v_recs_read)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":926 - * # Don't worry about EOF error because we don't know how many - * # records we need to read - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: # <<<<<<<<<<<<<< - * free(data) - * self.__raise_adapter_exception(result) - */ - switch (__pyx_v_result) { - case ADAPTER_SUCCESS: - case ADAPTER_ERROR_READ_EOF: - __pyx_t_3 = 0; - break; - default: - __pyx_t_3 = 1; - break; - } - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":927 - * # records we need to read - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: - * free(data) # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * - */ - free(__pyx_v_data); - - /* "TextAdapter/textadapter/TextAdapter.pyx":928 - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: - * free(data) - * self.__raise_adapter_exception(result) # <<<<<<<<<<<<<< - * - * num_recs = num_recs + recs_read - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_adapter_exception); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 928, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 928, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_8) { - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 928, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_5}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 928, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_5}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 928, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 928, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 928, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":926 - * # Don't worry about EOF error because we don't know how many - * # records we need to read - * if result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_READ_EOF: # <<<<<<<<<<<<<< - * free(data) - * self.__raise_adapter_exception(result) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":930 - * self.__raise_adapter_exception(result) - * - * num_recs = num_recs + recs_read # <<<<<<<<<<<<<< - * - * # If we've hit eof, resize array to get rid of empty unused - */ - __pyx_t_9 = __Pyx_PyInt_From_uint64_t(__pyx_v_recs_read); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PyNumber_Add(__pyx_v_num_recs, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF_SET(__pyx_v_num_recs, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":934 - * # If we've hit eof, resize array to get rid of empty unused - * # records at the end. - * if recs_read < self.REC_CHUNK_SIZE: # <<<<<<<<<<<<<< - * # Trim unused memory at end of memory block before - * # creating numpy array out of it - */ - __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_recs_read); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 934, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyObject_RichCompare(__pyx_t_4, __pyx_v_self->REC_CHUNK_SIZE, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 934, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 934, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":937 - * # Trim unused memory at end of memory block before - * # creating numpy array out of it - * data = realloc(data, num_recs * rec_size) # <<<<<<<<<<<<<< - * if data == 0: - * raise MemoryError('out of memory') - */ - __pyx_t_9 = PyNumber_Multiply(__pyx_v_num_recs, __pyx_v_rec_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 937, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_23 = __Pyx_PyInt_As_size_t(__pyx_t_9); if (unlikely((__pyx_t_23 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 937, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_data = ((char *)realloc(__pyx_v_data, __pyx_t_23)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":938 - * # creating numpy array out of it - * data = realloc(data, num_recs * rec_size) - * if data == 0: # <<<<<<<<<<<<<< - * raise MemoryError('out of memory') - * array = create_array(data, numpy.dtype(dtype), num_recs) - */ - __pyx_t_3 = ((((int)__pyx_v_data) == 0) != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":939 - * data = realloc(data, num_recs * rec_size) - * if data == 0: - * raise MemoryError('out of memory') # <<<<<<<<<<<<<< - * array = create_array(data, numpy.dtype(dtype), num_recs) - * break - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__72, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 939, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 939, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":938 - * # creating numpy array out of it - * data = realloc(data, num_recs * rec_size) - * if data == 0: # <<<<<<<<<<<<<< - * raise MemoryError('out of memory') - * array = create_array(data, numpy.dtype(dtype), num_recs) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":940 - * if data == 0: - * raise MemoryError('out of memory') - * array = create_array(data, numpy.dtype(dtype), num_recs) # <<<<<<<<<<<<<< - * break - * - */ - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 940, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_dtype); - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 940, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_25 = __Pyx_PyInt_As_uint64_t(__pyx_v_num_recs); if (unlikely((__pyx_t_25 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 940, __pyx_L1_error) - __pyx_t_9 = __pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_array(__pyx_v_data, __pyx_t_4, __pyx_t_25); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 940, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_array = __pyx_t_9; - __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":941 - * raise MemoryError('out of memory') - * array = create_array(data, numpy.dtype(dtype), num_recs) - * break # <<<<<<<<<<<<<< - * - * offset = offset + (rec_size * self.REC_CHUNK_SIZE) - */ - goto __pyx_L38_break; - - /* "TextAdapter/textadapter/TextAdapter.pyx":934 - * # If we've hit eof, resize array to get rid of empty unused - * # records at the end. - * if recs_read < self.REC_CHUNK_SIZE: # <<<<<<<<<<<<<< - * # Trim unused memory at end of memory block before - * # creating numpy array out of it - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":943 - * break - * - * offset = offset + (rec_size * self.REC_CHUNK_SIZE) # <<<<<<<<<<<<<< - * - * # Expand output memory block for next chunk of records - */ - __pyx_t_9 = PyNumber_Multiply(__pyx_v_rec_size, __pyx_v_self->REC_CHUNK_SIZE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 943, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PyNumber_Add(__pyx_v_offset, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 943, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF_SET(__pyx_v_offset, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":947 - * # Expand output memory block for next chunk of records - * data = realloc(data, - * (num_recs + self.REC_CHUNK_SIZE) * rec_size) # <<<<<<<<<<<<<< - * if data == 0: - * raise MemoryError('out of memory') - */ - __pyx_t_4 = PyNumber_Add(__pyx_v_num_recs, __pyx_v_self->REC_CHUNK_SIZE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 947, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyNumber_Multiply(__pyx_t_4, __pyx_v_rec_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 947, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_23 = __Pyx_PyInt_As_size_t(__pyx_t_9); if (unlikely((__pyx_t_23 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 947, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":946 - * - * # Expand output memory block for next chunk of records - * data = realloc(data, # <<<<<<<<<<<<<< - * (num_recs + self.REC_CHUNK_SIZE) * rec_size) - * if data == 0: - */ - __pyx_v_data = ((char *)realloc(__pyx_v_data, __pyx_t_23)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":948 - * data = realloc(data, - * (num_recs + self.REC_CHUNK_SIZE) * rec_size) - * if data == 0: # <<<<<<<<<<<<<< - * raise MemoryError('out of memory') - * - */ - __pyx_t_3 = ((((int)__pyx_v_data) == 0) != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":949 - * (num_recs + self.REC_CHUNK_SIZE) * rec_size) - * if data == 0: - * raise MemoryError('out of memory') # <<<<<<<<<<<<<< - * - * # We know exactly how many records to read, - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__73, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 949, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 949, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":948 - * data = realloc(data, - * (num_recs + self.REC_CHUNK_SIZE) * rec_size) - * if data == 0: # <<<<<<<<<<<<<< - * raise MemoryError('out of memory') - * - */ - } - } - __pyx_L38_break:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":912 - * # If we want to read whole file but don't know the number of records, - * # read REC_CHUNK_SIZE records at a time until we reach eof. - * if stop_rec == -1 or stop_rec == 0: # <<<<<<<<<<<<<< - * - * data = calloc(self.REC_CHUNK_SIZE, rec_size) - */ - goto __pyx_L33; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":954 - * # so allocate array and read them - * else: - * num_recs = math.ceil(abs((stop_rec - start_rec) / step_rec)) # <<<<<<<<<<<<<< - * - * data = calloc(num_recs, rec_size) - */ - /*else*/ { - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ceil); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_v_stop_rec, __pyx_v_start_rec); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_step_rec); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Absolute(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_5) { - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_num_recs = __pyx_t_9; - __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":956 - * num_recs = math.ceil(abs((stop_rec - start_rec) / step_rec)) - * - * data = calloc(num_recs, rec_size) # <<<<<<<<<<<<<< - * if data == 0: - * raise MemoryError('out of memory') - */ - __pyx_t_23 = __Pyx_PyInt_As_size_t(__pyx_v_num_recs); if (unlikely((__pyx_t_23 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 956, __pyx_L1_error) - __pyx_t_22 = __Pyx_PyInt_As_size_t(__pyx_v_rec_size); if (unlikely((__pyx_t_22 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 956, __pyx_L1_error) - __pyx_v_data = ((char *)calloc(__pyx_t_23, __pyx_t_22)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":957 - * - * data = calloc(num_recs, rec_size) - * if data == 0: # <<<<<<<<<<<<<< - * raise MemoryError('out of memory') - * - */ - __pyx_t_3 = ((((int)__pyx_v_data) == 0) != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":958 - * data = calloc(num_recs, rec_size) - * if data == 0: - * raise MemoryError('out of memory') # <<<<<<<<<<<<<< - * - * result = read_records(self.adapter, stop_rec - start_rec, step_rec, - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__74, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 958, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 958, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":957 - * - * data = calloc(num_recs, rec_size) - * if data == 0: # <<<<<<<<<<<<<< - * raise MemoryError('out of memory') - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":960 - * raise MemoryError('out of memory') - * - * result = read_records(self.adapter, stop_rec - start_rec, step_rec, # <<<<<<<<<<<<<< - * data, &recs_read) - * if result != ADAPTER_SUCCESS: - */ - __pyx_t_9 = PyNumber_Subtract(__pyx_v_stop_rec, __pyx_v_start_rec); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 960, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_25 = __Pyx_PyInt_As_uint64_t(__pyx_t_9); if (unlikely((__pyx_t_25 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 960, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_24 = __Pyx_PyInt_As_uint64_t(__pyx_v_step_rec); if (unlikely((__pyx_t_24 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 960, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":961 - * - * result = read_records(self.adapter, stop_rec - start_rec, step_rec, - * data, &recs_read) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * free(data) - */ - __pyx_v_result = read_records(__pyx_v_self->adapter, __pyx_t_25, __pyx_t_24, ((char *)__pyx_v_data), (&__pyx_v_recs_read)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":962 - * result = read_records(self.adapter, stop_rec - start_rec, step_rec, - * data, &recs_read) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * free(data) - * self.__raise_adapter_exception(result) - */ - __pyx_t_3 = ((__pyx_v_result != ADAPTER_SUCCESS) != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":963 - * data, &recs_read) - * if result != ADAPTER_SUCCESS: - * free(data) # <<<<<<<<<<<<<< - * self.__raise_adapter_exception(result) - * if recs_read < num_recs: - */ - free(__pyx_v_data); - - /* "TextAdapter/textadapter/TextAdapter.pyx":964 - * if result != ADAPTER_SUCCESS: - * free(data) - * self.__raise_adapter_exception(result) # <<<<<<<<<<<<<< - * if recs_read < num_recs: - * data = realloc(data, recs_read * rec_size) - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_adapter_exception); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 964, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 964, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_4) { - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 964, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_8}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 964, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_8}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 964, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 964, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 964, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":962 - * result = read_records(self.adapter, stop_rec - start_rec, step_rec, - * data, &recs_read) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * free(data) - * self.__raise_adapter_exception(result) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":965 - * free(data) - * self.__raise_adapter_exception(result) - * if recs_read < num_recs: # <<<<<<<<<<<<<< - * data = realloc(data, recs_read * rec_size) - * if data == 0: - */ - __pyx_t_9 = __Pyx_PyInt_From_uint64_t(__pyx_v_recs_read); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 965, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_9, __pyx_v_num_recs, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 965, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 965, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":966 - * self.__raise_adapter_exception(result) - * if recs_read < num_recs: - * data = realloc(data, recs_read * rec_size) # <<<<<<<<<<<<<< - * if data == 0: - * raise MemoryError('out of memory') - */ - __pyx_t_6 = __Pyx_PyInt_From_uint64_t(__pyx_v_recs_read); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyNumber_Multiply(__pyx_t_6, __pyx_v_rec_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_22 = __Pyx_PyInt_As_size_t(__pyx_t_9); if (unlikely((__pyx_t_22 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_data = ((char *)realloc(__pyx_v_data, __pyx_t_22)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":967 - * if recs_read < num_recs: - * data = realloc(data, recs_read * rec_size) - * if data == 0: # <<<<<<<<<<<<<< - * raise MemoryError('out of memory') - * - */ - __pyx_t_3 = ((((int)__pyx_v_data) == 0) != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":968 - * data = realloc(data, recs_read * rec_size) - * if data == 0: - * raise MemoryError('out of memory') # <<<<<<<<<<<<<< - * - * array = create_array(data, numpy.dtype(dtype), recs_read) - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__75, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 968, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 968, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":967 - * if recs_read < num_recs: - * data = realloc(data, recs_read * rec_size) - * if data == 0: # <<<<<<<<<<<<<< - * raise MemoryError('out of memory') - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":965 - * free(data) - * self.__raise_adapter_exception(result) - * if recs_read < num_recs: # <<<<<<<<<<<<<< - * data = realloc(data, recs_read * rec_size) - * if data == 0: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":970 - * raise MemoryError('out of memory') - * - * array = create_array(data, numpy.dtype(dtype), recs_read) # <<<<<<<<<<<<<< - * - * if self.indexing is True: - */ - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 970, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_dtype); - __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 970, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_array(__pyx_v_data, __pyx_t_6, __pyx_v_recs_read); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 970, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_array = __pyx_t_9; - __pyx_t_9 = 0; - } - __pyx_L33:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":972 - * array = create_array(data, numpy.dtype(dtype), recs_read) - * - * if self.indexing is True: # <<<<<<<<<<<<<< - * self.exact_index.finalize(self.adapter.num_records) - * - */ - __pyx_t_3 = (__pyx_v_self->indexing == Py_True); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":973 - * - * if self.indexing is True: - * self.exact_index.finalize(self.adapter.num_records) # <<<<<<<<<<<<<< - * - * return array - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->exact_index, __pyx_n_s_finalize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 973, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->adapter->num_records); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 973, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_8) { - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 973, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_5}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 973, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_5}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 973, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 973, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 973, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":972 - * array = create_array(data, numpy.dtype(dtype), recs_read) - * - * if self.indexing is True: # <<<<<<<<<<<<<< - * self.exact_index.finalize(self.adapter.num_records) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":975 - * self.exact_index.finalize(self.adapter.num_records) - * - * return array # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_array)) { __Pyx_RaiseUnboundLocalError("array"); __PYX_ERR(0, 975, __pyx_L1_error) } - __Pyx_INCREF(__pyx_v_array); - __pyx_r = __pyx_v_array; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":855 - * - * - * def __read_slice(self, start_rec, stop_rec, step_rec): # <<<<<<<<<<<<<< - * """ Read records by slice """ - * cdef uint64_t recs_read = 0 - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_19); - __Pyx_XDECREF(__pyx_t_20); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__read_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_field_names); - __Pyx_XDECREF(__pyx_v_field_namesDict); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_dtype); - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XDECREF(__pyx_v_warning); - __Pyx_XDECREF(__pyx_v_rec_size); - __Pyx_XDECREF(__pyx_v_num_recs); - __Pyx_XDECREF(__pyx_v_offset); - __Pyx_XDECREF(__pyx_v_array); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":978 - * - * - * def __build_converters(self): # <<<<<<<<<<<<<< - * """ - * Set function converters according to field/dtype dict in self.mapping - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_47__build_converters(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_46__build_converters[] = "\n Set function converters according to field/dtype dict in self.mapping\n "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_47__build_converters(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__build_converters (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_46__build_converters(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_46__build_converters(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - PyObject *__pyx_v_field = NULL; - PyObject *__pyx_v_dtype = NULL; - PyObject *__pyx_v_index = 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)(PyObject *); - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - __Pyx_RefNannySetupContext("__build_converters", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":982 - * Set function converters according to field/dtype dict in self.mapping - * """ - * reset_converters(self.adapter.fields) # <<<<<<<<<<<<<< - * - * for field, dtype in self.mapping.items(): - */ - reset_converters(__pyx_v_self->adapter->fields); - - /* "TextAdapter/textadapter/TextAdapter.pyx":984 - * reset_converters(self.adapter.fields) - * - * for field, dtype in self.mapping.items(): # <<<<<<<<<<<<<< - * if isinstance(field, (int, long)): - * index = field - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->mapping, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 984, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __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_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 984, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 984, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 984, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 984, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 984, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 984, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); - __pyx_t_6 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 984, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 984, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 984, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 984, __pyx_L1_error) - __pyx_t_8 = NULL; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 984, __pyx_L1_error) - __pyx_L6_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_3); - __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_6); - __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":985 - * - * for field, dtype in self.mapping.items(): - * if isinstance(field, (int, long)): # <<<<<<<<<<<<<< - * index = field - * elif isinstance(field, string_types): - */ - __pyx_t_10 = PyInt_Check(__pyx_v_field); - __pyx_t_11 = (__pyx_t_10 != 0); - if (!__pyx_t_11) { - } else { - __pyx_t_9 = __pyx_t_11; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_11 = PyLong_Check(__pyx_v_field); - __pyx_t_10 = (__pyx_t_11 != 0); - __pyx_t_9 = __pyx_t_10; - __pyx_L8_bool_binop_done:; - __pyx_t_10 = (__pyx_t_9 != 0); - if (__pyx_t_10) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":986 - * for field, dtype in self.mapping.items(): - * if isinstance(field, (int, long)): - * index = field # <<<<<<<<<<<<<< - * elif isinstance(field, string_types): - * index = self._field_names.index(field) - */ - __Pyx_INCREF(__pyx_v_field); - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_v_field); - - /* "TextAdapter/textadapter/TextAdapter.pyx":985 - * - * for field, dtype in self.mapping.items(): - * if isinstance(field, (int, long)): # <<<<<<<<<<<<<< - * index = field - * elif isinstance(field, string_types): - */ - goto __pyx_L7; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":987 - * if isinstance(field, (int, long)): - * index = field - * elif isinstance(field, string_types): # <<<<<<<<<<<<<< - * index = self._field_names.index(field) - * else: - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_string_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 987, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyObject_IsInstance(__pyx_v_field, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 987, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_9 = (__pyx_t_10 != 0); - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":988 - * index = field - * elif isinstance(field, string_types): - * index = self._field_names.index(field) # <<<<<<<<<<<<<< - * else: - * raise TypeError('field to map must be int or string') - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_field_names, __pyx_n_s_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 988, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_field); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_field}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_field}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 988, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_field); - __Pyx_GIVEREF(__pyx_v_field); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_field); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":987 - * if isinstance(field, (int, long)): - * index = field - * elif isinstance(field, string_types): # <<<<<<<<<<<<<< - * index = self._field_names.index(field) - * else: - */ - goto __pyx_L7; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":990 - * index = self._field_names.index(field) - * else: - * raise TypeError('field to map must be int or string') # <<<<<<<<<<<<<< - * if self._field_filter is None or index in self._field_filter: - * if field in self.build_converter: - */ - /*else*/ { - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__76, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __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_ERR(0, 990, __pyx_L1_error) - } - __pyx_L7:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":991 - * else: - * raise TypeError('field to map must be int or string') - * if self._field_filter is None or index in self._field_filter: # <<<<<<<<<<<<<< - * if field in self.build_converter: - * self.build_converter[field]() - */ - __pyx_t_10 = (__pyx_v_self->_field_filter == Py_None); - __pyx_t_11 = (__pyx_t_10 != 0); - if (!__pyx_t_11) { - } else { - __pyx_t_9 = __pyx_t_11; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_v_index, __pyx_v_self->_field_filter, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 991, __pyx_L1_error) - __pyx_t_10 = (__pyx_t_11 != 0); - __pyx_t_9 = __pyx_t_10; - __pyx_L11_bool_binop_done:; - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":992 - * raise TypeError('field to map must be int or string') - * if self._field_filter is None or index in self._field_filter: - * if field in self.build_converter: # <<<<<<<<<<<<<< - * self.build_converter[field]() - * else: - */ - __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_v_field, __pyx_v_self->build_converter, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 992, __pyx_L1_error) - __pyx_t_10 = (__pyx_t_9 != 0); - if (__pyx_t_10) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":993 - * if self._field_filter is None or index in self._field_filter: - * if field in self.build_converter: - * self.build_converter[field]() # <<<<<<<<<<<<<< - * else: - * self.__set_dtype_converter(index, dtype) - */ - __pyx_t_6 = PyObject_GetItem(__pyx_v_self->build_converter, __pyx_v_field); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 993, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 993, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 993, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":992 - * raise TypeError('field to map must be int or string') - * if self._field_filter is None or index in self._field_filter: - * if field in self.build_converter: # <<<<<<<<<<<<<< - * self.build_converter[field]() - * else: - */ - goto __pyx_L13; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":995 - * self.build_converter[field]() - * else: - * self.__set_dtype_converter(index, dtype) # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_dtype_converter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 995, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_index, __pyx_v_dtype}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_index, __pyx_v_dtype}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_3 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 995, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_12, __pyx_v_index); - __Pyx_INCREF(__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_12, __pyx_v_dtype); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L13:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":991 - * else: - * raise TypeError('field to map must be int or string') - * if self._field_filter is None or index in self._field_filter: # <<<<<<<<<<<<<< - * if field in self.build_converter: - * self.build_converter[field]() - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":984 - * reset_converters(self.adapter.fields) - * - * for field, dtype in self.mapping.items(): # <<<<<<<<<<<<<< - * if isinstance(field, (int, long)): - * index = field - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":978 - * - * - * def __build_converters(self): # <<<<<<<<<<<<<< - * """ - * Set function converters according to field/dtype dict in self.mapping - */ - - /* function exit code */ - __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_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__build_converters", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XDECREF(__pyx_v_dtype); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":998 - * - * - * def __get_mapping_from_converters(self): # <<<<<<<<<<<<<< - * """ - * Set field/dtype dict from converter functions set by - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_49__get_mapping_from_converters(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_48__get_mapping_from_converters[] = "\n Set field/dtype dict from converter functions set by\n type inference engine\n "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_49__get_mapping_from_converters(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get_mapping_from_converters (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_48__get_mapping_from_converters(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_48__get_mapping_from_converters(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self) { - converter_func_ptr __pyx_v_converter; - PyObject *__pyx_v_mapping = NULL; - PyObject *__pyx_v_field = NULL; - PyObject *__pyx_v_size = NULL; - PyObject *__pyx_v_dtype_string = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - converter_func_ptr __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("__get_mapping_from_converters", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1004 - * """ - * cdef converter_func_ptr converter - * mapping = {} # <<<<<<<<<<<<<< - * - * for field in self._field_filter: - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_mapping = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1006 - * mapping = {} - * - * for field in self._field_filter: # <<<<<<<<<<<<<< - * size = self.adapter.fields.field_info[field].output_field_size - * converter = self.adapter.fields.field_info[field].converter - */ - if (likely(PyList_CheckExact(__pyx_v_self->_field_filter)) || PyTuple_CheckExact(__pyx_v_self->_field_filter)) { - __pyx_t_1 = __pyx_v_self->_field_filter; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->_field_filter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1006, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1006, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1006, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1006, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1007 - * - * for field in self._field_filter: - * size = self.adapter.fields.field_info[field].output_field_size # <<<<<<<<<<<<<< - * converter = self.adapter.fields.field_info[field].converter - * if converter == &str2uint_converter: - */ - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_field); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1007, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyInt_From_uint32_t((__pyx_v_self->adapter->fields->field_info[__pyx_t_5]).output_field_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1007, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_size, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1008 - * for field in self._field_filter: - * size = self.adapter.fields.field_info[field].output_field_size - * converter = self.adapter.fields.field_info[field].converter # <<<<<<<<<<<<<< - * if converter == &str2uint_converter: - * dtype_string = 'u%d' % size - */ - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_field); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1008, __pyx_L1_error) - __pyx_t_6 = (__pyx_v_self->adapter->fields->field_info[__pyx_t_5]).converter; - __pyx_v_converter = __pyx_t_6; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1009 - * size = self.adapter.fields.field_info[field].output_field_size - * converter = self.adapter.fields.field_info[field].converter - * if converter == &str2uint_converter: # <<<<<<<<<<<<<< - * dtype_string = 'u%d' % size - * elif converter == &str2int_converter: - */ - __pyx_t_7 = ((__pyx_v_converter == (&str2uint_converter)) != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1010 - * converter = self.adapter.fields.field_info[field].converter - * if converter == &str2uint_converter: - * dtype_string = 'u%d' % size # <<<<<<<<<<<<<< - * elif converter == &str2int_converter: - * dtype_string = 'i%d' % size - */ - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_u_d, __pyx_v_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1010, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_dtype_string, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1009 - * size = self.adapter.fields.field_info[field].output_field_size - * converter = self.adapter.fields.field_info[field].converter - * if converter == &str2uint_converter: # <<<<<<<<<<<<<< - * dtype_string = 'u%d' % size - * elif converter == &str2int_converter: - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1011 - * if converter == &str2uint_converter: - * dtype_string = 'u%d' % size - * elif converter == &str2int_converter: # <<<<<<<<<<<<<< - * dtype_string = 'i%d' % size - * elif converter == &str2float_converter: - */ - __pyx_t_7 = ((__pyx_v_converter == (&str2int_converter)) != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1012 - * dtype_string = 'u%d' % size - * elif converter == &str2int_converter: - * dtype_string = 'i%d' % size # <<<<<<<<<<<<<< - * elif converter == &str2float_converter: - * dtype_string = 'f%d' % size - */ - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_i_d, __pyx_v_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1012, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_dtype_string, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1011 - * if converter == &str2uint_converter: - * dtype_string = 'u%d' % size - * elif converter == &str2int_converter: # <<<<<<<<<<<<<< - * dtype_string = 'i%d' % size - * elif converter == &str2float_converter: - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1013 - * elif converter == &str2int_converter: - * dtype_string = 'i%d' % size - * elif converter == &str2float_converter: # <<<<<<<<<<<<<< - * dtype_string = 'f%d' % size - * elif converter == &str2str_object_converter: - */ - __pyx_t_7 = ((__pyx_v_converter == (&str2float_converter)) != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1014 - * dtype_string = 'i%d' % size - * elif converter == &str2float_converter: - * dtype_string = 'f%d' % size # <<<<<<<<<<<<<< - * elif converter == &str2str_object_converter: - * dtype_string = 'O' - */ - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_f_d, __pyx_v_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1014, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_dtype_string, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1013 - * elif converter == &str2int_converter: - * dtype_string = 'i%d' % size - * elif converter == &str2float_converter: # <<<<<<<<<<<<<< - * dtype_string = 'f%d' % size - * elif converter == &str2str_object_converter: - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1015 - * elif converter == &str2float_converter: - * dtype_string = 'f%d' % size - * elif converter == &str2str_object_converter: # <<<<<<<<<<<<<< - * dtype_string = 'O' - * else: - */ - __pyx_t_7 = ((__pyx_v_converter == (&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2str_object_converter)) != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1016 - * dtype_string = 'f%d' % size - * elif converter == &str2str_object_converter: - * dtype_string = 'O' # <<<<<<<<<<<<<< - * else: - * continue - */ - __Pyx_INCREF(__pyx_n_s_O); - __Pyx_XDECREF_SET(__pyx_v_dtype_string, __pyx_n_s_O); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1015 - * elif converter == &str2float_converter: - * dtype_string = 'f%d' % size - * elif converter == &str2str_object_converter: # <<<<<<<<<<<<<< - * dtype_string = 'O' - * else: - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1018 - * dtype_string = 'O' - * else: - * continue # <<<<<<<<<<<<<< - * - * mapping[field] = numpy.dtype(dtype_string) - */ - /*else*/ { - goto __pyx_L3_continue; - } - __pyx_L5:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1020 - * continue - * - * mapping[field] = numpy.dtype(dtype_string) # <<<<<<<<<<<<<< - * - * return mapping - */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_dtype_string); - __Pyx_GIVEREF(__pyx_v_dtype_string); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dtype_string); - __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(PyDict_SetItem(__pyx_v_mapping, __pyx_v_field, __pyx_t_8) < 0)) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1006 - * mapping = {} - * - * for field in self._field_filter: # <<<<<<<<<<<<<< - * size = self.adapter.fields.field_info[field].output_field_size - * converter = self.adapter.fields.field_info[field].converter - */ - __pyx_L3_continue:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1022 - * mapping[field] = numpy.dtype(dtype_string) - * - * return mapping # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_mapping); - __pyx_r = __pyx_v_mapping; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":998 - * - * - * def __get_mapping_from_converters(self): # <<<<<<<<<<<<<< - * """ - * Set field/dtype dict from converter functions set by - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__get_mapping_from_converters", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_mapping); - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XDECREF(__pyx_v_size); - __Pyx_XDECREF(__pyx_v_dtype_string); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1025 - * - * - * def __set_dtype_converter(self, field, dtype): # <<<<<<<<<<<<<< - * """ Set converter for field and dtype """ - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_51__set_dtype_converter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_50__set_dtype_converter[] = " Set converter for field and dtype "; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_51__set_dtype_converter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_field = 0; - PyObject *__pyx_v_dtype = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set_dtype_converter (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field,&__pyx_n_s_dtype,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dtype)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__set_dtype_converter", 1, 2, 2, 1); __PYX_ERR(0, 1025, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__set_dtype_converter") < 0)) __PYX_ERR(0, 1025, __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_field = values[0]; - __pyx_v_dtype = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__set_dtype_converter", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1025, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__set_dtype_converter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_50__set_dtype_converter(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), __pyx_v_field, __pyx_v_dtype); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_50__set_dtype_converter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_dtype) { - converter_func_ptr __pyx_v_converter_func; - void *__pyx_v_arg; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - uint32_t __pyx_t_3; - uint32_t __pyx_t_4; - __Pyx_RefNannySetupContext("__set_dtype_converter", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1029 - * - * cdef converter_func_ptr converter_func - * cdef void *arg = NULL # <<<<<<<<<<<<<< - * - * if dtype.kind == 'u': - */ - __pyx_v_arg = NULL; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1031 - * cdef void *arg = NULL - * - * if dtype.kind == 'u': # <<<<<<<<<<<<<< - * converter_func = str2uint_converter - * elif dtype.kind == 'i': - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_u, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1031, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1032 - * - * if dtype.kind == 'u': - * converter_func = str2uint_converter # <<<<<<<<<<<<<< - * elif dtype.kind == 'i': - * converter_func = str2int_converter - */ - __pyx_v_converter_func = str2uint_converter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1031 - * cdef void *arg = NULL - * - * if dtype.kind == 'u': # <<<<<<<<<<<<<< - * converter_func = str2uint_converter - * elif dtype.kind == 'i': - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1033 - * if dtype.kind == 'u': - * converter_func = str2uint_converter - * elif dtype.kind == 'i': # <<<<<<<<<<<<<< - * converter_func = str2int_converter - * elif dtype.kind == 'f': - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1033, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_i, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1033, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1034 - * converter_func = str2uint_converter - * elif dtype.kind == 'i': - * converter_func = str2int_converter # <<<<<<<<<<<<<< - * elif dtype.kind == 'f': - * converter_func = str2float_converter - */ - __pyx_v_converter_func = str2int_converter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1033 - * if dtype.kind == 'u': - * converter_func = str2uint_converter - * elif dtype.kind == 'i': # <<<<<<<<<<<<<< - * converter_func = str2int_converter - * elif dtype.kind == 'f': - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1035 - * elif dtype.kind == 'i': - * converter_func = str2int_converter - * elif dtype.kind == 'f': # <<<<<<<<<<<<<< - * converter_func = str2float_converter - * elif dtype.kind == 'S': - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1035, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_f, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1035, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1036 - * converter_func = str2int_converter - * elif dtype.kind == 'f': - * converter_func = str2float_converter # <<<<<<<<<<<<<< - * elif dtype.kind == 'S': - * converter_func = str2str_converter - */ - __pyx_v_converter_func = str2float_converter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1035 - * elif dtype.kind == 'i': - * converter_func = str2int_converter - * elif dtype.kind == 'f': # <<<<<<<<<<<<<< - * converter_func = str2float_converter - * elif dtype.kind == 'S': - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1037 - * elif dtype.kind == 'f': - * converter_func = str2float_converter - * elif dtype.kind == 'S': # <<<<<<<<<<<<<< - * converter_func = str2str_converter - * elif dtype.kind == 'c': - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1037, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_S, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1037, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1038 - * converter_func = str2float_converter - * elif dtype.kind == 'S': - * converter_func = str2str_converter # <<<<<<<<<<<<<< - * elif dtype.kind == 'c': - * converter_func = str2complex_converter - */ - __pyx_v_converter_func = str2str_converter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1037 - * elif dtype.kind == 'f': - * converter_func = str2float_converter - * elif dtype.kind == 'S': # <<<<<<<<<<<<<< - * converter_func = str2str_converter - * elif dtype.kind == 'c': - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1039 - * elif dtype.kind == 'S': - * converter_func = str2str_converter - * elif dtype.kind == 'c': # <<<<<<<<<<<<<< - * converter_func = str2complex_converter - * elif dtype.kind == 'M': - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1039, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1039, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1040 - * converter_func = str2str_converter - * elif dtype.kind == 'c': - * converter_func = str2complex_converter # <<<<<<<<<<<<<< - * elif dtype.kind == 'M': - * converter_func = str2datetime_converter - */ - __pyx_v_converter_func = str2complex_converter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1039 - * elif dtype.kind == 'S': - * converter_func = str2str_converter - * elif dtype.kind == 'c': # <<<<<<<<<<<<<< - * converter_func = str2complex_converter - * elif dtype.kind == 'M': - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1041 - * elif dtype.kind == 'c': - * converter_func = str2complex_converter - * elif dtype.kind == 'M': # <<<<<<<<<<<<<< - * converter_func = str2datetime_converter - * else: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_M, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1042 - * converter_func = str2complex_converter - * elif dtype.kind == 'M': - * converter_func = str2datetime_converter # <<<<<<<<<<<<<< - * else: - * converter_func = str2str_object_converter - */ - __pyx_v_converter_func = __pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2datetime_converter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1041 - * elif dtype.kind == 'c': - * converter_func = str2complex_converter - * elif dtype.kind == 'M': # <<<<<<<<<<<<<< - * converter_func = str2datetime_converter - * else: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1044 - * converter_func = str2datetime_converter - * else: - * converter_func = str2str_object_converter # <<<<<<<<<<<<<< - * - * if converter_func == &str2datetime_converter: - */ - /*else*/ { - __pyx_v_converter_func = __pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2str_object_converter; - } - __pyx_L3:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1046 - * converter_func = str2str_object_converter - * - * if converter_func == &str2datetime_converter: # <<<<<<<<<<<<<< - * arg = dtype - * elif converter_func == &str2str_object_converter: - */ - __pyx_t_2 = ((__pyx_v_converter_func == (&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2datetime_converter)) != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1047 - * - * if converter_func == &str2datetime_converter: - * arg = dtype # <<<<<<<<<<<<<< - * elif converter_func == &str2str_object_converter: - * arg = self.kh_string_table - */ - __pyx_v_arg = ((void *)__pyx_v_dtype); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1046 - * converter_func = str2str_object_converter - * - * if converter_func == &str2datetime_converter: # <<<<<<<<<<<<<< - * arg = dtype - * elif converter_func == &str2str_object_converter: - */ - goto __pyx_L4; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1048 - * if converter_func == &str2datetime_converter: - * arg = dtype - * elif converter_func == &str2str_object_converter: # <<<<<<<<<<<<<< - * arg = self.kh_string_table - * - */ - __pyx_t_2 = ((__pyx_v_converter_func == (&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2str_object_converter)) != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1049 - * arg = dtype - * elif converter_func == &str2str_object_converter: - * arg = self.kh_string_table # <<<<<<<<<<<<<< - * - * set_converter(self.adapter.fields, field, NULL, dtype.itemsize, - */ - __pyx_v_arg = ((void *)__pyx_v_self->kh_string_table); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1048 - * if converter_func == &str2datetime_converter: - * arg = dtype - * elif converter_func == &str2str_object_converter: # <<<<<<<<<<<<<< - * arg = self.kh_string_table - * - */ - } - __pyx_L4:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1051 - * arg = self.kh_string_table - * - * set_converter(self.adapter.fields, field, NULL, dtype.itemsize, # <<<<<<<<<<<<<< - * converter_func, arg) - * - */ - __pyx_t_3 = __Pyx_PyInt_As_uint32_t(__pyx_v_field); if (unlikely((__pyx_t_3 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1052 - * - * set_converter(self.adapter.fields, field, NULL, dtype.itemsize, - * converter_func, arg) # <<<<<<<<<<<<<< - * - * - */ - set_converter(__pyx_v_self->adapter->fields, __pyx_t_3, NULL, __pyx_t_4, __pyx_v_converter_func, __pyx_v_arg); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1025 - * - * - * def __set_dtype_converter(self, field, dtype): # <<<<<<<<<<<<<< - * """ Set converter for field and dtype """ - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__set_dtype_converter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1055 - * - * - * def __raise_adapter_exception(self, result): # <<<<<<<<<<<<<< - * cdef ConvertErrorInfo info = get_error_info() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_53__raise_adapter_exception(PyObject *__pyx_v_self, PyObject *__pyx_v_result); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_53__raise_adapter_exception(PyObject *__pyx_v_self, PyObject *__pyx_v_result) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__raise_adapter_exception (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_52__raise_adapter_exception(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_result)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_52__raise_adapter_exception(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *__pyx_v_self, PyObject *__pyx_v_result) { - ConvertErrorInfo __pyx_v_info; - PyObject *__pyx_v_token = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __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; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - __Pyx_RefNannySetupContext("__raise_adapter_exception", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1056 - * - * def __raise_adapter_exception(self, result): - * cdef ConvertErrorInfo info = get_error_info() # <<<<<<<<<<<<<< - * - * if result == ADAPTER_ERROR_CONVERT: - */ - __pyx_v_info = get_error_info(); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1058 - * cdef ConvertErrorInfo info = get_error_info() - * - * if result == ADAPTER_ERROR_CONVERT: # <<<<<<<<<<<<<< - * token = '' - * if info.token != NULL: - */ - __pyx_t_1 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_CONVERT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1058, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_result, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1058, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1058, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1059 - * - * if result == ADAPTER_ERROR_CONVERT: - * token = '' # <<<<<<<<<<<<<< - * if info.token != NULL: - * token = info.token - */ - __Pyx_INCREF(__pyx_kp_s__25); - __pyx_v_token = __pyx_kp_s__25; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1060 - * if result == ADAPTER_ERROR_CONVERT: - * token = '' - * if info.token != NULL: # <<<<<<<<<<<<<< - * token = info.token - * raise text_adapter_exception(result, info.convert_result, - */ - __pyx_t_3 = ((__pyx_v_info.token != NULL) != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1061 - * token = '' - * if info.token != NULL: - * token = info.token # <<<<<<<<<<<<<< - * raise text_adapter_exception(result, info.convert_result, - * token, info.record_num, info.field_num, - */ - __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_info.token); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1061, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_token, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1060 - * if result == ADAPTER_ERROR_CONVERT: - * token = '' - * if info.token != NULL: # <<<<<<<<<<<<<< - * token = info.token - * raise text_adapter_exception(result, info.convert_result, - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1062 - * if info.token != NULL: - * token = info.token - * raise text_adapter_exception(result, info.convert_result, # <<<<<<<<<<<<<< - * token, info.record_num, info.field_num, - * self.mapping[info.field_num]) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_text_adapter_exception); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_From_ConvertError(__pyx_v_info.convert_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1063 - * token = info.token - * raise text_adapter_exception(result, info.convert_result, - * token, info.record_num, info.field_num, # <<<<<<<<<<<<<< - * self.mapping[info.field_num]) - * else: - */ - __pyx_t_5 = __Pyx_PyInt_From_uint64_t(__pyx_v_info.record_num); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1063, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_uint64_t(__pyx_v_info.field_num); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1063, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1064 - * raise text_adapter_exception(result, info.convert_result, - * token, info.record_num, info.field_num, - * self.mapping[info.field_num]) # <<<<<<<<<<<<<< - * else: - * raise text_adapter_exception(result, record=info.record_num) - */ - __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_self->mapping, __pyx_v_info.field_num, uint64_t, 0, __Pyx_PyInt_From_uint64_t, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - __pyx_t_9 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_9 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[7] = {__pyx_t_8, __pyx_v_result, __pyx_t_4, __pyx_v_token, __pyx_t_5, __pyx_t_6, __pyx_t_7}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[7] = {__pyx_t_8, __pyx_v_result, __pyx_t_4, __pyx_v_token, __pyx_t_5, __pyx_t_6, __pyx_t_7}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(6+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL; - } - __Pyx_INCREF(__pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_result); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_4); - __Pyx_INCREF(__pyx_v_token); - __Pyx_GIVEREF(__pyx_v_token); - PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_v_token); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_9, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 5+__pyx_t_9, __pyx_t_7); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1062, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1058 - * cdef ConvertErrorInfo info = get_error_info() - * - * if result == ADAPTER_ERROR_CONVERT: # <<<<<<<<<<<<<< - * token = '' - * if info.token != NULL: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1066 - * self.mapping[info.field_num]) - * else: - * raise text_adapter_exception(result, record=info.record_num) # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_text_adapter_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_result); - __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_7 = __Pyx_PyInt_From_uint64_t(__pyx_v_info.record_num); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_record, __pyx_t_7) < 0) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 1066, __pyx_L1_error) - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1055 - * - * - * def __raise_adapter_exception(self, result): # <<<<<<<<<<<<<< - * cdef ConvertErrorInfo info = get_error_info() - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.TextAdapter.__raise_adapter_exception", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XDECREF(__pyx_v_token); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1074 - * 'json':JSONTextAdapter} - * - * def text_adapter(source, parser='csv', *args, **kwargs): # <<<<<<<<<<<<<< - * """ - * Create a text adapter for reading CSV, JSON, or fixed width - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_1text_adapter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_text_adapter[] = "\n Create a text adapter for reading CSV, JSON, or fixed width\n text files, or a text file defined by regular expressions.\n\n Args:\n source: filename, file object, StringIO object, BytesIO object,\n http url, or python generator\n parser: type of text adapter ('csv', 'fixed_width', 'regex', or 'json')\n encoding: type of character encoding (current ascii and utf8 are supported)\n compression : type of data compression (currently only gzip is supported)\n comment: character used to indicate comment line\n quote: character used to quote fields\n num_records: limits parsing to specified number of records; defaults\n to all records\n header: number of lines in file header; these lines are skipped when parsing\n footer: number of lines in file footer; these lines are skipped when parsing\n field_names: If True, parse field names from first non comment line of\n text file. If list, use values as field names. If False,\n use default numpy naming scheme for field names('f0', 'f1', etc).\n indexing: create record index on the fly as characters are read\n index_name: name of file to write index to\n output: type of output object (numpy array or Pandas dataframe)\n debug: If True, enable debug logging\n delimiter (CSV parser only): character used to define fields\n escape (CSV parser only): character used to \"escape\" characters with\n special meaning\n group_whitespace_delims (CSV parser only): If delimiter is whitespace,\n value of True treats multiple\n whitespace characters as\n single delimiter\n whitespace_delims (CSV parser only): If True, treat all whitespace characters\n "" as delimiter\n field_widths (Fixed width parser only): List of field widths\n regex_string (regex parser only): regex string used to define fields\n "; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_1text_adapter = {"text_adapter", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_1text_adapter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_text_adapter}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_1text_adapter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_source = 0; - PyObject *__pyx_v_parser = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("text_adapter (wrapper)", 0); - __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - if (PyTuple_GET_SIZE(__pyx_args) > 2) { - __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); - if (unlikely(!__pyx_v_args)) { - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_v_args); - } else { - __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); - } - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_parser,0}; - PyObject* values[2] = {0,0}; - values[1] = ((PyObject *)__pyx_n_s_csv); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - default: - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "text_adapter") < 0)) __PYX_ERR(0, 1074, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - default: - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - case 0: - goto __pyx_L5_argtuple_error; - } - } - __pyx_v_source = values[0]; - __pyx_v_parser = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("text_adapter", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1074, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.text_adapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_text_adapter(__pyx_self, __pyx_v_source, __pyx_v_parser, __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_text_adapter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source, PyObject *__pyx_v_parser, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - 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; - int __pyx_t_6; - 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; - __Pyx_RefNannySetupContext("text_adapter", 0); - __Pyx_INCREF(__pyx_v_parser); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1110 - * regex_string (regex parser only): regex string used to define fields - * """ - * try: # <<<<<<<<<<<<<< - * parser = parser_classes[parser] - * except KeyError: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __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:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1111 - * """ - * try: - * parser = parser_classes[parser] # <<<<<<<<<<<<<< - * except KeyError: - * raise errors.AdapterException("Unknown text parser '%s'" % parser) - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_parser_classes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1111, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_v_parser); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1111, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_parser, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1110 - * regex_string (regex parser only): regex string used to define fields - * """ - * try: # <<<<<<<<<<<<<< - * parser = parser_classes[parser] - * except KeyError: - */ - } - __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_L10_try_end; - __pyx_L3_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1112 - * try: - * parser = parser_classes[parser] - * except KeyError: # <<<<<<<<<<<<<< - * raise errors.AdapterException("Unknown text parser '%s'" % parser) - * - */ - __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); - if (__pyx_t_6) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.text_adapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 1112, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_7); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1113 - * parser = parser_classes[parser] - * except KeyError: - * raise errors.AdapterException("Unknown text parser '%s'" % parser) # <<<<<<<<<<<<<< - * - * return parser(source, *args, **kwargs) - */ - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1113, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_AdapterException); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1113, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Unknown_text_parser_s, __pyx_v_parser); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1113, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - if (!__pyx_t_11) { - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1113, __pyx_L5_except_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_8); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_9}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1113, __pyx_L5_except_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_9}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1113, __pyx_L5_except_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1113, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1113, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(0, 1113, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1110 - * regex_string (regex parser only): regex string used to define fields - * """ - * try: # <<<<<<<<<<<<<< - * parser = parser_classes[parser] - * except KeyError: - */ - __Pyx_PyThreadState_assign - __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_L10_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1115 - * raise errors.AdapterException("Unknown text parser '%s'" % parser) - * - * return parser(source, *args, **kwargs) # <<<<<<<<<<<<<< - * - * def s3_text_adapter(access_key, secret_key, bucket_name, key_name, - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_v_source); - __Pyx_GIVEREF(__pyx_v_source); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_source); - __pyx_t_4 = PyNumber_Add(__pyx_t_7, __pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_parser, __pyx_t_4, __pyx_v_kwargs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1074 - * 'json':JSONTextAdapter} - * - * def text_adapter(source, parser='csv', *args, **kwargs): # <<<<<<<<<<<<<< - * """ - * Create a text adapter for reading CSV, JSON, or fixed width - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.text_adapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_parser); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1117 - * return parser(source, *args, **kwargs) - * - * def s3_text_adapter(access_key, secret_key, bucket_name, key_name, # <<<<<<<<<<<<<< - * remote_s3_index=False, parser='csv', *args, **kwargs): - * """ - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_3s3_text_adapter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_2s3_text_adapter[] = "\n Create a text adapter for reading a text file from S3. Text file can be\n CSV, JSON, fixed width, or defined by regular expressions\n\n Args:\n access_key: AWS access key\n secret_key: AWS secret key\n bucket_name: S3 bucket name\n key_name: S3 bucket key\n remote_s3_index: optional text adapter index file stored on S3\n parser: type of text adapter ('csv', 'fixed_width', 'regex', or 'json')\n encoding: type of character encoding (current ascii and utf8 are supported)\n compression : type of data compression (currently only gzip is supported)\n comment: character used to indicate comment line\n quote: character used to quote fields\n num_records: limits parsing to specified number of records; defaults\n to all records\n header: number of lines in file header; these lines are skipped when parsing\n footer: number of lines in file footer; these lines are skipped when parsing\n field_names: If True, parse field names from first non comment line of\n text file. If list, use values as field names. If False,\n use default numpy naming scheme for field names('f0', 'f1', etc).\n indexing: create record index on the fly as characters are read\n index_name: name of file to write index to\n output: type of output object (NumpPy array or Pandas DataFrame)\n debug: If True, enable debug logging\n delimiter (CSV parser only): character used to define fields\n escape (CSV parser only): character used to \"escape\" characters with\n special meaning\n group_whitespace_delims (CSV parser only): If delimiter is whitespace,\n value of True treats multiple\n whitespace characters as\n single delimiter""\n whitespace_delims (CSV parser only): If True, treat all whitespace characters\n as delimiter\n field_widths (Fixed width parser only): List of field widths\n regex_string (regex parser only): regex string used to define fields\n "; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_3s3_text_adapter = {"s3_text_adapter", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_3s3_text_adapter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_2s3_text_adapter}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_3s3_text_adapter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_access_key = 0; - PyObject *__pyx_v_secret_key = 0; - PyObject *__pyx_v_bucket_name = 0; - PyObject *__pyx_v_key_name = 0; - PyObject *__pyx_v_remote_s3_index = 0; - PyObject *__pyx_v_parser = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("s3_text_adapter (wrapper)", 0); - __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - if (PyTuple_GET_SIZE(__pyx_args) > 6) { - __pyx_v_args = PyTuple_GetSlice(__pyx_args, 6, PyTuple_GET_SIZE(__pyx_args)); - if (unlikely(!__pyx_v_args)) { - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_v_args); - } else { - __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); - } - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_access_key,&__pyx_n_s_secret_key,&__pyx_n_s_bucket_name,&__pyx_n_s_key_name,&__pyx_n_s_remote_s3_index,&__pyx_n_s_parser,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1118 - * - * def s3_text_adapter(access_key, secret_key, bucket_name, key_name, - * remote_s3_index=False, parser='csv', *args, **kwargs): # <<<<<<<<<<<<<< - * """ - * Create a text adapter for reading a text file from S3. Text file can be - */ - values[4] = ((PyObject *)Py_False); - values[5] = ((PyObject *)__pyx_n_s_csv); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - default: - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_access_key)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_secret_key)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("s3_text_adapter", 0, 4, 6, 1); __PYX_ERR(0, 1117, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bucket_name)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("s3_text_adapter", 0, 4, 6, 2); __PYX_ERR(0, 1117, __pyx_L3_error) - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key_name)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("s3_text_adapter", 0, 4, 6, 3); __PYX_ERR(0, 1117, __pyx_L3_error) - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_remote_s3_index); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parser); - if (value) { values[5] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t used_pos_args = (pos_args < 6) ? pos_args : 6; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "s3_text_adapter") < 0)) __PYX_ERR(0, 1117, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - default: - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - case 3: - case 2: - case 1: - case 0: - goto __pyx_L5_argtuple_error; - } - } - __pyx_v_access_key = values[0]; - __pyx_v_secret_key = values[1]; - __pyx_v_bucket_name = values[2]; - __pyx_v_key_name = values[3]; - __pyx_v_remote_s3_index = values[4]; - __pyx_v_parser = values[5]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("s3_text_adapter", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1117, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.s3_text_adapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_2s3_text_adapter(__pyx_self, __pyx_v_access_key, __pyx_v_secret_key, __pyx_v_bucket_name, __pyx_v_key_name, __pyx_v_remote_s3_index, __pyx_v_parser, __pyx_v_args, __pyx_v_kwargs); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1117 - * return parser(source, *args, **kwargs) - * - * def s3_text_adapter(access_key, secret_key, bucket_name, key_name, # <<<<<<<<<<<<<< - * remote_s3_index=False, parser='csv', *args, **kwargs): - * """ - */ - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_2s3_text_adapter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_access_key, PyObject *__pyx_v_secret_key, PyObject *__pyx_v_bucket_name, PyObject *__pyx_v_key_name, PyObject *__pyx_v_remote_s3_index, PyObject *__pyx_v_parser, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_v_conn = NULL; - PyObject *__pyx_v_bucket = NULL; - PyObject *__pyx_v_k = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - __Pyx_RefNannySetupContext("s3_text_adapter", 0); - __Pyx_INCREF(__pyx_v_parser); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1158 - * """ - * - * if not boto_installed: # <<<<<<<<<<<<<< - * raise errors.AdapterException("Cannot use s3 interface: boto not installed") - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_boto_installed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1158, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!__pyx_t_2) != 0); - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1159 - * - * if not boto_installed: - * raise errors.AdapterException("Cannot use s3 interface: boto not installed") # <<<<<<<<<<<<<< - * - * try: - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_AdapterException); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__77, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 1159, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1158 - * """ - * - * if not boto_installed: # <<<<<<<<<<<<<< - * raise errors.AdapterException("Cannot use s3 interface: boto not installed") - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1161 - * raise errors.AdapterException("Cannot use s3 interface: boto not installed") - * - * try: # <<<<<<<<<<<<<< - * parser = parser_classes[parser] - * except KeyError: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - /*try:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1162 - * - * try: - * parser = parser_classes[parser] # <<<<<<<<<<<<<< - * except KeyError: - * raise errors.AdapterException("Unknown text parser '%s'" % parser) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_parser_classes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1162, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetItem(__pyx_t_1, __pyx_v_parser); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1162, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_parser, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1161 - * raise errors.AdapterException("Cannot use s3 interface: boto not installed") - * - * try: # <<<<<<<<<<<<<< - * parser = parser_classes[parser] - * except KeyError: - */ - } - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L11_try_end; - __pyx_L4_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1163 - * try: - * parser = parser_classes[parser] - * except KeyError: # <<<<<<<<<<<<<< - * raise errors.AdapterException("Unknown text parser '%s'" % parser) - * - */ - __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); - if (__pyx_t_8) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.s3_text_adapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 1163, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_9); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1164 - * parser = parser_classes[parser] - * except KeyError: - * raise errors.AdapterException("Unknown text parser '%s'" % parser) # <<<<<<<<<<<<<< - * - * conn = boto.connect_s3(access_key, secret_key) - */ - __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1164, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_AdapterException); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1164, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_Unknown_text_parser_s, __pyx_v_parser); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1164, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_13 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - } - } - if (!__pyx_t_13) { - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1164, __pyx_L6_except_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_10); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_12)) { - PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_11}; - __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1164, __pyx_L6_except_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) { - PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_11}; - __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1164, __pyx_L6_except_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - { - __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1164, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_11); - __pyx_t_11 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_14, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1164, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } - } - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(0, 1164, __pyx_L6_except_error) - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1161 - * raise errors.AdapterException("Cannot use s3 interface: boto not installed") - * - * try: # <<<<<<<<<<<<<< - * parser = parser_classes[parser] - * except KeyError: - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); - goto __pyx_L1_error; - __pyx_L11_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1166 - * raise errors.AdapterException("Unknown text parser '%s'" % parser) - * - * conn = boto.connect_s3(access_key, secret_key) # <<<<<<<<<<<<<< - * bucket = conn.get_bucket(bucket_name) - * k = bucket.lookup(key_name) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_boto); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1166, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_connect_s3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1166, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_access_key, __pyx_v_secret_key}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1166, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_access_key, __pyx_v_secret_key}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1166, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else - #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1166, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_1) { - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL; - } - __Pyx_INCREF(__pyx_v_access_key); - __Pyx_GIVEREF(__pyx_v_access_key); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_v_access_key); - __Pyx_INCREF(__pyx_v_secret_key); - __Pyx_GIVEREF(__pyx_v_secret_key); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_v_secret_key); - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1166, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_conn = __pyx_t_9; - __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1167 - * - * conn = boto.connect_s3(access_key, secret_key) - * bucket = conn.get_bucket(bucket_name) # <<<<<<<<<<<<<< - * k = bucket.lookup(key_name) - * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_conn, __pyx_n_s_get_bucket); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1167, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_10) { - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_bucket_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1167, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_bucket_name}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1167, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_bucket_name}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1167, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else - #endif - { - __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1167, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_INCREF(__pyx_v_bucket_name); - __Pyx_GIVEREF(__pyx_v_bucket_name); - PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_bucket_name); - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1167, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_bucket = __pyx_t_9; - __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1168 - * conn = boto.connect_s3(access_key, secret_key) - * bucket = conn.get_bucket(bucket_name) - * k = bucket.lookup(key_name) # <<<<<<<<<<<<<< - * - * if remote_s3_index is True: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_bucket, __pyx_n_s_lookup); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_1) { - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_key_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_key_name}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1168, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_key_name}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1168, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_9); - } else - #endif - { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL; - __Pyx_INCREF(__pyx_v_key_name); - __Pyx_GIVEREF(__pyx_v_key_name); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_key_name); - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_k = __pyx_t_9; - __pyx_t_9 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1170 - * k = bucket.lookup(key_name) - * - * if remote_s3_index is True: # <<<<<<<<<<<<<< - * return parser(k, index_name=k, *args, **kwargs) - * else: - */ - __pyx_t_3 = (__pyx_v_remote_s3_index == Py_True); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1171 - * - * if remote_s3_index is True: - * return parser(k, index_name=k, *args, **kwargs) # <<<<<<<<<<<<<< - * else: - * return parser(k, *args, **kwargs) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_k); - __pyx_t_4 = PyNumber_Add(__pyx_t_9, __pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_index_name, __pyx_v_k) < 0) __PYX_ERR(0, 1171, __pyx_L1_error) - __pyx_t_9 = __pyx_t_10; - __pyx_t_10 = 0; - if (__Pyx_MergeKeywords(__pyx_t_9, __pyx_v_kwargs) < 0) __PYX_ERR(0, 1171, __pyx_L1_error) - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_v_parser, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_r = __pyx_t_10; - __pyx_t_10 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1170 - * k = bucket.lookup(key_name) - * - * if remote_s3_index is True: # <<<<<<<<<<<<<< - * return parser(k, index_name=k, *args, **kwargs) - * else: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1173 - * return parser(k, index_name=k, *args, **kwargs) - * else: - * return parser(k, *args, **kwargs) # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_k); - __pyx_t_9 = PyNumber_Add(__pyx_t_10, __pyx_v_args); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_v_parser, __pyx_t_9, __pyx_v_kwargs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_r = __pyx_t_10; - __pyx_t_10 = 0; - goto __pyx_L0; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1117 - * return parser(source, *args, **kwargs) - * - * def s3_text_adapter(access_key, secret_key, bucket_name, key_name, # <<<<<<<<<<<<<< - * remote_s3_index=False, parser='csv', *args, **kwargs): - * """ - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.s3_text_adapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_conn); - __Pyx_XDECREF(__pyx_v_bucket); - __Pyx_XDECREF(__pyx_v_k); - __Pyx_XDECREF(__pyx_v_parser); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1184 - * """ - * - * def __cinit__(self, fh, delimiter=True, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', escape='\\', num_records=0, - * header=0, footer=0, field_names=True, infer_types=True, - */ - -/* Python wrapper */ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_14CSVTextAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_14CSVTextAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fh = 0; - PyObject *__pyx_v_delimiter = 0; - PyObject *__pyx_v_encoding = 0; - PyObject *__pyx_v_compression = 0; - PyObject *__pyx_v_comment = 0; - PyObject *__pyx_v_quote = 0; - PyObject *__pyx_v_escape = 0; - PyObject *__pyx_v_num_records = 0; - PyObject *__pyx_v_header = 0; - PyObject *__pyx_v_footer = 0; - PyObject *__pyx_v_field_names = 0; - CYTHON_UNUSED PyObject *__pyx_v_infer_types = 0; - PyObject *__pyx_v_indexing = 0; - PyObject *__pyx_v_index_name = 0; - PyObject *__pyx_v_output = 0; - PyObject *__pyx_v_group_whitespace_delims = 0; - PyObject *__pyx_v_whitespace_delims = 0; - PyObject *__pyx_v_debug = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fh,&__pyx_n_s_delimiter,&__pyx_n_s_encoding,&__pyx_n_s_compression,&__pyx_n_s_comment,&__pyx_n_s_quote,&__pyx_n_s_escape,&__pyx_n_s_num_records,&__pyx_n_s_header,&__pyx_n_s_footer,&__pyx_n_s_field_names,&__pyx_n_s_infer_types_2,&__pyx_n_s_indexing,&__pyx_n_s_index_name,&__pyx_n_s_output,&__pyx_n_s_group_whitespace_delims,&__pyx_n_s_whitespace_delims,&__pyx_n_s_debug,0}; - PyObject* values[18] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - values[1] = ((PyObject *)Py_True); - values[2] = ((PyObject *)__pyx_n_s_utf_8); - values[3] = ((PyObject *)Py_None); - values[4] = ((PyObject *)__pyx_kp_s__37); - values[5] = ((PyObject *)__pyx_kp_s__38); - values[6] = ((PyObject *)__pyx_kp_s__78); - values[7] = ((PyObject *)__pyx_int_0); - values[8] = ((PyObject *)__pyx_int_0); - values[9] = ((PyObject *)__pyx_int_0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1186 - * def __cinit__(self, fh, delimiter=True, encoding='utf_8', compression=None, - * comment='#', quote='"', escape='\\', num_records=0, - * header=0, footer=0, field_names=True, infer_types=True, # <<<<<<<<<<<<<< - * indexing=False, index_name=None, output='ndarray', - * group_whitespace_delims=True, whitespace_delims=False, debug=False): - */ - values[10] = ((PyObject *)Py_True); - values[11] = ((PyObject *)Py_True); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1187 - * comment='#', quote='"', escape='\\', num_records=0, - * header=0, footer=0, field_names=True, infer_types=True, - * indexing=False, index_name=None, output='ndarray', # <<<<<<<<<<<<<< - * group_whitespace_delims=True, whitespace_delims=False, debug=False): - * - */ - values[12] = ((PyObject *)Py_False); - values[13] = ((PyObject *)Py_None); - values[14] = ((PyObject *)__pyx_n_s_ndarray); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1188 - * header=0, footer=0, field_names=True, infer_types=True, - * indexing=False, index_name=None, output='ndarray', - * group_whitespace_delims=True, whitespace_delims=False, debug=False): # <<<<<<<<<<<<<< - * - * self.__init_text_adapter(fh, encoding, compression, comment, quote, - */ - values[15] = ((PyObject *)Py_True); - values[16] = ((PyObject *)Py_False); - values[17] = ((PyObject *)Py_False); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); - case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); - case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fh)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_delimiter); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_encoding); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compression); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comment); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_quote); - if (value) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_escape); - if (value) { values[6] = value; kw_args--; } - } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_records); - if (value) { values[7] = value; kw_args--; } - } - case 8: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_header); - if (value) { values[8] = value; kw_args--; } - } - case 9: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_footer); - if (value) { values[9] = value; kw_args--; } - } - case 10: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_names); - if (value) { values[10] = value; kw_args--; } - } - case 11: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_infer_types_2); - if (value) { values[11] = value; kw_args--; } - } - case 12: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indexing); - if (value) { values[12] = value; kw_args--; } - } - case 13: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_name); - if (value) { values[13] = value; kw_args--; } - } - case 14: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output); - if (value) { values[14] = value; kw_args--; } - } - case 15: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_group_whitespace_delims); - if (value) { values[15] = value; kw_args--; } - } - case 16: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_whitespace_delims); - if (value) { values[16] = value; kw_args--; } - } - case 17: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_debug); - if (value) { values[17] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1184, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); - case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); - case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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_fh = values[0]; - __pyx_v_delimiter = values[1]; - __pyx_v_encoding = values[2]; - __pyx_v_compression = values[3]; - __pyx_v_comment = values[4]; - __pyx_v_quote = values[5]; - __pyx_v_escape = values[6]; - __pyx_v_num_records = values[7]; - __pyx_v_header = values[8]; - __pyx_v_footer = values[9]; - __pyx_v_field_names = values[10]; - __pyx_v_infer_types = values[11]; - __pyx_v_indexing = values[12]; - __pyx_v_index_name = values[13]; - __pyx_v_output = values[14]; - __pyx_v_group_whitespace_delims = values[15]; - __pyx_v_whitespace_delims = values[16]; - __pyx_v_debug = values[17]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 18, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1184, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.CSVTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_14CSVTextAdapter___cinit__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter *)__pyx_v_self), __pyx_v_fh, __pyx_v_delimiter, __pyx_v_encoding, __pyx_v_compression, __pyx_v_comment, __pyx_v_quote, __pyx_v_escape, __pyx_v_num_records, __pyx_v_header, __pyx_v_footer, __pyx_v_field_names, __pyx_v_infer_types, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_group_whitespace_delims, __pyx_v_whitespace_delims, __pyx_v_debug); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1184 - * """ - * - * def __cinit__(self, fh, delimiter=True, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', escape='\\', num_records=0, - * header=0, footer=0, field_names=True, infer_types=True, - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_14CSVTextAdapter___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter *__pyx_v_self, PyObject *__pyx_v_fh, PyObject *__pyx_v_delimiter, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_comment, PyObject *__pyx_v_quote, PyObject *__pyx_v_escape, PyObject *__pyx_v_num_records, PyObject *__pyx_v_header, PyObject *__pyx_v_footer, PyObject *__pyx_v_field_names, CYTHON_UNUSED PyObject *__pyx_v_infer_types, PyObject *__pyx_v_indexing, PyObject *__pyx_v_index_name, PyObject *__pyx_v_output, PyObject *__pyx_v_group_whitespace_delims, PyObject *__pyx_v_whitespace_delims, PyObject *__pyx_v_debug) { - PyObject *__pyx_v_offset = NULL; - CYTHON_UNUSED PyObject *__pyx_v_comment_offset = NULL; - PyObject *__pyx_v_comment_line = NULL; - PyObject *__pyx_v_line_iter = NULL; - PyObject *__pyx_v_line = NULL; - PyObject *__pyx_v_d = NULL; - PyObject *__pyx_v_field_values = NULL; - PyObject *__pyx_v_line2 = NULL; - PyObject *__pyx_v_csv_reader = NULL; - PyObject *__pyx_v_comment_line2 = NULL; - PyObject *__pyx_v_temp_field_names = NULL; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_missing_values = NULL; - uint32_t __pyx_v_field; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_v_field_name = NULL; - PyObject *__pyx_v_i = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - long __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - Py_ssize_t __pyx_t_12; - int __pyx_t_13; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - PyObject *(*__pyx_t_16)(PyObject *); - uint64_t __pyx_t_17; - int __pyx_t_18; - uint32_t __pyx_t_19; - uint32_t __pyx_t_20; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_delimiter); - __Pyx_INCREF(__pyx_v_field_names); - __Pyx_INCREF(__pyx_v_whitespace_delims); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1190 - * group_whitespace_delims=True, whitespace_delims=False, debug=False): - * - * self.__init_text_adapter(fh, encoding, compression, comment, quote, # <<<<<<<<<<<<<< - * num_records, header, footer, indexing, index_name, output, debug) - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_text_adapter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1191 - * - * self.__init_text_adapter(fh, encoding, compression, comment, quote, - * num_records, header, footer, indexing, index_name, output, debug) # <<<<<<<<<<<<<< - * - * self.adapter.tokenize = &delim_tokenizer; - */ - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[13] = {__pyx_t_3, __pyx_v_fh, __pyx_v_encoding, __pyx_v_compression, __pyx_v_comment, __pyx_v_quote, __pyx_v_num_records, __pyx_v_header, __pyx_v_footer, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 12+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1190, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[13] = {__pyx_t_3, __pyx_v_fh, __pyx_v_encoding, __pyx_v_compression, __pyx_v_comment, __pyx_v_quote, __pyx_v_num_records, __pyx_v_header, __pyx_v_footer, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 12+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1190, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_5 = PyTuple_New(12+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_fh); - __Pyx_GIVEREF(__pyx_v_fh); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_fh); - __Pyx_INCREF(__pyx_v_encoding); - __Pyx_GIVEREF(__pyx_v_encoding); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_encoding); - __Pyx_INCREF(__pyx_v_compression); - __Pyx_GIVEREF(__pyx_v_compression); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_compression); - __Pyx_INCREF(__pyx_v_comment); - __Pyx_GIVEREF(__pyx_v_comment); - PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_comment); - __Pyx_INCREF(__pyx_v_quote); - __Pyx_GIVEREF(__pyx_v_quote); - PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_quote); - __Pyx_INCREF(__pyx_v_num_records); - __Pyx_GIVEREF(__pyx_v_num_records); - PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_num_records); - __Pyx_INCREF(__pyx_v_header); - __Pyx_GIVEREF(__pyx_v_header); - PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_header); - __Pyx_INCREF(__pyx_v_footer); - __Pyx_GIVEREF(__pyx_v_footer); - PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_footer); - __Pyx_INCREF(__pyx_v_indexing); - __Pyx_GIVEREF(__pyx_v_indexing); - PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_indexing); - __Pyx_INCREF(__pyx_v_index_name); - __Pyx_GIVEREF(__pyx_v_index_name); - PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_index_name); - __Pyx_INCREF(__pyx_v_output); - __Pyx_GIVEREF(__pyx_v_output); - PyTuple_SET_ITEM(__pyx_t_5, 10+__pyx_t_4, __pyx_v_output); - __Pyx_INCREF(__pyx_v_debug); - __Pyx_GIVEREF(__pyx_v_debug); - PyTuple_SET_ITEM(__pyx_t_5, 11+__pyx_t_4, __pyx_v_debug); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1193 - * num_records, header, footer, indexing, index_name, output, debug) - * - * self.adapter.tokenize = &delim_tokenizer; # <<<<<<<<<<<<<< - * - * self.adapter.escape_char = 0 - */ - __pyx_v_self->__pyx_base.adapter->tokenize = (&delim_tokenizer); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1195 - * self.adapter.tokenize = &delim_tokenizer; - * - * self.adapter.escape_char = 0 # <<<<<<<<<<<<<< - * if escape is not None: - * self.adapter.escape_char = ord(escape[0]) - */ - __pyx_v_self->__pyx_base.adapter->escape_char = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1196 - * - * self.adapter.escape_char = 0 - * if escape is not None: # <<<<<<<<<<<<<< - * self.adapter.escape_char = ord(escape[0]) - * - */ - __pyx_t_6 = (__pyx_v_escape != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1197 - * self.adapter.escape_char = 0 - * if escape is not None: - * self.adapter.escape_char = ord(escape[0]) # <<<<<<<<<<<<<< - * - * # Find first line of text that isn't a comment. - */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_escape, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_Ord(__pyx_t_1); if (unlikely(__pyx_t_8 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 1197, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->__pyx_base.adapter->escape_char = __pyx_t_8; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1196 - * - * self.adapter.escape_char = 0 - * if escape is not None: # <<<<<<<<<<<<<< - * self.adapter.escape_char = ord(escape[0]) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1202 - * # Save last comment line. If comment lines exist, we'll use that - * # instead of first non comment text line for field names. - * offset = 0 # <<<<<<<<<<<<<< - * comment_offset = 0 - * comment_line = None - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_offset = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1203 - * # instead of first non comment text line for field names. - * offset = 0 - * comment_offset = 0 # <<<<<<<<<<<<<< - * comment_line = None - * try: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_comment_offset = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1204 - * offset = 0 - * comment_offset = 0 - * comment_line = None # <<<<<<<<<<<<<< - * try: - * line_iter = create_line_iter(self.adapter) - */ - __Pyx_INCREF(Py_None); - __pyx_v_comment_line = Py_None; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1205 - * comment_offset = 0 - * comment_line = None - * try: # <<<<<<<<<<<<<< - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - /*try:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1206 - * comment_line = None - * try: - * line_iter = create_line_iter(self.adapter) # <<<<<<<<<<<<<< - * line = next(line_iter) - * offset = len(line) - */ - __pyx_t_1 = __pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_line_iter(__pyx_v_self->__pyx_base.adapter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1206, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_line_iter = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1207 - * try: - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) # <<<<<<<<<<<<<< - * offset = len(line) - * - */ - __pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_line_iter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1207, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_line = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1208 - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - * offset = len(line) # <<<<<<<<<<<<<< - * - * if comment is not None and line.strip() != '' and \ - */ - __pyx_t_12 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1208, __pyx_L4_error) - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1208, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_offset, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1210 - * offset = len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - __pyx_t_6 = (__pyx_v_comment != Py_None); - __pyx_t_13 = (__pyx_t_6 != 0); - if (__pyx_t_13) { - } else { - __pyx_t_7 = __pyx_t_13; - goto __pyx_L13_bool_binop_done; - } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1210, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1210, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1210, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__25, Py_NE)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1210, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_13) { - } else { - __pyx_t_7 = __pyx_t_13; - goto __pyx_L13_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1211 - * - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: # <<<<<<<<<<<<<< - * comment_line = line - * comment_offset = offset - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1211, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1211, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1211, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1211, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_comment, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1211, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1211, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __pyx_t_13; - __pyx_L13_bool_binop_done:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1210 - * offset = len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1212 - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: - * comment_line = line # <<<<<<<<<<<<<< - * comment_offset = offset - * - */ - __Pyx_INCREF(__pyx_v_line); - __Pyx_DECREF_SET(__pyx_v_comment_line, __pyx_v_line); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1213 - * line.strip()[0] == comment: - * comment_line = line - * comment_offset = offset # <<<<<<<<<<<<<< - * - * while line.strip() == '' or \ - */ - __Pyx_INCREF(__pyx_v_offset); - __Pyx_DECREF_SET(__pyx_v_comment_offset, __pyx_v_offset); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1210 - * offset = len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1215 - * comment_offset = offset - * - * while line.strip() == '' or \ # <<<<<<<<<<<<<< - * (comment is not None and line.strip()[0] == comment): - * line = next(line_iter) - */ - while (1) { - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1215, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1215, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1215, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__25, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1215, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_13) { - } else { - __pyx_t_7 = __pyx_t_13; - goto __pyx_L18_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1216 - * - * while line.strip() == '' or \ - * (comment is not None and line.strip()[0] == comment): # <<<<<<<<<<<<<< - * line = next(line_iter) - * offset = offset + len(line) - */ - __pyx_t_13 = (__pyx_v_comment != Py_None); - __pyx_t_6 = (__pyx_t_13 != 0); - if (__pyx_t_6) { - } else { - __pyx_t_7 = __pyx_t_6; - goto __pyx_L18_bool_binop_done; - } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1216, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1216, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1216, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1216, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_comment, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1216, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1216, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __pyx_t_6; - __pyx_L18_bool_binop_done:; - if (!__pyx_t_7) break; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1217 - * while line.strip() == '' or \ - * (comment is not None and line.strip()[0] == comment): - * line = next(line_iter) # <<<<<<<<<<<<<< - * offset = offset + len(line) - * - */ - __pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_line_iter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1217, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1218 - * (comment is not None and line.strip()[0] == comment): - * line = next(line_iter) - * offset = offset + len(line) # <<<<<<<<<<<<<< - * - * if comment is not None and line.strip() != '' and \ - */ - __pyx_t_12 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1218, __pyx_L4_error) - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1218, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_v_offset, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1218, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_offset, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1220 - * offset = offset + len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - __pyx_t_6 = (__pyx_v_comment != Py_None); - __pyx_t_13 = (__pyx_t_6 != 0); - if (__pyx_t_13) { - } else { - __pyx_t_7 = __pyx_t_13; - goto __pyx_L22_bool_binop_done; - } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1220, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1220, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1220, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__25, Py_NE)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1220, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_13) { - } else { - __pyx_t_7 = __pyx_t_13; - goto __pyx_L22_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1221 - * - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: # <<<<<<<<<<<<<< - * comment_line = line - * comment_offset = offset - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1221, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1221, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1221, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1221, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_comment, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1221, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1221, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __pyx_t_13; - __pyx_L22_bool_binop_done:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1220 - * offset = offset + len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1222 - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: - * comment_line = line # <<<<<<<<<<<<<< - * comment_offset = offset - * - */ - __Pyx_INCREF(__pyx_v_line); - __Pyx_DECREF_SET(__pyx_v_comment_line, __pyx_v_line); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1223 - * line.strip()[0] == comment: - * comment_line = line - * comment_offset = offset # <<<<<<<<<<<<<< - * - * except StopIteration: - */ - __Pyx_INCREF(__pyx_v_offset); - __Pyx_DECREF_SET(__pyx_v_comment_offset, __pyx_v_offset); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1220 - * offset = offset + len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - } - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1205 - * comment_offset = 0 - * comment_line = None - * try: # <<<<<<<<<<<<<< - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - */ - } - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L11_try_end; - __pyx_L4_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1225 - * comment_offset = offset - * - * except StopIteration: # <<<<<<<<<<<<<< - * raise EOFError() - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration); - if (__pyx_t_4) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.CSVTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 1225, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_5); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1226 - * - * except StopIteration: - * raise EOFError() # <<<<<<<<<<<<<< - * - * # If a tab delimiter is explicitly specified, - */ - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_EOFError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1226, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1226, __pyx_L6_except_error) - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1205 - * comment_offset = 0 - * comment_line = None - * try: # <<<<<<<<<<<<<< - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); - goto __pyx_L1_error; - __pyx_L11_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1230 - * # If a tab delimiter is explicitly specified, - * # override group whitespace delim argument - * if group_whitespace_delims and delimiter != '\t': # <<<<<<<<<<<<<< - * self.adapter.group_whitespace_delims = 1 - * - */ - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_group_whitespace_delims); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1230, __pyx_L1_error) - if (__pyx_t_13) { - } else { - __pyx_t_7 = __pyx_t_13; - goto __pyx_L28_bool_binop_done; - } - __pyx_t_13 = (__Pyx_PyString_Equals(__pyx_v_delimiter, __pyx_kp_s__79, Py_NE)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1230, __pyx_L1_error) - __pyx_t_7 = __pyx_t_13; - __pyx_L28_bool_binop_done:; - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1231 - * # override group whitespace delim argument - * if group_whitespace_delims and delimiter != '\t': - * self.adapter.group_whitespace_delims = 1 # <<<<<<<<<<<<<< - * - * if whitespace_delims: - */ - __pyx_v_self->__pyx_base.adapter->group_whitespace_delims = 1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1230 - * # If a tab delimiter is explicitly specified, - * # override group whitespace delim argument - * if group_whitespace_delims and delimiter != '\t': # <<<<<<<<<<<<<< - * self.adapter.group_whitespace_delims = 1 - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1233 - * self.adapter.group_whitespace_delims = 1 - * - * if whitespace_delims: # <<<<<<<<<<<<<< - * delimiter = ' ' - * self.adapter.any_whitespace_as_delim = 1 - */ - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_whitespace_delims); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1233, __pyx_L1_error) - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1234 - * - * if whitespace_delims: - * delimiter = ' ' # <<<<<<<<<<<<<< - * self.adapter.any_whitespace_as_delim = 1 - * - */ - __Pyx_INCREF(__pyx_kp_s__80); - __Pyx_DECREF_SET(__pyx_v_delimiter, __pyx_kp_s__80); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1235 - * if whitespace_delims: - * delimiter = ' ' - * self.adapter.any_whitespace_as_delim = 1 # <<<<<<<<<<<<<< - * - * # Try to guess delimiter - */ - __pyx_v_self->__pyx_base.adapter->any_whitespace_as_delim = 1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1233 - * self.adapter.group_whitespace_delims = 1 - * - * if whitespace_delims: # <<<<<<<<<<<<<< - * delimiter = ' ' - * self.adapter.any_whitespace_as_delim = 1 - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1238 - * - * # Try to guess delimiter - * if delimiter is True: # <<<<<<<<<<<<<< - * try: - * d=csv.Sniffer().sniff(line.strip(comment)) - */ - __pyx_t_7 = (__pyx_v_delimiter == Py_True); - __pyx_t_13 = (__pyx_t_7 != 0); - if (__pyx_t_13) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1239 - * # Try to guess delimiter - * if delimiter is True: - * try: # <<<<<<<<<<<<<< - * d=csv.Sniffer().sniff(line.strip(comment)) - * delimiter = str(d.delimiter) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_9); - /*try:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1240 - * if delimiter is True: - * try: - * d=csv.Sniffer().sniff(line.strip(comment)) # <<<<<<<<<<<<<< - * delimiter = str(d.delimiter) - * if delimiter == ' ': - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_csv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Sniffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1240, __pyx_L32_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sniff); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_14 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_14)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_14) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_comment}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_comment}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); __pyx_t_14 = NULL; - __Pyx_INCREF(__pyx_v_comment); - __Pyx_GIVEREF(__pyx_v_comment); - PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_comment); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_2) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_1}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_1}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1240, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_d = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1241 - * try: - * d=csv.Sniffer().sniff(line.strip(comment)) - * delimiter = str(d.delimiter) # <<<<<<<<<<<<<< - * if delimiter == ' ': - * whitespace_delims = True - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_delimiter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1241, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1241, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1241, __pyx_L32_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_delimiter, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1242 - * d=csv.Sniffer().sniff(line.strip(comment)) - * delimiter = str(d.delimiter) - * if delimiter == ' ': # <<<<<<<<<<<<<< - * whitespace_delims = True - * self.adapter.any_whitespace_as_delim = 1 - */ - __pyx_t_13 = (__Pyx_PyString_Equals(__pyx_v_delimiter, __pyx_kp_s__80, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1242, __pyx_L32_error) - if (__pyx_t_13) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1243 - * delimiter = str(d.delimiter) - * if delimiter == ' ': - * whitespace_delims = True # <<<<<<<<<<<<<< - * self.adapter.any_whitespace_as_delim = 1 - * except csv.Error: - */ - __Pyx_INCREF(Py_True); - __Pyx_DECREF_SET(__pyx_v_whitespace_delims, Py_True); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1244 - * if delimiter == ' ': - * whitespace_delims = True - * self.adapter.any_whitespace_as_delim = 1 # <<<<<<<<<<<<<< - * except csv.Error: - * raise errors.ParserError('could not guess delimiter character') - */ - __pyx_v_self->__pyx_base.adapter->any_whitespace_as_delim = 1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1242 - * d=csv.Sniffer().sniff(line.strip(comment)) - * delimiter = str(d.delimiter) - * if delimiter == ' ': # <<<<<<<<<<<<<< - * whitespace_delims = True - * self.adapter.any_whitespace_as_delim = 1 - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1239 - * # Try to guess delimiter - * if delimiter is True: - * try: # <<<<<<<<<<<<<< - * d=csv.Sniffer().sniff(line.strip(comment)) - * delimiter = str(d.delimiter) - */ - } - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L39_try_end; - __pyx_L32_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1245 - * whitespace_delims = True - * self.adapter.any_whitespace_as_delim = 1 - * except csv.Error: # <<<<<<<<<<<<<< - * raise errors.ParserError('could not guess delimiter character') - * - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_csv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1245, __pyx_L34_except_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1245, __pyx_L34_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.CSVTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_15) < 0) __PYX_ERR(0, 1245, __pyx_L34_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_15); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1246 - * self.adapter.any_whitespace_as_delim = 1 - * except csv.Error: - * raise errors.ParserError('could not guess delimiter character') # <<<<<<<<<<<<<< - * - * # Set delimiter character - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1246, __pyx_L34_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ParserError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1246, __pyx_L34_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__81, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1246, __pyx_L34_except_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 1246, __pyx_L34_except_error) - } - goto __pyx_L34_except_error; - __pyx_L34_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1239 - * # Try to guess delimiter - * if delimiter is True: - * try: # <<<<<<<<<<<<<< - * d=csv.Sniffer().sniff(line.strip(comment)) - * delimiter = str(d.delimiter) - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); - goto __pyx_L1_error; - __pyx_L39_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1238 - * - * # Try to guess delimiter - * if delimiter is True: # <<<<<<<<<<<<<< - * try: - * d=csv.Sniffer().sniff(line.strip(comment)) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1249 - * - * # Set delimiter character - * if delimiter is None: # <<<<<<<<<<<<<< - * self.adapter.delim_char = 0 - * else: - */ - __pyx_t_13 = (__pyx_v_delimiter == Py_None); - __pyx_t_7 = (__pyx_t_13 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1250 - * # Set delimiter character - * if delimiter is None: - * self.adapter.delim_char = 0 # <<<<<<<<<<<<<< - * else: - * try: - */ - __pyx_v_self->__pyx_base.adapter->delim_char = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1249 - * - * # Set delimiter character - * if delimiter is None: # <<<<<<<<<<<<<< - * self.adapter.delim_char = 0 - * else: - */ - goto __pyx_L43; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1252 - * self.adapter.delim_char = 0 - * else: - * try: # <<<<<<<<<<<<<< - * self.adapter.delim_char = ord(delimiter[0]) - * except OverflowError: - */ - /*else*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - /*try:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1253 - * else: - * try: - * self.adapter.delim_char = ord(delimiter[0]) # <<<<<<<<<<<<<< - * except OverflowError: - * raise errors.ArgumentError("delimiter must be ASCII character") - */ - __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_delimiter, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1253, __pyx_L44_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_8 = __Pyx_PyObject_Ord(__pyx_t_15); if (unlikely(__pyx_t_8 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 1253, __pyx_L44_error) - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_v_self->__pyx_base.adapter->delim_char = __pyx_t_8; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1252 - * self.adapter.delim_char = 0 - * else: - * try: # <<<<<<<<<<<<<< - * self.adapter.delim_char = ord(delimiter[0]) - * except OverflowError: - */ - } - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L51_try_end; - __pyx_L44_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1254 - * try: - * self.adapter.delim_char = ord(delimiter[0]) - * except OverflowError: # <<<<<<<<<<<<<< - * raise errors.ArgumentError("delimiter must be ASCII character") - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError); - if (__pyx_t_4) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.CSVTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_15, &__pyx_t_5, &__pyx_t_3) < 0) __PYX_ERR(0, 1254, __pyx_L46_except_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_3); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1255 - * self.adapter.delim_char = ord(delimiter[0]) - * except OverflowError: - * raise errors.ArgumentError("delimiter must be ASCII character") # <<<<<<<<<<<<<< - * - * # set number of fields in file - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1255, __pyx_L46_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ArgumentError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1255, __pyx_L46_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__82, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1255, __pyx_L46_except_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 1255, __pyx_L46_except_error) - } - goto __pyx_L46_except_error; - __pyx_L46_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1252 - * self.adapter.delim_char = 0 - * else: - * try: # <<<<<<<<<<<<<< - * self.adapter.delim_char = ord(delimiter[0]) - * except OverflowError: - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); - goto __pyx_L1_error; - __pyx_L51_try_end:; - } - } - __pyx_L43:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1258 - * - * # set number of fields in file - * if whitespace_delims: # <<<<<<<<<<<<<< - * field_values = line.strip(comment).split() - * set_num_fields(self.adapter.fields, len(field_values)) - */ - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_whitespace_delims); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1258, __pyx_L1_error) - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1259 - * # set number of fields in file - * if whitespace_delims: - * field_values = line.strip(comment).split() # <<<<<<<<<<<<<< - * set_num_fields(self.adapter.fields, len(field_values)) - * elif delimiter is not None: - */ - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_15, function); - } - } - if (!__pyx_t_1) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_v_comment); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_15)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_comment}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1259, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_comment}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1259, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL; - __Pyx_INCREF(__pyx_v_comment); - __Pyx_GIVEREF(__pyx_v_comment); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_comment); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_split); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_15); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_15, function); - } - } - if (__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1259, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1259, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_v_field_values = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1260 - * if whitespace_delims: - * field_values = line.strip(comment).split() - * set_num_fields(self.adapter.fields, len(field_values)) # <<<<<<<<<<<<<< - * elif delimiter is not None: - * # csv module doesn't handle unicode on python 2, so just always - */ - __pyx_t_12 = PyObject_Length(__pyx_v_field_values); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1260, __pyx_L1_error) - set_num_fields(__pyx_v_self->__pyx_base.adapter->fields, __pyx_t_12); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1258 - * - * # set number of fields in file - * if whitespace_delims: # <<<<<<<<<<<<<< - * field_values = line.strip(comment).split() - * set_num_fields(self.adapter.fields, len(field_values)) - */ - goto __pyx_L54; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1261 - * field_values = line.strip(comment).split() - * set_num_fields(self.adapter.fields, len(field_values)) - * elif delimiter is not None: # <<<<<<<<<<<<<< - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - */ - __pyx_t_7 = (__pyx_v_delimiter != Py_None); - __pyx_t_13 = (__pyx_t_7 != 0); - if (__pyx_t_13) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1264 - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - * if sys.version < '3': # <<<<<<<<<<<<<< - * line2 = line.encode('utf_8') - * else: - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1264, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_version); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1264, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_RichCompare(__pyx_t_15, __pyx_kp_s_3, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1264, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1264, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_13) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1265 - * # encode the line string as bytes - * if sys.version < '3': - * line2 = line.encode('utf_8') # <<<<<<<<<<<<<< - * else: - * line2 = line - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__83, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_line2 = __pyx_t_15; - __pyx_t_15 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1264 - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - * if sys.version < '3': # <<<<<<<<<<<<<< - * line2 = line.encode('utf_8') - * else: - */ - goto __pyx_L55; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1267 - * line2 = line.encode('utf_8') - * else: - * line2 = line # <<<<<<<<<<<<<< - * csv_reader = csv.reader([line2.strip(comment)], - * delimiter=delimiter, skipinitialspace=True, - */ - /*else*/ { - __Pyx_INCREF(__pyx_v_line); - __pyx_v_line2 = __pyx_v_line; - } - __pyx_L55:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1268 - * else: - * line2 = line - * csv_reader = csv.reader([line2.strip(comment)], # <<<<<<<<<<<<<< - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) - */ - __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_csv); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_reader); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_line2, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_2) { - __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_comment); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_comment}; - __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1268, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_15); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_comment}; - __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1268, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_15); - } else - #endif - { - __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_comment); - __Pyx_GIVEREF(__pyx_v_comment); - PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_comment); - __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_15); - PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_15); - __pyx_t_15 = 0; - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1269 - * line2 = line - * csv_reader = csv.reader([line2.strip(comment)], - * delimiter=delimiter, skipinitialspace=True, # <<<<<<<<<<<<<< - * escapechar=escape, quotechar=quote) - * field_values = [value for value in csv_reader] - */ - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_delimiter, __pyx_v_delimiter) < 0) __PYX_ERR(0, 1269, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_skipinitialspace, Py_True) < 0) __PYX_ERR(0, 1269, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1270 - * csv_reader = csv.reader([line2.strip(comment)], - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) # <<<<<<<<<<<<<< - * field_values = [value for value in csv_reader] - * if len(field_values[0]) == 1 and len(field_values[0][0]) == 0: - */ - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_escapechar, __pyx_v_escape) < 0) __PYX_ERR(0, 1269, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_quotechar, __pyx_v_quote) < 0) __PYX_ERR(0, 1269, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1268 - * else: - * line2 = line - * csv_reader = csv.reader([line2.strip(comment)], # <<<<<<<<<<<<<< - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_csv_reader = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1271 - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) - * field_values = [value for value in csv_reader] # <<<<<<<<<<<<<< - * if len(field_values[0]) == 1 and len(field_values[0][0]) == 0: - * set_num_fields(self.adapter.fields, 0) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_v_csv_reader)) || PyTuple_CheckExact(__pyx_v_csv_reader)) { - __pyx_t_5 = __pyx_v_csv_reader; __Pyx_INCREF(__pyx_t_5); __pyx_t_12 = 0; - __pyx_t_16 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_csv_reader); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_16 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1271, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_16)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_15 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_12); __Pyx_INCREF(__pyx_t_15); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1271, __pyx_L1_error) - #else - __pyx_t_15 = PySequence_ITEM(__pyx_t_5, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_12); __Pyx_INCREF(__pyx_t_15); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1271, __pyx_L1_error) - #else - __pyx_t_15 = PySequence_ITEM(__pyx_t_5, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - #endif - } - } else { - __pyx_t_15 = __pyx_t_16(__pyx_t_5); - if (unlikely(!__pyx_t_15)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1271, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_15); - } - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_15); - __pyx_t_15 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_v_value))) __PYX_ERR(0, 1271, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_field_values = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1272 - * escapechar=escape, quotechar=quote) - * field_values = [value for value in csv_reader] - * if len(field_values[0]) == 1 and len(field_values[0][0]) == 0: # <<<<<<<<<<<<<< - * set_num_fields(self.adapter.fields, 0) - * else: - */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_field_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1272, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = ((__pyx_t_12 == 1) != 0); - if (__pyx_t_7) { - } else { - __pyx_t_13 = __pyx_t_7; - goto __pyx_L59_bool_binop_done; - } - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_field_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_12 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1272, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = ((__pyx_t_12 == 0) != 0); - __pyx_t_13 = __pyx_t_7; - __pyx_L59_bool_binop_done:; - if (__pyx_t_13) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1273 - * field_values = [value for value in csv_reader] - * if len(field_values[0]) == 1 and len(field_values[0][0]) == 0: - * set_num_fields(self.adapter.fields, 0) # <<<<<<<<<<<<<< - * else: - * set_num_fields(self.adapter.fields, len(field_values[0])) - */ - set_num_fields(__pyx_v_self->__pyx_base.adapter->fields, 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1272 - * escapechar=escape, quotechar=quote) - * field_values = [value for value in csv_reader] - * if len(field_values[0]) == 1 and len(field_values[0][0]) == 0: # <<<<<<<<<<<<<< - * set_num_fields(self.adapter.fields, 0) - * else: - */ - goto __pyx_L58; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1275 - * set_num_fields(self.adapter.fields, 0) - * else: - * set_num_fields(self.adapter.fields, len(field_values[0])) # <<<<<<<<<<<<<< - * else: - * set_num_fields(self.adapter.fields, 1) - */ - /*else*/ { - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_field_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_12 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1275, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - set_num_fields(__pyx_v_self->__pyx_base.adapter->fields, __pyx_t_12); - } - __pyx_L58:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1261 - * field_values = line.strip(comment).split() - * set_num_fields(self.adapter.fields, len(field_values)) - * elif delimiter is not None: # <<<<<<<<<<<<<< - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - */ - goto __pyx_L54; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1277 - * set_num_fields(self.adapter.fields, len(field_values[0])) - * else: - * set_num_fields(self.adapter.fields, 1) # <<<<<<<<<<<<<< - * - * self.field_filter = range(self.field_count) - */ - /*else*/ { - set_num_fields(__pyx_v_self->__pyx_base.adapter->fields, 1); - } - __pyx_L54:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1279 - * set_num_fields(self.adapter.fields, 1) - * - * self.field_filter = range(self.field_count) # <<<<<<<<<<<<<< - * - * # Set field names from either last comment line if it exists, - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_filter, __pyx_t_5) < 0) __PYX_ERR(0, 1279, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1283 - * # Set field names from either last comment line if it exists, - * # or first line of data. - * if field_names is True: # <<<<<<<<<<<<<< - * - * if comment_line is not None: - */ - __pyx_t_13 = (__pyx_v_field_names == Py_True); - __pyx_t_7 = (__pyx_t_13 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1285 - * if field_names is True: - * - * if comment_line is not None: # <<<<<<<<<<<<<< - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - */ - __pyx_t_7 = (__pyx_v_comment_line != Py_None); - __pyx_t_13 = (__pyx_t_7 != 0); - if (__pyx_t_13) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1288 - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - * if sys.version < '3': # <<<<<<<<<<<<<< - * comment_line2 = comment_line.encode('utf_8') - * else: - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_kp_s_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1288, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1288, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_13) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1289 - * # encode the line string as bytes - * if sys.version < '3': - * comment_line2 = comment_line.encode('utf_8') # <<<<<<<<<<<<<< - * else: - * comment_line2 = comment_line - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_comment_line, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__84, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_comment_line2 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1288 - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - * if sys.version < '3': # <<<<<<<<<<<<<< - * comment_line2 = comment_line.encode('utf_8') - * else: - */ - goto __pyx_L63; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1291 - * comment_line2 = comment_line.encode('utf_8') - * else: - * comment_line2 = comment_line # <<<<<<<<<<<<<< - * csv_reader = csv.reader([comment_line2.strip(comment)], - * delimiter=delimiter, skipinitialspace=True, - */ - /*else*/ { - __Pyx_INCREF(__pyx_v_comment_line); - __pyx_v_comment_line2 = __pyx_v_comment_line; - } - __pyx_L63:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1292 - * else: - * comment_line2 = comment_line - * csv_reader = csv.reader([comment_line2.strip(comment)], # <<<<<<<<<<<<<< - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_csv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_reader); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_comment_line2, __pyx_n_s_strip); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_15); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_15, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_v_comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_15)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_comment}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_comment}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_comment); - __Pyx_GIVEREF(__pyx_v_comment); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_comment); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyList_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_GIVEREF(__pyx_t_1); - PyList_SET_ITEM(__pyx_t_15, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_15); - __pyx_t_15 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1293 - * comment_line2 = comment_line - * csv_reader = csv.reader([comment_line2.strip(comment)], - * delimiter=delimiter, skipinitialspace=True, # <<<<<<<<<<<<<< - * escapechar=escape, quotechar=quote) - * field_names = [field_name for field_name in csv_reader] - */ - __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_delimiter, __pyx_v_delimiter) < 0) __PYX_ERR(0, 1293, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_skipinitialspace, Py_True) < 0) __PYX_ERR(0, 1293, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1294 - * csv_reader = csv.reader([comment_line2.strip(comment)], - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) # <<<<<<<<<<<<<< - * field_names = [field_name for field_name in csv_reader] - * elif delimiter is not None: - */ - if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_escapechar, __pyx_v_escape) < 0) __PYX_ERR(0, 1293, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_quotechar, __pyx_v_quote) < 0) __PYX_ERR(0, 1293, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1292 - * else: - * comment_line2 = comment_line - * csv_reader = csv.reader([comment_line2.strip(comment)], # <<<<<<<<<<<<<< - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF_SET(__pyx_v_csv_reader, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1295 - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) - * field_names = [field_name for field_name in csv_reader] # <<<<<<<<<<<<<< - * elif delimiter is not None: - * # csv module doesn't handle unicode on python 2, so just always - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(PyList_CheckExact(__pyx_v_csv_reader)) || PyTuple_CheckExact(__pyx_v_csv_reader)) { - __pyx_t_15 = __pyx_v_csv_reader; __Pyx_INCREF(__pyx_t_15); __pyx_t_12 = 0; - __pyx_t_16 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_v_csv_reader); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1295, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_16)) { - if (likely(PyList_CheckExact(__pyx_t_15))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_15)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1295, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_15)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1295, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_16(__pyx_t_15); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1295, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_field_name, __pyx_t_1); - __pyx_t_1 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_v_field_name))) __PYX_ERR(0, 1295, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF_SET(__pyx_v_field_names, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1285 - * if field_names is True: - * - * if comment_line is not None: # <<<<<<<<<<<<<< - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - */ - goto __pyx_L62; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1296 - * escapechar=escape, quotechar=quote) - * field_names = [field_name for field_name in csv_reader] - * elif delimiter is not None: # <<<<<<<<<<<<<< - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - */ - __pyx_t_13 = (__pyx_v_delimiter != Py_None); - __pyx_t_7 = (__pyx_t_13 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1299 - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - * if sys.version < '3': # <<<<<<<<<<<<<< - * line2 = line.encode('utf_8') - * else: - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_version); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_15, __pyx_kp_s_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1299, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1299, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1300 - * # encode the line string as bytes - * if sys.version < '3': - * line2 = line.encode('utf_8') # <<<<<<<<<<<<<< - * else: - * line2 = line - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__85, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_line2, __pyx_t_15); - __pyx_t_15 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1299 - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - * if sys.version < '3': # <<<<<<<<<<<<<< - * line2 = line.encode('utf_8') - * else: - */ - goto __pyx_L66; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1302 - * line2 = line.encode('utf_8') - * else: - * line2 = line # <<<<<<<<<<<<<< - * csv_reader = csv.reader([line2.strip(comment)], - * delimiter=delimiter, skipinitialspace=True, - */ - /*else*/ { - __Pyx_INCREF(__pyx_v_line); - __Pyx_XDECREF_SET(__pyx_v_line2, __pyx_v_line); - } - __pyx_L66:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1303 - * else: - * line2 = line - * csv_reader = csv.reader([line2.strip(comment)], # <<<<<<<<<<<<<< - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) - */ - __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_csv); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line2, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_5) { - __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_comment); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_comment}; - __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1303, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_15); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_comment}; - __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1303, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_15); - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_comment); - __Pyx_GIVEREF(__pyx_v_comment); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_comment); - __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_15); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_15); - __pyx_t_15 = 0; - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1304 - * line2 = line - * csv_reader = csv.reader([line2.strip(comment)], - * delimiter=delimiter, skipinitialspace=True, # <<<<<<<<<<<<<< - * escapechar=escape, quotechar=quote) - * field_names = [field_name for field_name in csv_reader] - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_delimiter, __pyx_v_delimiter) < 0) __PYX_ERR(0, 1304, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_skipinitialspace, Py_True) < 0) __PYX_ERR(0, 1304, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1305 - * csv_reader = csv.reader([line2.strip(comment)], - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) # <<<<<<<<<<<<<< - * field_names = [field_name for field_name in csv_reader] - * else: - */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_escapechar, __pyx_v_escape) < 0) __PYX_ERR(0, 1304, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_quotechar, __pyx_v_quote) < 0) __PYX_ERR(0, 1304, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1303 - * else: - * line2 = line - * csv_reader = csv.reader([line2.strip(comment)], # <<<<<<<<<<<<<< - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_15, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_csv_reader, __pyx_t_3); - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1306 - * delimiter=delimiter, skipinitialspace=True, - * escapechar=escape, quotechar=quote) - * field_names = [field_name for field_name in csv_reader] # <<<<<<<<<<<<<< - * else: - * field_names = [line.strip(comment)] - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_v_csv_reader)) || PyTuple_CheckExact(__pyx_v_csv_reader)) { - __pyx_t_1 = __pyx_v_csv_reader; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0; - __pyx_t_16 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_csv_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1306, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_16)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_15 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_15); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1306, __pyx_L1_error) - #else - __pyx_t_15 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_15); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1306, __pyx_L1_error) - #else - __pyx_t_15 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - #endif - } - } else { - __pyx_t_15 = __pyx_t_16(__pyx_t_1); - if (unlikely(!__pyx_t_15)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1306, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_15); - } - __Pyx_XDECREF_SET(__pyx_v_field_name, __pyx_t_15); - __pyx_t_15 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_v_field_name))) __PYX_ERR(0, 1306, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_field_names, __pyx_t_3); - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1296 - * escapechar=escape, quotechar=quote) - * field_names = [field_name for field_name in csv_reader] - * elif delimiter is not None: # <<<<<<<<<<<<<< - * # csv module doesn't handle unicode on python 2, so just always - * # encode the line string as bytes - */ - goto __pyx_L62; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1308 - * field_names = [field_name for field_name in csv_reader] - * else: - * field_names = [line.strip(comment)] # <<<<<<<<<<<<<< - * - * if len(field_names) > 0: - */ - /*else*/ { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_15 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_15) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_comment); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_v_comment}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1308, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_v_comment}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1308, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_15); __pyx_t_15 = NULL; - __Pyx_INCREF(__pyx_v_comment); - __Pyx_GIVEREF(__pyx_v_comment); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_comment); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_field_names, __pyx_t_1); - __pyx_t_1 = 0; - } - __pyx_L62:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1310 - * field_names = [line.strip(comment)] - * - * if len(field_names) > 0: # <<<<<<<<<<<<<< - * - * # If we used the first data line for field names and not the - */ - __pyx_t_12 = PyObject_Length(__pyx_v_field_names); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1310, __pyx_L1_error) - __pyx_t_7 = ((__pyx_t_12 > 0) != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1315 - * # last comment line, reset the header size to the end of the - * # first data line. - * if comment_line is None: # <<<<<<<<<<<<<< - * self.adapter.input_data.header = self.adapter.input_data.header + offset - * - */ - __pyx_t_7 = (__pyx_v_comment_line == Py_None); - __pyx_t_13 = (__pyx_t_7 != 0); - if (__pyx_t_13) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1316 - * # first data line. - * if comment_line is None: - * self.adapter.input_data.header = self.adapter.input_data.header + offset # <<<<<<<<<<<<<< - * - * temp_field_names = [] - */ - __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->__pyx_base.adapter->input_data->header); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1316, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1316, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_17 = __Pyx_PyInt_As_uint64_t(__pyx_t_3); if (unlikely((__pyx_t_17 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1316, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_self->__pyx_base.adapter->input_data->header = __pyx_t_17; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1315 - * # last comment line, reset the header size to the end of the - * # first data line. - * if comment_line is None: # <<<<<<<<<<<<<< - * self.adapter.input_data.header = self.adapter.input_data.header + offset - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1318 - * self.adapter.input_data.header = self.adapter.input_data.header + offset - * - * temp_field_names = [] # <<<<<<<<<<<<<< - * for name in field_names[0]: - * name = name.strip() - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1318, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_temp_field_names = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1319 - * - * temp_field_names = [] - * for name in field_names[0]: # <<<<<<<<<<<<<< - * name = name.strip() - * temp_field_names.append(name) - */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_field_names, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1319, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0; - __pyx_t_16 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1319, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1319, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_16)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1319, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1319, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1319, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1319, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_16(__pyx_t_1); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1319, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_3); - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1320 - * temp_field_names = [] - * for name in field_names[0]: - * name = name.strip() # <<<<<<<<<<<<<< - * temp_field_names.append(name) - * self.field_names = temp_field_names - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_15 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_15) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1320, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1320, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_3); - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1321 - * for name in field_names[0]: - * name = name.strip() - * temp_field_names.append(name) # <<<<<<<<<<<<<< - * self.field_names = temp_field_names - * elif isinstance(field_names, list): - */ - __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_temp_field_names, __pyx_v_name); if (unlikely(__pyx_t_18 == -1)) __PYX_ERR(0, 1321, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1319 - * - * temp_field_names = [] - * for name in field_names[0]: # <<<<<<<<<<<<<< - * name = name.strip() - * temp_field_names.append(name) - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1322 - * name = name.strip() - * temp_field_names.append(name) - * self.field_names = temp_field_names # <<<<<<<<<<<<<< - * elif isinstance(field_names, list): - * self.field_names = field_names - */ - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names, __pyx_v_temp_field_names) < 0) __PYX_ERR(0, 1322, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1310 - * field_names = [line.strip(comment)] - * - * if len(field_names) > 0: # <<<<<<<<<<<<<< - * - * # If we used the first data line for field names and not the - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1283 - * # Set field names from either last comment line if it exists, - * # or first line of data. - * if field_names is True: # <<<<<<<<<<<<<< - * - * if comment_line is not None: - */ - goto __pyx_L61; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1323 - * temp_field_names.append(name) - * self.field_names = temp_field_names - * elif isinstance(field_names, list): # <<<<<<<<<<<<<< - * self.field_names = field_names - * else: - */ - __pyx_t_13 = PyList_Check(__pyx_v_field_names); - __pyx_t_7 = (__pyx_t_13 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1324 - * self.field_names = temp_field_names - * elif isinstance(field_names, list): - * self.field_names = field_names # <<<<<<<<<<<<<< - * else: - * self.field_names = ['f' + str(i) for i in range(self.field_count)] - */ - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names, __pyx_v_field_names) < 0) __PYX_ERR(0, 1324, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1323 - * temp_field_names.append(name) - * self.field_names = temp_field_names - * elif isinstance(field_names, list): # <<<<<<<<<<<<<< - * self.field_names = field_names - * else: - */ - goto __pyx_L61; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1326 - * self.field_names = field_names - * else: - * self.field_names = ['f' + str(i) for i in range(self.field_count)] # <<<<<<<<<<<<<< - * - * # Default missing value strings - */ - /*else*/ { - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0; - __pyx_t_16 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_16 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1326, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_16)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1326, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1326, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_16(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1326, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i); - __pyx_t_15 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_n_s_f, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names, __pyx_t_1) < 0) __PYX_ERR(0, 1326, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L61:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1329 - * - * # Default missing value strings - * missing_values = {} # <<<<<<<<<<<<<< - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1329, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_missing_values = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1330 - * # Default missing value strings - * missing_values = {} - * for field in range(self.adapter.fields.num_fields): # <<<<<<<<<<<<<< - * missing_values[field] = default_missing_values - * self.set_missing_values(missing_values) - */ - __pyx_t_19 = __pyx_v_self->__pyx_base.adapter->fields->num_fields; - for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { - __pyx_v_field = __pyx_t_20; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1331 - * missing_values = {} - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values # <<<<<<<<<<<<<< - * self.set_missing_values(missing_values) - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_default_missing_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_field); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(PyDict_SetItem(__pyx_v_missing_values, __pyx_t_2, __pyx_t_1) < 0)) __PYX_ERR(0, 1331, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1332 - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values - * self.set_missing_values(missing_values) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_missing_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_missing_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_missing_values}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1332, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_missing_values}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1332, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_missing_values); - __Pyx_GIVEREF(__pyx_v_missing_values); - PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_missing_values); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1184 - * """ - * - * def __cinit__(self, fh, delimiter=True, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', escape='\\', num_records=0, - * header=0, footer=0, field_names=True, infer_types=True, - */ - - /* function exit code */ - __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_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.CSVTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_offset); - __Pyx_XDECREF(__pyx_v_comment_offset); - __Pyx_XDECREF(__pyx_v_comment_line); - __Pyx_XDECREF(__pyx_v_line_iter); - __Pyx_XDECREF(__pyx_v_line); - __Pyx_XDECREF(__pyx_v_d); - __Pyx_XDECREF(__pyx_v_field_values); - __Pyx_XDECREF(__pyx_v_line2); - __Pyx_XDECREF(__pyx_v_csv_reader); - __Pyx_XDECREF(__pyx_v_comment_line2); - __Pyx_XDECREF(__pyx_v_temp_field_names); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_missing_values); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_field_name); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_delimiter); - __Pyx_XDECREF(__pyx_v_field_names); - __Pyx_XDECREF(__pyx_v_whitespace_delims); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1344 - * __doc__ += TextAdapter.__doc__ - * - * def __cinit__(self, fh, field_widths, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', num_records=0, header=0, footer=0, - * field_names=True, infer_types=True, indexing=False, - */ - -/* Python wrapper */ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_21FixedWidthTextAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_21FixedWidthTextAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fh = 0; - PyObject *__pyx_v_field_widths = 0; - PyObject *__pyx_v_encoding = 0; - PyObject *__pyx_v_compression = 0; - PyObject *__pyx_v_comment = 0; - PyObject *__pyx_v_quote = 0; - PyObject *__pyx_v_num_records = 0; - PyObject *__pyx_v_header = 0; - PyObject *__pyx_v_footer = 0; - PyObject *__pyx_v_field_names = 0; - CYTHON_UNUSED PyObject *__pyx_v_infer_types = 0; - PyObject *__pyx_v_indexing = 0; - PyObject *__pyx_v_index_name = 0; - PyObject *__pyx_v_output = 0; - PyObject *__pyx_v_debug = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fh,&__pyx_n_s_field_widths,&__pyx_n_s_encoding,&__pyx_n_s_compression,&__pyx_n_s_comment,&__pyx_n_s_quote,&__pyx_n_s_num_records,&__pyx_n_s_header,&__pyx_n_s_footer,&__pyx_n_s_field_names,&__pyx_n_s_infer_types_2,&__pyx_n_s_indexing,&__pyx_n_s_index_name,&__pyx_n_s_output,&__pyx_n_s_debug,0}; - PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - values[2] = ((PyObject *)__pyx_n_s_utf_8); - values[3] = ((PyObject *)Py_None); - values[4] = ((PyObject *)__pyx_kp_s__37); - values[5] = ((PyObject *)__pyx_kp_s__38); - values[6] = ((PyObject *)__pyx_int_0); - values[7] = ((PyObject *)__pyx_int_0); - values[8] = ((PyObject *)__pyx_int_0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1346 - * def __cinit__(self, fh, field_widths, encoding='utf_8', compression=None, - * comment='#', quote='"', num_records=0, header=0, footer=0, - * field_names=True, infer_types=True, indexing=False, # <<<<<<<<<<<<<< - * index_name=None, output='ndarray', debug=False): - * - */ - values[9] = ((PyObject *)Py_True); - values[10] = ((PyObject *)Py_True); - values[11] = ((PyObject *)Py_False); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1347 - * comment='#', quote='"', num_records=0, header=0, footer=0, - * field_names=True, infer_types=True, indexing=False, - * index_name=None, output='ndarray', debug=False): # <<<<<<<<<<<<<< - * - * self.__init_text_adapter(fh, encoding, compression, comment, quote, - */ - values[12] = ((PyObject *)Py_None); - values[13] = ((PyObject *)__pyx_n_s_ndarray); - values[14] = ((PyObject *)Py_False); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fh)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_widths)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 15, 1); __PYX_ERR(0, 1344, __pyx_L3_error) - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_encoding); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compression); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comment); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_quote); - if (value) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_records); - if (value) { values[6] = value; kw_args--; } - } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_header); - if (value) { values[7] = value; kw_args--; } - } - case 8: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_footer); - if (value) { values[8] = value; kw_args--; } - } - case 9: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_names); - if (value) { values[9] = value; kw_args--; } - } - case 10: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_infer_types_2); - if (value) { values[10] = value; kw_args--; } - } - case 11: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indexing); - if (value) { values[11] = value; kw_args--; } - } - case 12: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_name); - if (value) { values[12] = value; kw_args--; } - } - case 13: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output); - if (value) { values[13] = value; kw_args--; } - } - case 14: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_debug); - if (value) { values[14] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1344, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_fh = values[0]; - __pyx_v_field_widths = values[1]; - __pyx_v_encoding = values[2]; - __pyx_v_compression = values[3]; - __pyx_v_comment = values[4]; - __pyx_v_quote = values[5]; - __pyx_v_num_records = values[6]; - __pyx_v_header = values[7]; - __pyx_v_footer = values[8]; - __pyx_v_field_names = values[9]; - __pyx_v_infer_types = values[10]; - __pyx_v_indexing = values[11]; - __pyx_v_index_name = values[12]; - __pyx_v_output = values[13]; - __pyx_v_debug = values[14]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 15, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1344, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FixedWidthTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_21FixedWidthTextAdapter___cinit__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter *)__pyx_v_self), __pyx_v_fh, __pyx_v_field_widths, __pyx_v_encoding, __pyx_v_compression, __pyx_v_comment, __pyx_v_quote, __pyx_v_num_records, __pyx_v_header, __pyx_v_footer, __pyx_v_field_names, __pyx_v_infer_types, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1344 - * __doc__ += TextAdapter.__doc__ - * - * def __cinit__(self, fh, field_widths, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', num_records=0, header=0, footer=0, - * field_names=True, infer_types=True, indexing=False, - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_21FixedWidthTextAdapter___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter *__pyx_v_self, PyObject *__pyx_v_fh, PyObject *__pyx_v_field_widths, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_comment, PyObject *__pyx_v_quote, PyObject *__pyx_v_num_records, PyObject *__pyx_v_header, PyObject *__pyx_v_footer, PyObject *__pyx_v_field_names, CYTHON_UNUSED PyObject *__pyx_v_infer_types, PyObject *__pyx_v_indexing, PyObject *__pyx_v_index_name, PyObject *__pyx_v_output, PyObject *__pyx_v_debug) { - PyObject *__pyx_v_record_iter = NULL; - PyObject *__pyx_v_line = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_offset = NULL; - CYTHON_UNUSED PyObject *__pyx_v_comment_offset = NULL; - PyObject *__pyx_v_comment_line = NULL; - PyObject *__pyx_v_line_iter = NULL; - CYTHON_UNUSED PyObject *__pyx_v_coment_line = NULL; - PyObject *__pyx_v_field_offset = NULL; - PyObject *__pyx_v_temp_field_names = NULL; - PyObject *__pyx_v_width = NULL; - PyObject *__pyx_v_missing_values = NULL; - uint32_t __pyx_v_field; - PyObject *__pyx_v_name = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - Py_ssize_t __pyx_t_12; - uint32_t __pyx_t_13; - PyObject *(*__pyx_t_14)(PyObject *); - uint32_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - int __pyx_t_17; - uint64_t __pyx_t_18; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1349 - * index_name=None, output='ndarray', debug=False): - * - * self.__init_text_adapter(fh, encoding, compression, comment, quote, # <<<<<<<<<<<<<< - * num_records, header, footer, indexing, index_name, output, debug) - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_text_adapter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1349, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1350 - * - * self.__init_text_adapter(fh, encoding, compression, comment, quote, - * num_records, header, footer, indexing, index_name, output, debug) # <<<<<<<<<<<<<< - * - * self.adapter.tokenize = &fixed_width_tokenizer; - */ - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[13] = {__pyx_t_3, __pyx_v_fh, __pyx_v_encoding, __pyx_v_compression, __pyx_v_comment, __pyx_v_quote, __pyx_v_num_records, __pyx_v_header, __pyx_v_footer, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 12+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1349, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[13] = {__pyx_t_3, __pyx_v_fh, __pyx_v_encoding, __pyx_v_compression, __pyx_v_comment, __pyx_v_quote, __pyx_v_num_records, __pyx_v_header, __pyx_v_footer, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 12+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1349, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_5 = PyTuple_New(12+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1349, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_fh); - __Pyx_GIVEREF(__pyx_v_fh); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_fh); - __Pyx_INCREF(__pyx_v_encoding); - __Pyx_GIVEREF(__pyx_v_encoding); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_encoding); - __Pyx_INCREF(__pyx_v_compression); - __Pyx_GIVEREF(__pyx_v_compression); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_compression); - __Pyx_INCREF(__pyx_v_comment); - __Pyx_GIVEREF(__pyx_v_comment); - PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_comment); - __Pyx_INCREF(__pyx_v_quote); - __Pyx_GIVEREF(__pyx_v_quote); - PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_quote); - __Pyx_INCREF(__pyx_v_num_records); - __Pyx_GIVEREF(__pyx_v_num_records); - PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_num_records); - __Pyx_INCREF(__pyx_v_header); - __Pyx_GIVEREF(__pyx_v_header); - PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_header); - __Pyx_INCREF(__pyx_v_footer); - __Pyx_GIVEREF(__pyx_v_footer); - PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_footer); - __Pyx_INCREF(__pyx_v_indexing); - __Pyx_GIVEREF(__pyx_v_indexing); - PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_indexing); - __Pyx_INCREF(__pyx_v_index_name); - __Pyx_GIVEREF(__pyx_v_index_name); - PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_index_name); - __Pyx_INCREF(__pyx_v_output); - __Pyx_GIVEREF(__pyx_v_output); - PyTuple_SET_ITEM(__pyx_t_5, 10+__pyx_t_4, __pyx_v_output); - __Pyx_INCREF(__pyx_v_debug); - __Pyx_GIVEREF(__pyx_v_debug); - PyTuple_SET_ITEM(__pyx_t_5, 11+__pyx_t_4, __pyx_v_debug); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1349, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1352 - * num_records, header, footer, indexing, index_name, output, debug) - * - * self.adapter.tokenize = &fixed_width_tokenizer; # <<<<<<<<<<<<<< - * - * # set number of fields and field widths - */ - __pyx_v_self->__pyx_base.adapter->tokenize = (&fixed_width_tokenizer); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1355 - * - * # set number of fields and field widths - * if isinstance(field_widths, (int, long)): # <<<<<<<<<<<<<< - * if field_widths <= 0: - * raise ValueError('field width must be greater than 0') - */ - __pyx_t_7 = PyInt_Check(__pyx_v_field_widths); - __pyx_t_8 = (__pyx_t_7 != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_6 = __pyx_t_8; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_8 = PyLong_Check(__pyx_v_field_widths); - __pyx_t_7 = (__pyx_t_8 != 0); - __pyx_t_6 = __pyx_t_7; - __pyx_L4_bool_binop_done:; - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1356 - * # set number of fields and field widths - * if isinstance(field_widths, (int, long)): - * if field_widths <= 0: # <<<<<<<<<<<<<< - * raise ValueError('field width must be greater than 0') - * try: - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_field_widths, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1356, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1356, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1357 - * if isinstance(field_widths, (int, long)): - * if field_widths <= 0: - * raise ValueError('field width must be greater than 0') # <<<<<<<<<<<<<< - * try: - * record_iter = create_record_iter(self.adapter) - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__86, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1357, __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_ERR(0, 1357, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1356 - * # set number of fields and field widths - * if isinstance(field_widths, (int, long)): - * if field_widths <= 0: # <<<<<<<<<<<<<< - * raise ValueError('field width must be greater than 0') - * try: - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1358 - * if field_widths <= 0: - * raise ValueError('field width must be greater than 0') - * try: # <<<<<<<<<<<<<< - * record_iter = create_record_iter(self.adapter) - * line = next(record_iter) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - /*try:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1359 - * raise ValueError('field width must be greater than 0') - * try: - * record_iter = create_record_iter(self.adapter) # <<<<<<<<<<<<<< - * line = next(record_iter) - * except StopIteration: - */ - __pyx_t_1 = __pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_record_iter(__pyx_v_self->__pyx_base.adapter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1359, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_record_iter = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1360 - * try: - * record_iter = create_record_iter(self.adapter) - * line = next(record_iter) # <<<<<<<<<<<<<< - * except StopIteration: - * raise EOFError() - */ - __pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_record_iter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1360, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_line = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1358 - * if field_widths <= 0: - * raise ValueError('field width must be greater than 0') - * try: # <<<<<<<<<<<<<< - * record_iter = create_record_iter(self.adapter) - * line = next(record_iter) - */ - } - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L14_try_end; - __pyx_L7_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1361 - * record_iter = create_record_iter(self.adapter) - * line = next(record_iter) - * except StopIteration: # <<<<<<<<<<<<<< - * raise EOFError() - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration); - if (__pyx_t_4) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FixedWidthTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(0, 1361, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_5); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1362 - * line = next(record_iter) - * except StopIteration: - * raise EOFError() # <<<<<<<<<<<<<< - * - * set_num_fields(self.adapter.fields, len(line)/field_widths) - */ - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_EOFError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1362, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1362, __pyx_L9_except_error) - } - goto __pyx_L9_except_error; - __pyx_L9_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1358 - * if field_widths <= 0: - * raise ValueError('field width must be greater than 0') - * try: # <<<<<<<<<<<<<< - * record_iter = create_record_iter(self.adapter) - * line = next(record_iter) - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); - goto __pyx_L1_error; - __pyx_L14_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1364 - * raise EOFError() - * - * set_num_fields(self.adapter.fields, len(line)/field_widths) # <<<<<<<<<<<<<< - * for i in range(0, self.adapter.fields.num_fields): - * set_field_width(self.adapter.fields, i, field_widths) - */ - __pyx_t_12 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1364, __pyx_L1_error) - __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_field_widths); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_13 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_13 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1364, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - set_num_fields(__pyx_v_self->__pyx_base.adapter->fields, __pyx_t_13); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1365 - * - * set_num_fields(self.adapter.fields, len(line)/field_widths) - * for i in range(0, self.adapter.fields.num_fields): # <<<<<<<<<<<<<< - * set_field_width(self.adapter.fields, i, field_widths) - * elif isinstance(field_widths, (list, tuple)): - */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->__pyx_base.adapter->fields->num_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5); __pyx_t_12 = 0; - __pyx_t_14 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1365, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1365, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1365, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_14(__pyx_t_5); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1365, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1366 - * set_num_fields(self.adapter.fields, len(line)/field_widths) - * for i in range(0, self.adapter.fields.num_fields): - * set_field_width(self.adapter.fields, i, field_widths) # <<<<<<<<<<<<<< - * elif isinstance(field_widths, (list, tuple)): - * for i in field_widths: - */ - __pyx_t_13 = __Pyx_PyInt_As_uint32_t(__pyx_v_i); if (unlikely((__pyx_t_13 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1366, __pyx_L1_error) - __pyx_t_15 = __Pyx_PyInt_As_uint32_t(__pyx_v_field_widths); if (unlikely((__pyx_t_15 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1366, __pyx_L1_error) - set_field_width(__pyx_v_self->__pyx_base.adapter->fields, __pyx_t_13, __pyx_t_15); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1365 - * - * set_num_fields(self.adapter.fields, len(line)/field_widths) - * for i in range(0, self.adapter.fields.num_fields): # <<<<<<<<<<<<<< - * set_field_width(self.adapter.fields, i, field_widths) - * elif isinstance(field_widths, (list, tuple)): - */ - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1355 - * - * # set number of fields and field widths - * if isinstance(field_widths, (int, long)): # <<<<<<<<<<<<<< - * if field_widths <= 0: - * raise ValueError('field width must be greater than 0') - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1367 - * for i in range(0, self.adapter.fields.num_fields): - * set_field_width(self.adapter.fields, i, field_widths) - * elif isinstance(field_widths, (list, tuple)): # <<<<<<<<<<<<<< - * for i in field_widths: - * if i <= 0: - */ - __pyx_t_6 = PyList_Check(__pyx_v_field_widths); - __pyx_t_8 = (__pyx_t_6 != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L19_bool_binop_done; - } - __pyx_t_8 = PyTuple_Check(__pyx_v_field_widths); - __pyx_t_6 = (__pyx_t_8 != 0); - __pyx_t_7 = __pyx_t_6; - __pyx_L19_bool_binop_done:; - __pyx_t_6 = (__pyx_t_7 != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1368 - * set_field_width(self.adapter.fields, i, field_widths) - * elif isinstance(field_widths, (list, tuple)): - * for i in field_widths: # <<<<<<<<<<<<<< - * if i <= 0: - * raise ValueError('field width must be greater than 0') - */ - if (likely(PyList_CheckExact(__pyx_v_field_widths)) || PyTuple_CheckExact(__pyx_v_field_widths)) { - __pyx_t_5 = __pyx_v_field_widths; __Pyx_INCREF(__pyx_t_5); __pyx_t_12 = 0; - __pyx_t_14 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_field_widths); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1368, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1368, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1368, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_14(__pyx_t_5); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1368, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1369 - * elif isinstance(field_widths, (list, tuple)): - * for i in field_widths: - * if i <= 0: # <<<<<<<<<<<<<< - * raise ValueError('field width must be greater than 0') - * set_num_fields(self.adapter.fields, len(field_widths)) - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1369, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1370 - * for i in field_widths: - * if i <= 0: - * raise ValueError('field width must be greater than 0') # <<<<<<<<<<<<<< - * set_num_fields(self.adapter.fields, len(field_widths)) - * for i in range(0, self.adapter.fields.num_fields): - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__87, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1370, __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_ERR(0, 1370, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1369 - * elif isinstance(field_widths, (list, tuple)): - * for i in field_widths: - * if i <= 0: # <<<<<<<<<<<<<< - * raise ValueError('field width must be greater than 0') - * set_num_fields(self.adapter.fields, len(field_widths)) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1368 - * set_field_width(self.adapter.fields, i, field_widths) - * elif isinstance(field_widths, (list, tuple)): - * for i in field_widths: # <<<<<<<<<<<<<< - * if i <= 0: - * raise ValueError('field width must be greater than 0') - */ - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1371 - * if i <= 0: - * raise ValueError('field width must be greater than 0') - * set_num_fields(self.adapter.fields, len(field_widths)) # <<<<<<<<<<<<<< - * for i in range(0, self.adapter.fields.num_fields): - * set_field_width(self.adapter.fields, i, field_widths[i]) - */ - __pyx_t_12 = PyObject_Length(__pyx_v_field_widths); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1371, __pyx_L1_error) - set_num_fields(__pyx_v_self->__pyx_base.adapter->fields, __pyx_t_12); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1372 - * raise ValueError('field width must be greater than 0') - * set_num_fields(self.adapter.fields, len(field_widths)) - * for i in range(0, self.adapter.fields.num_fields): # <<<<<<<<<<<<<< - * set_field_width(self.adapter.fields, i, field_widths[i]) - * else: - */ - __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->__pyx_base.adapter->fields->num_fields); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1372, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1372, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1372, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { - __pyx_t_2 = __pyx_t_5; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0; - __pyx_t_14 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1372, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_14 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1372, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1372, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1372, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1372, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1372, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_14(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1372, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1373 - * set_num_fields(self.adapter.fields, len(field_widths)) - * for i in range(0, self.adapter.fields.num_fields): - * set_field_width(self.adapter.fields, i, field_widths[i]) # <<<<<<<<<<<<<< - * else: - * raise ValueError('field widths must be specified by int or list of ints') - */ - __pyx_t_15 = __Pyx_PyInt_As_uint32_t(__pyx_v_i); if (unlikely((__pyx_t_15 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1373, __pyx_L1_error) - __pyx_t_5 = PyObject_GetItem(__pyx_v_field_widths, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_13 = __Pyx_PyInt_As_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_13 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1373, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - set_field_width(__pyx_v_self->__pyx_base.adapter->fields, __pyx_t_15, __pyx_t_13); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1372 - * raise ValueError('field width must be greater than 0') - * set_num_fields(self.adapter.fields, len(field_widths)) - * for i in range(0, self.adapter.fields.num_fields): # <<<<<<<<<<<<<< - * set_field_width(self.adapter.fields, i, field_widths[i]) - * else: - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1367 - * for i in range(0, self.adapter.fields.num_fields): - * set_field_width(self.adapter.fields, i, field_widths) - * elif isinstance(field_widths, (list, tuple)): # <<<<<<<<<<<<<< - * for i in field_widths: - * if i <= 0: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1375 - * set_field_width(self.adapter.fields, i, field_widths[i]) - * else: - * raise ValueError('field widths must be specified by int or list of ints') # <<<<<<<<<<<<<< - * - * self.field_filter = range(self.field_count) - */ - /*else*/ { - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__88, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1375, __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_ERR(0, 1375, __pyx_L1_error) - } - __pyx_L3:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1377 - * raise ValueError('field widths must be specified by int or list of ints') - * - * self.field_filter = range(self.field_count) # <<<<<<<<<<<<<< - * - * # Set field names from either last comment line if it exists, - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_filter, __pyx_t_2) < 0) __PYX_ERR(0, 1377, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1381 - * # Set field names from either last comment line if it exists, - * # or first line of data - * if field_names is True: # <<<<<<<<<<<<<< - * - * # Find first line of text that isn't a comment. - */ - __pyx_t_6 = (__pyx_v_field_names == Py_True); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1386 - * # Save last comment line. If comment lines exist, we'll use that - * # instead of first non comment text line for field names. - * offset = 0 # <<<<<<<<<<<<<< - * comment_offset = 0 - * comment_line = None - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_offset = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1387 - * # instead of first non comment text line for field names. - * offset = 0 - * comment_offset = 0 # <<<<<<<<<<<<<< - * comment_line = None - * try: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_comment_offset = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1388 - * offset = 0 - * comment_offset = 0 - * comment_line = None # <<<<<<<<<<<<<< - * try: - * line_iter = create_line_iter(self.adapter) - */ - __Pyx_INCREF(Py_None); - __pyx_v_comment_line = Py_None; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1389 - * comment_offset = 0 - * comment_line = None - * try: # <<<<<<<<<<<<<< - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_9); - /*try:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1390 - * comment_line = None - * try: - * line_iter = create_line_iter(self.adapter) # <<<<<<<<<<<<<< - * line = next(line_iter) - * offset = len(line) - */ - __pyx_t_2 = __pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_line_iter(__pyx_v_self->__pyx_base.adapter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1390, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_line_iter = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1391 - * try: - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) # <<<<<<<<<<<<<< - * offset = len(line) - * - */ - __pyx_t_2 = __Pyx_PyIter_Next(__pyx_v_line_iter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1391, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1392 - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - * offset = len(line) # <<<<<<<<<<<<<< - * - * if comment is not None and line.strip() != '' and \ - */ - __pyx_t_12 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1392, __pyx_L27_error) - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1392, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_offset, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1394 - * offset = len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - __pyx_t_6 = (__pyx_v_comment != Py_None); - __pyx_t_8 = (__pyx_t_6 != 0); - if (__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L36_bool_binop_done; - } - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1394, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_1) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1394, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1394, __pyx_L27_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__25, Py_NE)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1394, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L36_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1395 - * - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: # <<<<<<<<<<<<<< - * comment_line = line - * comment_offset = offset - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1395, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_1) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1395, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1395, __pyx_L27_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1395, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_v_comment, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1395, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1395, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __pyx_t_8; - __pyx_L36_bool_binop_done:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1394 - * offset = len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1396 - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: - * comment_line = line # <<<<<<<<<<<<<< - * comment_offset = offset - * - */ - __Pyx_INCREF(__pyx_v_line); - __Pyx_DECREF_SET(__pyx_v_comment_line, __pyx_v_line); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1397 - * line.strip()[0] == comment: - * comment_line = line - * comment_offset = offset # <<<<<<<<<<<<<< - * - * while line.strip() == '' or (comment is not None and \ - */ - __Pyx_INCREF(__pyx_v_offset); - __Pyx_DECREF_SET(__pyx_v_comment_offset, __pyx_v_offset); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1394 - * offset = len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1399 - * comment_offset = offset - * - * while line.strip() == '' or (comment is not None and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment): - * line = next(line_iter) - */ - while (1) { - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1399, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_1) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1399, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1399, __pyx_L27_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__25, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1399, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L41_bool_binop_done; - } - __pyx_t_8 = (__pyx_v_comment != Py_None); - __pyx_t_6 = (__pyx_t_8 != 0); - if (__pyx_t_6) { - } else { - __pyx_t_7 = __pyx_t_6; - goto __pyx_L41_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1400 - * - * while line.strip() == '' or (comment is not None and \ - * line.strip()[0] == comment): # <<<<<<<<<<<<<< - * line = next(line_iter) - * offset = offset + len(line) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1400, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_1) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1400, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1400, __pyx_L27_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1400, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_v_comment, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1400, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1400, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __pyx_t_6; - __pyx_L41_bool_binop_done:; - if (!__pyx_t_7) break; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1401 - * while line.strip() == '' or (comment is not None and \ - * line.strip()[0] == comment): - * line = next(line_iter) # <<<<<<<<<<<<<< - * offset = offset + len(line) - * - */ - __pyx_t_2 = __Pyx_PyIter_Next(__pyx_v_line_iter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1401, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1402 - * line.strip()[0] == comment): - * line = next(line_iter) - * offset = offset + len(line) # <<<<<<<<<<<<<< - * - * if comment is not None and line.strip() != '' and \ - */ - __pyx_t_12 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1402, __pyx_L27_error) - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1402, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyNumber_Add(__pyx_v_offset, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1402, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_offset, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1404 - * offset = offset + len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - __pyx_t_6 = (__pyx_v_comment != Py_None); - __pyx_t_8 = (__pyx_t_6 != 0); - if (__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L45_bool_binop_done; - } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1404, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_1) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1404, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1404, __pyx_L27_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_kp_s__25, Py_NE)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1404, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L45_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1405 - * - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: # <<<<<<<<<<<<<< - * comment_line = line - * comment_offset = offset - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1405, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_1) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1405, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1405, __pyx_L27_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1405, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_v_comment, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1405, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1405, __pyx_L27_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __pyx_t_8; - __pyx_L45_bool_binop_done:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1404 - * offset = offset + len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1406 - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: - * comment_line = line # <<<<<<<<<<<<<< - * comment_offset = offset - * - */ - __Pyx_INCREF(__pyx_v_line); - __Pyx_DECREF_SET(__pyx_v_comment_line, __pyx_v_line); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1407 - * line.strip()[0] == comment: - * comment_line = line - * comment_offset = offset # <<<<<<<<<<<<<< - * - * except StopIteration: - */ - __Pyx_INCREF(__pyx_v_offset); - __Pyx_DECREF_SET(__pyx_v_comment_offset, __pyx_v_offset); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1404 - * offset = offset + len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - } - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1389 - * comment_offset = 0 - * comment_line = None - * try: # <<<<<<<<<<<<<< - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - */ - } - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L34_try_end; - __pyx_L27_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1409 - * comment_offset = offset - * - * except StopIteration: # <<<<<<<<<<<<<< - * raise EOFError() - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration); - if (__pyx_t_4) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FixedWidthTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1409, __pyx_L29_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1410 - * - * except StopIteration: - * raise EOFError() # <<<<<<<<<<<<<< - * - * if comment_line is not None: - */ - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_EOFError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L29_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1410, __pyx_L29_except_error) - } - goto __pyx_L29_except_error; - __pyx_L29_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1389 - * comment_offset = 0 - * comment_line = None - * try: # <<<<<<<<<<<<<< - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); - goto __pyx_L1_error; - __pyx_L34_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1412 - * raise EOFError() - * - * if comment_line is not None: # <<<<<<<<<<<<<< - * coment_line = comment_line.strip() - * comment_line = comment_line.strip(comment) - */ - __pyx_t_7 = (__pyx_v_comment_line != Py_None); - __pyx_t_8 = (__pyx_t_7 != 0); - if (__pyx_t_8) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1413 - * - * if comment_line is not None: - * coment_line = comment_line.strip() # <<<<<<<<<<<<<< - * comment_line = comment_line.strip(comment) - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_comment_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1413, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1413, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_coment_line = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1414 - * if comment_line is not None: - * coment_line = comment_line.strip() - * comment_line = comment_line.strip(comment) # <<<<<<<<<<<<<< - * - * field_offset = 0 - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_comment_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1414, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_comment}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_comment}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1414, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_comment); - __Pyx_GIVEREF(__pyx_v_comment); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_comment); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __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_DECREF_SET(__pyx_v_comment_line, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1412 - * raise EOFError() - * - * if comment_line is not None: # <<<<<<<<<<<<<< - * coment_line = comment_line.strip() - * comment_line = comment_line.strip(comment) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1416 - * comment_line = comment_line.strip(comment) - * - * field_offset = 0 # <<<<<<<<<<<<<< - * temp_field_names = [] - * for width in field_widths: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_field_offset = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1417 - * - * field_offset = 0 - * temp_field_names = [] # <<<<<<<<<<<<<< - * for width in field_widths: - * if comment_line is not None and (field_offset+width) < len(comment_line): - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_temp_field_names = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1418 - * field_offset = 0 - * temp_field_names = [] - * for width in field_widths: # <<<<<<<<<<<<<< - * if comment_line is not None and (field_offset+width) < len(comment_line): - * temp_field_names.append(comment_line[field_offset:field_offset+width].strip()) - */ - if (likely(PyList_CheckExact(__pyx_v_field_widths)) || PyTuple_CheckExact(__pyx_v_field_widths)) { - __pyx_t_1 = __pyx_v_field_widths; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0; - __pyx_t_14 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_field_widths); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1418, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1418, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1418, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_14(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1418, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_width, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1419 - * temp_field_names = [] - * for width in field_widths: - * if comment_line is not None and (field_offset+width) < len(comment_line): # <<<<<<<<<<<<<< - * temp_field_names.append(comment_line[field_offset:field_offset+width].strip()) - * elif line is not None and (field_offset+width) < len(line): - */ - __pyx_t_7 = (__pyx_v_comment_line != Py_None); - __pyx_t_6 = (__pyx_t_7 != 0); - if (__pyx_t_6) { - } else { - __pyx_t_8 = __pyx_t_6; - goto __pyx_L54_bool_binop_done; - } - __pyx_t_2 = PyNumber_Add(__pyx_v_field_offset, __pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1419, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_16 = PyObject_Length(__pyx_v_comment_line); if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 1419, __pyx_L1_error) - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1419, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1419, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1419, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __pyx_t_6; - __pyx_L54_bool_binop_done:; - if (__pyx_t_8) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1420 - * for width in field_widths: - * if comment_line is not None and (field_offset+width) < len(comment_line): - * temp_field_names.append(comment_line[field_offset:field_offset+width].strip()) # <<<<<<<<<<<<<< - * elif line is not None and (field_offset+width) < len(line): - * temp_field_names.append(line[field_offset:field_offset+width].strip()) - */ - __pyx_t_3 = PyNumber_Add(__pyx_v_field_offset, __pyx_v_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_comment_line, 0, 0, &__pyx_v_field_offset, &__pyx_t_3, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_strip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_2) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1420, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1420, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_temp_field_names, __pyx_t_5); if (unlikely(__pyx_t_17 == -1)) __PYX_ERR(0, 1420, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1419 - * temp_field_names = [] - * for width in field_widths: - * if comment_line is not None and (field_offset+width) < len(comment_line): # <<<<<<<<<<<<<< - * temp_field_names.append(comment_line[field_offset:field_offset+width].strip()) - * elif line is not None and (field_offset+width) < len(line): - */ - goto __pyx_L53; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1421 - * if comment_line is not None and (field_offset+width) < len(comment_line): - * temp_field_names.append(comment_line[field_offset:field_offset+width].strip()) - * elif line is not None and (field_offset+width) < len(line): # <<<<<<<<<<<<<< - * temp_field_names.append(line[field_offset:field_offset+width].strip()) - * else: - */ - __pyx_t_6 = (__pyx_v_line != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - } else { - __pyx_t_8 = __pyx_t_7; - goto __pyx_L56_bool_binop_done; - } - __pyx_t_5 = PyNumber_Add(__pyx_v_field_offset, __pyx_v_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1421, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_16 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 1421, __pyx_L1_error) - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1421, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1421, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1421, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_8 = __pyx_t_7; - __pyx_L56_bool_binop_done:; - if (__pyx_t_8) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1422 - * temp_field_names.append(comment_line[field_offset:field_offset+width].strip()) - * elif line is not None and (field_offset+width) < len(line): - * temp_field_names.append(line[field_offset:field_offset+width].strip()) # <<<<<<<<<<<<<< - * else: - * temp_field_names.append('') - */ - __pyx_t_3 = PyNumber_Add(__pyx_v_field_offset, __pyx_v_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_line, 0, 0, &__pyx_v_field_offset, &__pyx_t_3, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_strip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1422, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1422, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_temp_field_names, __pyx_t_2); if (unlikely(__pyx_t_17 == -1)) __PYX_ERR(0, 1422, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1421 - * if comment_line is not None and (field_offset+width) < len(comment_line): - * temp_field_names.append(comment_line[field_offset:field_offset+width].strip()) - * elif line is not None and (field_offset+width) < len(line): # <<<<<<<<<<<<<< - * temp_field_names.append(line[field_offset:field_offset+width].strip()) - * else: - */ - goto __pyx_L53; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1424 - * temp_field_names.append(line[field_offset:field_offset+width].strip()) - * else: - * temp_field_names.append('') # <<<<<<<<<<<<<< - * field_offset = field_offset + width - * self.field_names = [str(name) for name in temp_field_names] - */ - /*else*/ { - __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_temp_field_names, __pyx_kp_s__25); if (unlikely(__pyx_t_17 == -1)) __PYX_ERR(0, 1424, __pyx_L1_error) - } - __pyx_L53:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1425 - * else: - * temp_field_names.append('') - * field_offset = field_offset + width # <<<<<<<<<<<<<< - * self.field_names = [str(name) for name in temp_field_names] - * - */ - __pyx_t_2 = PyNumber_Add(__pyx_v_field_offset, __pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_field_offset, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1418 - * field_offset = 0 - * temp_field_names = [] - * for width in field_widths: # <<<<<<<<<<<<<< - * if comment_line is not None and (field_offset+width) < len(comment_line): - * temp_field_names.append(comment_line[field_offset:field_offset+width].strip()) - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1426 - * temp_field_names.append('') - * field_offset = field_offset + width - * self.field_names = [str(name) for name in temp_field_names] # <<<<<<<<<<<<<< - * - * # If we used the first data line for field names and not the last - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1426, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_temp_field_names; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0; - for (;;) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1426, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1426, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1426, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_name); - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1426, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 1426, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names, __pyx_t_1) < 0) __PYX_ERR(0, 1426, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1430 - * # If we used the first data line for field names and not the last - * # comment line, reset the header size to the end of the first data line. - * if comment_line is None: # <<<<<<<<<<<<<< - * self.adapter.input_data.header = self.adapter.input_data.header + offset - * - */ - __pyx_t_8 = (__pyx_v_comment_line == Py_None); - __pyx_t_7 = (__pyx_t_8 != 0); - if (__pyx_t_7) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1431 - * # comment line, reset the header size to the end of the first data line. - * if comment_line is None: - * self.adapter.input_data.header = self.adapter.input_data.header + offset # <<<<<<<<<<<<<< - * - * # Default missing value strings - */ - __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->__pyx_base.adapter->input_data->header); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_18 = __Pyx_PyInt_As_uint64_t(__pyx_t_2); if (unlikely((__pyx_t_18 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1431, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_self->__pyx_base.adapter->input_data->header = __pyx_t_18; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1430 - * # If we used the first data line for field names and not the last - * # comment line, reset the header size to the end of the first data line. - * if comment_line is None: # <<<<<<<<<<<<<< - * self.adapter.input_data.header = self.adapter.input_data.header + offset - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1381 - * # Set field names from either last comment line if it exists, - * # or first line of data - * if field_names is True: # <<<<<<<<<<<<<< - * - * # Find first line of text that isn't a comment. - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1434 - * - * # Default missing value strings - * missing_values = {} # <<<<<<<<<<<<<< - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_missing_values = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1435 - * # Default missing value strings - * missing_values = {} - * for field in range(self.adapter.fields.num_fields): # <<<<<<<<<<<<<< - * missing_values[field] = default_missing_values - * self.set_missing_values(missing_values) - */ - __pyx_t_13 = __pyx_v_self->__pyx_base.adapter->fields->num_fields; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_13; __pyx_t_15+=1) { - __pyx_v_field = __pyx_t_15; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1436 - * missing_values = {} - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values # <<<<<<<<<<<<<< - * self.set_missing_values(missing_values) - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_default_missing_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1436, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_field); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1436, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_missing_values, __pyx_t_1, __pyx_t_2) < 0)) __PYX_ERR(0, 1436, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1437 - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values - * self.set_missing_values(missing_values) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_missing_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_missing_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_missing_values}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1437, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_missing_values}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1437, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_missing_values); - __Pyx_GIVEREF(__pyx_v_missing_values); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_missing_values); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1344 - * __doc__ += TextAdapter.__doc__ - * - * def __cinit__(self, fh, field_widths, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', num_records=0, header=0, footer=0, - * field_names=True, infer_types=True, indexing=False, - */ - - /* function exit code */ - __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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.FixedWidthTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_record_iter); - __Pyx_XDECREF(__pyx_v_line); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_offset); - __Pyx_XDECREF(__pyx_v_comment_offset); - __Pyx_XDECREF(__pyx_v_comment_line); - __Pyx_XDECREF(__pyx_v_line_iter); - __Pyx_XDECREF(__pyx_v_coment_line); - __Pyx_XDECREF(__pyx_v_field_offset); - __Pyx_XDECREF(__pyx_v_temp_field_names); - __Pyx_XDECREF(__pyx_v_width); - __Pyx_XDECREF(__pyx_v_missing_values); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1444 - * cdef JsonTokenizerArgs *json_args - * - * def __cinit__(self, fh, encoding='utf_8', compression=None, num_records=0, # <<<<<<<<<<<<<< - * field_names=None, infer_types=True, indexing=False, - * index_name=None, output='ndarray', debug=False): - */ - -/* Python wrapper */ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fh = 0; - PyObject *__pyx_v_encoding = 0; - PyObject *__pyx_v_compression = 0; - PyObject *__pyx_v_num_records = 0; - PyObject *__pyx_v_field_names = 0; - CYTHON_UNUSED PyObject *__pyx_v_infer_types = 0; - PyObject *__pyx_v_indexing = 0; - PyObject *__pyx_v_index_name = 0; - PyObject *__pyx_v_output = 0; - PyObject *__pyx_v_debug = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fh,&__pyx_n_s_encoding,&__pyx_n_s_compression,&__pyx_n_s_num_records,&__pyx_n_s_field_names,&__pyx_n_s_infer_types_2,&__pyx_n_s_indexing,&__pyx_n_s_index_name,&__pyx_n_s_output,&__pyx_n_s_debug,0}; - PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; - values[1] = ((PyObject *)__pyx_n_s_utf_8); - values[2] = ((PyObject *)Py_None); - values[3] = ((PyObject *)__pyx_int_0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1445 - * - * def __cinit__(self, fh, encoding='utf_8', compression=None, num_records=0, - * field_names=None, infer_types=True, indexing=False, # <<<<<<<<<<<<<< - * index_name=None, output='ndarray', debug=False): - * - */ - values[4] = ((PyObject *)Py_None); - values[5] = ((PyObject *)Py_True); - values[6] = ((PyObject *)Py_False); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1446 - * def __cinit__(self, fh, encoding='utf_8', compression=None, num_records=0, - * field_names=None, infer_types=True, indexing=False, - * index_name=None, output='ndarray', debug=False): # <<<<<<<<<<<<<< - * - * self.__init_text_adapter(fh, encoding, compression, None, None, - */ - values[7] = ((PyObject *)Py_None); - values[8] = ((PyObject *)__pyx_n_s_ndarray); - values[9] = ((PyObject *)Py_False); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fh)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_encoding); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compression); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_records); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_names); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_infer_types_2); - if (value) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indexing); - if (value) { values[6] = value; kw_args--; } - } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_name); - if (value) { values[7] = value; kw_args--; } - } - case 8: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output); - if (value) { values[8] = value; kw_args--; } - } - case 9: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_debug); - if (value) { values[9] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1444, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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_fh = values[0]; - __pyx_v_encoding = values[1]; - __pyx_v_compression = values[2]; - __pyx_v_num_records = values[3]; - __pyx_v_field_names = values[4]; - __pyx_v_infer_types = values[5]; - __pyx_v_indexing = values[6]; - __pyx_v_index_name = values[7]; - __pyx_v_output = values[8]; - __pyx_v_debug = values[9]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1444, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.JSONTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter___cinit__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter *)__pyx_v_self), __pyx_v_fh, __pyx_v_encoding, __pyx_v_compression, __pyx_v_num_records, __pyx_v_field_names, __pyx_v_infer_types, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1444 - * cdef JsonTokenizerArgs *json_args - * - * def __cinit__(self, fh, encoding='utf_8', compression=None, num_records=0, # <<<<<<<<<<<<<< - * field_names=None, infer_types=True, indexing=False, - * index_name=None, output='ndarray', debug=False): - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1468 - * record = json.loads(line, object_pairs_hook=OrderedDict) - * - * def count_fields(rec, num): # <<<<<<<<<<<<<< - * for field in rec: - * if isinstance(field, list): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___1count_fields(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___1count_fields = {"count_fields", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___1count_fields, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___1count_fields(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_rec = 0; - PyObject *__pyx_v_num = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("count_fields (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rec,&__pyx_n_s_num,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rec)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("count_fields", 1, 2, 2, 1); __PYX_ERR(0, 1468, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "count_fields") < 0)) __PYX_ERR(0, 1468, __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_rec = values[0]; - __pyx_v_num = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("count_fields", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1468, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.JSONTextAdapter.__cinit__.count_fields", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___count_fields(__pyx_self, __pyx_v_rec, __pyx_v_num); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___count_fields(PyObject *__pyx_self, PyObject *__pyx_v_rec, PyObject *__pyx_v_num) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *__pyx_cur_scope; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *__pyx_outer_scope; - PyObject *__pyx_v_field = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("count_fields", 0); - __pyx_outer_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - __Pyx_INCREF(__pyx_v_num); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1469 - * - * def count_fields(rec, num): - * for field in rec: # <<<<<<<<<<<<<< - * if isinstance(field, list): - * num = count_fields(field, num) - */ - if (likely(PyList_CheckExact(__pyx_v_rec)) || PyTuple_CheckExact(__pyx_v_rec)) { - __pyx_t_1 = __pyx_v_rec; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1469, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1469, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1469, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1469, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1469, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1469, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1469, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1470 - * def count_fields(rec, num): - * for field in rec: - * if isinstance(field, list): # <<<<<<<<<<<<<< - * num = count_fields(field, num) - * elif isinstance(field, dict): - */ - __pyx_t_5 = PyList_Check(__pyx_v_field); - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1471 - * for field in rec: - * if isinstance(field, list): - * num = count_fields(field, num) # <<<<<<<<<<<<<< - * elif isinstance(field, dict): - * num = count_fields(field.values(), num) - */ - if (unlikely(!__pyx_cur_scope->__pyx_v_count_fields)) { __Pyx_RaiseClosureNameError("count_fields"); __PYX_ERR(0, 1471, __pyx_L1_error) } - __pyx_t_4 = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___count_fields(__pyx_cur_scope->__pyx_v_count_fields, __pyx_v_field, __pyx_v_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1471, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_4); - __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1470 - * def count_fields(rec, num): - * for field in rec: - * if isinstance(field, list): # <<<<<<<<<<<<<< - * num = count_fields(field, num) - * elif isinstance(field, dict): - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1472 - * if isinstance(field, list): - * num = count_fields(field, num) - * elif isinstance(field, dict): # <<<<<<<<<<<<<< - * num = count_fields(field.values(), num) - * else: - */ - __pyx_t_6 = PyDict_Check(__pyx_v_field); - __pyx_t_5 = (__pyx_t_6 != 0); - if (__pyx_t_5) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1473 - * num = count_fields(field, num) - * elif isinstance(field, dict): - * num = count_fields(field.values(), num) # <<<<<<<<<<<<<< - * else: - * num += 1 - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_values); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (__pyx_t_8) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1473, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1473, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_cur_scope->__pyx_v_count_fields)) { __Pyx_RaiseClosureNameError("count_fields"); __PYX_ERR(0, 1473, __pyx_L1_error) } - __pyx_t_7 = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___count_fields(__pyx_cur_scope->__pyx_v_count_fields, __pyx_t_4, __pyx_v_num); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_7); - __pyx_t_7 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1472 - * if isinstance(field, list): - * num = count_fields(field, num) - * elif isinstance(field, dict): # <<<<<<<<<<<<<< - * num = count_fields(field.values(), num) - * else: - */ - goto __pyx_L5; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1475 - * num = count_fields(field.values(), num) - * else: - * num += 1 # <<<<<<<<<<<<<< - * return num - * - */ - /*else*/ { - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_v_num, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_7); - __pyx_t_7 = 0; - } - __pyx_L5:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1469 - * - * def count_fields(rec, num): - * for field in rec: # <<<<<<<<<<<<<< - * if isinstance(field, list): - * num = count_fields(field, num) - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1476 - * else: - * num += 1 - * return num # <<<<<<<<<<<<<< - * - * if isinstance(record, dict): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_num); - __pyx_r = __pyx_v_num; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1468 - * record = json.loads(line, object_pairs_hook=OrderedDict) - * - * def count_fields(rec, num): # <<<<<<<<<<<<<< - * for field in rec: - * if isinstance(field, list): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.JSONTextAdapter.__cinit__.count_fields", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_field); - __Pyx_XDECREF(__pyx_v_num); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1444 - * cdef JsonTokenizerArgs *json_args - * - * def __cinit__(self, fh, encoding='utf_8', compression=None, num_records=0, # <<<<<<<<<<<<<< - * field_names=None, infer_types=True, indexing=False, - * index_name=None, output='ndarray', debug=False): - */ - -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter *__pyx_v_self, PyObject *__pyx_v_fh, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_num_records, PyObject *__pyx_v_field_names, CYTHON_UNUSED PyObject *__pyx_v_infer_types, PyObject *__pyx_v_indexing, PyObject *__pyx_v_index_name, PyObject *__pyx_v_output, PyObject *__pyx_v_debug) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *__pyx_cur_scope; - PyObject *__pyx_v_record_iter = NULL; - PyObject *__pyx_v_line = NULL; - PyObject *__pyx_v_json = NULL; - PyObject *__pyx_v_record = NULL; - PyObject *__pyx_v_num_fields = NULL; - PyObject *__pyx_v_missing_values = NULL; - uint32_t __pyx_v_field; - PyObject *__pyx_v_key = NULL; - PyObject *__pyx_v_i = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_t_10; - uint32_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - PyObject *(*__pyx_t_13)(PyObject *); - uint32_t __pyx_t_14; - __Pyx_RefNannySetupContext("__cinit__", 0); - __pyx_cur_scope = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *)__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 1444, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1448 - * index_name=None, output='ndarray', debug=False): - * - * self.__init_text_adapter(fh, encoding, compression, None, None, # <<<<<<<<<<<<<< - * num_records, 0, 0, indexing, index_name, output, debug) - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_text_adapter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1449 - * - * self.__init_text_adapter(fh, encoding, compression, None, None, - * num_records, 0, 0, indexing, index_name, output, debug) # <<<<<<<<<<<<<< - * - * self.json_args = calloc(1, sizeof(JsonTokenizerArgs)) - */ - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[13] = {__pyx_t_3, __pyx_v_fh, __pyx_v_encoding, __pyx_v_compression, Py_None, Py_None, __pyx_v_num_records, __pyx_int_0, __pyx_int_0, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 12+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1448, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[13] = {__pyx_t_3, __pyx_v_fh, __pyx_v_encoding, __pyx_v_compression, Py_None, Py_None, __pyx_v_num_records, __pyx_int_0, __pyx_int_0, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 12+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1448, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_5 = PyTuple_New(12+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_fh); - __Pyx_GIVEREF(__pyx_v_fh); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_fh); - __Pyx_INCREF(__pyx_v_encoding); - __Pyx_GIVEREF(__pyx_v_encoding); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_encoding); - __Pyx_INCREF(__pyx_v_compression); - __Pyx_GIVEREF(__pyx_v_compression); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_compression); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, Py_None); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, Py_None); - __Pyx_INCREF(__pyx_v_num_records); - __Pyx_GIVEREF(__pyx_v_num_records); - PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_num_records); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_int_0); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_int_0); - __Pyx_INCREF(__pyx_v_indexing); - __Pyx_GIVEREF(__pyx_v_indexing); - PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_indexing); - __Pyx_INCREF(__pyx_v_index_name); - __Pyx_GIVEREF(__pyx_v_index_name); - PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_index_name); - __Pyx_INCREF(__pyx_v_output); - __Pyx_GIVEREF(__pyx_v_output); - PyTuple_SET_ITEM(__pyx_t_5, 10+__pyx_t_4, __pyx_v_output); - __Pyx_INCREF(__pyx_v_debug); - __Pyx_GIVEREF(__pyx_v_debug); - PyTuple_SET_ITEM(__pyx_t_5, 11+__pyx_t_4, __pyx_v_debug); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1451 - * num_records, 0, 0, indexing, index_name, output, debug) - * - * self.json_args = calloc(1, sizeof(JsonTokenizerArgs)) # <<<<<<<<<<<<<< - * self.json_args.jc = new_JSON_checker(20); - * self.adapter.tokenize_args = self.json_args - */ - __pyx_v_self->json_args = ((JsonTokenizerArgs *)calloc(1, (sizeof(JsonTokenizerArgs)))); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1452 - * - * self.json_args = calloc(1, sizeof(JsonTokenizerArgs)) - * self.json_args.jc = new_JSON_checker(20); # <<<<<<<<<<<<<< - * self.adapter.tokenize_args = self.json_args - * self.adapter.reset_json_args = 1 - */ - __pyx_v_self->json_args->jc = new_JSON_checker(20); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1453 - * self.json_args = calloc(1, sizeof(JsonTokenizerArgs)) - * self.json_args.jc = new_JSON_checker(20); - * self.adapter.tokenize_args = self.json_args # <<<<<<<<<<<<<< - * self.adapter.reset_json_args = 1 - * - */ - __pyx_v_self->__pyx_base.adapter->tokenize_args = ((void *)__pyx_v_self->json_args); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1454 - * self.json_args.jc = new_JSON_checker(20); - * self.adapter.tokenize_args = self.json_args - * self.adapter.reset_json_args = 1 # <<<<<<<<<<<<<< - * - * try: - */ - __pyx_v_self->__pyx_base.adapter->reset_json_args = 1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1456 - * self.adapter.reset_json_args = 1 - * - * try: # <<<<<<<<<<<<<< - * record_iter = create_json_record_iter(self.adapter) - * line = next(record_iter) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - /*try:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1457 - * - * try: - * record_iter = create_json_record_iter(self.adapter) # <<<<<<<<<<<<<< - * line = next(record_iter) - * except StopIteration: - */ - __pyx_t_1 = __pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_json_record_iter(__pyx_v_self->__pyx_base.adapter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1457, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_record_iter = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1458 - * try: - * record_iter = create_json_record_iter(self.adapter) - * line = next(record_iter) # <<<<<<<<<<<<<< - * except StopIteration: - * raise EOFError() - */ - __pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_record_iter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1458, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_line = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1456 - * self.adapter.reset_json_args = 1 - * - * try: # <<<<<<<<<<<<<< - * record_iter = create_json_record_iter(self.adapter) - * line = next(record_iter) - */ - } - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L10_try_end; - __pyx_L3_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1459 - * record_iter = create_json_record_iter(self.adapter) - * line = next(record_iter) - * except StopIteration: # <<<<<<<<<<<<<< - * raise EOFError() - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration); - if (__pyx_t_4) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.JSONTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(0, 1459, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_5); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1460 - * line = next(record_iter) - * except StopIteration: - * raise EOFError() # <<<<<<<<<<<<<< - * - * import json - */ - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_EOFError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1460, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1460, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1456 - * self.adapter.reset_json_args = 1 - * - * try: # <<<<<<<<<<<<<< - * record_iter = create_json_record_iter(self.adapter) - * line = next(record_iter) - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L1_error; - __pyx_L10_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1462 - * raise EOFError() - * - * import json # <<<<<<<<<<<<<< - * if sys.version < '2.7': - * record = json.loads(line, object_hook=OrderedDict) - */ - __pyx_t_5 = __Pyx_Import(__pyx_n_s_json, 0, -1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1462, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_json = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1463 - * - * import json - * if sys.version < '2.7': # <<<<<<<<<<<<<< - * record = json.loads(line, object_hook=OrderedDict) - * else: - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1463, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1463, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_kp_s_2_7, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1463, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1463, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1464 - * import json - * if sys.version < '2.7': - * record = json.loads(line, object_hook=OrderedDict) # <<<<<<<<<<<<<< - * else: - * record = json.loads(line, object_pairs_hook=OrderedDict) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_json, __pyx_n_s_loads); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_line); - __Pyx_GIVEREF(__pyx_v_line); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_object_hook, __pyx_t_3) < 0) __PYX_ERR(0, 1464, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_record = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1463 - * - * import json - * if sys.version < '2.7': # <<<<<<<<<<<<<< - * record = json.loads(line, object_hook=OrderedDict) - * else: - */ - goto __pyx_L13; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1466 - * record = json.loads(line, object_hook=OrderedDict) - * else: - * record = json.loads(line, object_pairs_hook=OrderedDict) # <<<<<<<<<<<<<< - * - * def count_fields(rec, num): - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_json, __pyx_n_s_loads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1466, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1466, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_line); - __Pyx_GIVEREF(__pyx_v_line); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1466, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_object_pairs_hook, __pyx_t_5) < 0) __PYX_ERR(0, 1466, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1466, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_record = __pyx_t_5; - __pyx_t_5 = 0; - } - __pyx_L13:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1468 - * record = json.loads(line, object_pairs_hook=OrderedDict) - * - * def count_fields(rec, num): # <<<<<<<<<<<<<< - * for field in rec: - * if isinstance(field, list): - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___1count_fields, 0, __pyx_n_s_cinit___locals_count_fields, ((PyObject*)__pyx_cur_scope), __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__90)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1468, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_count_fields = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1478 - * return num - * - * if isinstance(record, dict): # <<<<<<<<<<<<<< - * num_fields = count_fields(record.values(), 0) - * else: - */ - __pyx_t_9 = PyDict_Check(__pyx_v_record); - __pyx_t_10 = (__pyx_t_9 != 0); - if (__pyx_t_10) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1479 - * - * if isinstance(record, dict): - * num_fields = count_fields(record.values(), 0) # <<<<<<<<<<<<<< - * else: - * num_fields = count_fields(record, 0) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_record, __pyx_n_s_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_1) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1479, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1479, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___count_fields(__pyx_cur_scope->__pyx_v_count_fields, __pyx_t_5, __pyx_int_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_num_fields = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1478 - * return num - * - * if isinstance(record, dict): # <<<<<<<<<<<<<< - * num_fields = count_fields(record.values(), 0) - * else: - */ - goto __pyx_L14; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1481 - * num_fields = count_fields(record.values(), 0) - * else: - * num_fields = count_fields(record, 0) # <<<<<<<<<<<<<< - * - * set_num_fields(self.adapter.fields, num_fields) - */ - /*else*/ { - __pyx_t_2 = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_9__cinit___count_fields(__pyx_cur_scope->__pyx_v_count_fields, __pyx_v_record, __pyx_int_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1481, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_num_fields = __pyx_t_2; - __pyx_t_2 = 0; - } - __pyx_L14:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1483 - * num_fields = count_fields(record, 0) - * - * set_num_fields(self.adapter.fields, num_fields) # <<<<<<<<<<<<<< - * - * self.adapter.tokenize = &json_tokenizer; - */ - __pyx_t_11 = __Pyx_PyInt_As_uint32_t(__pyx_v_num_fields); if (unlikely((__pyx_t_11 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1483, __pyx_L1_error) - set_num_fields(__pyx_v_self->__pyx_base.adapter->fields, __pyx_t_11); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1485 - * set_num_fields(self.adapter.fields, num_fields) - * - * self.adapter.tokenize = &json_tokenizer; # <<<<<<<<<<<<<< - * self.field_filter = range(self.field_count) - * if field_names is not None: - */ - __pyx_v_self->__pyx_base.adapter->tokenize = (&json_tokenizer); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1486 - * - * self.adapter.tokenize = &json_tokenizer; - * self.field_filter = range(self.field_count) # <<<<<<<<<<<<<< - * if field_names is not None: - * self.field_names = field_names - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_filter, __pyx_t_2) < 0) __PYX_ERR(0, 1486, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1487 - * self.adapter.tokenize = &json_tokenizer; - * self.field_filter = range(self.field_count) - * if field_names is not None: # <<<<<<<<<<<<<< - * self.field_names = field_names - * elif isinstance(record, dict): - */ - __pyx_t_10 = (__pyx_v_field_names != Py_None); - __pyx_t_9 = (__pyx_t_10 != 0); - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1488 - * self.field_filter = range(self.field_count) - * if field_names is not None: - * self.field_names = field_names # <<<<<<<<<<<<<< - * elif isinstance(record, dict): - * self.field_names = [str(key) for key in record.keys()] - */ - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names, __pyx_v_field_names) < 0) __PYX_ERR(0, 1488, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1487 - * self.adapter.tokenize = &json_tokenizer; - * self.field_filter = range(self.field_count) - * if field_names is not None: # <<<<<<<<<<<<<< - * self.field_names = field_names - * elif isinstance(record, dict): - */ - goto __pyx_L15; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1489 - * if field_names is not None: - * self.field_names = field_names - * elif isinstance(record, dict): # <<<<<<<<<<<<<< - * self.field_names = [str(key) for key in record.keys()] - * else: - */ - __pyx_t_9 = PyDict_Check(__pyx_v_record); - __pyx_t_10 = (__pyx_t_9 != 0); - if (__pyx_t_10) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1490 - * self.field_names = field_names - * elif isinstance(record, dict): - * self.field_names = [str(key) for key in record.keys()] # <<<<<<<<<<<<<< - * else: - * self.field_names = ['f' + str(i) for i in range(self.field_count)] - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_record, __pyx_n_s_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_3) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1490, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1490, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { - __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0; - __pyx_t_13 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1490, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - for (;;) { - if (likely(!__pyx_t_13)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1490, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1490, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_13(__pyx_t_1); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1490, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_key); - __Pyx_GIVEREF(__pyx_v_key); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_key); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1490, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names, __pyx_t_2) < 0) __PYX_ERR(0, 1490, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1489 - * if field_names is not None: - * self.field_names = field_names - * elif isinstance(record, dict): # <<<<<<<<<<<<<< - * self.field_names = [str(key) for key in record.keys()] - * else: - */ - goto __pyx_L15; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1492 - * self.field_names = [str(key) for key in record.keys()] - * else: - * self.field_names = ['f' + str(i) for i in range(self.field_count)] # <<<<<<<<<<<<<< - * - * # Default missing value strings - */ - /*else*/ { - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = 0; - __pyx_t_13 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1492, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_13)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1492, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1492, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_13(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1492, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i); - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_n_s_f, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names, __pyx_t_2) < 0) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L15:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1495 - * - * # Default missing value strings - * missing_values = {} # <<<<<<<<<<<<<< - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_missing_values = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1496 - * # Default missing value strings - * missing_values = {} - * for field in range(self.adapter.fields.num_fields): # <<<<<<<<<<<<<< - * missing_values[field] = default_missing_values - * self.set_missing_values(missing_values) - */ - __pyx_t_11 = __pyx_v_self->__pyx_base.adapter->fields->num_fields; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_11; __pyx_t_14+=1) { - __pyx_v_field = __pyx_t_14; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1497 - * missing_values = {} - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values # <<<<<<<<<<<<<< - * self.set_missing_values(missing_values) - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_default_missing_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_field); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyDict_SetItem(__pyx_v_missing_values, __pyx_t_3, __pyx_t_2) < 0)) __PYX_ERR(0, 1497, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1498 - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values - * self.set_missing_values(missing_values) # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_missing_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1498, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_1) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_missing_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1498, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_missing_values}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1498, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_missing_values}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1498, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1498, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL; - __Pyx_INCREF(__pyx_v_missing_values); - __Pyx_GIVEREF(__pyx_v_missing_values); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_missing_values); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1498, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1444 - * cdef JsonTokenizerArgs *json_args - * - * def __cinit__(self, fh, encoding='utf_8', compression=None, num_records=0, # <<<<<<<<<<<<<< - * field_names=None, infer_types=True, indexing=False, - * index_name=None, output='ndarray', debug=False): - */ - - /* function exit code */ - __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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.JSONTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_record_iter); - __Pyx_XDECREF(__pyx_v_line); - __Pyx_XDECREF(__pyx_v_json); - __Pyx_XDECREF(__pyx_v_record); - __Pyx_XDECREF(__pyx_v_num_fields); - __Pyx_XDECREF(__pyx_v_missing_values); - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1500 - * self.set_missing_values(missing_values) - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * if self.json_args != NULL: - * free(self.json_args) - */ - -/* Python wrapper */ -static void __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_2__dealloc__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_2__dealloc__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter *__pyx_v_self) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1501 - * - * def __dealloc__(self): - * if self.json_args != NULL: # <<<<<<<<<<<<<< - * free(self.json_args) - * - */ - __pyx_t_1 = ((__pyx_v_self->json_args != NULL) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1502 - * def __dealloc__(self): - * if self.json_args != NULL: - * free(self.json_args) # <<<<<<<<<<<<<< - * - * - */ - free(__pyx_v_self->json_args); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1501 - * - * def __dealloc__(self): - * if self.json_args != NULL: # <<<<<<<<<<<<<< - * free(self.json_args) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1500 - * self.set_missing_values(missing_values) - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * if self.json_args != NULL: - * free(self.json_args) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1517 - * cdef object temp - * - * def __cinit__(self, fh, regex_string, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', num_records=0, header=0, footer=0, - * field_names=True, infer_types=True, indexing=False, - */ - -/* Python wrapper */ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fh = 0; - PyObject *__pyx_v_regex_string = 0; - PyObject *__pyx_v_encoding = 0; - PyObject *__pyx_v_compression = 0; - PyObject *__pyx_v_comment = 0; - PyObject *__pyx_v_quote = 0; - PyObject *__pyx_v_num_records = 0; - PyObject *__pyx_v_header = 0; - PyObject *__pyx_v_footer = 0; - PyObject *__pyx_v_field_names = 0; - CYTHON_UNUSED PyObject *__pyx_v_infer_types = 0; - PyObject *__pyx_v_indexing = 0; - PyObject *__pyx_v_index_name = 0; - PyObject *__pyx_v_output = 0; - PyObject *__pyx_v_debug = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fh,&__pyx_n_s_regex_string,&__pyx_n_s_encoding,&__pyx_n_s_compression,&__pyx_n_s_comment,&__pyx_n_s_quote,&__pyx_n_s_num_records,&__pyx_n_s_header,&__pyx_n_s_footer,&__pyx_n_s_field_names,&__pyx_n_s_infer_types_2,&__pyx_n_s_indexing,&__pyx_n_s_index_name,&__pyx_n_s_output,&__pyx_n_s_debug,0}; - PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - values[2] = ((PyObject *)__pyx_n_s_utf_8); - values[3] = ((PyObject *)Py_None); - values[4] = ((PyObject *)__pyx_kp_s__37); - values[5] = ((PyObject *)__pyx_kp_s__38); - values[6] = ((PyObject *)__pyx_int_0); - values[7] = ((PyObject *)__pyx_int_0); - values[8] = ((PyObject *)__pyx_int_0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1519 - * def __cinit__(self, fh, regex_string, encoding='utf_8', compression=None, - * comment='#', quote='"', num_records=0, header=0, footer=0, - * field_names=True, infer_types=True, indexing=False, # <<<<<<<<<<<<<< - * index_name=None, output='ndarray', debug=False): - * - */ - values[9] = ((PyObject *)Py_True); - values[10] = ((PyObject *)Py_True); - values[11] = ((PyObject *)Py_False); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1520 - * comment='#', quote='"', num_records=0, header=0, footer=0, - * field_names=True, infer_types=True, indexing=False, - * index_name=None, output='ndarray', debug=False): # <<<<<<<<<<<<<< - * - * self.__init_text_adapter(fh, encoding, compression, comment, quote, - */ - values[12] = ((PyObject *)Py_None); - values[13] = ((PyObject *)__pyx_n_s_ndarray); - values[14] = ((PyObject *)Py_False); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fh)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_regex_string)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 15, 1); __PYX_ERR(0, 1517, __pyx_L3_error) - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_encoding); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compression); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_comment); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_quote); - if (value) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_records); - if (value) { values[6] = value; kw_args--; } - } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_header); - if (value) { values[7] = value; kw_args--; } - } - case 8: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_footer); - if (value) { values[8] = value; kw_args--; } - } - case 9: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_names); - if (value) { values[9] = value; kw_args--; } - } - case 10: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_infer_types_2); - if (value) { values[10] = value; kw_args--; } - } - case 11: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indexing); - if (value) { values[11] = value; kw_args--; } - } - case 12: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_name); - if (value) { values[12] = value; kw_args--; } - } - case 13: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_output); - if (value) { values[13] = value; kw_args--; } - } - case 14: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_debug); - if (value) { values[14] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1517, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_fh = values[0]; - __pyx_v_regex_string = values[1]; - __pyx_v_encoding = values[2]; - __pyx_v_compression = values[3]; - __pyx_v_comment = values[4]; - __pyx_v_quote = values[5]; - __pyx_v_num_records = values[6]; - __pyx_v_header = values[7]; - __pyx_v_footer = values[8]; - __pyx_v_field_names = values[9]; - __pyx_v_infer_types = values[10]; - __pyx_v_indexing = values[11]; - __pyx_v_index_name = values[12]; - __pyx_v_output = values[13]; - __pyx_v_debug = values[14]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 15, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1517, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.RegexTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter___cinit__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *)__pyx_v_self), __pyx_v_fh, __pyx_v_regex_string, __pyx_v_encoding, __pyx_v_compression, __pyx_v_comment, __pyx_v_quote, __pyx_v_num_records, __pyx_v_header, __pyx_v_footer, __pyx_v_field_names, __pyx_v_infer_types, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1517 - * cdef object temp - * - * def __cinit__(self, fh, regex_string, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', num_records=0, header=0, footer=0, - * field_names=True, infer_types=True, indexing=False, - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter___cinit__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *__pyx_v_self, PyObject *__pyx_v_fh, PyObject *__pyx_v_regex_string, PyObject *__pyx_v_encoding, PyObject *__pyx_v_compression, PyObject *__pyx_v_comment, PyObject *__pyx_v_quote, PyObject *__pyx_v_num_records, PyObject *__pyx_v_header, PyObject *__pyx_v_footer, PyObject *__pyx_v_field_names, CYTHON_UNUSED PyObject *__pyx_v_infer_types, PyObject *__pyx_v_indexing, PyObject *__pyx_v_index_name, PyObject *__pyx_v_output, PyObject *__pyx_v_debug) { - char *__pyx_v_error; - int __pyx_v_error_offset; - PyObject *__pyx_v_pattern = NULL; - PyObject *__pyx_v_offset = NULL; - CYTHON_UNUSED PyObject *__pyx_v_comment_offset = NULL; - PyObject *__pyx_v_comment_line = NULL; - PyObject *__pyx_v_line_iter = NULL; - PyObject *__pyx_v_line = NULL; - CYTHON_UNUSED PyObject *__pyx_v_coment_line = NULL; - PyObject *__pyx_v_temp_field_names = NULL; - PyObject *__pyx_v_missing_values = NULL; - uint32_t __pyx_v_field; - PyObject *__pyx_v_name = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - uint32_t __pyx_t_6; - char *__pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - Py_ssize_t __pyx_t_13; - int __pyx_t_14; - PyObject *(*__pyx_t_15)(PyObject *); - uint64_t __pyx_t_16; - uint32_t __pyx_t_17; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_regex_string); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1522 - * index_name=None, output='ndarray', debug=False): - * - * self.__init_text_adapter(fh, encoding, compression, comment, quote, # <<<<<<<<<<<<<< - * num_records, header, footer, indexing, index_name, output, debug) - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_text_adapter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1523 - * - * self.__init_text_adapter(fh, encoding, compression, comment, quote, - * num_records, header, footer, indexing, index_name, output, debug) # <<<<<<<<<<<<<< - * - * cdef char *error - */ - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[13] = {__pyx_t_3, __pyx_v_fh, __pyx_v_encoding, __pyx_v_compression, __pyx_v_comment, __pyx_v_quote, __pyx_v_num_records, __pyx_v_header, __pyx_v_footer, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 12+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[13] = {__pyx_t_3, __pyx_v_fh, __pyx_v_encoding, __pyx_v_compression, __pyx_v_comment, __pyx_v_quote, __pyx_v_num_records, __pyx_v_header, __pyx_v_footer, __pyx_v_indexing, __pyx_v_index_name, __pyx_v_output, __pyx_v_debug}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 12+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_5 = PyTuple_New(12+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_fh); - __Pyx_GIVEREF(__pyx_v_fh); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_fh); - __Pyx_INCREF(__pyx_v_encoding); - __Pyx_GIVEREF(__pyx_v_encoding); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_encoding); - __Pyx_INCREF(__pyx_v_compression); - __Pyx_GIVEREF(__pyx_v_compression); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_compression); - __Pyx_INCREF(__pyx_v_comment); - __Pyx_GIVEREF(__pyx_v_comment); - PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_comment); - __Pyx_INCREF(__pyx_v_quote); - __Pyx_GIVEREF(__pyx_v_quote); - PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_quote); - __Pyx_INCREF(__pyx_v_num_records); - __Pyx_GIVEREF(__pyx_v_num_records); - PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_num_records); - __Pyx_INCREF(__pyx_v_header); - __Pyx_GIVEREF(__pyx_v_header); - PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_header); - __Pyx_INCREF(__pyx_v_footer); - __Pyx_GIVEREF(__pyx_v_footer); - PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_footer); - __Pyx_INCREF(__pyx_v_indexing); - __Pyx_GIVEREF(__pyx_v_indexing); - PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_indexing); - __Pyx_INCREF(__pyx_v_index_name); - __Pyx_GIVEREF(__pyx_v_index_name); - PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_index_name); - __Pyx_INCREF(__pyx_v_output); - __Pyx_GIVEREF(__pyx_v_output); - PyTuple_SET_ITEM(__pyx_t_5, 10+__pyx_t_4, __pyx_v_output); - __Pyx_INCREF(__pyx_v_debug); - __Pyx_GIVEREF(__pyx_v_debug); - PyTuple_SET_ITEM(__pyx_t_5, 11+__pyx_t_4, __pyx_v_debug); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1528 - * cdef int error_offset - * - * self.adapter.tokenize = ®ex_tokenizer # <<<<<<<<<<<<<< - * - * regex_string = '^' + regex_string - */ - __pyx_v_self->__pyx_base.adapter->tokenize = (®ex_tokenizer); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1530 - * self.adapter.tokenize = ®ex_tokenizer - * - * regex_string = '^' + regex_string # <<<<<<<<<<<<<< - * pattern = re.compile(regex_string) - * - */ - __pyx_t_1 = PyNumber_Add(__pyx_kp_s__91, __pyx_v_regex_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_regex_string, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1531 - * - * regex_string = '^' + regex_string - * pattern = re.compile(regex_string) # <<<<<<<<<<<<<< - * - * set_num_fields(self.adapter.fields, pattern.groups) - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_compile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_regex_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_regex_string}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1531, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_regex_string}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1531, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_regex_string); - __Pyx_GIVEREF(__pyx_v_regex_string); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_regex_string); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_pattern = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1533 - * pattern = re.compile(regex_string) - * - * set_num_fields(self.adapter.fields, pattern.groups) # <<<<<<<<<<<<<< - * - * self.field_filter = range(self.field_count) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pattern, __pyx_n_s_groups); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1533, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyInt_As_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_6 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1533, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - set_num_fields(__pyx_v_self->__pyx_base.adapter->fields, __pyx_t_6); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1535 - * set_num_fields(self.adapter.fields, pattern.groups) - * - * self.field_filter = range(self.field_count) # <<<<<<<<<<<<<< - * - * self.regex_args = calloc(1, sizeof(RegexTokenizerArgs)) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_filter, __pyx_t_1) < 0) __PYX_ERR(0, 1535, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1537 - * self.field_filter = range(self.field_count) - * - * self.regex_args = calloc(1, sizeof(RegexTokenizerArgs)) # <<<<<<<<<<<<<< - * self.temp = regex_string.encode(self.encoding) - * self.regex_args.pcre_regex = pcre_compile(self.temp, 0, - */ - __pyx_v_self->regex_args = ((RegexTokenizerArgs *)calloc(1, (sizeof(RegexTokenizerArgs)))); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1538 - * - * self.regex_args = calloc(1, sizeof(RegexTokenizerArgs)) - * self.temp = regex_string.encode(self.encoding) # <<<<<<<<<<<<<< - * self.regex_args.pcre_regex = pcre_compile(self.temp, 0, - * &error, &error_offset, NULL); - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_regex_string, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_self->__pyx_base.encoding); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_self->__pyx_base.encoding}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1538, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_self->__pyx_base.encoding}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1538, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_self->__pyx_base.encoding); - __Pyx_GIVEREF(__pyx_v_self->__pyx_base.encoding); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_self->__pyx_base.encoding); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->temp); - __Pyx_DECREF(__pyx_v_self->temp); - __pyx_v_self->temp = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1539 - * self.regex_args = calloc(1, sizeof(RegexTokenizerArgs)) - * self.temp = regex_string.encode(self.encoding) - * self.regex_args.pcre_regex = pcre_compile(self.temp, 0, # <<<<<<<<<<<<<< - * &error, &error_offset, NULL); - * self.regex_args.extra_regex = pcre_study(self.regex_args.pcre_regex, 0, &error); - */ - __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_self->temp); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 1539, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1540 - * self.temp = regex_string.encode(self.encoding) - * self.regex_args.pcre_regex = pcre_compile(self.temp, 0, - * &error, &error_offset, NULL); # <<<<<<<<<<<<<< - * self.regex_args.extra_regex = pcre_study(self.regex_args.pcre_regex, 0, &error); - * self.adapter.tokenize_args = self.regex_args - */ - __pyx_v_self->regex_args->pcre_regex = pcre_compile(((char *)__pyx_t_7), 0, (&__pyx_v_error), (&__pyx_v_error_offset), NULL); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1541 - * self.regex_args.pcre_regex = pcre_compile(self.temp, 0, - * &error, &error_offset, NULL); - * self.regex_args.extra_regex = pcre_study(self.regex_args.pcre_regex, 0, &error); # <<<<<<<<<<<<<< - * self.adapter.tokenize_args = self.regex_args - * - */ - __pyx_v_self->regex_args->extra_regex = pcre_study(__pyx_v_self->regex_args->pcre_regex, 0, (&__pyx_v_error)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1542 - * &error, &error_offset, NULL); - * self.regex_args.extra_regex = pcre_study(self.regex_args.pcre_regex, 0, &error); - * self.adapter.tokenize_args = self.regex_args # <<<<<<<<<<<<<< - * - * # Set field names from either last comment line if it exists, - */ - __pyx_v_self->__pyx_base.adapter->tokenize_args = ((void *)__pyx_v_self->regex_args); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1546 - * # Set field names from either last comment line if it exists, - * # or first line of data - * if field_names is True: # <<<<<<<<<<<<<< - * - * # Find first line of text that isn't a comment. - */ - __pyx_t_8 = (__pyx_v_field_names == Py_True); - __pyx_t_9 = (__pyx_t_8 != 0); - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1551 - * # Save last comment line. If comment lines exist, we'll use that - * # instead of first non comment text line for field names. - * offset = 0 # <<<<<<<<<<<<<< - * comment_offset = 0 - * comment_line = None - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_offset = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1552 - * # instead of first non comment text line for field names. - * offset = 0 - * comment_offset = 0 # <<<<<<<<<<<<<< - * comment_line = None - * try: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_comment_offset = __pyx_int_0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1553 - * offset = 0 - * comment_offset = 0 - * comment_line = None # <<<<<<<<<<<<<< - * try: - * line_iter = create_line_iter(self.adapter) - */ - __Pyx_INCREF(Py_None); - __pyx_v_comment_line = Py_None; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1554 - * comment_offset = 0 - * comment_line = None - * try: # <<<<<<<<<<<<<< - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - /*try:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1555 - * comment_line = None - * try: - * line_iter = create_line_iter(self.adapter) # <<<<<<<<<<<<<< - * line = next(line_iter) - * offset = len(line) - */ - __pyx_t_1 = __pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_line_iter(__pyx_v_self->__pyx_base.adapter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1555, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_line_iter = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1556 - * try: - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) # <<<<<<<<<<<<<< - * offset = len(line) - * - */ - __pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_line_iter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_line = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1557 - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - * offset = len(line) # <<<<<<<<<<<<<< - * - * if comment is not None and line.strip() != '' and \ - */ - __pyx_t_13 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 1557, __pyx_L4_error) - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1557, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_offset, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1559 - * offset = len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - __pyx_t_8 = (__pyx_v_comment != Py_None); - __pyx_t_14 = (__pyx_t_8 != 0); - if (__pyx_t_14) { - } else { - __pyx_t_9 = __pyx_t_14; - goto __pyx_L13_bool_binop_done; - } - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1559, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1559, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1559, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_14 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__25, Py_NE)); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1559, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_14) { - } else { - __pyx_t_9 = __pyx_t_14; - goto __pyx_L13_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1560 - * - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: # <<<<<<<<<<<<<< - * comment_line = line - * comment_offset = offset - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1560, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1560, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1560, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1560, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_v_comment, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1560, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1560, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_9 = __pyx_t_14; - __pyx_L13_bool_binop_done:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1559 - * offset = len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1561 - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: - * comment_line = line # <<<<<<<<<<<<<< - * comment_offset = offset - * - */ - __Pyx_INCREF(__pyx_v_line); - __Pyx_DECREF_SET(__pyx_v_comment_line, __pyx_v_line); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1562 - * line.strip()[0] == comment: - * comment_line = line - * comment_offset = offset # <<<<<<<<<<<<<< - * - * while line.strip() == '' or (comment is not None and \ - */ - __Pyx_INCREF(__pyx_v_offset); - __Pyx_DECREF_SET(__pyx_v_comment_offset, __pyx_v_offset); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1559 - * offset = len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1564 - * comment_offset = offset - * - * while line.strip() == '' or (comment is not None and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment): - * line = next(line_iter) - */ - while (1) { - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1564, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1564, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1564, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_14 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__25, Py_EQ)); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1564, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_14) { - } else { - __pyx_t_9 = __pyx_t_14; - goto __pyx_L18_bool_binop_done; - } - __pyx_t_14 = (__pyx_v_comment != Py_None); - __pyx_t_8 = (__pyx_t_14 != 0); - if (__pyx_t_8) { - } else { - __pyx_t_9 = __pyx_t_8; - goto __pyx_L18_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1565 - * - * while line.strip() == '' or (comment is not None and \ - * line.strip()[0] == comment): # <<<<<<<<<<<<<< - * line = next(line_iter) - * offset = offset + len(line) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1565, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1565, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1565, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1565, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_v_comment, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1565, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1565, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_9 = __pyx_t_8; - __pyx_L18_bool_binop_done:; - if (!__pyx_t_9) break; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1566 - * while line.strip() == '' or (comment is not None and \ - * line.strip()[0] == comment): - * line = next(line_iter) # <<<<<<<<<<<<<< - * offset = offset + len(line) - * - */ - __pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_line_iter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1566, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1567 - * line.strip()[0] == comment): - * line = next(line_iter) - * offset = offset + len(line) # <<<<<<<<<<<<<< - * - * if comment is not None and line.strip() != '' and \ - */ - __pyx_t_13 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 1567, __pyx_L4_error) - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1567, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyNumber_Add(__pyx_v_offset, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1567, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_offset, __pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1569 - * offset = offset + len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - __pyx_t_8 = (__pyx_v_comment != Py_None); - __pyx_t_14 = (__pyx_t_8 != 0); - if (__pyx_t_14) { - } else { - __pyx_t_9 = __pyx_t_14; - goto __pyx_L22_bool_binop_done; - } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1569, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_2) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1569, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1569, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_14 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_kp_s__25, Py_NE)); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1569, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_14) { - } else { - __pyx_t_9 = __pyx_t_14; - goto __pyx_L22_bool_binop_done; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1570 - * - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: # <<<<<<<<<<<<<< - * comment_line = line - * comment_offset = offset - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1570, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_2) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1570, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1570, __pyx_L4_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1570, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_v_comment, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1570, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1570, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_9 = __pyx_t_14; - __pyx_L22_bool_binop_done:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1569 - * offset = offset + len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1571 - * if comment is not None and line.strip() != '' and \ - * line.strip()[0] == comment: - * comment_line = line # <<<<<<<<<<<<<< - * comment_offset = offset - * - */ - __Pyx_INCREF(__pyx_v_line); - __Pyx_DECREF_SET(__pyx_v_comment_line, __pyx_v_line); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1572 - * line.strip()[0] == comment: - * comment_line = line - * comment_offset = offset # <<<<<<<<<<<<<< - * - * except StopIteration: - */ - __Pyx_INCREF(__pyx_v_offset); - __Pyx_DECREF_SET(__pyx_v_comment_offset, __pyx_v_offset); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1569 - * offset = offset + len(line) - * - * if comment is not None and line.strip() != '' and \ # <<<<<<<<<<<<<< - * line.strip()[0] == comment: - * comment_line = line - */ - } - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1554 - * comment_offset = 0 - * comment_line = None - * try: # <<<<<<<<<<<<<< - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - */ - } - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L11_try_end; - __pyx_L4_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1574 - * comment_offset = offset - * - * except StopIteration: # <<<<<<<<<<<<<< - * raise EOFError() - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration); - if (__pyx_t_4) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.RegexTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 1574, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1575 - * - * except StopIteration: - * raise EOFError() # <<<<<<<<<<<<<< - * - * if comment_line is not None: - */ - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_EOFError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1575, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1575, __pyx_L6_except_error) - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1554 - * comment_offset = 0 - * comment_line = None - * try: # <<<<<<<<<<<<<< - * line_iter = create_line_iter(self.adapter) - * line = next(line_iter) - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - goto __pyx_L1_error; - __pyx_L11_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1577 - * raise EOFError() - * - * if comment_line is not None: # <<<<<<<<<<<<<< - * coment_line = comment_line.strip() - * comment_line = comment_line.strip(comment) - */ - __pyx_t_9 = (__pyx_v_comment_line != Py_None); - __pyx_t_14 = (__pyx_t_9 != 0); - if (__pyx_t_14) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1578 - * - * if comment_line is not None: - * coment_line = comment_line.strip() # <<<<<<<<<<<<<< - * comment_line = comment_line.strip(comment) - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_comment_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1578, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1578, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_coment_line = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1579 - * if comment_line is not None: - * coment_line = comment_line.strip() - * comment_line = comment_line.strip(comment) # <<<<<<<<<<<<<< - * - * temp_field_names = [''] * self.field_count - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_comment_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_comment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_comment}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1579, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_comment}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1579, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_comment); - __Pyx_GIVEREF(__pyx_v_comment); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_comment); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_comment_line, __pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1577 - * raise EOFError() - * - * if comment_line is not None: # <<<<<<<<<<<<<< - * coment_line = comment_line.strip() - * comment_line = comment_line.strip(comment) - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1581 - * comment_line = comment_line.strip(comment) - * - * temp_field_names = [''] * self.field_count # <<<<<<<<<<<<<< - * if comment_line is not None: - * temp_field_names = comment_line.split() - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_kp_s__25); - __Pyx_GIVEREF(__pyx_kp_s__25); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_s__25); - { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 1581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_temp); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_temp; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_temp_field_names = __pyx_t_1; - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1582 - * - * temp_field_names = [''] * self.field_count - * if comment_line is not None: # <<<<<<<<<<<<<< - * temp_field_names = comment_line.split() - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) - */ - __pyx_t_14 = (__pyx_v_comment_line != Py_None); - __pyx_t_9 = (__pyx_t_14 != 0); - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1583 - * temp_field_names = [''] * self.field_count - * if comment_line is not None: - * temp_field_names = comment_line.split() # <<<<<<<<<<<<<< - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) - * elif line is not None: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_comment_line, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1583, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1583, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1583, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_temp_field_names, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1584 - * if comment_line is not None: - * temp_field_names = comment_line.split() - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) # <<<<<<<<<<<<<< - * elif line is not None: - * temp_field_names = line.split() - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PyObject_Length(__pyx_v_temp_field_names); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 1584, __pyx_L1_error) - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1584, __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_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_kp_s__25); - __Pyx_GIVEREF(__pyx_kp_s__25); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s__25); - { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 1584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_temp); - __Pyx_DECREF(__pyx_t_2); - __pyx_t_2 = __pyx_temp; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_temp_field_names, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_temp_field_names, __pyx_t_3); - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1582 - * - * temp_field_names = [''] * self.field_count - * if comment_line is not None: # <<<<<<<<<<<<<< - * temp_field_names = comment_line.split() - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) - */ - goto __pyx_L28; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1585 - * temp_field_names = comment_line.split() - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) - * elif line is not None: # <<<<<<<<<<<<<< - * temp_field_names = line.split() - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) - */ - __pyx_t_9 = (__pyx_v_line != Py_None); - __pyx_t_14 = (__pyx_t_9 != 0); - if (__pyx_t_14) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1586 - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) - * elif line is not None: - * temp_field_names = line.split() # <<<<<<<<<<<<<< - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) - * # numpy doesn't like unicode strings as dtype field names on python 2 - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_1) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_temp_field_names, __pyx_t_3); - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1587 - * elif line is not None: - * temp_field_names = line.split() - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) # <<<<<<<<<<<<<< - * # numpy doesn't like unicode strings as dtype field names on python 2 - * self.field_names = [str(name) for name in temp_field_names] - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1587, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = PyObject_Length(__pyx_v_temp_field_names); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 1587, __pyx_L1_error) - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1587, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1587, __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_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1587, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_kp_s__25); - __Pyx_GIVEREF(__pyx_kp_s__25); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s__25); - { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 1587, __pyx_L1_error) - __Pyx_GOTREF(__pyx_temp); - __Pyx_DECREF(__pyx_t_2); - __pyx_t_2 = __pyx_temp; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_temp_field_names, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1587, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_temp_field_names, __pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1585 - * temp_field_names = comment_line.split() - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) - * elif line is not None: # <<<<<<<<<<<<<< - * temp_field_names = line.split() - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) - */ - } - __pyx_L28:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1589 - * temp_field_names += [''] * (self.field_count - len(temp_field_names)) - * # numpy doesn't like unicode strings as dtype field names on python 2 - * self.field_names = [str(name) for name in temp_field_names] # <<<<<<<<<<<<<< - * - * # If we used the first data line for field names and not the last - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_v_temp_field_names)) || PyTuple_CheckExact(__pyx_v_temp_field_names)) { - __pyx_t_2 = __pyx_v_temp_field_names; __Pyx_INCREF(__pyx_t_2); __pyx_t_13 = 0; - __pyx_t_15 = NULL; - } else { - __pyx_t_13 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_temp_field_names); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1589, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_15)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 1589, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 1589, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_15(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1589, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_name); - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names, __pyx_t_1) < 0) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1593 - * # If we used the first data line for field names and not the last - * # comment line, reset the header size to the end of the first data line. - * if comment_line is None: # <<<<<<<<<<<<<< - * self.adapter.input_data.header = self.adapter.input_data.header + offset - * - */ - __pyx_t_14 = (__pyx_v_comment_line == Py_None); - __pyx_t_9 = (__pyx_t_14 != 0); - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1594 - * # comment line, reset the header size to the end of the first data line. - * if comment_line is None: - * self.adapter.input_data.header = self.adapter.input_data.header + offset # <<<<<<<<<<<<<< - * - * # Default missing value strings - */ - __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->__pyx_base.adapter->input_data->header); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1594, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1594, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_16 = __Pyx_PyInt_As_uint64_t(__pyx_t_2); if (unlikely((__pyx_t_16 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1594, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_self->__pyx_base.adapter->input_data->header = __pyx_t_16; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1593 - * # If we used the first data line for field names and not the last - * # comment line, reset the header size to the end of the first data line. - * if comment_line is None: # <<<<<<<<<<<<<< - * self.adapter.input_data.header = self.adapter.input_data.header + offset - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1546 - * # Set field names from either last comment line if it exists, - * # or first line of data - * if field_names is True: # <<<<<<<<<<<<<< - * - * # Find first line of text that isn't a comment. - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1597 - * - * # Default missing value strings - * missing_values = {} # <<<<<<<<<<<<<< - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1597, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_missing_values = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1598 - * # Default missing value strings - * missing_values = {} - * for field in range(self.adapter.fields.num_fields): # <<<<<<<<<<<<<< - * missing_values[field] = default_missing_values - * self.set_missing_values(missing_values) - */ - __pyx_t_6 = __pyx_v_self->__pyx_base.adapter->fields->num_fields; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_6; __pyx_t_17+=1) { - __pyx_v_field = __pyx_t_17; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1599 - * missing_values = {} - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values # <<<<<<<<<<<<<< - * self.set_missing_values(missing_values) - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_default_missing_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_field); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_missing_values, __pyx_t_1, __pyx_t_2) < 0)) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1600 - * for field in range(self.adapter.fields.num_fields): - * missing_values[field] = default_missing_values - * self.set_missing_values(missing_values) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_missing_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_missing_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_missing_values}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1600, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_missing_values}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1600, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_missing_values); - __Pyx_GIVEREF(__pyx_v_missing_values); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_missing_values); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1517 - * cdef object temp - * - * def __cinit__(self, fh, regex_string, encoding='utf_8', compression=None, # <<<<<<<<<<<<<< - * comment='#', quote='"', num_records=0, header=0, footer=0, - * field_names=True, infer_types=True, indexing=False, - */ - - /* function exit code */ - __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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.RegexTextAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_pattern); - __Pyx_XDECREF(__pyx_v_offset); - __Pyx_XDECREF(__pyx_v_comment_offset); - __Pyx_XDECREF(__pyx_v_comment_line); - __Pyx_XDECREF(__pyx_v_line_iter); - __Pyx_XDECREF(__pyx_v_line); - __Pyx_XDECREF(__pyx_v_coment_line); - __Pyx_XDECREF(__pyx_v_temp_field_names); - __Pyx_XDECREF(__pyx_v_missing_values); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_regex_string); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1603 - * - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * if self.regex_args != NULL: - * free(self.regex_args) - */ - -/* Python wrapper */ -static void __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter_2__dealloc__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter_2__dealloc__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *__pyx_v_self) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1604 - * - * def __dealloc__(self): - * if self.regex_args != NULL: # <<<<<<<<<<<<<< - * free(self.regex_args) - * - */ - __pyx_t_1 = ((__pyx_v_self->regex_args != NULL) != 0); - if (__pyx_t_1) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1605 - * def __dealloc__(self): - * if self.regex_args != NULL: - * free(self.regex_args) # <<<<<<<<<<<<<< - * - * # Use text_adapter machinery to iterate over each record in data - */ - free(__pyx_v_self->regex_args); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1604 - * - * def __dealloc__(self): - * if self.regex_args != NULL: # <<<<<<<<<<<<<< - * free(self.regex_args) - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1603 - * - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * if self.regex_args != NULL: - * free(self.regex_args) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1608 - * - * # Use text_adapter machinery to iterate over each record in data - * cdef object create_line_iter(text_adapter_t *adapter): # <<<<<<<<<<<<<< - * line_iter = LineIter() - * seek_record(adapter, 0) - */ - -static PyObject *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_line_iter(struct text_adapter_t *__pyx_v_adapter) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_LineIter *__pyx_v_line_iter = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("create_line_iter", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1609 - * # Use text_adapter machinery to iterate over each record in data - * cdef object create_line_iter(text_adapter_t *adapter): - * line_iter = LineIter() # <<<<<<<<<<<<<< - * seek_record(adapter, 0) - * line_iter.adapter = adapter - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_LineIter), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_line_iter = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_LineIter *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1610 - * cdef object create_line_iter(text_adapter_t *adapter): - * line_iter = LineIter() - * seek_record(adapter, 0) # <<<<<<<<<<<<<< - * line_iter.adapter = adapter - * return line_iter - */ - seek_record(__pyx_v_adapter, 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1611 - * line_iter = LineIter() - * seek_record(adapter, 0) - * line_iter.adapter = adapter # <<<<<<<<<<<<<< - * return line_iter - * - */ - __pyx_v_line_iter->adapter = __pyx_v_adapter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1612 - * seek_record(adapter, 0) - * line_iter.adapter = adapter - * return line_iter # <<<<<<<<<<<<<< - * - * cdef class LineIter(object): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_line_iter)); - __pyx_r = ((PyObject *)__pyx_v_line_iter); - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1608 - * - * # Use text_adapter machinery to iterate over each record in data - * cdef object create_line_iter(text_adapter_t *adapter): # <<<<<<<<<<<<<< - * line_iter = LineIter() - * seek_record(adapter, 0) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.create_line_iter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_line_iter); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1618 - * cdef text_adapter_t *adapter - * - * def __iter(self): # <<<<<<<<<<<<<< - * return self - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8LineIter_1__iter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8LineIter_1__iter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8LineIter___iter(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_LineIter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8LineIter___iter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_LineIter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1619 - * - * def __iter(self): - * return self # <<<<<<<<<<<<<< - * - * def __next__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1618 - * cdef text_adapter_t *adapter - * - * def __iter(self): # <<<<<<<<<<<<<< - * return self - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1621 - * return self - * - * def __next__(self): # <<<<<<<<<<<<<< - * cdef numpy.ndarray carray - * cdef tokenize_func_ptr tokenizer - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8LineIter_3__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8LineIter_3__next__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8LineIter_2__next__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_LineIter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8LineIter_2__next__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_LineIter *__pyx_v_self) { - PyArrayObject *__pyx_v_carray = 0; - tokenize_func_ptr __pyx_v_tokenizer; - converter_func_ptr __pyx_v_converter; - uint32_t __pyx_v_num_fields; - PyArrayObject *__pyx_v_temp = 0; - void *__pyx_v_fill_value; - PyObject *__pyx_v_a = NULL; - uint64_t __pyx_v_num_recs_read; - CYTHON_UNUSED AdapterError __pyx_v_result; - PyObject *__pyx_v_line = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - tokenize_func_ptr __pyx_t_1; - uint32_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - converter_func_ptr __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - __Pyx_RefNannySetupContext("__next__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1629 - * cdef void *fill_value - * - * tokenizer = self.adapter.tokenize # <<<<<<<<<<<<<< - * self.adapter.tokenize = &line_tokenizer - * num_fields = self.adapter.fields.num_fields - */ - __pyx_t_1 = __pyx_v_self->adapter->tokenize; - __pyx_v_tokenizer = __pyx_t_1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1630 - * - * tokenizer = self.adapter.tokenize - * self.adapter.tokenize = &line_tokenizer # <<<<<<<<<<<<<< - * num_fields = self.adapter.fields.num_fields - * self.adapter.fields.num_fields = 1 - */ - __pyx_v_self->adapter->tokenize = (&line_tokenizer); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1631 - * tokenizer = self.adapter.tokenize - * self.adapter.tokenize = &line_tokenizer - * num_fields = self.adapter.fields.num_fields # <<<<<<<<<<<<<< - * self.adapter.fields.num_fields = 1 - * - */ - __pyx_t_2 = __pyx_v_self->adapter->fields->num_fields; - __pyx_v_num_fields = __pyx_t_2; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1632 - * self.adapter.tokenize = &line_tokenizer - * num_fields = self.adapter.fields.num_fields - * self.adapter.fields.num_fields = 1 # <<<<<<<<<<<<<< - * - * # NOTE: This is kinda hacky, but set up empty string as fill value - */ - __pyx_v_self->adapter->fields->num_fields = 1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1636 - * # NOTE: This is kinda hacky, but set up empty string as fill value - * # otherwise adapter will fail to convert blank lines and report error. - * a = numpy.array([''], dtype='O') # <<<<<<<<<<<<<< - * temp = a - * fill_value = temp.data - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1636, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1636, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1636, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_kp_s__25); - __Pyx_GIVEREF(__pyx_kp_s__25); - PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s__25); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1636, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1636, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_O) < 0) __PYX_ERR(0, 1636, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1636, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_a = __pyx_t_6; - __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1637 - * # otherwise adapter will fail to convert blank lines and report error. - * a = numpy.array([''], dtype='O') - * temp = a # <<<<<<<<<<<<<< - * fill_value = temp.data - * set_fill_value(self.adapter.fields, NULL, 0, fill_value, - */ - if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1637, __pyx_L1_error) - __pyx_t_6 = __pyx_v_a; - __Pyx_INCREF(__pyx_t_6); - __pyx_v_temp = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1638 - * a = numpy.array([''], dtype='O') - * temp = a - * fill_value = temp.data # <<<<<<<<<<<<<< - * set_fill_value(self.adapter.fields, NULL, 0, fill_value, - * 1, 1) - */ - __pyx_v_fill_value = ((void *)__pyx_v_temp->data); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1639 - * temp = a - * fill_value = temp.data - * set_fill_value(self.adapter.fields, NULL, 0, fill_value, # <<<<<<<<<<<<<< - * 1, 1) - * - */ - set_fill_value(__pyx_v_self->adapter->fields, NULL, 0, __pyx_v_fill_value, 1, 1); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1642 - * 1, 1) - * - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) # <<<<<<<<<<<<<< - * converter = self.adapter.fields.field_info[0].converter - * self.adapter.fields.field_info[0].converter = \ - */ - (__pyx_v_self->adapter->fields->field_info[0]).output_field_size = (sizeof(PyObject *)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1643 - * - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) - * converter = self.adapter.fields.field_info[0].converter # <<<<<<<<<<<<<< - * self.adapter.fields.field_info[0].converter = \ - * &str2str_object_converter - */ - __pyx_t_7 = (__pyx_v_self->adapter->fields->field_info[0]).converter; - __pyx_v_converter = __pyx_t_7; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1644 - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) - * converter = self.adapter.fields.field_info[0].converter - * self.adapter.fields.field_info[0].converter = \ # <<<<<<<<<<<<<< - * &str2str_object_converter - * - */ - (__pyx_v_self->adapter->fields->field_info[0]).converter = ((converter_func_ptr)(&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2str_object_converter)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1647 - * &str2str_object_converter - * - * carray = numpy.ndarray(1, dtype='O') # <<<<<<<<<<<<<< - * cdef uint64_t num_recs_read = 0 - * result = read_records(self.adapter, 1, 1, - */ - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1647, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_n_s_O) < 0) __PYX_ERR(0, 1647, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_tuple__92, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1647, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_carray = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1648 - * - * carray = numpy.ndarray(1, dtype='O') - * cdef uint64_t num_recs_read = 0 # <<<<<<<<<<<<<< - * result = read_records(self.adapter, 1, 1, - * (carray.data), &num_recs_read) - */ - __pyx_v_num_recs_read = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1649 - * carray = numpy.ndarray(1, dtype='O') - * cdef uint64_t num_recs_read = 0 - * result = read_records(self.adapter, 1, 1, # <<<<<<<<<<<<<< - * (carray.data), &num_recs_read) - * line = numpy.asarray(carray) - */ - __pyx_v_result = read_records(__pyx_v_self->adapter, 1, 1, ((char *)__pyx_v_carray->data), (&__pyx_v_num_recs_read)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1651 - * result = read_records(self.adapter, 1, 1, - * (carray.data), &num_recs_read) - * line = numpy.asarray(carray) # <<<<<<<<<<<<<< - * - * self.adapter.tokenize = tokenizer - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_carray)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, ((PyObject *)__pyx_v_carray)}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1651, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, ((PyObject *)__pyx_v_carray)}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1651, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_carray)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_carray)); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_carray)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_line = __pyx_t_3; - __pyx_t_3 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1653 - * line = numpy.asarray(carray) - * - * self.adapter.tokenize = tokenizer # <<<<<<<<<<<<<< - * self.adapter.fields.num_fields = num_fields - * self.adapter.fields.field_info[0].converter = converter - */ - __pyx_v_self->adapter->tokenize = __pyx_v_tokenizer; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1654 - * - * self.adapter.tokenize = tokenizer - * self.adapter.fields.num_fields = num_fields # <<<<<<<<<<<<<< - * self.adapter.fields.field_info[0].converter = converter - * - */ - __pyx_v_self->adapter->fields->num_fields = __pyx_v_num_fields; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1655 - * self.adapter.tokenize = tokenizer - * self.adapter.fields.num_fields = num_fields - * self.adapter.fields.field_info[0].converter = converter # <<<<<<<<<<<<<< - * - * if num_recs_read == 0: - */ - (__pyx_v_self->adapter->fields->field_info[0]).converter = __pyx_v_converter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1657 - * self.adapter.fields.field_info[0].converter = converter - * - * if num_recs_read == 0: # <<<<<<<<<<<<<< - * raise StopIteration - * - */ - __pyx_t_8 = ((__pyx_v_num_recs_read == 0) != 0); - if (__pyx_t_8) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1658 - * - * if num_recs_read == 0: - * raise StopIteration # <<<<<<<<<<<<<< - * - * if line[0] is None: - */ - __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); - __PYX_ERR(0, 1658, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1657 - * self.adapter.fields.field_info[0].converter = converter - * - * if num_recs_read == 0: # <<<<<<<<<<<<<< - * raise StopIteration - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1660 - * raise StopIteration - * - * if line[0] is None: # <<<<<<<<<<<<<< - * line[0] = '' - * return line[0] + '\n' - */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_line, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = (__pyx_t_3 == Py_None); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = (__pyx_t_8 != 0); - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1661 - * - * if line[0] is None: - * line[0] = '' # <<<<<<<<<<<<<< - * return line[0] + '\n' - * - */ - if (unlikely(__Pyx_SetItemInt(__pyx_v_line, 0, __pyx_kp_s__25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 1661, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1660 - * raise StopIteration - * - * if line[0] is None: # <<<<<<<<<<<<<< - * line[0] = '' - * return line[0] + '\n' - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1662 - * if line[0] is None: - * line[0] = '' - * return line[0] + '\n' # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_line, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_kp_s__27); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1621 - * return self - * - * def __next__(self): # <<<<<<<<<<<<<< - * cdef numpy.ndarray carray - * cdef tokenize_func_ptr tokenizer - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.LineIter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_carray); - __Pyx_XDECREF((PyObject *)__pyx_v_temp); - __Pyx_XDECREF(__pyx_v_a); - __Pyx_XDECREF(__pyx_v_line); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1666 - * - * # Use text_adapter machinery to iterate over each record in data - * cdef object create_record_iter(text_adapter_t *adapter): # <<<<<<<<<<<<<< - * record_iter = RecordIter() - * seek_record(adapter, 0) - */ - -static PyObject *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_record_iter(struct text_adapter_t *__pyx_v_adapter) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RecordIter *__pyx_v_record_iter = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("create_record_iter", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1667 - * # Use text_adapter machinery to iterate over each record in data - * cdef object create_record_iter(text_adapter_t *adapter): - * record_iter = RecordIter() # <<<<<<<<<<<<<< - * seek_record(adapter, 0) - * record_iter.adapter = adapter - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_RecordIter), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_record_iter = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RecordIter *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1668 - * cdef object create_record_iter(text_adapter_t *adapter): - * record_iter = RecordIter() - * seek_record(adapter, 0) # <<<<<<<<<<<<<< - * record_iter.adapter = adapter - * return record_iter - */ - seek_record(__pyx_v_adapter, 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1669 - * record_iter = RecordIter() - * seek_record(adapter, 0) - * record_iter.adapter = adapter # <<<<<<<<<<<<<< - * return record_iter - * - */ - __pyx_v_record_iter->adapter = __pyx_v_adapter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1670 - * seek_record(adapter, 0) - * record_iter.adapter = adapter - * return record_iter # <<<<<<<<<<<<<< - * - * cdef class RecordIter(object): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_record_iter)); - __pyx_r = ((PyObject *)__pyx_v_record_iter); - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1666 - * - * # Use text_adapter machinery to iterate over each record in data - * cdef object create_record_iter(text_adapter_t *adapter): # <<<<<<<<<<<<<< - * record_iter = RecordIter() - * seek_record(adapter, 0) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.create_record_iter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_record_iter); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1676 - * cdef text_adapter_t *adapter - * - * def __iter(self): # <<<<<<<<<<<<<< - * return self - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10RecordIter_1__iter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10RecordIter_1__iter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10RecordIter___iter(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RecordIter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10RecordIter___iter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RecordIter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1677 - * - * def __iter(self): - * return self # <<<<<<<<<<<<<< - * - * def __next__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1676 - * cdef text_adapter_t *adapter - * - * def __iter(self): # <<<<<<<<<<<<<< - * return self - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1679 - * return self - * - * def __next__(self): # <<<<<<<<<<<<<< - * cdef numpy.ndarray carray - * cdef tokenize_func_ptr tokenizer - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10RecordIter_3__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10RecordIter_3__next__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10RecordIter_2__next__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RecordIter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_10RecordIter_2__next__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RecordIter *__pyx_v_self) { - PyArrayObject *__pyx_v_carray = 0; - tokenize_func_ptr __pyx_v_tokenizer; - converter_func_ptr __pyx_v_converter; - uint32_t __pyx_v_num_fields; - CYTHON_UNUSED AdapterError __pyx_v_result; - PyObject *__pyx_v_line = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - tokenize_func_ptr __pyx_t_1; - uint32_t __pyx_t_2; - converter_func_ptr __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - int __pyx_t_9; - __Pyx_RefNannySetupContext("__next__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1685 - * cdef uint32_t num_fields - * - * tokenizer = self.adapter.tokenize # <<<<<<<<<<<<<< - * self.adapter.tokenize = &line_tokenizer - * num_fields = self.adapter.fields.num_fields - */ - __pyx_t_1 = __pyx_v_self->adapter->tokenize; - __pyx_v_tokenizer = __pyx_t_1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1686 - * - * tokenizer = self.adapter.tokenize - * self.adapter.tokenize = &line_tokenizer # <<<<<<<<<<<<<< - * num_fields = self.adapter.fields.num_fields - * self.adapter.fields.num_fields = 1 - */ - __pyx_v_self->adapter->tokenize = (&line_tokenizer); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1687 - * tokenizer = self.adapter.tokenize - * self.adapter.tokenize = &line_tokenizer - * num_fields = self.adapter.fields.num_fields # <<<<<<<<<<<<<< - * self.adapter.fields.num_fields = 1 - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) - */ - __pyx_t_2 = __pyx_v_self->adapter->fields->num_fields; - __pyx_v_num_fields = __pyx_t_2; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1688 - * self.adapter.tokenize = &line_tokenizer - * num_fields = self.adapter.fields.num_fields - * self.adapter.fields.num_fields = 1 # <<<<<<<<<<<<<< - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) - * converter = self.adapter.fields.field_info[0].converter - */ - __pyx_v_self->adapter->fields->num_fields = 1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1689 - * num_fields = self.adapter.fields.num_fields - * self.adapter.fields.num_fields = 1 - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) # <<<<<<<<<<<<<< - * converter = self.adapter.fields.field_info[0].converter - * self.adapter.fields.field_info[0].converter = \ - */ - (__pyx_v_self->adapter->fields->field_info[0]).output_field_size = (sizeof(PyObject *)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1690 - * self.adapter.fields.num_fields = 1 - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) - * converter = self.adapter.fields.field_info[0].converter # <<<<<<<<<<<<<< - * self.adapter.fields.field_info[0].converter = \ - * &str2str_object_converter - */ - __pyx_t_3 = (__pyx_v_self->adapter->fields->field_info[0]).converter; - __pyx_v_converter = __pyx_t_3; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1691 - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) - * converter = self.adapter.fields.field_info[0].converter - * self.adapter.fields.field_info[0].converter = \ # <<<<<<<<<<<<<< - * &str2str_object_converter - * - */ - (__pyx_v_self->adapter->fields->field_info[0]).converter = ((converter_func_ptr)(&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2str_object_converter)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1694 - * &str2str_object_converter - * - * carray = numpy.ndarray(1, dtype='O') # <<<<<<<<<<<<<< - * result = read_records(self.adapter, 1, 1, (carray.data), NULL) - * line = numpy.asarray(carray) - */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1694, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_O) < 0) __PYX_ERR(0, 1694, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_tuple__93, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1694, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_carray = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1695 - * - * carray = numpy.ndarray(1, dtype='O') - * result = read_records(self.adapter, 1, 1, (carray.data), NULL) # <<<<<<<<<<<<<< - * line = numpy.asarray(carray) - * - */ - __pyx_v_result = read_records(__pyx_v_self->adapter, 1, 1, ((char *)__pyx_v_carray->data), NULL); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1696 - * carray = numpy.ndarray(1, dtype='O') - * result = read_records(self.adapter, 1, 1, (carray.data), NULL) - * line = numpy.asarray(carray) # <<<<<<<<<<<<<< - * - * self.adapter.tokenize = tokenizer - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_4) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_carray)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_carray)}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1696, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_carray)}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1696, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_carray)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_carray)); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_carray)); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_line = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1698 - * line = numpy.asarray(carray) - * - * self.adapter.tokenize = tokenizer # <<<<<<<<<<<<<< - * self.adapter.fields.num_fields = num_fields - * self.adapter.fields.field_info[0].converter = converter - */ - __pyx_v_self->adapter->tokenize = __pyx_v_tokenizer; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1699 - * - * self.adapter.tokenize = tokenizer - * self.adapter.fields.num_fields = num_fields # <<<<<<<<<<<<<< - * self.adapter.fields.field_info[0].converter = converter - * - */ - __pyx_v_self->adapter->fields->num_fields = __pyx_v_num_fields; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1700 - * self.adapter.tokenize = tokenizer - * self.adapter.fields.num_fields = num_fields - * self.adapter.fields.field_info[0].converter = converter # <<<<<<<<<<<<<< - * - * if line[0] is None: - */ - (__pyx_v_self->adapter->fields->field_info[0]).converter = __pyx_v_converter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1702 - * self.adapter.fields.field_info[0].converter = converter - * - * if line[0] is None: # <<<<<<<<<<<<<< - * raise StopIteration - * - */ - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_line, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1702, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = (__pyx_t_5 == Py_None); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_9 = (__pyx_t_8 != 0); - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1703 - * - * if line[0] is None: - * raise StopIteration # <<<<<<<<<<<<<< - * - * return line[0] + '\n' - */ - __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); - __PYX_ERR(0, 1703, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1702 - * self.adapter.fields.field_info[0].converter = converter - * - * if line[0] is None: # <<<<<<<<<<<<<< - * raise StopIteration - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1705 - * raise StopIteration - * - * return line[0] + '\n' # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_line, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_kp_s__27); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1679 - * return self - * - * def __next__(self): # <<<<<<<<<<<<<< - * cdef numpy.ndarray carray - * cdef tokenize_func_ptr tokenizer - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.RecordIter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_carray); - __Pyx_XDECREF(__pyx_v_line); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1708 - * - * - * cdef object create_json_record_iter(text_adapter_t *adapter): # <<<<<<<<<<<<<< - * record_iter = JSONRecordIter() - * seek_record(adapter, 0) - */ - -static PyObject *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_json_record_iter(struct text_adapter_t *__pyx_v_adapter) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter *__pyx_v_record_iter = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("create_json_record_iter", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1709 - * - * cdef object create_json_record_iter(text_adapter_t *adapter): - * record_iter = JSONRecordIter() # <<<<<<<<<<<<<< - * seek_record(adapter, 0) - * record_iter.adapter = adapter - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1709, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_record_iter = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1710 - * cdef object create_json_record_iter(text_adapter_t *adapter): - * record_iter = JSONRecordIter() - * seek_record(adapter, 0) # <<<<<<<<<<<<<< - * record_iter.adapter = adapter - * return record_iter - */ - seek_record(__pyx_v_adapter, 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1711 - * record_iter = JSONRecordIter() - * seek_record(adapter, 0) - * record_iter.adapter = adapter # <<<<<<<<<<<<<< - * return record_iter - * - */ - __pyx_v_record_iter->adapter = __pyx_v_adapter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1712 - * seek_record(adapter, 0) - * record_iter.adapter = adapter - * return record_iter # <<<<<<<<<<<<<< - * - * cdef class JSONRecordIter(object): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_record_iter)); - __pyx_r = ((PyObject *)__pyx_v_record_iter); - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1708 - * - * - * cdef object create_json_record_iter(text_adapter_t *adapter): # <<<<<<<<<<<<<< - * record_iter = JSONRecordIter() - * seek_record(adapter, 0) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.create_json_record_iter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_record_iter); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1718 - * cdef text_adapter_t *adapter - * - * def __iter(self): # <<<<<<<<<<<<<< - * return self - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter_1__iter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter_1__iter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter___iter(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter___iter(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1719 - * - * def __iter(self): - * return self # <<<<<<<<<<<<<< - * - * def __next__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1718 - * cdef text_adapter_t *adapter - * - * def __iter(self): # <<<<<<<<<<<<<< - * return self - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1721 - * return self - * - * def __next__(self): # <<<<<<<<<<<<<< - * cdef numpy.ndarray carray - * cdef tokenize_func_ptr tokenizer - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter_3__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter_3__next__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter_2__next__(((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter_2__next__(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter *__pyx_v_self) { - PyArrayObject *__pyx_v_carray = 0; - tokenize_func_ptr __pyx_v_tokenizer; - converter_func_ptr __pyx_v_converter; - uint32_t __pyx_v_num_fields; - CYTHON_UNUSED AdapterError __pyx_v_result; - PyObject *__pyx_v_line = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - tokenize_func_ptr __pyx_t_1; - uint32_t __pyx_t_2; - converter_func_ptr __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - int __pyx_t_9; - __Pyx_RefNannySetupContext("__next__", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1727 - * cdef uint32_t num_fields - * - * tokenizer = self.adapter.tokenize # <<<<<<<<<<<<<< - * self.adapter.tokenize = &json_record_tokenizer - * num_fields = self.adapter.fields.num_fields - */ - __pyx_t_1 = __pyx_v_self->adapter->tokenize; - __pyx_v_tokenizer = __pyx_t_1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1728 - * - * tokenizer = self.adapter.tokenize - * self.adapter.tokenize = &json_record_tokenizer # <<<<<<<<<<<<<< - * num_fields = self.adapter.fields.num_fields - * self.adapter.fields.num_fields = 1 - */ - __pyx_v_self->adapter->tokenize = (&json_record_tokenizer); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1729 - * tokenizer = self.adapter.tokenize - * self.adapter.tokenize = &json_record_tokenizer - * num_fields = self.adapter.fields.num_fields # <<<<<<<<<<<<<< - * self.adapter.fields.num_fields = 1 - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) - */ - __pyx_t_2 = __pyx_v_self->adapter->fields->num_fields; - __pyx_v_num_fields = __pyx_t_2; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1730 - * self.adapter.tokenize = &json_record_tokenizer - * num_fields = self.adapter.fields.num_fields - * self.adapter.fields.num_fields = 1 # <<<<<<<<<<<<<< - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) - * converter = self.adapter.fields.field_info[0].converter - */ - __pyx_v_self->adapter->fields->num_fields = 1; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1731 - * num_fields = self.adapter.fields.num_fields - * self.adapter.fields.num_fields = 1 - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) # <<<<<<<<<<<<<< - * converter = self.adapter.fields.field_info[0].converter - * self.adapter.fields.field_info[0].converter = \ - */ - (__pyx_v_self->adapter->fields->field_info[0]).output_field_size = (sizeof(PyObject *)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1732 - * self.adapter.fields.num_fields = 1 - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) - * converter = self.adapter.fields.field_info[0].converter # <<<<<<<<<<<<<< - * self.adapter.fields.field_info[0].converter = \ - * &str2str_object_converter - */ - __pyx_t_3 = (__pyx_v_self->adapter->fields->field_info[0]).converter; - __pyx_v_converter = __pyx_t_3; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1733 - * self.adapter.fields.field_info[0].output_field_size = sizeof(PyObject*) - * converter = self.adapter.fields.field_info[0].converter - * self.adapter.fields.field_info[0].converter = \ # <<<<<<<<<<<<<< - * &str2str_object_converter - * - */ - (__pyx_v_self->adapter->fields->field_info[0]).converter = ((converter_func_ptr)(&__pyx_f_5TextAdapter_11textadapter_11TextAdapter_str2str_object_converter)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1736 - * &str2str_object_converter - * - * carray = numpy.ndarray(1, dtype='O') # <<<<<<<<<<<<<< - * result = read_records(self.adapter, 1, 1, (carray.data), NULL) - * line = numpy.asarray(carray) - */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1736, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_O) < 0) __PYX_ERR(0, 1736, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_tuple__94, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1736, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_carray = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1737 - * - * carray = numpy.ndarray(1, dtype='O') - * result = read_records(self.adapter, 1, 1, (carray.data), NULL) # <<<<<<<<<<<<<< - * line = numpy.asarray(carray) - * - */ - __pyx_v_result = read_records(__pyx_v_self->adapter, 1, 1, ((char *)__pyx_v_carray->data), NULL); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1738 - * carray = numpy.ndarray(1, dtype='O') - * result = read_records(self.adapter, 1, 1, (carray.data), NULL) - * line = numpy.asarray(carray) # <<<<<<<<<<<<<< - * - * self.adapter.tokenize = tokenizer - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_4) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_carray)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_carray)}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1738, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_carray)}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1738, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_carray)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_carray)); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_carray)); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_line = __pyx_t_5; - __pyx_t_5 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1740 - * line = numpy.asarray(carray) - * - * self.adapter.tokenize = tokenizer # <<<<<<<<<<<<<< - * self.adapter.fields.num_fields = num_fields - * self.adapter.fields.field_info[0].converter = converter - */ - __pyx_v_self->adapter->tokenize = __pyx_v_tokenizer; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1741 - * - * self.adapter.tokenize = tokenizer - * self.adapter.fields.num_fields = num_fields # <<<<<<<<<<<<<< - * self.adapter.fields.field_info[0].converter = converter - * - */ - __pyx_v_self->adapter->fields->num_fields = __pyx_v_num_fields; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1742 - * self.adapter.tokenize = tokenizer - * self.adapter.fields.num_fields = num_fields - * self.adapter.fields.field_info[0].converter = converter # <<<<<<<<<<<<<< - * - * if line[0] is None: - */ - (__pyx_v_self->adapter->fields->field_info[0]).converter = __pyx_v_converter; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1744 - * self.adapter.fields.field_info[0].converter = converter - * - * if line[0] is None: # <<<<<<<<<<<<<< - * raise StopIteration - * - */ - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_line, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1744, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = (__pyx_t_5 == Py_None); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_9 = (__pyx_t_8 != 0); - if (__pyx_t_9) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1745 - * - * if line[0] is None: - * raise StopIteration # <<<<<<<<<<<<<< - * - * return line[0] - */ - __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); - __PYX_ERR(0, 1745, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1744 - * self.adapter.fields.field_info[0].converter = converter - * - * if line[0] is None: # <<<<<<<<<<<<<< - * raise StopIteration - * - */ - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1747 - * raise StopIteration - * - * return line[0] # <<<<<<<<<<<<<< - * - * cdef create_array(char *data, object dtype, uint64_t num_recs): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_line, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1721 - * return self - * - * def __next__(self): # <<<<<<<<<<<<<< - * cdef numpy.ndarray carray - * cdef tokenize_func_ptr tokenizer - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.JSONRecordIter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_carray); - __Pyx_XDECREF(__pyx_v_line); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1749 - * return line[0] - * - * cdef create_array(char *data, object dtype, uint64_t num_recs): # <<<<<<<<<<<<<< - * """ - * Create numpy array out of pre allocated data filled in by call to read_records(). - */ - -static PyObject *__pyx_f_5TextAdapter_11textadapter_11TextAdapter_create_array(char *__pyx_v_data, PyObject *__pyx_v_dtype, uint64_t __pyx_v_num_recs) { - npy_intp __pyx_v_dims[1]; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc *__pyx_v_array_dealloc = 0; - PyArrayObject *__pyx_v_carray = 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; - __Pyx_RefNannySetupContext("create_array", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1758 - * cdef numpy.ndarray carray - * - * dims[0] = num_recs # <<<<<<<<<<<<<< - * carray = PyArray_NewFromDescr(numpy.ndarray, dtype, 1, dims, NULL, data, - * NPY_WRITEABLE, NULL) - */ - (__pyx_v_dims[0]) = __pyx_v_num_recs; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1759 - * - * dims[0] = num_recs - * carray = PyArray_NewFromDescr(numpy.ndarray, dtype, 1, dims, NULL, data, # <<<<<<<<<<<<<< - * NPY_WRITEABLE, NULL) - * Py_INCREF(dtype) - */ - if (!(likely(((__pyx_v_dtype) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dtype, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(0, 1759, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1760 - * dims[0] = num_recs - * carray = PyArray_NewFromDescr(numpy.ndarray, dtype, 1, dims, NULL, data, - * NPY_WRITEABLE, NULL) # <<<<<<<<<<<<<< - * Py_INCREF(dtype) - * - */ - __pyx_t_1 = PyArray_NewFromDescr(((PyObject *)__pyx_ptype_5numpy_ndarray), ((PyArray_Descr *)__pyx_v_dtype), 1, __pyx_v_dims, NULL, __pyx_v_data, NPY_WRITEABLE, ((PyObject *)NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1759, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1759 - * - * dims[0] = num_recs - * carray = PyArray_NewFromDescr(numpy.ndarray, dtype, 1, dims, NULL, data, # <<<<<<<<<<<<<< - * NPY_WRITEABLE, NULL) - * Py_INCREF(dtype) - */ - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1759, __pyx_L1_error) - __pyx_v_carray = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1761 - * carray = PyArray_NewFromDescr(numpy.ndarray, dtype, 1, dims, NULL, data, - * NPY_WRITEABLE, NULL) - * Py_INCREF(dtype) # <<<<<<<<<<<<<< - * - * # Use ArrayDealloc object to make sure array data is properly deallocted - */ - Py_INCREF(__pyx_v_dtype); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1765 - * # Use ArrayDealloc object to make sure array data is properly deallocted - * # when array is destroyed - * array_dealloc = ArrayDealloc.__new__(ArrayDealloc) # <<<<<<<<<<<<<< - * array_dealloc.data = data - * Py_INCREF(array_dealloc) - */ - __pyx_t_1 = __pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc(((PyTypeObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1765, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc)))) __PYX_ERR(0, 1765, __pyx_L1_error) - __pyx_v_array_dealloc = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1766 - * # when array is destroyed - * array_dealloc = ArrayDealloc.__new__(ArrayDealloc) - * array_dealloc.data = data # <<<<<<<<<<<<<< - * Py_INCREF(array_dealloc) - * - */ - __pyx_v_array_dealloc->data = __pyx_v_data; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1767 - * array_dealloc = ArrayDealloc.__new__(ArrayDealloc) - * array_dealloc.data = data - * Py_INCREF(array_dealloc) # <<<<<<<<<<<<<< - * - * carray.base = array_dealloc - */ - Py_INCREF(((PyObject *)__pyx_v_array_dealloc)); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1769 - * Py_INCREF(array_dealloc) - * - * carray.base = array_dealloc # <<<<<<<<<<<<<< - * return numpy.asarray(carray) - * - */ - __pyx_v_carray->base = ((PyObject *)__pyx_v_array_dealloc); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1770 - * - * carray.base = array_dealloc - * return numpy.asarray(carray) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1770, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1770, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_carray)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1770, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_carray)}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1770, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_carray)}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1770, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1770, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_carray)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_carray)); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_carray)); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1770, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1749 - * return line[0] - * - * cdef create_array(char *data, object dtype, uint64_t num_recs): # <<<<<<<<<<<<<< - * """ - * Create numpy array out of pre allocated data filled in by call to read_records(). - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.create_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_array_dealloc); - __Pyx_XDECREF((PyObject *)__pyx_v_carray); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "TextAdapter/textadapter/TextAdapter.pyx":1784 - * } - * - * def text_adapter_exception(error, convert_error=None, token=None, record=None, # <<<<<<<<<<<<<< - * field=None, dtype=None): - * """ - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_5text_adapter_exception(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_4text_adapter_exception[] = "\n Returns appropriate adapter exception for reporting reading, parsing,\n and converting issues.\n\n Arguments:\n * `error` - AdapterError enum value\n * `convert_error` - ConvertError enum value, if this is a convert error\n * `token` - token string where error occurred, if applicable\n * `record` - record where parsing or convert error happened\n * `field` - field where parsing or convert error happened\n "; -static PyMethodDef __pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_5text_adapter_exception = {"text_adapter_exception", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_5text_adapter_exception, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_4text_adapter_exception}; -static PyObject *__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_5text_adapter_exception(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_error = 0; - PyObject *__pyx_v_convert_error = 0; - PyObject *__pyx_v_token = 0; - PyObject *__pyx_v_record = 0; - PyObject *__pyx_v_field = 0; - PyObject *__pyx_v_dtype = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("text_adapter_exception (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_error,&__pyx_n_s_convert_error,&__pyx_n_s_token,&__pyx_n_s_record,&__pyx_n_s_field,&__pyx_n_s_dtype,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)Py_None); - values[3] = ((PyObject *)Py_None); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1785 - * - * def text_adapter_exception(error, convert_error=None, token=None, record=None, - * field=None, dtype=None): # <<<<<<<<<<<<<< - * """ - * Returns appropriate adapter exception for reporting reading, parsing, - */ - values[4] = ((PyObject *)Py_None); - values[5] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_error)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_convert_error); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_token); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_record); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dtype); - if (value) { values[5] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "text_adapter_exception") < 0)) __PYX_ERR(0, 1784, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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_error = values[0]; - __pyx_v_convert_error = values[1]; - __pyx_v_token = values[2]; - __pyx_v_record = values[3]; - __pyx_v_field = values[4]; - __pyx_v_dtype = values[5]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("text_adapter_exception", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1784, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.text_adapter_exception", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_4text_adapter_exception(__pyx_self, __pyx_v_error, __pyx_v_convert_error, __pyx_v_token, __pyx_v_record, __pyx_v_field, __pyx_v_dtype); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1784 - * } - * - * def text_adapter_exception(error, convert_error=None, token=None, record=None, # <<<<<<<<<<<<<< - * field=None, dtype=None): - * """ - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5TextAdapter_11textadapter_11TextAdapter_4text_adapter_exception(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_error, PyObject *__pyx_v_convert_error, PyObject *__pyx_v_token, PyObject *__pyx_v_record, PyObject *__pyx_v_field, PyObject *__pyx_v_dtype) { - PyObject *__pyx_v_reason = NULL; - PyObject *__pyx_v_e = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - 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; - __Pyx_RefNannySetupContext("text_adapter_exception", 0); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1797 - * * `field` - field where parsing or convert error happened - * """ - * if error == ADAPTER_ERROR_CONVERT: # <<<<<<<<<<<<<< - * reason = convert_error_reasons.get(convert_error, "unknown") - * e = errors.DataTypeError('Could not convert token "{0}" at record {1} field {2} to {3}.' \ - */ - __pyx_t_1 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_CONVERT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1797, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_error, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1797, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1797, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1798 - * """ - * if error == ADAPTER_ERROR_CONVERT: - * reason = convert_error_reasons.get(convert_error, "unknown") # <<<<<<<<<<<<<< - * e = errors.DataTypeError('Could not convert token "{0}" at record {1} field {2} to {3}.' \ - * 'Reason: {4}'.format(token, str(record), str(field), dtype, reason)) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_convert_error_reasons); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_convert_error, __pyx_n_s_unknown}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1798, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_convert_error, __pyx_n_s_unknown}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1798, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_1) { - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL; - } - __Pyx_INCREF(__pyx_v_convert_error); - __Pyx_GIVEREF(__pyx_v_convert_error); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_convert_error); - __Pyx_INCREF(__pyx_n_s_unknown); - __Pyx_GIVEREF(__pyx_n_s_unknown); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_n_s_unknown); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_reason = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1799 - * if error == ADAPTER_ERROR_CONVERT: - * reason = convert_error_reasons.get(convert_error, "unknown") - * e = errors.DataTypeError('Could not convert token "{0}" at record {1} field {2} to {3}.' \ # <<<<<<<<<<<<<< - * 'Reason: {4}'.format(token, str(record), str(field), dtype, reason)) - * elif error == ADAPTER_ERROR_SEEK: - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_DataTypeError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1800 - * reason = convert_error_reasons.get(convert_error, "unknown") - * e = errors.DataTypeError('Could not convert token "{0}" at record {1} field {2} to {3}.' \ - * 'Reason: {4}'.format(token, str(record), str(field), dtype, reason)) # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_SEEK: - * e = errors.SourceError('Seek error') - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Could_not_convert_token_0_at_rec, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_v_record); - __Pyx_GIVEREF(__pyx_v_record); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_record); - __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_v_field); - __Pyx_GIVEREF(__pyx_v_field); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_field); - __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_token, __pyx_t_8, __pyx_t_9, __pyx_v_dtype, __pyx_v_reason}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1800, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_token, __pyx_t_8, __pyx_t_9, __pyx_v_dtype, __pyx_v_reason}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1800, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_INCREF(__pyx_v_token); - __Pyx_GIVEREF(__pyx_v_token); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_5, __pyx_v_token); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_5, __pyx_t_9); - __Pyx_INCREF(__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_5, __pyx_v_dtype); - __Pyx_INCREF(__pyx_v_reason); - __Pyx_GIVEREF(__pyx_v_reason); - PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_5, __pyx_v_reason); - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1800, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_1) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1799, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1799, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1799, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_e = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1797 - * * `field` - field where parsing or convert error happened - * """ - * if error == ADAPTER_ERROR_CONVERT: # <<<<<<<<<<<<<< - * reason = convert_error_reasons.get(convert_error, "unknown") - * e = errors.DataTypeError('Could not convert token "{0}" at record {1} field {2} to {3}.' \ - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1801 - * e = errors.DataTypeError('Could not convert token "{0}" at record {1} field {2} to {3}.' \ - * 'Reason: {4}'.format(token, str(record), str(field), dtype, reason)) - * elif error == ADAPTER_ERROR_SEEK: # <<<<<<<<<<<<<< - * e = errors.SourceError('Seek error') - * elif error == ADAPTER_ERROR_SEEK_EOF: - */ - __pyx_t_2 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_SEEK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1801, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_RichCompare(__pyx_v_error, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1801, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1801, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1802 - * 'Reason: {4}'.format(token, str(record), str(field), dtype, reason)) - * elif error == ADAPTER_ERROR_SEEK: - * e = errors.SourceError('Seek error') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_SEEK_EOF: - * e = errors.AdapterIndexError('Record {0} is out of bounds'.format(str(record))) - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1802, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_SourceError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1802, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__95, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1802, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_e = __pyx_t_6; - __pyx_t_6 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1801 - * e = errors.DataTypeError('Could not convert token "{0}" at record {1} field {2} to {3}.' \ - * 'Reason: {4}'.format(token, str(record), str(field), dtype, reason)) - * elif error == ADAPTER_ERROR_SEEK: # <<<<<<<<<<<<<< - * e = errors.SourceError('Seek error') - * elif error == ADAPTER_ERROR_SEEK_EOF: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1803 - * elif error == ADAPTER_ERROR_SEEK: - * e = errors.SourceError('Seek error') - * elif error == ADAPTER_ERROR_SEEK_EOF: # <<<<<<<<<<<<<< - * e = errors.AdapterIndexError('Record {0} is out of bounds'.format(str(record))) - * elif error == ADAPTER_ERROR_SEEK_S3: - */ - __pyx_t_6 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_SEEK_EOF); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1803, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_error, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1803, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1803, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1804 - * e = errors.SourceError('Seek error') - * elif error == ADAPTER_ERROR_SEEK_EOF: - * e = errors.AdapterIndexError('Record {0} is out of bounds'.format(str(record))) # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_SEEK_S3: - * e = errors.SourceError('S3 seek error') - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_AdapterIndexError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Record_0_is_out_of_bounds, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_record); - __Pyx_GIVEREF(__pyx_v_record); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_record); - __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_1) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_9}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_9}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __pyx_t_1 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_e = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1803 - * elif error == ADAPTER_ERROR_SEEK: - * e = errors.SourceError('Seek error') - * elif error == ADAPTER_ERROR_SEEK_EOF: # <<<<<<<<<<<<<< - * e = errors.AdapterIndexError('Record {0} is out of bounds'.format(str(record))) - * elif error == ADAPTER_ERROR_SEEK_S3: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1805 - * elif error == ADAPTER_ERROR_SEEK_EOF: - * e = errors.AdapterIndexError('Record {0} is out of bounds'.format(str(record))) - * elif error == ADAPTER_ERROR_SEEK_S3: # <<<<<<<<<<<<<< - * e = errors.SourceError('S3 seek error') - * elif error == ADAPTER_ERROR_READ: - */ - __pyx_t_2 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_SEEK_S3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_RichCompare(__pyx_v_error, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1805, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1805, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1806 - * e = errors.AdapterIndexError('Record {0} is out of bounds'.format(str(record))) - * elif error == ADAPTER_ERROR_SEEK_S3: - * e = errors.SourceError('S3 seek error') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_READ: - * e = errors.SourceError('Read error') - */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1806, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_SourceError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1806, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__96, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1806, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_e = __pyx_t_10; - __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1805 - * elif error == ADAPTER_ERROR_SEEK_EOF: - * e = errors.AdapterIndexError('Record {0} is out of bounds'.format(str(record))) - * elif error == ADAPTER_ERROR_SEEK_S3: # <<<<<<<<<<<<<< - * e = errors.SourceError('S3 seek error') - * elif error == ADAPTER_ERROR_READ: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1807 - * elif error == ADAPTER_ERROR_SEEK_S3: - * e = errors.SourceError('S3 seek error') - * elif error == ADAPTER_ERROR_READ: # <<<<<<<<<<<<<< - * e = errors.SourceError('Read error') - * elif error == ADAPTER_ERROR_READ_S3: - */ - __pyx_t_10 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_READ); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1807, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_error, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1807, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1807, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1808 - * e = errors.SourceError('S3 seek error') - * elif error == ADAPTER_ERROR_READ: - * e = errors.SourceError('Read error') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_READ_S3: - * e = errors.SourceError('S3 read error') - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1808, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SourceError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1808, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__97, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1808, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_e = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1807 - * elif error == ADAPTER_ERROR_SEEK_S3: - * e = errors.SourceError('S3 seek error') - * elif error == ADAPTER_ERROR_READ: # <<<<<<<<<<<<<< - * e = errors.SourceError('Read error') - * elif error == ADAPTER_ERROR_READ_S3: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1809 - * elif error == ADAPTER_ERROR_READ: - * e = errors.SourceError('Read error') - * elif error == ADAPTER_ERROR_READ_S3: # <<<<<<<<<<<<<< - * e = errors.SourceError('S3 read error') - * elif error == ADAPTER_ERROR_NO_FIELDS: - */ - __pyx_t_2 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_READ_S3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1809, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_RichCompare(__pyx_v_error, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1809, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1809, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1810 - * e = errors.SourceError('Read error') - * elif error == ADAPTER_ERROR_READ_S3: - * e = errors.SourceError('S3 read error') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_NO_FIELDS: - * e = errors.NoSuchFieldError('No fields found or no converters set') - */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_SourceError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__98, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_e = __pyx_t_10; - __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1809 - * elif error == ADAPTER_ERROR_READ: - * e = errors.SourceError('Read error') - * elif error == ADAPTER_ERROR_READ_S3: # <<<<<<<<<<<<<< - * e = errors.SourceError('S3 read error') - * elif error == ADAPTER_ERROR_NO_FIELDS: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1811 - * elif error == ADAPTER_ERROR_READ_S3: - * e = errors.SourceError('S3 read error') - * elif error == ADAPTER_ERROR_NO_FIELDS: # <<<<<<<<<<<<<< - * e = errors.NoSuchFieldError('No fields found or no converters set') - * elif error == ADAPTER_ERROR_INDEX: - */ - __pyx_t_10 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_NO_FIELDS); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1811, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_error, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1811, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1811, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1812 - * e = errors.SourceError('S3 read error') - * elif error == ADAPTER_ERROR_NO_FIELDS: - * e = errors.NoSuchFieldError('No fields found or no converters set') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_INDEX: - * e = errors.DataIndexError('Could not find record offset in index') - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1812, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_NoSuchFieldError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1812, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__99, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1812, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_e = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1811 - * elif error == ADAPTER_ERROR_READ_S3: - * e = errors.SourceError('S3 read error') - * elif error == ADAPTER_ERROR_NO_FIELDS: # <<<<<<<<<<<<<< - * e = errors.NoSuchFieldError('No fields found or no converters set') - * elif error == ADAPTER_ERROR_INDEX: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1813 - * elif error == ADAPTER_ERROR_NO_FIELDS: - * e = errors.NoSuchFieldError('No fields found or no converters set') - * elif error == ADAPTER_ERROR_INDEX: # <<<<<<<<<<<<<< - * e = errors.DataIndexError('Could not find record offset in index') - * elif error == ADAPTER_ERROR_PROCESS_TOKEN: - */ - __pyx_t_2 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_INDEX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1813, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_RichCompare(__pyx_v_error, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1813, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1813, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1814 - * e = errors.NoSuchFieldError('No fields found or no converters set') - * elif error == ADAPTER_ERROR_INDEX: - * e = errors.DataIndexError('Could not find record offset in index') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_PROCESS_TOKEN: - * e = errors.ParserError('Error processing token') - */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1814, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_DataIndexError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1814, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__100, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1814, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_e = __pyx_t_10; - __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1813 - * elif error == ADAPTER_ERROR_NO_FIELDS: - * e = errors.NoSuchFieldError('No fields found or no converters set') - * elif error == ADAPTER_ERROR_INDEX: # <<<<<<<<<<<<<< - * e = errors.DataIndexError('Could not find record offset in index') - * elif error == ADAPTER_ERROR_PROCESS_TOKEN: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1815 - * elif error == ADAPTER_ERROR_INDEX: - * e = errors.DataIndexError('Could not find record offset in index') - * elif error == ADAPTER_ERROR_PROCESS_TOKEN: # <<<<<<<<<<<<<< - * e = errors.ParserError('Error processing token') - * e.token = token - */ - __pyx_t_10 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_PROCESS_TOKEN); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1815, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_error, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1815, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1815, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1816 - * e = errors.DataIndexError('Could not find record offset in index') - * elif error == ADAPTER_ERROR_PROCESS_TOKEN: - * e = errors.ParserError('Error processing token') # <<<<<<<<<<<<<< - * e.token = token - * elif error == ADAPTER_ERROR_READ_TOKENS: - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1816, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ParserError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1816, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__101, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1816, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_e = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1817 - * elif error == ADAPTER_ERROR_PROCESS_TOKEN: - * e = errors.ParserError('Error processing token') - * e.token = token # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_READ_TOKENS: - * e = errors.ParserError('Error reading tokens') - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_e, __pyx_n_s_token, __pyx_v_token) < 0) __PYX_ERR(0, 1817, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1815 - * elif error == ADAPTER_ERROR_INDEX: - * e = errors.DataIndexError('Could not find record offset in index') - * elif error == ADAPTER_ERROR_PROCESS_TOKEN: # <<<<<<<<<<<<<< - * e = errors.ParserError('Error processing token') - * e.token = token - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1818 - * e = errors.ParserError('Error processing token') - * e.token = token - * elif error == ADAPTER_ERROR_READ_TOKENS: # <<<<<<<<<<<<<< - * e = errors.ParserError('Error reading tokens') - * e.token = token - */ - __pyx_t_2 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_READ_TOKENS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1818, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_RichCompare(__pyx_v_error, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1818, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1818, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1819 - * e.token = token - * elif error == ADAPTER_ERROR_READ_TOKENS: - * e = errors.ParserError('Error reading tokens') # <<<<<<<<<<<<<< - * e.token = token - * elif error == ADAPTER_ERROR_READ_RECORDS: - */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1819, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ParserError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1819, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__102, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1819, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_e = __pyx_t_10; - __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1820 - * elif error == ADAPTER_ERROR_READ_TOKENS: - * e = errors.ParserError('Error reading tokens') - * e.token = token # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_READ_RECORDS: - * e = errors.ParserError('Error reading records') - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_e, __pyx_n_s_token, __pyx_v_token) < 0) __PYX_ERR(0, 1820, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1818 - * e = errors.ParserError('Error processing token') - * e.token = token - * elif error == ADAPTER_ERROR_READ_TOKENS: # <<<<<<<<<<<<<< - * e = errors.ParserError('Error reading tokens') - * e.token = token - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1821 - * e = errors.ParserError('Error reading tokens') - * e.token = token - * elif error == ADAPTER_ERROR_READ_RECORDS: # <<<<<<<<<<<<<< - * e = errors.ParserError('Error reading records') - * e.token = token - */ - __pyx_t_10 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_READ_RECORDS); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_error, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1821, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1821, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1822 - * e.token = token - * elif error == ADAPTER_ERROR_READ_RECORDS: - * e = errors.ParserError('Error reading records') # <<<<<<<<<<<<<< - * e.token = token - * elif error == ADAPTER_ERROR_READ_EOF: - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ParserError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__103, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_e = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1823 - * elif error == ADAPTER_ERROR_READ_RECORDS: - * e = errors.ParserError('Error reading records') - * e.token = token # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_READ_EOF: - * e = errors.AdapterIndexError('Invalid record number or slice') - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_e, __pyx_n_s_token, __pyx_v_token) < 0) __PYX_ERR(0, 1823, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1821 - * e = errors.ParserError('Error reading tokens') - * e.token = token - * elif error == ADAPTER_ERROR_READ_RECORDS: # <<<<<<<<<<<<<< - * e = errors.ParserError('Error reading records') - * e.token = token - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1824 - * e = errors.ParserError('Error reading records') - * e.token = token - * elif error == ADAPTER_ERROR_READ_EOF: # <<<<<<<<<<<<<< - * e = errors.AdapterIndexError('Invalid record number or slice') - * elif error == ADAPTER_ERROR_INVALID_CHAR_CODE: - */ - __pyx_t_2 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_READ_EOF); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_RichCompare(__pyx_v_error, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1824, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1824, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1825 - * e.token = token - * elif error == ADAPTER_ERROR_READ_EOF: - * e = errors.AdapterIndexError('Invalid record number or slice') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_INVALID_CHAR_CODE: - * e = errors.ParserError('Invalid character in input data') - */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_AdapterIndexError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__104, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_e = __pyx_t_10; - __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1824 - * e = errors.ParserError('Error reading records') - * e.token = token - * elif error == ADAPTER_ERROR_READ_EOF: # <<<<<<<<<<<<<< - * e = errors.AdapterIndexError('Invalid record number or slice') - * elif error == ADAPTER_ERROR_INVALID_CHAR_CODE: - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1826 - * elif error == ADAPTER_ERROR_READ_EOF: - * e = errors.AdapterIndexError('Invalid record number or slice') - * elif error == ADAPTER_ERROR_INVALID_CHAR_CODE: # <<<<<<<<<<<<<< - * e = errors.ParserError('Invalid character in input data') - * e.token = token - */ - __pyx_t_10 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_INVALID_CHAR_CODE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1826, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_error, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":1827 - * e = errors.AdapterIndexError('Invalid record number or slice') - * elif error == ADAPTER_ERROR_INVALID_CHAR_CODE: - * e = errors.ParserError('Invalid character in input data') # <<<<<<<<<<<<<< - * e.token = token - * else: - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ParserError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__105, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_e = __pyx_t_2; - __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1828 - * elif error == ADAPTER_ERROR_INVALID_CHAR_CODE: - * e = errors.ParserError('Invalid character in input data') - * e.token = token # <<<<<<<<<<<<<< - * else: - * e = errors.AdapterException('Unknown text adapter error (code %d)' % error) - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_e, __pyx_n_s_token, __pyx_v_token) < 0) __PYX_ERR(0, 1828, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1826 - * elif error == ADAPTER_ERROR_READ_EOF: - * e = errors.AdapterIndexError('Invalid record number or slice') - * elif error == ADAPTER_ERROR_INVALID_CHAR_CODE: # <<<<<<<<<<<<<< - * e = errors.ParserError('Invalid character in input data') - * e.token = token - */ - goto __pyx_L3; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":1830 - * e.token = token - * else: - * e = errors.AdapterException('Unknown text adapter error (code %d)' % error) # <<<<<<<<<<<<<< - * - * e.field = field - */ - /*else*/ { - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_errors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_AdapterException); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_Unknown_text_adapter_error_code, __pyx_v_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - if (!__pyx_t_6) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1830, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_10}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1830, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_10}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1830, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_e = __pyx_t_2; - __pyx_t_2 = 0; - } - __pyx_L3:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1832 - * e = errors.AdapterException('Unknown text adapter error (code %d)' % error) - * - * e.field = field # <<<<<<<<<<<<<< - * e.record = record - * - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_e, __pyx_n_s_field, __pyx_v_field) < 0) __PYX_ERR(0, 1832, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1833 - * - * e.field = field - * e.record = record # <<<<<<<<<<<<<< - * - * return e - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_e, __pyx_n_s_record, __pyx_v_record) < 0) __PYX_ERR(0, 1833, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1835 - * e.record = record - * - * return e # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_e); - __pyx_r = __pyx_v_e; - goto __pyx_L0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1784 - * } - * - * def text_adapter_exception(error, convert_error=None, token=None, record=None, # <<<<<<<<<<<<<< - * field=None, dtype=None): - * """ - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter.text_adapter_exception", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_reason); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":197 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_copy_shape; - int __pyx_v_i; - int __pyx_v_ndim; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - int __pyx_v_t; - char *__pyx_v_f; - PyArray_Descr *__pyx_v_descr = 0; - int __pyx_v_offset; - int __pyx_v_hasfields; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - __Pyx_RefNannySetupContext("__getbuffer__", 0); - if (__pyx_v_info != NULL) { - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":203 - * # of flags - * - * if info == NULL: return # <<<<<<<<<<<<<< - * - * cdef int copy_shape, i, ndim - */ - __pyx_t_1 = ((__pyx_v_info == NULL) != 0); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":206 - * - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - */ - __pyx_v_endian_detector = 1; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":207 - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * - * ndim = PyArray_NDIM(self) - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":209 - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":211 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":212 - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * copy_shape = 1 # <<<<<<<<<<<<<< - * else: - * copy_shape = 0 - */ - __pyx_v_copy_shape = 1; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":211 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - goto __pyx_L4; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":214 - * copy_shape = 1 - * else: - * copy_shape = 0 # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - */ - /*else*/ { - __pyx_v_copy_shape = 0; - } - __pyx_L4:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L6_bool_binop_done; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":217 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not C contiguous") - * - */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L6_bool_binop_done:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - if (__pyx_t_1) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":218 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__106, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 218, __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_ERR(4, 218, __pyx_L1_error) - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":220 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L9_bool_binop_done; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":221 - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not Fortran contiguous") - * - */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L9_bool_binop_done:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":220 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - if (__pyx_t_1) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":222 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__107, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 222, __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_ERR(4, 222, __pyx_L1_error) - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":220 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":224 - * raise ValueError(u"ndarray is not Fortran contiguous") - * - * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< - * info.ndim = ndim - * if copy_shape: - */ - __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":225 - * - * info.buf = PyArray_DATA(self) - * info.ndim = ndim # <<<<<<<<<<<<<< - * if copy_shape: - * # Allocate new buffer for strides and shape info. - */ - __pyx_v_info->ndim = __pyx_v_ndim; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":226 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - */ - __pyx_t_1 = (__pyx_v_copy_shape != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":229 - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< - * info.shape = info.strides + ndim - * for i in range(ndim): - */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":230 - * # This is allocated as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim # <<<<<<<<<<<<<< - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - */ - __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":231 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim - * for i in range(ndim): # <<<<<<<<<<<<<< - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] - */ - __pyx_t_4 = __pyx_v_ndim; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":232 - * info.shape = info.strides + ndim - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":233 - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< - * else: - * info.strides = PyArray_STRIDES(self) - */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":226 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - */ - goto __pyx_L11; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":235 - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - */ - /*else*/ { - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":236 - * else: - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); - } - __pyx_L11:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":237 - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) - */ - __pyx_v_info->suboffsets = NULL; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":238 - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< - * info.readonly = not PyArray_ISWRITEABLE(self) - * - */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":239 - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< - * - * cdef int t - */ - __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":242 - * - * cdef int t - * cdef char* f = NULL # <<<<<<<<<<<<<< - * cdef dtype descr = self.descr - * cdef int offset - */ - __pyx_v_f = NULL; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":243 - * cdef int t - * cdef char* f = NULL - * cdef dtype descr = self.descr # <<<<<<<<<<<<<< - * cdef int offset - * - */ - __pyx_t_3 = ((PyObject *)__pyx_v_self->descr); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":246 - * cdef int offset - * - * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * - * if not hasfields and not copy_shape: - */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":248 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L15_bool_binop_done:; - if (__pyx_t_1) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":250 - * if not hasfields and not copy_shape: - * # do not call releasebuffer - * info.obj = None # <<<<<<<<<<<<<< - * else: - * # need to call releasebuffer - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = Py_None; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":248 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - goto __pyx_L14; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":253 - * else: - * # need to call releasebuffer - * info.obj = self # <<<<<<<<<<<<<< - * - * if not hasfields: - */ - /*else*/ { - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - } - __pyx_L14:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":255 - * info.obj = self - * - * if not hasfields: # <<<<<<<<<<<<<< - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - */ - __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":256 - * - * if not hasfields: - * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - */ - __pyx_t_4 = __pyx_v_descr->type_num; - __pyx_v_t = __pyx_t_4; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":257 - * if not hasfields: - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0); - if (!__pyx_t_2) { - goto __pyx_L20_next_or; - } else { - } - __pyx_t_2 = (__pyx_v_little_endian != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L19_bool_binop_done; - } - __pyx_L20_next_or:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":258 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - */ - __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L19_bool_binop_done; - } - __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L19_bool_binop_done:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":257 - * if not hasfields: - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - if (__pyx_t_1) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":259 - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__108, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 259, __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_ERR(4, 259, __pyx_L1_error) - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":257 - * if not hasfields: - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":260 - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - */ - switch (__pyx_v_t) { - case NPY_BYTE: - __pyx_v_f = ((char *)"b"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":261 - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - */ - case NPY_UBYTE: - __pyx_v_f = ((char *)"B"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":262 - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - */ - case NPY_SHORT: - __pyx_v_f = ((char *)"h"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":263 - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - */ - case NPY_USHORT: - __pyx_v_f = ((char *)"H"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":264 - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - */ - case NPY_INT: - __pyx_v_f = ((char *)"i"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":265 - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - */ - case NPY_UINT: - __pyx_v_f = ((char *)"I"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":266 - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - */ - case NPY_LONG: - __pyx_v_f = ((char *)"l"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":267 - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - */ - case NPY_ULONG: - __pyx_v_f = ((char *)"L"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":268 - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - */ - case NPY_LONGLONG: - __pyx_v_f = ((char *)"q"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":269 - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - */ - case NPY_ULONGLONG: - __pyx_v_f = ((char *)"Q"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":270 - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - */ - case NPY_FLOAT: - __pyx_v_f = ((char *)"f"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":271 - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - */ - case NPY_DOUBLE: - __pyx_v_f = ((char *)"d"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":272 - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - */ - case NPY_LONGDOUBLE: - __pyx_v_f = ((char *)"g"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":273 - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - */ - case NPY_CFLOAT: - __pyx_v_f = ((char *)"Zf"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":274 - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" - */ - case NPY_CDOUBLE: - __pyx_v_f = ((char *)"Zd"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":275 - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f = "O" - * else: - */ - case NPY_CLONGDOUBLE: - __pyx_v_f = ((char *)"Zg"); - break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":276 - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - case NPY_OBJECT: - __pyx_v_f = ((char *)"O"); - break; - default: - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":278 - * elif t == NPY_OBJECT: f = "O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * info.format = f - * return - */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(4, 278, __pyx_L1_error) - break; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":279 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f # <<<<<<<<<<<<<< - * return - * else: - */ - __pyx_v_info->format = __pyx_v_f; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":280 - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f - * return # <<<<<<<<<<<<<< - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":255 - * info.obj = self - * - * if not hasfields: # <<<<<<<<<<<<<< - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - */ - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":282 - * return - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 - */ - /*else*/ { - __pyx_v_info->format = ((char *)malloc(0xFF)); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":283 - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, - */ - (__pyx_v_info->format[0]) = '^'; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":284 - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 # <<<<<<<<<<<<<< - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - */ - __pyx_v_offset = 0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":285 - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< - * info.format + _buffer_format_string_len, - * &offset) - */ - __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) __PYX_ERR(4, 285, __pyx_L1_error) - __pyx_v_f = __pyx_t_7; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":288 - * info.format + _buffer_format_string_len, - * &offset) - * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - */ - (__pyx_v_f[0]) = '\x00'; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":197 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(Py_None); - __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; - } - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":290 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - -/* Python wrapper */ -static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); - __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":291 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":292 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) - */ - free(__pyx_v_info->format); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":291 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":293 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block - */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":294 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block - * - */ - free(__pyx_v_info->strides); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":293 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block - */ - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":290 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":770 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":771 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew2(a, b): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 771, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":770 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":773 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":774 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":773 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":776 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":777 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 777, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":776 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":779 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":780 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":779 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":782 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":783 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 783, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":782 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":785 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child = 0; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - PyObject *__pyx_v_fields = 0; - PyObject *__pyx_v_childname = NULL; - PyObject *__pyx_v_new_offset = NULL; - PyObject *__pyx_v_t = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - long __pyx_t_8; - char *__pyx_t_9; - __Pyx_RefNannySetupContext("_util_dtypestring", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":790 - * - * cdef dtype child - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * cdef tuple fields - */ - __pyx_v_endian_detector = 1; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":791 - * cdef dtype child - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * cdef tuple fields - * - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":794 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - if (unlikely(__pyx_v_descr->names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(4, 794, __pyx_L1_error) - } - __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - for (;;) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(4, 794, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 794, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); - __pyx_t_3 = 0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":795 - * - * for childname in descr.names: - * fields = descr.fields[childname] # <<<<<<<<<<<<<< - * child, new_offset = fields - * - */ - if (unlikely(__pyx_v_descr->fields == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(4, 795, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 795, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(4, 795, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":796 - * for childname in descr.names: - * fields = descr.fields[childname] - * child, new_offset = fields # <<<<<<<<<<<<<< - * - * if (end - f) - (new_offset - offset[0]) < 15: - */ - if (likely(__pyx_v_fields != Py_None)) { - PyObject* sequence = __pyx_v_fields; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(4, 796, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(4, 796, __pyx_L1_error) - } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(4, 796, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); - __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); - __pyx_t_4 = 0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":798 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 798, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); - if (__pyx_t_6) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":799 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == c'>' and little_endian) or - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__109, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 799, __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_ERR(4, 799, __pyx_L1_error) - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":798 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":801 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); - if (!__pyx_t_7) { - goto __pyx_L8_next_or; - } else { - } - __pyx_t_7 = (__pyx_v_little_endian != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L7_bool_binop_done; - } - __pyx_L8_next_or:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":802 - * - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * # One could encode it in the format string and have Cython - */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); - if (__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_6 = __pyx_t_7; - __pyx_L7_bool_binop_done:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":801 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - if (__pyx_t_6) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":803 - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__110, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 803, __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_ERR(4, 803, __pyx_L1_error) - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":801 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":813 - * - * # Output padding bytes - * while offset[0] < new_offset: # <<<<<<<<<<<<<< - * f[0] = 120 # "x"; pad byte - * f += 1 - */ - while (1) { - __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 813, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 813, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 813, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_6) break; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":814 - * # Output padding bytes - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< - * f += 1 - * offset[0] += 1 - */ - (__pyx_v_f[0]) = 0x78; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":815 - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte - * f += 1 # <<<<<<<<<<<<<< - * offset[0] += 1 - * - */ - __pyx_v_f = (__pyx_v_f + 1); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":816 - * f[0] = 120 # "x"; pad byte - * f += 1 - * offset[0] += 1 # <<<<<<<<<<<<<< - * - * offset[0] += child.itemsize - */ - __pyx_t_8 = 0; - (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":818 - * offset[0] += 1 - * - * offset[0] += child.itemsize # <<<<<<<<<<<<<< - * - * if not PyDataType_HASFIELDS(child): - */ - __pyx_t_8 = 0; - (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":820 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); - if (__pyx_t_6) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":821 - * - * if not PyDataType_HASFIELDS(child): - * t = child.type_num # <<<<<<<<<<<<<< - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); - __pyx_t_4 = 0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":822 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); - if (__pyx_t_6) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":823 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__111, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(4, 823, __pyx_L1_error) - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":822 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":826 - * - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 826, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 98; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":827 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 827, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 827, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 66; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":828 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 828, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 828, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x68; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":829 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 829, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 829, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 72; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":830 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 830, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 830, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x69; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":831 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 831, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 831, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 831, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 73; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":832 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 832, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 832, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 832, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x6C; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":833 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 833, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 833, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 833, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 76; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":834 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 834, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 834, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x71; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":835 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 835, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 835, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 81; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":836 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 836, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 836, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x66; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":837 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 837, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 837, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x64; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":838 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 838, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 838, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x67; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":839 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 839, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 839, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x66; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":840 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 840, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 840, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x64; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":841 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 841, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 841, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x67; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":842 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 842, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 842, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 842, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 79; - goto __pyx_L15; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":844 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: - */ - /*else*/ { - __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 844, __pyx_L1_error) - } - __pyx_L15:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":845 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * # Cython ignores struct boundary information ("T{...}"), - */ - __pyx_v_f = (__pyx_v_f + 1); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":820 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - goto __pyx_L13; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":849 - * # Cython ignores struct boundary information ("T{...}"), - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< - * return f - * - */ - /*else*/ { - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) __PYX_ERR(4, 849, __pyx_L1_error) - __pyx_v_f = __pyx_t_9; - } - __pyx_L13:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":794 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":850 - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) - * return f # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_f; - goto __pyx_L0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":785 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_child); - __Pyx_XDECREF(__pyx_v_fields); - __Pyx_XDECREF(__pyx_v_childname); - __Pyx_XDECREF(__pyx_v_new_offset); - __Pyx_XDECREF(__pyx_v_t); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":966 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: - */ - -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - PyObject *__pyx_v_baseptr; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("set_array_base", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":968 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_base == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":969 - * cdef PyObject* baseptr - * if base is None: - * baseptr = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(base) # important to do this before decref below! - */ - __pyx_v_baseptr = NULL; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":968 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - goto __pyx_L3; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":971 - * baseptr = NULL - * else: - * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< - * baseptr = base - * Py_XDECREF(arr.base) - */ - /*else*/ { - Py_INCREF(__pyx_v_base); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":972 - * else: - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base # <<<<<<<<<<<<<< - * Py_XDECREF(arr.base) - * arr.base = baseptr - */ - __pyx_v_baseptr = ((PyObject *)__pyx_v_base); - } - __pyx_L3:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":973 - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base - * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< - * arr.base = baseptr - * - */ - Py_XDECREF(__pyx_v_arr->base); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":974 - * baseptr = base - * Py_XDECREF(arr.base) - * arr.base = baseptr # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - __pyx_v_arr->base = __pyx_v_baseptr; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":966 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":976 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":977 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":978 - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: - * return None # <<<<<<<<<<<<<< - * else: - * return arr.base - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":977 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":980 - * return None - * else: - * return arr.base # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); - __pyx_r = ((PyObject *)__pyx_v_arr->base); - goto __pyx_L0; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":976 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":985 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * _import_array() - */ - -static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("import_array", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":986 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * _import_array() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __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:*/ { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":987 - * cdef inline int import_array() except -1: - * try: - * _import_array() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") - */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(4, 987, __pyx_L3_error) - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":986 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * _import_array() - * except Exception: - */ - } - __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_L10_try_end; - __pyx_L3_error:; - __Pyx_PyThreadState_assign - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":988 - * try: - * _import_array() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.multiarray failed to import") - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(4, 988, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":989 - * _import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_umath() except -1: - */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__112, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 989, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(4, 989, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":986 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * _import_array() - * except Exception: - */ - __Pyx_PyThreadState_assign - __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_L10_try_end:; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":985 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * _import_array() - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":991 - * raise ImportError("numpy.core.multiarray failed to import") - * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - -static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("import_umath", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":992 - * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __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:*/ { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":993 - * cdef inline int import_umath() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") - */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(4, 993, __pyx_L3_error) - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":992 - * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - } - __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_L10_try_end; - __pyx_L3_error:; - __Pyx_PyThreadState_assign - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":994 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(4, 994, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":995 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_ufunc() except -1: - */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__113, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 995, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(4, 995, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":992 - * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - __Pyx_PyThreadState_assign - __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_L10_try_end:; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":991 - * raise ImportError("numpy.core.multiarray failed to import") - * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":997 - * raise ImportError("numpy.core.umath failed to import") - * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - -static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("import_ufunc", 0); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":998 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __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:*/ { - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":999 - * cdef inline int import_ufunc() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") - */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(4, 999, __pyx_L3_error) - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":998 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - } - __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_L10_try_end; - __pyx_L3_error:; - __Pyx_PyThreadState_assign - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1000 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(4, 1000, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1001 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__114, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 1001, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(4, 1001, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":998 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - __Pyx_PyThreadState_assign - __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_L10_try_end:; - } - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":997 - * raise ImportError("numpy.core.umath failed to import") - * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - if (unlikely(__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc(PyObject *o) { - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_12ArrayDealloc_3__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - (*Py_TYPE(o)->tp_free)(o); -} - -static PyMethodDef __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.ArrayDealloc", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|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*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc, /*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_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator __pyx_vtable_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *)o); - p->__pyx_vtab = __pyx_vtabptr_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator; - p->converter = Py_None; Py_INCREF(Py_None); - p->dtype = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_1__cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator(PyObject *o) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->converter); - Py_CLEAR(p->dtype); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *)o; - if (p->converter) { - e = (*v)(p->converter, a); if (e) return e; - } - if (p->dtype) { - e = (*v)(p->dtype, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *)o; - tmp = ((PyObject*)p->converter); - p->converter = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->dtype); - p->dtype = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.ConverterDecorator", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_3__call__, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator, /*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_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)o); - p->encoding = Py_None; Py_INCREF(Py_None); - p->compression = Py_None; Py_INCREF(Py_None); - p->REC_CHUNK_SIZE = Py_None; Py_INCREF(Py_None); - p->exact_index = Py_None; Py_INCREF(Py_None); - p->indexing = Py_None; Py_INCREF(Py_None); - p->mapping = Py_None; Py_INCREF(Py_None); - p->_field_names = Py_None; Py_INCREF(Py_None); - p->_field_filter = Py_None; Py_INCREF(Py_None); - p->fill_values = Py_None; Py_INCREF(Py_None); - p->loose_fill = Py_None; Py_INCREF(Py_None); - p->build_converter = Py_None; Py_INCREF(Py_None); - p->converter_objects = Py_None; Py_INCREF(Py_None); - p->default_output = Py_None; Py_INCREF(Py_None); - p->logger = Py_None; Py_INCREF(Py_None); - p->missing_values = Py_None; Py_INCREF(Py_None); - p->data = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(PyObject *o) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_7__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->encoding); - Py_CLEAR(p->compression); - Py_CLEAR(p->REC_CHUNK_SIZE); - Py_CLEAR(p->exact_index); - Py_CLEAR(p->indexing); - Py_CLEAR(p->mapping); - Py_CLEAR(p->_field_names); - Py_CLEAR(p->_field_filter); - Py_CLEAR(p->fill_values); - Py_CLEAR(p->loose_fill); - Py_CLEAR(p->build_converter); - Py_CLEAR(p->converter_objects); - Py_CLEAR(p->default_output); - Py_CLEAR(p->logger); - Py_CLEAR(p->missing_values); - Py_CLEAR(p->data); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)o; - if (p->encoding) { - e = (*v)(p->encoding, a); if (e) return e; - } - if (p->compression) { - e = (*v)(p->compression, a); if (e) return e; - } - if (p->REC_CHUNK_SIZE) { - e = (*v)(p->REC_CHUNK_SIZE, a); if (e) return e; - } - if (p->exact_index) { - e = (*v)(p->exact_index, a); if (e) return e; - } - if (p->indexing) { - e = (*v)(p->indexing, a); if (e) return e; - } - if (p->mapping) { - e = (*v)(p->mapping, a); if (e) return e; - } - if (p->_field_names) { - e = (*v)(p->_field_names, a); if (e) return e; - } - if (p->_field_filter) { - e = (*v)(p->_field_filter, a); if (e) return e; - } - if (p->fill_values) { - e = (*v)(p->fill_values, a); if (e) return e; - } - if (p->loose_fill) { - e = (*v)(p->loose_fill, a); if (e) return e; - } - if (p->build_converter) { - e = (*v)(p->build_converter, a); if (e) return e; - } - if (p->converter_objects) { - e = (*v)(p->converter_objects, a); if (e) return e; - } - if (p->default_output) { - e = (*v)(p->default_output, a); if (e) return e; - } - if (p->logger) { - e = (*v)(p->logger, a); if (e) return e; - } - if (p->missing_values) { - e = (*v)(p->missing_values, a); if (e) return e; - } - if (p->data) { - e = (*v)(p->data, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)o; - tmp = ((PyObject*)p->encoding); - p->encoding = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->compression); - p->compression = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->REC_CHUNK_SIZE); - p->REC_CHUNK_SIZE = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->exact_index); - p->exact_index = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->indexing); - p->indexing = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->mapping); - p->mapping = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_field_names); - p->_field_names = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_field_filter); - p->_field_filter = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->fill_values); - p->fill_values = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->loose_fill); - p->loose_fill = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->build_converter); - p->build_converter = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->converter_objects); - p->converter_objects = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->default_output); - p->default_output = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->logger); - p->logger = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->missing_values); - p->missing_values = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->data); - p->data = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} -static PyObject *__pyx_sq_item_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(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 PyObject *__pyx_getprop_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_size(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_4size_1__get__(o); -} - -static PyObject *__pyx_getprop_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_field_count(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11field_count_1__get__(o); -} - -static PyMethodDef __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_TextAdapter[] = { - {"__init_text_adapter", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_3__init_text_adapter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_2__init_text_adapter}, - {"close", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_5close, METH_NOARGS, 0}, - {"get_field_filter", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_9get_field_filter, METH_NOARGS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_8get_field_filter}, - {"set_field_filter", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_11set_field_filter, METH_O, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_10set_field_filter}, - {"get_field_names", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_13get_field_names, METH_NOARGS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_12get_field_names}, - {"set_field_names", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_15set_field_names, METH_O, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_14set_field_names}, - {"get_field_types", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_17get_field_types, METH_NOARGS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_16get_field_types}, - {"set_field_types", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_19set_field_types, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_18set_field_types}, - {"create_index", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_21create_index, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_20create_index}, - {"set_converter", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_23set_converter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_22set_converter}, - {"__build_python_converter", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_25__build_python_converter, METH_VARARGS|METH_KEYWORDS, 0}, - {"set_missing_values", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_27set_missing_values, METH_O, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_26set_missing_values}, - {"set_fill_values", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_29set_fill_values, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_28set_fill_values}, - {"__set_fill_values", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_31__set_fill_values, METH_O, 0}, - {"to_array", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_33to_array, METH_NOARGS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_32to_array}, - {"to_dataframe", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_35to_dataframe, METH_NOARGS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_34to_dataframe}, - {"__parse_slice", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_39__parse_slice, METH_O, 0}, - {"__read_slice_infer_types", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_41__read_slice_infer_types, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_40__read_slice_infer_types}, - {"__infer_types", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_43__infer_types, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_42__infer_types}, - {"__read_slice", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_45__read_slice, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_44__read_slice}, - {"__build_converters", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_47__build_converters, METH_NOARGS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_46__build_converters}, - {"__get_mapping_from_converters", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_49__get_mapping_from_converters, METH_NOARGS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_48__get_mapping_from_converters}, - {"__set_dtype_converter", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_51__set_dtype_converter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_50__set_dtype_converter}, - {"__raise_adapter_exception", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_53__raise_adapter_exception, METH_O, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_5TextAdapter_11textadapter_11TextAdapter_TextAdapter[] = { - {(char *)"size", __pyx_getprop_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_size, 0, (char *)" Returns number of records in data. ", 0}, - {(char *)"field_count", __pyx_getprop_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_field_count, 0, (char *)" Returns number of fields in data. ", 0}, - {0, 0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_TextAdapter = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*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_TextAdapter = { - 0, /*mp_length*/ - __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_37__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter_TextAdapter = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.TextAdapter", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_TextAdapter, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_TextAdapter, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "\n TextAdapter objects read CSV data and output a numpy array or Pandas\n DataFrame containing the data converted to appropriate data types. The\n following features are currently implemented:\n\n * parse CSV data very fast using minimal memory - The TextAdapter core is\n written in C to ensure text is parsed as fast as data can be read from\n disk. Text is read and parsed in small chunks instead of reading whole\n datasets into memory at once, which enables very large datasets to be\n read and parsed without running out of memory.\n\n * use basic slicing notation to examine subsets of CSV records - Basic\n Numpy style slicing notation can be used to specify the subset of records\n to be read from file.\n\n * define records and fields by delimiter character, fixed field widths, or\n regular expression - In additional to specifying a delimiter character,\n fields can be specified by fixed field widths as well as a regular\n expression. This enables a larger variety of CSV and CSV-like text files\n to be parsed.\n\n * parse gzipped CSV data - Gzipped data can be parsed without having to\n uncompress it first. Parsing speed is about the same as an uncompressed\n version of same data.\n\n * build index of CSV records to enable random access, and save index to\n disk - An index of record offsets can be build to allow fast random\n access to records.\n\n * define converter functions for each field in python, or cython\n compiled function - Converter functions can be specified for converting\n parsed text to proper dtype for storing in Numpy array. Converter\n functions can be defined in Python or Cython.\n\n * define dtype of Numpy record array to store parsed data - As each record\n is parsed, the fields are converted to specified dtype and stored in\n Numpy struct array.\n ", /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*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_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = __pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(t, a, k); - if (unlikely(!o)) return 0; - if (unlikely(__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_14CSVTextAdapter_1__cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static PyMethodDef __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.CSVTextAdapter", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "\n CSV adapter for parsing CSV data using delimiter character.\n\n Arguments (in addition to TextAdapter base class arguments):\n delimiter - delimiter character that separates fields in record\n ", /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter, /*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_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = __pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(t, a, k); - if (unlikely(!o)) return 0; - if (unlikely(__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_21FixedWidthTextAdapter_1__cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static PyMethodDef __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.FixedWidthTextAdapter", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "\n CSV adapter for parsing CSV data with fixed width fields.\n\n Arguments (in addition to TextAdapter base class arguments):\n field_widths - list of field widths, or single field width for all fields\n ", /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter, /*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_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = __pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(t, a, k); - if (unlikely(!o)) return 0; - if (unlikely(__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_1__cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter(PyObject *o) { - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_15JSONTextAdapter_3__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - PyObject_GC_Track(o); - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(o); -} - -static PyMethodDef __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.JSONTextAdapter", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter, /*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_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *p; - PyObject *o = __pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *)o); - p->temp = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter_1__cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter(PyObject *o) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_16RegexTextAdapter_3__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->temp); - PyObject_GC_Track(o); - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(o); -} - -static int __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *)o; - e = __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(o, v, a); if (e) return e; - if (p->temp) { - e = (*v)(p->temp, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter *)o; - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter_TextAdapter(o); - tmp = ((PyObject*)p->temp); - p->temp = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.RegexTextAdapter", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "\n CSV adapter for parsing csv data using regular expressions.\n\n Arguments (in addition to TextAdapter base class arguments):\n regex_string - regular expression string that defines fields in record\n ", /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter, /*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_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_LineIter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - return o; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_LineIter(PyObject *o) { - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - (*Py_TYPE(o)->tp_free)(o); -} - -static PyMethodDef __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_LineIter[] = { - {"__iter", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8LineIter_1__iter, METH_NOARGS, 0}, - {"__next__", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8LineIter_3__next__, METH_NOARGS|METH_COEXIST, 0}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter_LineIter = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.LineIter", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_LineIter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_LineIter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|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*/ - 0, /*tp_iter*/ - __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_8LineIter_3__next__, /*tp_iternext*/ - __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_LineIter, /*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_5TextAdapter_11textadapter_11TextAdapter_LineIter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_RecordIter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - return o; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_RecordIter(PyObject *o) { - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - (*Py_TYPE(o)->tp_free)(o); -} - -static PyMethodDef __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_RecordIter[] = { - {"__iter", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10RecordIter_1__iter, METH_NOARGS, 0}, - {"__next__", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10RecordIter_3__next__, METH_NOARGS|METH_COEXIST, 0}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter_RecordIter = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.RecordIter", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_RecordIter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_RecordIter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|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*/ - 0, /*tp_iter*/ - __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_10RecordIter_3__next__, /*tp_iternext*/ - __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_RecordIter, /*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_5TextAdapter_11textadapter_11TextAdapter_RecordIter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - return o; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter(PyObject *o) { - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - (*Py_TYPE(o)->tp_free)(o); -} - -static PyMethodDef __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter[] = { - {"__iter", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter_1__iter, METH_NOARGS, 0}, - {"__next__", (PyCFunction)__pyx_pw_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter_3__next__, METH_NOARGS|METH_COEXIST, 0}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.JSONRecordIter", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|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*/ - 0, /*tp_iter*/ - __pyx_pw_5TextAdapter_11textadapter_11TextAdapter_14JSONRecordIter_3__next__, /*tp_iternext*/ - __pyx_methods_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter, /*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_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter[8]; -static int __pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter = 0; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter)))) { - o = (PyObject*)__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter[--__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter]; - memset(o, 0, sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter(PyObject *o) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter)))) { - __pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter[__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter++] = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *)o; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.__pyx_scope_struct__set_field_filter", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*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_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr[8]; -static int __pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr = 0; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr)))) { - o = (PyObject*)__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr[--__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr(PyObject *o) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_outer_scope); - Py_CLEAR(p->__pyx_v_x); - Py_CLEAR(p->__pyx_t_0); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr)))) { - __pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr[__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_x) { - e = (*v)(p->__pyx_v_x, a); if (e) return e; - } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr *)o; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_x); - p->__pyx_v_x = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.__pyx_scope_struct_1_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*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_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names[8]; -static int __pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names = 0; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names)))) { - o = (PyObject*)__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names[--__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names]; - memset(o, 0, sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names(PyObject *o) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names)))) { - __pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names[__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names++] = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *)o; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.__pyx_scope_struct_2_set_field_names", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*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_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr[8]; -static int __pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr = 0; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr)))) { - o = (PyObject*)__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr[--__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr(PyObject *o) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_outer_scope); - Py_CLEAR(p->__pyx_v_x); - Py_CLEAR(p->__pyx_t_0); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr)))) { - __pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr[__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_x) { - e = (*v)(p->__pyx_v_x, a); if (e) return e; - } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr *)o; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_x); - p->__pyx_v_x = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.__pyx_scope_struct_3_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*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_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types[8]; -static int __pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types = 0; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types)))) { - o = (PyObject*)__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types[--__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types]; - memset(o, 0, sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types(PyObject *o) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types)))) { - __pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types[__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types++] = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *)o; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.__pyx_scope_struct_4_set_field_types", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*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_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr[8]; -static int __pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr = 0; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr)))) { - o = (PyObject*)__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr[--__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr(PyObject *o) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_outer_scope); - Py_CLEAR(p->__pyx_v_dtype); - Py_CLEAR(p->__pyx_v_field); - Py_CLEAR(p->__pyx_t_0); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr)))) { - __pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr[__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_dtype) { - e = (*v)(p->__pyx_v_dtype, a); if (e) return e; - } - if (p->__pyx_v_field) { - e = (*v)(p->__pyx_v_field, a); if (e) return e; - } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr *)o; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_dtype); - p->__pyx_v_dtype = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_field); - p->__pyx_v_field = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.__pyx_scope_struct_5_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*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_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter[8]; -static int __pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter = 0; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter)))) { - o = (PyObject*)__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter[--__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter]; - memset(o, 0, sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter(PyObject *o) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_converter); - Py_CLEAR(p->__pyx_v_field); - Py_CLEAR(p->__pyx_v_self); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter)))) { - __pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter[__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter++] = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *)o; - if (p->__pyx_v_converter) { - e = (*v)(p->__pyx_v_converter, a); if (e) return e; - } - if (p->__pyx_v_field) { - e = (*v)(p->__pyx_v_field, a); if (e) return e; - } - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter *)o; - tmp = ((PyObject*)p->__pyx_v_converter); - p->__pyx_v_converter = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_field); - p->__pyx_v_field = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_TextAdapter *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.__pyx_scope_struct_6_set_converter", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*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_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__[8]; -static int __pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ = 0; - -static PyObject *__pyx_tp_new_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__)))) { - o = (PyObject*)__pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__[--__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__]; - memset(o, 0, sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__(PyObject *o) { - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_count_fields); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__)))) { - __pyx_freelist_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__[__pyx_freecount_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__++] = ((struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *)o; - if (p->__pyx_v_count_fields) { - e = (*v)(p->__pyx_v_count_fields, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *p = (struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ *)o; - tmp = ((PyObject*)p->__pyx_v_count_fields); - p->__pyx_v_count_fields = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ = { - PyVarObject_HEAD_INIT(0, 0) - "TextAdapter.textadapter.TextAdapter.__pyx_scope_struct_7___cinit__", /*tp_name*/ - sizeof(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__, /*tp_traverse*/ - __pyx_tp_clear_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*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_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "TextAdapter", - 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_0_encoding_not_supported_yet, __pyx_k_0_encoding_not_supported_yet, sizeof(__pyx_k_0_encoding_not_supported_yet), 0, 0, 1, 0}, - {&__pyx_kp_s_1_6, __pyx_k_1_6, sizeof(__pyx_k_1_6), 0, 0, 1, 0}, - {&__pyx_kp_s_2_7, __pyx_k_2_7, sizeof(__pyx_k_2_7), 0, 0, 1, 0}, - {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, - {&__pyx_n_s_AdapterException, __pyx_k_AdapterException, sizeof(__pyx_k_AdapterException), 0, 0, 1, 1}, - {&__pyx_n_s_AdapterIndexError, __pyx_k_AdapterIndexError, sizeof(__pyx_k_AdapterIndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Adapter_has_no_fields_specified, __pyx_k_Adapter_has_no_fields_specified, sizeof(__pyx_k_Adapter_has_no_fields_specified), 0, 0, 1, 0}, - {&__pyx_n_s_ArgumentError, __pyx_k_ArgumentError, sizeof(__pyx_k_ArgumentError), 0, 0, 1, 1}, - {&__pyx_n_s_BytesIO, __pyx_k_BytesIO, sizeof(__pyx_k_BytesIO), 0, 0, 1, 1}, - {&__pyx_n_s_CHECKSUM_OFFSET, __pyx_k_CHECKSUM_OFFSET, sizeof(__pyx_k_CHECKSUM_OFFSET), 0, 0, 1, 1}, - {&__pyx_n_s_CHECKSUM_SIZE, __pyx_k_CHECKSUM_SIZE, sizeof(__pyx_k_CHECKSUM_SIZE), 0, 0, 1, 1}, - {&__pyx_n_s_CS, __pyx_k_CS, sizeof(__pyx_k_CS), 0, 0, 1, 1}, - {&__pyx_n_s_CSVTextAdapter, __pyx_k_CSVTextAdapter, sizeof(__pyx_k_CSVTextAdapter), 0, 0, 1, 1}, - {&__pyx_kp_s_Cannot_open_data_source_of_type, __pyx_k_Cannot_open_data_source_of_type, sizeof(__pyx_k_Cannot_open_data_source_of_type), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_use_s3_interface_boto_not, __pyx_k_Cannot_use_s3_interface_boto_not, sizeof(__pyx_k_Cannot_use_s3_interface_boto_not), 0, 0, 1, 0}, - {&__pyx_n_s_ConfigurationError, __pyx_k_ConfigurationError, sizeof(__pyx_k_ConfigurationError), 0, 0, 1, 1}, - {&__pyx_kp_s_Could_not_convert_token_0_at_rec, __pyx_k_Could_not_convert_token_0_at_rec, sizeof(__pyx_k_Could_not_convert_token_0_at_rec), 0, 0, 1, 0}, - {&__pyx_kp_s_Could_not_find_record_offset_in, __pyx_k_Could_not_find_record_offset_in, sizeof(__pyx_k_Could_not_find_record_offset_in), 0, 0, 1, 0}, - {&__pyx_kp_s_Could_not_initialize_data_source, __pyx_k_Could_not_initialize_data_source, sizeof(__pyx_k_Could_not_initialize_data_source), 0, 0, 1, 0}, - {&__pyx_kp_s_Could_not_initialize_text_adapte, __pyx_k_Could_not_initialize_text_adapte, sizeof(__pyx_k_Could_not_initialize_text_adapte), 0, 0, 1, 0}, - {&__pyx_n_s_DEBUG, __pyx_k_DEBUG, sizeof(__pyx_k_DEBUG), 0, 0, 1, 1}, - {&__pyx_n_s_DENSITY_OFFSET, __pyx_k_DENSITY_OFFSET, sizeof(__pyx_k_DENSITY_OFFSET), 0, 0, 1, 1}, - {&__pyx_n_s_DataFrame, __pyx_k_DataFrame, sizeof(__pyx_k_DataFrame), 0, 0, 1, 1}, - {&__pyx_n_s_DataIndexError, __pyx_k_DataIndexError, sizeof(__pyx_k_DataIndexError), 0, 0, 1, 1}, - {&__pyx_n_s_DataTypeError, __pyx_k_DataTypeError, sizeof(__pyx_k_DataTypeError), 0, 0, 1, 1}, - {&__pyx_n_s_EOFError, __pyx_k_EOFError, sizeof(__pyx_k_EOFError), 0, 0, 1, 1}, - {&__pyx_n_s_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 0, 1, 1}, - {&__pyx_kp_s_Error_processing_token, __pyx_k_Error_processing_token, sizeof(__pyx_k_Error_processing_token), 0, 0, 1, 0}, - {&__pyx_kp_s_Error_reading_records, __pyx_k_Error_reading_records, sizeof(__pyx_k_Error_reading_records), 0, 0, 1, 0}, - {&__pyx_kp_s_Error_reading_tokens, __pyx_k_Error_reading_tokens, sizeof(__pyx_k_Error_reading_tokens), 0, 0, 1, 0}, - {&__pyx_n_s_ExactIndex, __pyx_k_ExactIndex, sizeof(__pyx_k_ExactIndex), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex___init, __pyx_k_ExactIndex___init, sizeof(__pyx_k_ExactIndex___init), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex___len, __pyx_k_ExactIndex___len, sizeof(__pyx_k_ExactIndex___len), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex_add_gzip_access_point, __pyx_k_ExactIndex_add_gzip_access_point, sizeof(__pyx_k_ExactIndex_add_gzip_access_point), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex_close, __pyx_k_ExactIndex_close, sizeof(__pyx_k_ExactIndex_close), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex_create_disk_index, __pyx_k_ExactIndex_create_disk_index, sizeof(__pyx_k_ExactIndex_create_disk_index), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex_finalize, __pyx_k_ExactIndex_finalize, sizeof(__pyx_k_ExactIndex_finalize), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex_get_density, __pyx_k_ExactIndex_get_density, sizeof(__pyx_k_ExactIndex_get_density), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex_get_gzip_access_point, __pyx_k_ExactIndex_get_gzip_access_point, sizeof(__pyx_k_ExactIndex_get_gzip_access_point), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex_get_offset, __pyx_k_ExactIndex_get_offset, sizeof(__pyx_k_ExactIndex_get_offset), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex_open_disk_index, __pyx_k_ExactIndex_open_disk_index, sizeof(__pyx_k_ExactIndex_open_disk_index), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex_open_s3_index, __pyx_k_ExactIndex_open_s3_index, sizeof(__pyx_k_ExactIndex_open_s3_index), 0, 0, 1, 1}, - {&__pyx_n_s_ExactIndex_set_offset, __pyx_k_ExactIndex_set_offset, sizeof(__pyx_k_ExactIndex_set_offset), 0, 0, 1, 1}, - {&__pyx_kp_s_Field_must_be_int_or_string, __pyx_k_Field_must_be_int_or_string, sizeof(__pyx_k_Field_must_be_int_or_string), 0, 0, 1, 0}, - {&__pyx_n_s_FixedWidthTextAdapter, __pyx_k_FixedWidthTextAdapter, sizeof(__pyx_k_FixedWidthTextAdapter), 0, 0, 1, 1}, - {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, - {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, - {&__pyx_n_s_FuzzyIdx, __pyx_k_FuzzyIdx, sizeof(__pyx_k_FuzzyIdx), 0, 0, 1, 1}, - {&__pyx_n_s_FuzzyIdx___init, __pyx_k_FuzzyIdx___init, sizeof(__pyx_k_FuzzyIdx___init), 0, 0, 1, 1}, - {&__pyx_n_s_FuzzyIdx___len, __pyx_k_FuzzyIdx___len, sizeof(__pyx_k_FuzzyIdx___len), 0, 0, 1, 1}, - {&__pyx_n_s_FuzzyIdx_align_fuzzy, __pyx_k_FuzzyIdx_align_fuzzy, sizeof(__pyx_k_FuzzyIdx_align_fuzzy), 0, 0, 1, 1}, - {&__pyx_n_s_FuzzyIdx_chunk_sizes, __pyx_k_FuzzyIdx_chunk_sizes, sizeof(__pyx_k_FuzzyIdx_chunk_sizes), 0, 0, 1, 1}, - {&__pyx_n_s_FuzzyIdx_close, __pyx_k_FuzzyIdx_close, sizeof(__pyx_k_FuzzyIdx_close), 0, 0, 1, 1}, - {&__pyx_n_s_FuzzyIdx_get_sample_chunksize, __pyx_k_FuzzyIdx_get_sample_chunksize, sizeof(__pyx_k_FuzzyIdx_get_sample_chunksize), 0, 0, 1, 1}, - {&__pyx_n_s_FuzzyIdx_seek_offset, __pyx_k_FuzzyIdx_seek_offset, sizeof(__pyx_k_FuzzyIdx_seek_offset), 0, 0, 1, 1}, - {&__pyx_n_s_GeneratorType, __pyx_k_GeneratorType, sizeof(__pyx_k_GeneratorType), 0, 0, 1, 1}, - {&__pyx_n_s_HEADER_SIZE, __pyx_k_HEADER_SIZE, sizeof(__pyx_k_HEADER_SIZE), 0, 0, 1, 1}, - {&__pyx_n_s_INFO, __pyx_k_INFO, sizeof(__pyx_k_INFO), 0, 0, 1, 1}, - {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1}, - {&__pyx_kp_s_Implementation_of_a_fuzzy_index, __pyx_k_Implementation_of_a_fuzzy_index, sizeof(__pyx_k_Implementation_of_a_fuzzy_index), 0, 0, 1, 0}, - {&__pyx_kp_s_Implementation_of_an_exact_index, __pyx_k_Implementation_of_an_exact_index, sizeof(__pyx_k_Implementation_of_an_exact_index), 0, 0, 1, 0}, - {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Invalid_character_in_input_data, __pyx_k_Invalid_character_in_input_data, sizeof(__pyx_k_Invalid_character_in_input_data), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_field_name, __pyx_k_Invalid_field_name, sizeof(__pyx_k_Invalid_field_name), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_field_number, __pyx_k_Invalid_field_number, sizeof(__pyx_k_Invalid_field_number), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_index_0_for_field_names, __pyx_k_Invalid_index_0_for_field_names, sizeof(__pyx_k_Invalid_index_0_for_field_names), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_missing_value_must_be_st, __pyx_k_Invalid_missing_value_must_be_st, sizeof(__pyx_k_Invalid_missing_value_must_be_st), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_record_number, __pyx_k_Invalid_record_number, sizeof(__pyx_k_Invalid_record_number), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_record_number_or_slice, __pyx_k_Invalid_record_number_or_slice, sizeof(__pyx_k_Invalid_record_number_or_slice), 0, 0, 1, 0}, - {&__pyx_n_s_JSONTextAdapter, __pyx_k_JSONTextAdapter, sizeof(__pyx_k_JSONTextAdapter), 0, 0, 1, 1}, - {&__pyx_n_s_Key, __pyx_k_Key, sizeof(__pyx_k_Key), 0, 0, 1, 1}, - {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, - {&__pyx_n_s_M, __pyx_k_M, sizeof(__pyx_k_M), 0, 0, 1, 1}, - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, - {&__pyx_n_s_NA, __pyx_k_NA, sizeof(__pyx_k_NA), 0, 0, 1, 1}, - {&__pyx_n_s_NB, __pyx_k_NB, sizeof(__pyx_k_NB), 0, 0, 1, 1}, - {&__pyx_n_s_NUMOFFSETS_OFFSET, __pyx_k_NUMOFFSETS_OFFSET, sizeof(__pyx_k_NUMOFFSETS_OFFSET), 0, 0, 1, 1}, - {&__pyx_n_s_NUMOFFSETS_SIZE, __pyx_k_NUMOFFSETS_SIZE, sizeof(__pyx_k_NUMOFFSETS_SIZE), 0, 0, 1, 1}, - {&__pyx_n_s_NUM_GZIP_ACCESS_POINTS_OFFSET, __pyx_k_NUM_GZIP_ACCESS_POINTS_OFFSET, sizeof(__pyx_k_NUM_GZIP_ACCESS_POINTS_OFFSET), 0, 0, 1, 1}, - {&__pyx_n_s_NUM_GZIP_ACCESS_POINTS_SIZE, __pyx_k_NUM_GZIP_ACCESS_POINTS_SIZE, sizeof(__pyx_k_NUM_GZIP_ACCESS_POINTS_SIZE), 0, 0, 1, 1}, - {&__pyx_n_s_NaN, __pyx_k_NaN, sizeof(__pyx_k_NaN), 0, 0, 1, 1}, - {&__pyx_n_s_NoSuchFieldError, __pyx_k_NoSuchFieldError, sizeof(__pyx_k_NoSuchFieldError), 0, 0, 1, 1}, - {&__pyx_kp_s_No_fields_found_or_no_converters, __pyx_k_No_fields_found_or_no_converters, sizeof(__pyx_k_No_fields_found_or_no_converters), 0, 0, 1, 0}, - {&__pyx_kp_s_No_missing_values_specified_for, __pyx_k_No_missing_values_specified_for, sizeof(__pyx_k_No_missing_values_specified_for), 0, 0, 1, 0}, - {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0}, - {&__pyx_n_s_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 0, 1, 1}, - {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1}, - {&__pyx_kp_s_NumPy_1_6_datetime_timedelta_not, __pyx_k_NumPy_1_6_datetime_timedelta_not, sizeof(__pyx_k_NumPy_1_6_datetime_timedelta_not), 0, 0, 1, 0}, - {&__pyx_kp_s_Number_of_field_names_0_does_not, __pyx_k_Number_of_field_names_0_does_not, sizeof(__pyx_k_Number_of_field_names_0_does_not), 0, 0, 1, 0}, - {&__pyx_n_s_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 1, 1}, - {&__pyx_n_s_OPTIONS_OFFSET, __pyx_k_OPTIONS_OFFSET, sizeof(__pyx_k_OPTIONS_OFFSET), 0, 0, 1, 1}, - {&__pyx_n_s_OPTIONS_SIZE, __pyx_k_OPTIONS_SIZE, sizeof(__pyx_k_OPTIONS_SIZE), 0, 0, 1, 1}, - {&__pyx_n_s_OrderedDict, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1}, - {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1}, - {&__pyx_kp_s_Pandas_module_is_not_installed, __pyx_k_Pandas_module_is_not_installed, sizeof(__pyx_k_Pandas_module_is_not_installed), 0, 0, 1, 0}, - {&__pyx_kp_s_Pandas_module_is_not_installed_O, __pyx_k_Pandas_module_is_not_installed_O, sizeof(__pyx_k_Pandas_module_is_not_installed_O), 0, 0, 1, 0}, - {&__pyx_n_s_ParserError, __pyx_k_ParserError, sizeof(__pyx_k_ParserError), 0, 0, 1, 1}, - {&__pyx_n_s_RESERVED1_OFFSET, __pyx_k_RESERVED1_OFFSET, sizeof(__pyx_k_RESERVED1_OFFSET), 0, 0, 1, 1}, - {&__pyx_n_s_RESERVED1_SIZE, __pyx_k_RESERVED1_SIZE, sizeof(__pyx_k_RESERVED1_SIZE), 0, 0, 1, 1}, - {&__pyx_n_s_Range, __pyx_k_Range, sizeof(__pyx_k_Range), 0, 0, 1, 1}, - {&__pyx_kp_s_Read_error, __pyx_k_Read_error, sizeof(__pyx_k_Read_error), 0, 0, 1, 0}, - {&__pyx_kp_s_Record_0_is_out_of_bounds, __pyx_k_Record_0_is_out_of_bounds, sizeof(__pyx_k_Record_0_is_out_of_bounds), 0, 0, 1, 0}, - {&__pyx_n_s_RegexTextAdapter, __pyx_k_RegexTextAdapter, sizeof(__pyx_k_RegexTextAdapter), 0, 0, 1, 1}, - {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 0, 1, 1}, - {&__pyx_n_s_S32768, __pyx_k_S32768, sizeof(__pyx_k_S32768), 0, 0, 1, 1}, - {&__pyx_kp_s_S3_read_error, __pyx_k_S3_read_error, sizeof(__pyx_k_S3_read_error), 0, 0, 1, 0}, - {&__pyx_kp_s_S3_seek_error, __pyx_k_S3_seek_error, sizeof(__pyx_k_S3_seek_error), 0, 0, 1, 0}, - {&__pyx_n_s_SEEK_END, __pyx_k_SEEK_END, sizeof(__pyx_k_SEEK_END), 0, 0, 1, 1}, - {&__pyx_n_s_SEEK_SET, __pyx_k_SEEK_SET, sizeof(__pyx_k_SEEK_SET), 0, 0, 1, 1}, - {&__pyx_kp_s_Seek_error, __pyx_k_Seek_error, sizeof(__pyx_k_Seek_error), 0, 0, 1, 0}, - {&__pyx_n_s_Sniffer, __pyx_k_Sniffer, sizeof(__pyx_k_Sniffer), 0, 0, 1, 1}, - {&__pyx_n_s_SourceError, __pyx_k_SourceError, sizeof(__pyx_k_SourceError), 0, 0, 1, 1}, - {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, - {&__pyx_n_s_StringIO, __pyx_k_StringIO, sizeof(__pyx_k_StringIO), 0, 0, 1, 1}, - {&__pyx_n_s_TAG_OFFSET, __pyx_k_TAG_OFFSET, sizeof(__pyx_k_TAG_OFFSET), 0, 0, 1, 1}, - {&__pyx_n_s_TAG_SIZE, __pyx_k_TAG_SIZE, sizeof(__pyx_k_TAG_SIZE), 0, 0, 1, 1}, - {&__pyx_n_s_TOTAL_NUM_RECORDS_OFFSET, __pyx_k_TOTAL_NUM_RECORDS_OFFSET, sizeof(__pyx_k_TOTAL_NUM_RECORDS_OFFSET), 0, 0, 1, 1}, - {&__pyx_n_s_TOTAL_NUM_RECORDS_SIZE, __pyx_k_TOTAL_NUM_RECORDS_SIZE, sizeof(__pyx_k_TOTAL_NUM_RECORDS_SIZE), 0, 0, 1, 1}, - {&__pyx_n_s_TYPESIZE_OFFSET, __pyx_k_TYPESIZE_OFFSET, sizeof(__pyx_k_TYPESIZE_OFFSET), 0, 0, 1, 1}, - {&__pyx_n_s_TYPESIZE_SIZE, __pyx_k_TYPESIZE_SIZE, sizeof(__pyx_k_TYPESIZE_SIZE), 0, 0, 1, 1}, - {&__pyx_n_s_TextAdapter, __pyx_k_TextAdapter, sizeof(__pyx_k_TextAdapter), 0, 0, 1, 1}, - {&__pyx_n_s_TextAdapterFields, __pyx_k_TextAdapterFields, sizeof(__pyx_k_TextAdapterFields), 0, 0, 1, 1}, - {&__pyx_kp_s_TextAdapter_cannot_be_used_direc, __pyx_k_TextAdapter_cannot_be_used_direc, sizeof(__pyx_k_TextAdapter_cannot_be_used_direc), 0, 0, 1, 0}, - {&__pyx_kp_s_The_magic_value_s_is_not_recogni, __pyx_k_The_magic_value_s_is_not_recogni, sizeof(__pyx_k_The_magic_value_s_is_not_recogni), 0, 0, 1, 0}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_n_s_U, __pyx_k_U, sizeof(__pyx_k_U), 0, 0, 1, 1}, - {&__pyx_kp_s_Unknown_text_adapter_error_code, __pyx_k_Unknown_text_adapter_error_code, sizeof(__pyx_k_Unknown_text_adapter_error_code), 0, 0, 1, 0}, - {&__pyx_kp_s_Unknown_text_parser_s, __pyx_k_Unknown_text_parser_s, sizeof(__pyx_k_Unknown_text_parser_s), 0, 0, 1, 0}, - {&__pyx_kp_s_Users_dmertz_Projects_TextAdapt, __pyx_k_Users_dmertz_Projects_TextAdapt, sizeof(__pyx_k_Users_dmertz_Projects_TextAdapt), 0, 0, 1, 0}, - {&__pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_k_Users_dmertz_Projects_TextAdapt_2, sizeof(__pyx_k_Users_dmertz_Projects_TextAdapt_2), 0, 0, 1, 0}, - {&__pyx_n_s_VERSION_OFFSET, __pyx_k_VERSION_OFFSET, sizeof(__pyx_k_VERSION_OFFSET), 0, 0, 1, 1}, - {&__pyx_n_s_VERSION_SIZE, __pyx_k_VERSION_SIZE, sizeof(__pyx_k_VERSION_SIZE), 0, 0, 1, 1}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_kp_s__25, __pyx_k__25, sizeof(__pyx_k__25), 0, 0, 1, 0}, - {&__pyx_kp_b__27, __pyx_k__27, sizeof(__pyx_k__27), 0, 0, 0, 0}, - {&__pyx_kp_s__27, __pyx_k__27, sizeof(__pyx_k__27), 0, 0, 1, 0}, - {&__pyx_kp_s__37, __pyx_k__37, sizeof(__pyx_k__37), 0, 0, 1, 0}, - {&__pyx_kp_s__38, __pyx_k__38, sizeof(__pyx_k__38), 0, 0, 1, 0}, - {&__pyx_kp_s__50, __pyx_k__50, sizeof(__pyx_k__50), 0, 0, 1, 0}, - {&__pyx_kp_s__51, __pyx_k__51, sizeof(__pyx_k__51), 0, 0, 1, 0}, - {&__pyx_kp_s__78, __pyx_k__78, sizeof(__pyx_k__78), 0, 0, 1, 0}, - {&__pyx_kp_s__79, __pyx_k__79, sizeof(__pyx_k__79), 0, 0, 1, 0}, - {&__pyx_kp_s__80, __pyx_k__80, sizeof(__pyx_k__80), 0, 0, 1, 0}, - {&__pyx_kp_s__91, __pyx_k__91, sizeof(__pyx_k__91), 0, 0, 1, 0}, - {&__pyx_n_s_access_key, __pyx_k_access_key, sizeof(__pyx_k_access_key), 0, 0, 1, 1}, - {&__pyx_n_s_access_point, __pyx_k_access_point, sizeof(__pyx_k_access_point), 0, 0, 1, 1}, - {&__pyx_n_s_adapter, __pyx_k_adapter, sizeof(__pyx_k_adapter), 0, 0, 1, 1}, - {&__pyx_n_s_add_gzip_access_point, __pyx_k_add_gzip_access_point, sizeof(__pyx_k_add_gzip_access_point), 0, 0, 1, 1}, - {&__pyx_n_s_aliases, __pyx_k_aliases, sizeof(__pyx_k_aliases), 0, 0, 1, 1}, - {&__pyx_n_s_align_fuzzy, __pyx_k_align_fuzzy, sizeof(__pyx_k_align_fuzzy), 0, 0, 1, 1}, - {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, - {&__pyx_n_s_allsizes, __pyx_k_allsizes, sizeof(__pyx_k_allsizes), 0, 0, 1, 1}, - {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, - {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, - {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1}, - {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, - {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1}, - {&__pyx_n_s_asizes, __pyx_k_asizes, sizeof(__pyx_k_asizes), 0, 0, 1, 1}, - {&__pyx_n_s_avail_in, __pyx_k_avail_in, sizeof(__pyx_k_avail_in), 0, 0, 1, 1}, - {&__pyx_n_s_avail_out, __pyx_k_avail_out, sizeof(__pyx_k_avail_out), 0, 0, 1, 1}, - {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1}, - {&__pyx_n_s_bits, __pyx_k_bits, sizeof(__pyx_k_bits), 0, 0, 1, 1}, - {&__pyx_n_s_boto, __pyx_k_boto, sizeof(__pyx_k_boto), 0, 0, 1, 1}, - {&__pyx_n_s_boto_installed, __pyx_k_boto_installed, sizeof(__pyx_k_boto_installed), 0, 0, 1, 1}, - {&__pyx_n_s_boto_s3, __pyx_k_boto_s3, sizeof(__pyx_k_boto_s3), 0, 0, 1, 1}, - {&__pyx_n_s_bpos, __pyx_k_bpos, sizeof(__pyx_k_bpos), 0, 0, 1, 1}, - {&__pyx_n_s_bucket, __pyx_k_bucket, sizeof(__pyx_k_bucket), 0, 0, 1, 1}, - {&__pyx_n_s_bucket_name, __pyx_k_bucket_name, sizeof(__pyx_k_bucket_name), 0, 0, 1, 1}, - {&__pyx_n_s_build_converters, __pyx_k_build_converters, sizeof(__pyx_k_build_converters), 0, 0, 1, 1}, - {&__pyx_n_s_build_python_converter, __pyx_k_build_python_converter, sizeof(__pyx_k_build_python_converter), 0, 0, 1, 1}, - {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1}, - {&__pyx_kp_s_bytes_0_1, __pyx_k_bytes_0_1, sizeof(__pyx_k_bytes_0_1), 0, 0, 1, 0}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_n_s_ceil, __pyx_k_ceil, sizeof(__pyx_k_ceil), 0, 0, 1, 1}, - {&__pyx_n_s_checksum, __pyx_k_checksum, sizeof(__pyx_k_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_chunk, __pyx_k_chunk, sizeof(__pyx_k_chunk), 0, 0, 1, 1}, - {&__pyx_n_s_chunk_sizes, __pyx_k_chunk_sizes, sizeof(__pyx_k_chunk_sizes), 0, 0, 1, 1}, - {&__pyx_n_s_chunksize, __pyx_k_chunksize, sizeof(__pyx_k_chunksize), 0, 0, 1, 1}, - {&__pyx_n_s_cinit___locals_count_fields, __pyx_k_cinit___locals_count_fields, sizeof(__pyx_k_cinit___locals_count_fields), 0, 0, 1, 1}, - {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, - {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, - {&__pyx_n_s_comment, __pyx_k_comment, sizeof(__pyx_k_comment), 0, 0, 1, 1}, - {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1}, - {&__pyx_n_s_compressed_offset, __pyx_k_compressed_offset, sizeof(__pyx_k_compressed_offset), 0, 0, 1, 1}, - {&__pyx_n_s_compression, __pyx_k_compression, sizeof(__pyx_k_compression), 0, 0, 1, 1}, - {&__pyx_n_s_concatenate, __pyx_k_concatenate, sizeof(__pyx_k_concatenate), 0, 0, 1, 1}, - {&__pyx_n_s_config, __pyx_k_config, sizeof(__pyx_k_config), 0, 0, 1, 1}, - {&__pyx_n_s_conn, __pyx_k_conn, sizeof(__pyx_k_conn), 0, 0, 1, 1}, - {&__pyx_n_s_connect_s3, __pyx_k_connect_s3, sizeof(__pyx_k_connect_s3), 0, 0, 1, 1}, - {&__pyx_n_s_convert_error, __pyx_k_convert_error, sizeof(__pyx_k_convert_error), 0, 0, 1, 1}, - {&__pyx_n_s_convert_error_reasons, __pyx_k_convert_error_reasons, sizeof(__pyx_k_convert_error_reasons), 0, 0, 1, 1}, - {&__pyx_n_s_converter, __pyx_k_converter, sizeof(__pyx_k_converter), 0, 0, 1, 1}, - {&__pyx_kp_s_could_not_guess_delimiter_charac, __pyx_k_could_not_guess_delimiter_charac, sizeof(__pyx_k_could_not_guess_delimiter_charac), 0, 0, 1, 0}, - {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, - {&__pyx_n_s_count_fields, __pyx_k_count_fields, sizeof(__pyx_k_count_fields), 0, 0, 1, 1}, - {&__pyx_n_s_create_disk_index, __pyx_k_create_disk_index, sizeof(__pyx_k_create_disk_index), 0, 0, 1, 1}, - {&__pyx_n_s_csv, __pyx_k_csv, sizeof(__pyx_k_csv), 0, 0, 1, 1}, - {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, - {&__pyx_n_s_dataframe, __pyx_k_dataframe, sizeof(__pyx_k_dataframe), 0, 0, 1, 1}, - {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1}, - {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1}, - {&__pyx_n_s_default_field_filter, __pyx_k_default_field_filter, sizeof(__pyx_k_default_field_filter), 0, 0, 1, 1}, - {&__pyx_n_s_default_fill_values, __pyx_k_default_fill_values, sizeof(__pyx_k_default_fill_values), 0, 0, 1, 1}, - {&__pyx_n_s_default_missing_values, __pyx_k_default_missing_values, sizeof(__pyx_k_default_missing_values), 0, 0, 1, 1}, - {&__pyx_n_s_delimiter, __pyx_k_delimiter, sizeof(__pyx_k_delimiter), 0, 0, 1, 1}, - {&__pyx_kp_s_delimiter_must_be_ASCII_characte, __pyx_k_delimiter_must_be_ASCII_characte, sizeof(__pyx_k_delimiter_must_be_ASCII_characte), 0, 0, 1, 0}, - {&__pyx_n_s_density, __pyx_k_density, sizeof(__pyx_k_density), 0, 0, 1, 1}, - {&__pyx_kp_s_density_is_too_large, __pyx_k_density_is_too_large, sizeof(__pyx_k_density_is_too_large), 0, 0, 1, 0}, - {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1}, - {&__pyx_n_s_emean, __pyx_k_emean, sizeof(__pyx_k_emean), 0, 0, 1, 1}, - {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1}, - {&__pyx_n_s_encodings, __pyx_k_encodings, sizeof(__pyx_k_encodings), 0, 0, 1, 1}, - {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, - {&__pyx_n_s_endswith, __pyx_k_endswith, sizeof(__pyx_k_endswith), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, - {&__pyx_n_s_errors, __pyx_k_errors, sizeof(__pyx_k_errors), 0, 0, 1, 1}, - {&__pyx_n_s_escape, __pyx_k_escape, sizeof(__pyx_k_escape), 0, 0, 1, 1}, - {&__pyx_n_s_escapechar, __pyx_k_escapechar, sizeof(__pyx_k_escapechar), 0, 0, 1, 1}, - {&__pyx_n_s_esizes, __pyx_k_esizes, sizeof(__pyx_k_esizes), 0, 0, 1, 1}, - {&__pyx_n_s_estd, __pyx_k_estd, sizeof(__pyx_k_estd), 0, 0, 1, 1}, - {&__pyx_n_s_exists, __pyx_k_exists, sizeof(__pyx_k_exists), 0, 0, 1, 1}, - {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1}, - {&__pyx_kp_s_f_d, __pyx_k_f_d, sizeof(__pyx_k_f_d), 0, 0, 1, 0}, - {&__pyx_n_s_fh, __pyx_k_fh, sizeof(__pyx_k_fh), 0, 0, 1, 1}, - {&__pyx_n_s_field, __pyx_k_field, sizeof(__pyx_k_field), 0, 0, 1, 1}, - {&__pyx_n_s_field_count, __pyx_k_field_count, sizeof(__pyx_k_field_count), 0, 0, 1, 1}, - {&__pyx_n_s_field_filter, __pyx_k_field_filter, sizeof(__pyx_k_field_filter), 0, 0, 1, 1}, - {&__pyx_kp_s_field_must_be_int_in_string, __pyx_k_field_must_be_int_in_string, sizeof(__pyx_k_field_must_be_int_in_string), 0, 0, 1, 0}, - {&__pyx_n_s_field_names, __pyx_k_field_names, sizeof(__pyx_k_field_names), 0, 0, 1, 1}, - {&__pyx_kp_s_field_to_map_must_be_int_or_stri, __pyx_k_field_to_map_must_be_int_or_stri, sizeof(__pyx_k_field_to_map_must_be_int_or_stri), 0, 0, 1, 0}, - {&__pyx_n_s_field_types, __pyx_k_field_types, sizeof(__pyx_k_field_types), 0, 0, 1, 1}, - {&__pyx_kp_s_field_width_must_be_greater_than, __pyx_k_field_width_must_be_greater_than, sizeof(__pyx_k_field_width_must_be_greater_than), 0, 0, 1, 0}, - {&__pyx_n_s_field_widths, __pyx_k_field_widths, sizeof(__pyx_k_field_widths), 0, 0, 1, 1}, - {&__pyx_kp_s_field_widths_must_be_specified_b, __pyx_k_field_widths_must_be_specified_b, sizeof(__pyx_k_field_widths_must_be_specified_b), 0, 0, 1, 0}, - {&__pyx_n_s_fields, __pyx_k_fields, sizeof(__pyx_k_fields), 0, 0, 1, 1}, - {&__pyx_n_s_filesize, __pyx_k_filesize, sizeof(__pyx_k_filesize), 0, 0, 1, 1}, - {&__pyx_n_s_fill_values, __pyx_k_fill_values, sizeof(__pyx_k_fill_values), 0, 0, 1, 1}, - {&__pyx_n_s_finalize, __pyx_k_finalize, sizeof(__pyx_k_finalize), 0, 0, 1, 1}, - {&__pyx_n_s_find, __pyx_k_find, sizeof(__pyx_k_find), 0, 0, 1, 1}, - {&__pyx_n_s_fixed_width, __pyx_k_fixed_width, sizeof(__pyx_k_fixed_width), 0, 0, 1, 1}, - {&__pyx_n_s_footer, __pyx_k_footer, sizeof(__pyx_k_footer), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_fpos, __pyx_k_fpos, sizeof(__pyx_k_fpos), 0, 0, 1, 1}, - {&__pyx_n_s_from_records, __pyx_k_from_records, sizeof(__pyx_k_from_records), 0, 0, 1, 1}, - {&__pyx_n_s_fromfile, __pyx_k_fromfile, sizeof(__pyx_k_fromfile), 0, 0, 1, 1}, - {&__pyx_n_s_fromstring, __pyx_k_fromstring, sizeof(__pyx_k_fromstring), 0, 0, 1, 1}, - {&__pyx_kp_s_ftp, __pyx_k_ftp, sizeof(__pyx_k_ftp), 0, 0, 1, 0}, - {&__pyx_n_s_fuzzy, __pyx_k_fuzzy, sizeof(__pyx_k_fuzzy), 0, 0, 1, 1}, - {&__pyx_n_s_generic, __pyx_k_generic, sizeof(__pyx_k_generic), 0, 0, 1, 1}, - {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1}, - {&__pyx_n_s_get_bucket, __pyx_k_get_bucket, sizeof(__pyx_k_get_bucket), 0, 0, 1, 1}, - {&__pyx_n_s_get_contents_as_string, __pyx_k_get_contents_as_string, sizeof(__pyx_k_get_contents_as_string), 0, 0, 1, 1}, - {&__pyx_n_s_get_density, __pyx_k_get_density, sizeof(__pyx_k_get_density), 0, 0, 1, 1}, - {&__pyx_n_s_get_field_filter, __pyx_k_get_field_filter, sizeof(__pyx_k_get_field_filter), 0, 0, 1, 1}, - {&__pyx_n_s_get_field_names, __pyx_k_get_field_names, sizeof(__pyx_k_get_field_names), 0, 0, 1, 1}, - {&__pyx_n_s_get_field_types, __pyx_k_get_field_types, sizeof(__pyx_k_get_field_types), 0, 0, 1, 1}, - {&__pyx_n_s_get_gzip_access_point, __pyx_k_get_gzip_access_point, sizeof(__pyx_k_get_gzip_access_point), 0, 0, 1, 1}, - {&__pyx_n_s_get_mapping_from_converters, __pyx_k_get_mapping_from_converters, sizeof(__pyx_k_get_mapping_from_converters), 0, 0, 1, 1}, - {&__pyx_n_s_get_offset, __pyx_k_get_offset, sizeof(__pyx_k_get_offset), 0, 0, 1, 1}, - {&__pyx_n_s_get_sample_chunksize, __pyx_k_get_sample_chunksize, sizeof(__pyx_k_get_sample_chunksize), 0, 0, 1, 1}, - {&__pyx_n_s_get_size_skipbytes, __pyx_k_get_size_skipbytes, sizeof(__pyx_k_get_size_skipbytes), 0, 0, 1, 1}, - {&__pyx_n_s_getitem, __pyx_k_getitem, sizeof(__pyx_k_getitem), 0, 0, 1, 1}, - {&__pyx_n_s_getitem___locals_TextAdapterFi, __pyx_k_getitem___locals_TextAdapterFi, sizeof(__pyx_k_getitem___locals_TextAdapterFi), 0, 0, 1, 1}, - {&__pyx_n_s_getitem___locals_TextAdapterFi_2, __pyx_k_getitem___locals_TextAdapterFi_2, sizeof(__pyx_k_getitem___locals_TextAdapterFi_2), 0, 0, 1, 1}, - {&__pyx_n_s_getitem___locals_TextAdapterFi_3, __pyx_k_getitem___locals_TextAdapterFi_3, sizeof(__pyx_k_getitem___locals_TextAdapterFi_3), 0, 0, 1, 1}, - {&__pyx_n_s_group_whitespace_delims, __pyx_k_group_whitespace_delims, sizeof(__pyx_k_group_whitespace_delims), 0, 0, 1, 1}, - {&__pyx_n_s_groups, __pyx_k_groups, sizeof(__pyx_k_groups), 0, 0, 1, 1}, - {&__pyx_kp_s_gz, __pyx_k_gz, sizeof(__pyx_k_gz), 0, 0, 1, 0}, - {&__pyx_n_s_gzip, __pyx_k_gzip, sizeof(__pyx_k_gzip), 0, 0, 1, 1}, - {&__pyx_n_s_gzip_access_points, __pyx_k_gzip_access_points, sizeof(__pyx_k_gzip_access_points), 0, 0, 1, 1}, - {&__pyx_n_s_header, __pyx_k_header, sizeof(__pyx_k_header), 0, 0, 1, 1}, - {&__pyx_n_s_header_length, __pyx_k_header_length, sizeof(__pyx_k_header_length), 0, 0, 1, 1}, - {&__pyx_n_s_headers, __pyx_k_headers, sizeof(__pyx_k_headers), 0, 0, 1, 1}, - {&__pyx_n_s_hnb, __pyx_k_hnb, sizeof(__pyx_k_hnb), 0, 0, 1, 1}, - {&__pyx_kp_s_http, __pyx_k_http, sizeof(__pyx_k_http), 0, 0, 1, 0}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_i4, __pyx_k_i4, sizeof(__pyx_k_i4), 0, 0, 1, 1}, - {&__pyx_n_s_i8, __pyx_k_i8, sizeof(__pyx_k_i8), 0, 0, 1, 1}, - {&__pyx_kp_s_i_d, __pyx_k_i_d, sizeof(__pyx_k_i_d), 0, 0, 1, 0}, - {&__pyx_kp_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 0}, - {&__pyx_n_s_idxfile, __pyx_k_idxfile, sizeof(__pyx_k_idxfile), 0, 0, 1, 1}, - {&__pyx_n_s_idxh, __pyx_k_idxh, sizeof(__pyx_k_idxh), 0, 0, 1, 1}, - {&__pyx_n_s_imean, __pyx_k_imean, sizeof(__pyx_k_imean), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, - {&__pyx_kp_s_index_must_be_int_slice_fancy_in, __pyx_k_index_must_be_int_slice_fancy_in, sizeof(__pyx_k_index_must_be_int_slice_fancy_in), 0, 0, 1, 0}, - {&__pyx_n_s_index_name, __pyx_k_index_name, sizeof(__pyx_k_index_name), 0, 0, 1, 1}, - {&__pyx_kp_s_index_out_ot_range, __pyx_k_index_out_ot_range, sizeof(__pyx_k_index_out_ot_range), 0, 0, 1, 0}, - {&__pyx_n_s_indexing, __pyx_k_indexing, sizeof(__pyx_k_indexing), 0, 0, 1, 1}, - {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1}, - {&__pyx_kp_s_inf_2, __pyx_k_inf_2, sizeof(__pyx_k_inf_2), 0, 0, 1, 0}, - {&__pyx_n_s_infer_types, __pyx_k_infer_types, sizeof(__pyx_k_infer_types), 0, 0, 1, 1}, - {&__pyx_n_s_infer_types_2, __pyx_k_infer_types_2, sizeof(__pyx_k_infer_types_2), 0, 0, 1, 1}, - {&__pyx_kp_s_infer_types_setting_dtype_0_fo, __pyx_k_infer_types_setting_dtype_0_fo, sizeof(__pyx_k_infer_types_setting_dtype_0_fo), 0, 0, 1, 0}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_init_text_adapter, __pyx_k_init_text_adapter, sizeof(__pyx_k_init_text_adapter), 0, 0, 1, 1}, - {&__pyx_kp_s_input_size, __pyx_k_input_size, sizeof(__pyx_k_input_size), 0, 0, 1, 0}, - {&__pyx_kp_s_input_string, __pyx_k_input_string, sizeof(__pyx_k_input_string), 0, 0, 1, 0}, - {&__pyx_kp_s_input_type, __pyx_k_input_type, sizeof(__pyx_k_input_type), 0, 0, 1, 0}, - {&__pyx_n_s_inv_rec_num, __pyx_k_inv_rec_num, sizeof(__pyx_k_inv_rec_num), 0, 0, 1, 1}, - {&__pyx_kp_s_invalid_field_number, __pyx_k_invalid_field_number, sizeof(__pyx_k_invalid_field_number), 0, 0, 1, 0}, - {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1}, - {&__pyx_n_s_ioffset, __pyx_k_ioffset, sizeof(__pyx_k_ioffset), 0, 0, 1, 1}, - {&__pyx_n_s_TextAdapter_lib, __pyx_k_TextAdapter_lib, sizeof(__pyx_k_TextAdapter_lib), 0, 0, 1, 1}, - {&__pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_k_TextAdapter_textadapter_TextAdapter, sizeof(__pyx_k_TextAdapter_textadapter_TextAdapter), 0, 0, 1, 1}, - {&__pyx_kp_s_is_not_a_valid_field_name, __pyx_k_is_not_a_valid_field_name, sizeof(__pyx_k_is_not_a_valid_field_name), 0, 0, 1, 0}, - {&__pyx_n_s_isizes, __pyx_k_isizes, sizeof(__pyx_k_isizes), 0, 0, 1, 1}, - {&__pyx_n_s_istd, __pyx_k_istd, sizeof(__pyx_k_istd), 0, 0, 1, 1}, - {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1}, - {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, - {&__pyx_n_s_json, __pyx_k_json, sizeof(__pyx_k_json), 0, 0, 1, 1}, - {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, - {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1}, - {&__pyx_n_s_key_name, __pyx_k_key_name, sizeof(__pyx_k_key_name), 0, 0, 1, 1}, - {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1}, - {&__pyx_n_s_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 0, 1, 1}, - {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_len, __pyx_k_len, sizeof(__pyx_k_len), 0, 0, 1, 1}, - {&__pyx_n_s_loads, __pyx_k_loads, sizeof(__pyx_k_loads), 0, 0, 1, 1}, - {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1}, - {&__pyx_n_s_lookup, __pyx_k_lookup, sizeof(__pyx_k_lookup), 0, 0, 1, 1}, - {&__pyx_n_s_loose, __pyx_k_loose, sizeof(__pyx_k_loose), 0, 0, 1, 1}, - {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1}, - {&__pyx_n_s_magic, __pyx_k_magic, sizeof(__pyx_k_magic), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1}, - {&__pyx_n_s_mean, __pyx_k_mean, sizeof(__pyx_k_mean), 0, 0, 1, 1}, - {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, - {&__pyx_kp_s_missing_values_must_be_dict_of_f, __pyx_k_missing_values_must_be_dict_of_f, sizeof(__pyx_k_missing_values_must_be_dict_of_f), 0, 0, 1, 0}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_kp_s_n_not_detected_in_the_backward, __pyx_k_n_not_detected_in_the_backward, sizeof(__pyx_k_n_not_detected_in_the_backward), 0, 0, 1, 0}, - {&__pyx_kp_s_n_not_detected_in_the_forward_d, __pyx_k_n_not_detected_in_the_forward_d, sizeof(__pyx_k_n_not_detected_in_the_forward_d), 0, 0, 1, 0}, - {&__pyx_n_s_nan, __pyx_k_nan, sizeof(__pyx_k_nan), 0, 0, 1, 1}, - {&__pyx_n_s_ndarray, __pyx_k_ndarray, sizeof(__pyx_k_ndarray), 0, 0, 1, 1}, - {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, - {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, - {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1}, - {&__pyx_kp_s_no_conversion_error, __pyx_k_no_conversion_error, sizeof(__pyx_k_no_conversion_error), 0, 0, 1, 0}, - {&__pyx_n_s_none, __pyx_k_none, sizeof(__pyx_k_none), 0, 0, 1, 1}, - {&__pyx_n_s_normalize_encoding, __pyx_k_normalize_encoding, sizeof(__pyx_k_normalize_encoding), 0, 0, 1, 1}, - {&__pyx_n_s_nrecords, __pyx_k_nrecords, sizeof(__pyx_k_nrecords), 0, 0, 1, 1}, - {&__pyx_n_s_num, __pyx_k_num, sizeof(__pyx_k_num), 0, 0, 1, 1}, - {&__pyx_n_s_num_gzip_access_points, __pyx_k_num_gzip_access_points, sizeof(__pyx_k_num_gzip_access_points), 0, 0, 1, 1}, - {&__pyx_n_s_num_offsets, __pyx_k_num_offsets, sizeof(__pyx_k_num_offsets), 0, 0, 1, 1}, - {&__pyx_n_s_num_records, __pyx_k_num_records, sizeof(__pyx_k_num_records), 0, 0, 1, 1}, - {&__pyx_n_s_num_recs, __pyx_k_num_recs, sizeof(__pyx_k_num_recs), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, - {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, - {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, - {&__pyx_kp_s_object_converter, __pyx_k_object_converter, sizeof(__pyx_k_object_converter), 0, 0, 1, 0}, - {&__pyx_n_s_object_hook, __pyx_k_object_hook, sizeof(__pyx_k_object_hook), 0, 0, 1, 1}, - {&__pyx_n_s_object_pairs_hook, __pyx_k_object_pairs_hook, sizeof(__pyx_k_object_pairs_hook), 0, 0, 1, 1}, - {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1}, - {&__pyx_n_s_offsets, __pyx_k_offsets, sizeof(__pyx_k_offsets), 0, 0, 1, 1}, - {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, - {&__pyx_n_s_open_disk_index, __pyx_k_open_disk_index, sizeof(__pyx_k_open_disk_index), 0, 0, 1, 1}, - {&__pyx_n_s_open_s3_index, __pyx_k_open_s3_index, sizeof(__pyx_k_open_s3_index), 0, 0, 1, 1}, - {&__pyx_n_s_options, __pyx_k_options, sizeof(__pyx_k_options), 0, 0, 1, 1}, - {&__pyx_n_s_ordereddict, __pyx_k_ordereddict, sizeof(__pyx_k_ordereddict), 0, 0, 1, 1}, - {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1}, - {&__pyx_kp_s_out_of_memory, __pyx_k_out_of_memory, sizeof(__pyx_k_out_of_memory), 0, 0, 1, 0}, - {&__pyx_n_s_output, __pyx_k_output, sizeof(__pyx_k_output), 0, 0, 1, 1}, - {&__pyx_kp_s_output_size, __pyx_k_output_size, sizeof(__pyx_k_output_size), 0, 0, 1, 0}, - {&__pyx_n_s_overflow, __pyx_k_overflow, sizeof(__pyx_k_overflow), 0, 0, 1, 1}, - {&__pyx_n_s_pandas, __pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 0, 1, 1}, - {&__pyx_n_s_pandas_installed, __pyx_k_pandas_installed, sizeof(__pyx_k_pandas_installed), 0, 0, 1, 1}, - {&__pyx_n_s_parse_slice, __pyx_k_parse_slice, sizeof(__pyx_k_parse_slice), 0, 0, 1, 1}, - {&__pyx_n_s_parser, __pyx_k_parser, sizeof(__pyx_k_parser), 0, 0, 1, 1}, - {&__pyx_n_s_parser_classes, __pyx_k_parser_classes, sizeof(__pyx_k_parser_classes), 0, 0, 1, 1}, - {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1}, - {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, - {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_prev_bits, __pyx_k_prev_bits, sizeof(__pyx_k_prev_bits), 0, 0, 1, 1}, - {&__pyx_n_s_prev_compressed_offset, __pyx_k_prev_compressed_offset, sizeof(__pyx_k_prev_compressed_offset), 0, 0, 1, 1}, - {&__pyx_n_s_prev_uncompressed_offset, __pyx_k_prev_uncompressed_offset, sizeof(__pyx_k_prev_uncompressed_offset), 0, 0, 1, 1}, - {&__pyx_n_s_prev_window, __pyx_k_prev_window, sizeof(__pyx_k_prev_window), 0, 0, 1, 1}, - {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, - {&__pyx_n_s_quote, __pyx_k_quote, sizeof(__pyx_k_quote), 0, 0, 1, 1}, - {&__pyx_n_s_quotechar, __pyx_k_quotechar, sizeof(__pyx_k_quotechar), 0, 0, 1, 1}, - {&__pyx_kp_s_r_b, __pyx_k_r_b, sizeof(__pyx_k_r_b), 0, 0, 1, 0}, - {&__pyx_n_s_raise_adapter_exception, __pyx_k_raise_adapter_exception, sizeof(__pyx_k_raise_adapter_exception), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1}, - {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1}, - {&__pyx_n_s_read_slice, __pyx_k_read_slice, sizeof(__pyx_k_read_slice), 0, 0, 1, 1}, - {&__pyx_n_s_read_slice_infer_types, __pyx_k_read_slice_infer_types, sizeof(__pyx_k_read_slice_infer_types), 0, 0, 1, 1}, - {&__pyx_n_s_reader, __pyx_k_reader, sizeof(__pyx_k_reader), 0, 0, 1, 1}, - {&__pyx_n_s_reason, __pyx_k_reason, sizeof(__pyx_k_reason), 0, 0, 1, 1}, - {&__pyx_n_s_rec, __pyx_k_rec, sizeof(__pyx_k_rec), 0, 0, 1, 1}, - {&__pyx_n_s_rec_num, __pyx_k_rec_num, sizeof(__pyx_k_rec_num), 0, 0, 1, 1}, - {&__pyx_n_s_record, __pyx_k_record, sizeof(__pyx_k_record), 0, 0, 1, 1}, - {&__pyx_n_s_regex, __pyx_k_regex, sizeof(__pyx_k_regex), 0, 0, 1, 1}, - {&__pyx_n_s_regex_string, __pyx_k_regex_string, sizeof(__pyx_k_regex_string), 0, 0, 1, 1}, - {&__pyx_n_s_remote_s3_index, __pyx_k_remote_s3_index, sizeof(__pyx_k_remote_s3_index), 0, 0, 1, 1}, - {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1}, - {&__pyx_kp_s_reverse_stepping_not_implemented, __pyx_k_reverse_stepping_not_implemented, sizeof(__pyx_k_reverse_stepping_not_implemented), 0, 0, 1, 0}, - {&__pyx_n_s_rfind, __pyx_k_rfind, sizeof(__pyx_k_rfind), 0, 0, 1, 1}, - {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1}, - {&__pyx_n_s_s3_key, __pyx_k_s3_key, sizeof(__pyx_k_s3_key), 0, 0, 1, 1}, - {&__pyx_n_s_s3_text_adapter, __pyx_k_s3_text_adapter, sizeof(__pyx_k_s3_text_adapter), 0, 0, 1, 1}, - {&__pyx_n_s_secret_key, __pyx_k_secret_key, sizeof(__pyx_k_secret_key), 0, 0, 1, 1}, - {&__pyx_n_s_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 0, 0, 1, 1}, - {&__pyx_n_s_seek_offset, __pyx_k_seek_offset, sizeof(__pyx_k_seek_offset), 0, 0, 1, 1}, - {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, - {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, - {&__pyx_n_s_setLevel, __pyx_k_setLevel, sizeof(__pyx_k_setLevel), 0, 0, 1, 1}, - {&__pyx_n_s_set_converter_locals_lambda, __pyx_k_set_converter_locals_lambda, sizeof(__pyx_k_set_converter_locals_lambda), 0, 0, 1, 1}, - {&__pyx_n_s_set_dtype_converter, __pyx_k_set_dtype_converter, sizeof(__pyx_k_set_dtype_converter), 0, 0, 1, 1}, - {&__pyx_n_s_set_field_filter, __pyx_k_set_field_filter, sizeof(__pyx_k_set_field_filter), 0, 0, 1, 1}, - {&__pyx_n_s_set_field_filter_locals_genexpr, __pyx_k_set_field_filter_locals_genexpr, sizeof(__pyx_k_set_field_filter_locals_genexpr), 0, 0, 1, 1}, - {&__pyx_kp_s_set_field_filter_setting_field_f, __pyx_k_set_field_filter_setting_field_f, sizeof(__pyx_k_set_field_filter_setting_field_f), 0, 0, 1, 0}, - {&__pyx_n_s_set_field_names, __pyx_k_set_field_names, sizeof(__pyx_k_set_field_names), 0, 0, 1, 1}, - {&__pyx_n_s_set_field_names_locals_genexpr, __pyx_k_set_field_names_locals_genexpr, sizeof(__pyx_k_set_field_names_locals_genexpr), 0, 0, 1, 1}, - {&__pyx_kp_s_set_field_names_setting_field_na, __pyx_k_set_field_names_setting_field_na, sizeof(__pyx_k_set_field_names_setting_field_na), 0, 0, 1, 0}, - {&__pyx_n_s_set_field_types, __pyx_k_set_field_types, sizeof(__pyx_k_set_field_types), 0, 0, 1, 1}, - {&__pyx_n_s_set_field_types_locals_genexpr, __pyx_k_set_field_types_locals_genexpr, sizeof(__pyx_k_set_field_types_locals_genexpr), 0, 0, 1, 1}, - {&__pyx_kp_s_set_field_types_setting_dtypes_t, __pyx_k_set_field_types_setting_dtypes_t, sizeof(__pyx_k_set_field_types_setting_dtypes_t), 0, 0, 1, 0}, - {&__pyx_n_s_set_fill_values, __pyx_k_set_fill_values, sizeof(__pyx_k_set_fill_values), 0, 0, 1, 1}, - {&__pyx_n_s_set_missing_values, __pyx_k_set_missing_values, sizeof(__pyx_k_set_missing_values), 0, 0, 1, 1}, - {&__pyx_n_s_set_offset, __pyx_k_set_offset, sizeof(__pyx_k_set_offset), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, - {&__pyx_n_s_shmean, __pyx_k_shmean, sizeof(__pyx_k_shmean), 0, 0, 1, 1}, - {&__pyx_n_s_six, __pyx_k_six, sizeof(__pyx_k_six), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_sizes, __pyx_k_sizes, sizeof(__pyx_k_sizes), 0, 0, 1, 1}, - {&__pyx_n_s_skip, __pyx_k_skip, sizeof(__pyx_k_skip), 0, 0, 1, 1}, - {&__pyx_n_s_skipbytes, __pyx_k_skipbytes, sizeof(__pyx_k_skipbytes), 0, 0, 1, 1}, - {&__pyx_n_s_skipinitialspace, __pyx_k_skipinitialspace, sizeof(__pyx_k_skipinitialspace), 0, 0, 1, 1}, - {&__pyx_n_s_sniff, __pyx_k_sniff, sizeof(__pyx_k_sniff), 0, 0, 1, 1}, - {&__pyx_n_s_source, __pyx_k_source, sizeof(__pyx_k_source), 0, 0, 1, 1}, - {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_start_rec, __pyx_k_start_rec, sizeof(__pyx_k_start_rec), 0, 0, 1, 1}, - {&__pyx_n_s_std, __pyx_k_std, sizeof(__pyx_k_std), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_step_rec, __pyx_k_step_rec, sizeof(__pyx_k_step_rec), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_n_s_stop_rec, __pyx_k_stop_rec, sizeof(__pyx_k_stop_rec), 0, 0, 1, 1}, - {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1}, - {&__pyx_n_s_string_types, __pyx_k_string_types, sizeof(__pyx_k_string_types), 0, 0, 1, 1}, - {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1}, - {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1}, - {&__pyx_n_s_supported_encodings, __pyx_k_supported_encodings, sizeof(__pyx_k_supported_encodings), 0, 0, 1, 1}, - {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, - {&__pyx_n_b_taix, __pyx_k_taix, sizeof(__pyx_k_taix), 0, 0, 0, 1}, - {&__pyx_n_s_taix, __pyx_k_taix, sizeof(__pyx_k_taix), 0, 0, 1, 1}, - {&__pyx_n_s_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 0, 0, 1, 1}, - {&__pyx_n_s_temp_field_filter, __pyx_k_temp_field_filter, sizeof(__pyx_k_temp_field_filter), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_text_adapter, __pyx_k_text_adapter, sizeof(__pyx_k_text_adapter), 0, 0, 1, 1}, - {&__pyx_n_s_text_adapter_exception, __pyx_k_text_adapter_exception, sizeof(__pyx_k_text_adapter_exception), 0, 0, 1, 1}, - {&__pyx_n_s_textfileh, __pyx_k_textfileh, sizeof(__pyx_k_textfileh), 0, 0, 1, 1}, - {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, - {&__pyx_n_s_to_array, __pyx_k_to_array, sizeof(__pyx_k_to_array), 0, 0, 1, 1}, - {&__pyx_n_s_tofile, __pyx_k_tofile, sizeof(__pyx_k_tofile), 0, 0, 1, 1}, - {&__pyx_n_s_token, __pyx_k_token, sizeof(__pyx_k_token), 0, 0, 1, 1}, - {&__pyx_n_s_total_num_records, __pyx_k_total_num_records, sizeof(__pyx_k_total_num_records), 0, 0, 1, 1}, - {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1}, - {&__pyx_n_s_types, __pyx_k_types, sizeof(__pyx_k_types), 0, 0, 1, 1}, - {&__pyx_kp_s_types_must_be_dict_of_fields_dty, __pyx_k_types_must_be_dict_of_fields_dty, sizeof(__pyx_k_types_must_be_dict_of_fields_dty), 0, 0, 1, 0}, - {&__pyx_n_s_typesize, __pyx_k_typesize, sizeof(__pyx_k_typesize), 0, 0, 1, 1}, - {&__pyx_n_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 1}, - {&__pyx_n_s_u1, __pyx_k_u1, sizeof(__pyx_k_u1), 0, 0, 1, 1}, - {&__pyx_n_s_u4, __pyx_k_u4, sizeof(__pyx_k_u4), 0, 0, 1, 1}, - {&__pyx_n_s_u8, __pyx_k_u8, sizeof(__pyx_k_u8), 0, 0, 1, 1}, - {&__pyx_kp_s_u_d, __pyx_k_u_d, sizeof(__pyx_k_u_d), 0, 0, 1, 0}, - {&__pyx_n_s_uncompressed_offset, __pyx_k_uncompressed_offset, sizeof(__pyx_k_uncompressed_offset), 0, 0, 1, 1}, - {&__pyx_n_s_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 0, 1, 1}, - {&__pyx_kp_s_unknown_compression_type_0, __pyx_k_unknown_compression_type_0, sizeof(__pyx_k_unknown_compression_type_0), 0, 0, 1, 0}, - {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, - {&__pyx_n_s_urllib, __pyx_k_urllib, sizeof(__pyx_k_urllib), 0, 0, 1, 1}, - {&__pyx_n_s_urllib_request, __pyx_k_urllib_request, sizeof(__pyx_k_urllib_request), 0, 0, 1, 1}, - {&__pyx_n_s_urlopen, __pyx_k_urlopen, sizeof(__pyx_k_urlopen), 0, 0, 1, 1}, - {&__pyx_kp_s_user_converter, __pyx_k_user_converter, sizeof(__pyx_k_user_converter), 0, 0, 1, 0}, - {&__pyx_n_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 1}, - {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, - {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, - {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, - {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1}, - {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1}, - {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1}, - {&__pyx_n_s_wb, __pyx_k_wb, sizeof(__pyx_k_wb), 0, 0, 1, 1}, - {&__pyx_n_s_where, __pyx_k_where, sizeof(__pyx_k_where), 0, 0, 1, 1}, - {&__pyx_n_s_whitespace_delims, __pyx_k_whitespace_delims, sizeof(__pyx_k_whitespace_delims), 0, 0, 1, 1}, - {&__pyx_n_s_window, __pyx_k_window, sizeof(__pyx_k_window), 0, 0, 1, 1}, - {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 23, __pyx_L1_error) - __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(1, 46, __pyx_L1_error) - __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 458, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 162, __pyx_L1_error) - __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(1, 195, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 350, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 365, __pyx_L1_error) - __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(1, 462, __pyx_L1_error) - __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(1, 499, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 517, __pyx_L1_error) - __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s_round); if (!__pyx_builtin_round) __PYX_ERR(1, 530, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 266, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 916, __pyx_L1_error) - __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 1112, __pyx_L1_error) - __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 1225, __pyx_L1_error) - __pyx_builtin_EOFError = __Pyx_GetBuiltinName(__pyx_n_s_EOFError); if (!__pyx_builtin_EOFError) __PYX_ERR(0, 1226, __pyx_L1_error) - __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(0, 1254, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(4, 799, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "TextAdapter/textadapter/Index.pyx":162 - * def __init__(self, index_name=None, density=DEFAULT_INDEX_DENSITY, typesize=8, num_records=0): - * if density > 2**16-1: - * raise ValueError("density is too large") # <<<<<<<<<<<<<< - * self.density = density - * self.typesize = typesize - */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_density_is_too_large); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 162, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - - /* "TextAdapter/textadapter/Index.pyx":196 - * # Write index header for version 1 of the format - * idxh = open(self.idxfile, 'wb') - * idxh.write(b"taix") # the 'magic' header # <<<<<<<<<<<<<< - * bytes = numpy.empty(4, dtype='u1') - * bytes[0] = 0x1 # the version - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_b_taix); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "TextAdapter/textadapter/Index.pyx":197 - * idxh = open(self.idxfile, 'wb') - * idxh.write(b"taix") # the 'magic' header - * bytes = numpy.empty(4, dtype='u1') # <<<<<<<<<<<<<< - * bytes[0] = 0x1 # the version - * bytes[1] = 0x0 # the options - */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - - /* "TextAdapter/textadapter/Index.pyx":206 - * numpy.array(self.density, dtype='u4').tofile(idxh) - * # Now, a reserved field - * numpy.array(-1, dtype='i4').tofile(idxh) # <<<<<<<<<<<<<< - * # The number of offsets is still unknown - * numpy.array(0, dtype='u8').tofile(idxh) - */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - - /* "TextAdapter/textadapter/Index.pyx":208 - * numpy.array(-1, dtype='i4').tofile(idxh) - * # The number of offsets is still unknown - * numpy.array(0, dtype='u8').tofile(idxh) # <<<<<<<<<<<<<< - * # The number of gzip access points is still unknown - * numpy.array(0, dtype='u8').tofile(idxh) - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "TextAdapter/textadapter/Index.pyx":210 - * numpy.array(0, dtype='u8').tofile(idxh) - * # The number of gzip access points is still unknown - * numpy.array(0, dtype='u8').tofile(idxh) # <<<<<<<<<<<<<< - * # The total number of records in file - * numpy.array(self.total_num_records, dtype='u8').tofile(idxh) - */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - - /* "TextAdapter/textadapter/Index.pyx":214 - * numpy.array(self.total_num_records, dtype='u8').tofile(idxh) - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) # <<<<<<<<<<<<<< - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) - */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - - /* "TextAdapter/textadapter/Index.pyx":216 - * numpy.array(-1, dtype='i8').tofile(idxh) - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) # <<<<<<<<<<<<<< - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) - */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "TextAdapter/textadapter/Index.pyx":218 - * numpy.array(-1, dtype='i8').tofile(idxh) - * # Reserved field - * numpy.array(-1, dtype='i8').tofile(idxh) # <<<<<<<<<<<<<< - * self.header_length = self.HEADER_SIZE - * self.idxh = idxh - */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - - /* "TextAdapter/textadapter/Index.pyx":230 - * self.idxh = idxh = open(self.idxfile, 'r+b') - * # Read header. - * magic = idxh.read(4) # <<<<<<<<<<<<<< - * if magic != b"taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) - */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - - /* "TextAdapter/textadapter/Index.pyx":234 - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( - * idxh.read(4), dtype='u1') # <<<<<<<<<<<<<< - * if version == 1: - * self.header_length = self.HEADER_SIZE - */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - - /* "TextAdapter/textadapter/Index.pyx":242 - * self.density = long(numpy.fromfile(idxh, dtype='u4', count=1)[0]) - * # A reserved field - * idxh.read(4) # <<<<<<<<<<<<<< - * # The number of offsets - * num_offsets = numpy.fromfile(idxh, dtype='u8', count=1)[0] - */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - - /* "TextAdapter/textadapter/Index.pyx":259 - * - * # Read header. - * magic = data.read(4) # <<<<<<<<<<<<<< - * if magic != "taix": - * raise ValueError("The magic value '%s' is not recognized!" % magic) - */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - - /* "TextAdapter/textadapter/Index.pyx":263 - * raise ValueError("The magic value '%s' is not recognized!" % magic) - * version, options, checksum, typesize = numpy.fromstring( - * data.read(4), dtype='u1') # <<<<<<<<<<<<<< - * if version == 1: - * self.header_length = self.HEADER_SIZE - */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - - /* "TextAdapter/textadapter/Index.pyx":269 - * self.dtype = numpy.dtype("u%d"%self.typesize) - * # The density - * self.density = long(numpy.fromstring(data.read(4), dtype='u4')) # <<<<<<<<<<<<<< - * # A reserved field - * data.read(4) - */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - - /* "TextAdapter/textadapter/Index.pyx":271 - * self.density = long(numpy.fromstring(data.read(4), dtype='u4')) - * # A reserved field - * data.read(4) # <<<<<<<<<<<<<< - * # The number of offsets - * num_offsets = numpy.fromstring(data.read(8), dtype='u8') - */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - - /* "TextAdapter/textadapter/Index.pyx":273 - * data.read(4) - * # The number of offsets - * num_offsets = numpy.fromstring(data.read(8), dtype='u8') # <<<<<<<<<<<<<< - * self.num_offsets = long(num_offsets) - * - */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_int_8); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - - /* "TextAdapter/textadapter/Index.pyx":276 - * self.num_offsets = long(num_offsets) - * - * num_gzip_access_points = numpy.fromstring(data.read(8), dtype='u8') # <<<<<<<<<<<<<< - * self.num_gzip_access_points = long(num_gzip_access_points) - * - */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_int_8); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - - /* "TextAdapter/textadapter/Index.pyx":279 - * self.num_gzip_access_points = long(num_gzip_access_points) - * - * total_num_records = numpy.fromstring(data.read(8), dtype='u8') # <<<<<<<<<<<<<< - * self.total_num_records = long(total_num_records) - * - */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_int_8); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - - /* "TextAdapter/textadapter/Index.pyx":288 - * - * if self.num_offsets == 0: - * return (0, 0) # <<<<<<<<<<<<<< - * - * # Do a seek in index file depending on the sign of the offset - */ - __pyx_tuple__20 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - - /* "TextAdapter/textadapter/Index.pyx":292 - * # Do a seek in index file depending on the sign of the offset - * if rec_num < 0: - * raise ValueError('Invalid record number') # <<<<<<<<<<<<<< - * - * ioffset, num_offsets = divmod(rec_num, self.density) - */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Invalid_record_number); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - - /* "TextAdapter/textadapter/Index.pyx":309 - * pos = ioffset * self.typesize + self.header_length - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(pos, pos+self.typesize)})) - * offset = long(numpy.fromstring(data.read(8), dtype='u8')) # <<<<<<<<<<<<<< - * return (ioffset * self.density, offset) - * - */ - __pyx_tuple__22 = PyTuple_Pack(1, __pyx_int_8); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - - /* "TextAdapter/textadapter/Index.pyx":327 - * self.offsets.append(offset) - * elif isinstance(self.idxfile, basestring): - * self.idxh.seek(0, 2) # <<<<<<<<<<<<<< - * numpy.array(offset, dtype=self.dtype).tofile(self.idxh) - * - */ - __pyx_tuple__23 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_2); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - - /* "TextAdapter/textadapter/Index.pyx":338 - * self.gzip_access_points.append((bits, compressed_offset, uncompressed_offset, window)) - * elif isinstance(self.idxfile, basestring): - * self.idxh.seek(0, 2) # <<<<<<<<<<<<<< - * numpy.array(bits, dtype='u1').tofile(self.idxh) - * numpy.array(compressed_offset, dtype='u8').tofile(self.idxh) - */ - __pyx_tuple__24 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_2); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); - - /* "TextAdapter/textadapter/Index.pyx":431 - * # Get values at the end - * esizes = self.chunk_sizes(where=-1, chunksize=self.chunksize) - * self.isizes, self.esizes = isizes, esizes[::-1] # <<<<<<<<<<<<<< - * self.imean, self.emean = isizes.mean(), esizes.mean() - * self.istd, self.estd = isizes.std(), esizes.std() - */ - __pyx_slice__26 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__26)) __PYX_ERR(1, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__26); - __Pyx_GIVEREF(__pyx_slice__26); - - /* "TextAdapter/textadapter/Index.pyx":456 - * self.textfileh.seek(skipbytes, 0) - * chunk = self.textfileh.read(chunksize) - * chunk = chunk[:chunk.rfind('\n')] # <<<<<<<<<<<<<< - * elif where == -1: - * self.textfileh.seek(-chunksize, 2) - */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s__27); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); - - /* "TextAdapter/textadapter/Index.pyx":460 - * self.textfileh.seek(-chunksize, 2) - * chunk = self.textfileh.read(chunksize) - * chunk = chunk[chunk.find('\n')+1:] # <<<<<<<<<<<<<< - * else: - * raise NotImplementedError - */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s__27); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 460, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - - /* "TextAdapter/textadapter/Index.pyx":473 - * - * def get_sample_chunksize(self): - * isizes = numpy.empty(0, dtype='i4') # <<<<<<<<<<<<<< - * chunksize = CS; skipbytes = self.skipbytes - * asizes = self.chunk_sizes( - */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - - /* "TextAdapter/textadapter/Index.pyx":497 - * - * # Start finding the '\\n' from the midpoint to backwards - * bpos = hnb - chunk[:hnb].rfind('\n') # <<<<<<<<<<<<<< - * if bpos > hnb: - * raise IOError("\\n not detected in the backward direction!") - */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s__27); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - - /* "TextAdapter/textadapter/Index.pyx":499 - * bpos = hnb - chunk[:hnb].rfind('\n') - * if bpos > hnb: - * raise IOError("\\n not detected in the backward direction!") # <<<<<<<<<<<<<< - * # Start finding the '\n' from the midpoint to forward - * fpos = chunk[hnb-1:].find('\n') - */ - __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_n_not_detected_in_the_backward); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(1, 499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); - - /* "TextAdapter/textadapter/Index.pyx":501 - * raise IOError("\\n not detected in the backward direction!") - * # Start finding the '\n' from the midpoint to forward - * fpos = chunk[hnb-1:].find('\n') # <<<<<<<<<<<<<< - * if fpos < 0: - * raise IOError("\\n not detected in the forward direction!") - */ - __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s__27); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - - /* "TextAdapter/textadapter/Index.pyx":503 - * fpos = chunk[hnb-1:].find('\n') - * if fpos < 0: - * raise IOError("\\n not detected in the forward direction!") # <<<<<<<<<<<<<< - * # Select the position nearest to the midpoint - * if bpos < fpos: - */ - __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_n_not_detected_in_the_forward_d); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__34); - __Pyx_GIVEREF(__pyx_tuple__34); - - /* "TextAdapter/textadapter/Index.pyx":517 - * """Get the offset for `rec_num` *and* positionate there.""" - * if not -self.nrecords <= rec_num < self.nrecords: - * raise IndexError("index out ot range") # <<<<<<<<<<<<<< - * - * if rec_num > (self.nrecords / 2): - */ - __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_index_out_ot_range); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - - /* "TextAdapter/textadapter/TextAdapter.pyx":171 - * def __cinit__(self): - * if type(self) == TextAdapter: - * raise errors.AdapterException('TextAdapter cannot be used directly. ' # <<<<<<<<<<<<<< - * 'Use CSVTextAdapter, FixedWidthTextAdapter, RegexTextAdapter,' - * 'or JSONTextAdapter') - */ - __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_TextAdapter_cannot_be_used_direc); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__36); - __Pyx_GIVEREF(__pyx_tuple__36); - - /* "TextAdapter/textadapter/TextAdapter.pyx":219 - * self.encoding = encoding - * - * self.logger = logging.getLogger('TextAdapter') # <<<<<<<<<<<<<< - * if debug: - * self.logger.setLevel(logging.DEBUG) - */ - __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_TextAdapter); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - - /* "TextAdapter/textadapter/TextAdapter.pyx":226 - * - * if output == 'dataframe' and not pandas_installed: - * raise warnings.warn('Pandas module is not installed. ' # <<<<<<<<<<<<<< - * 'Output type will be set to numpy array.') - * self.default_output = 'ndarray' - */ - __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_Pandas_module_is_not_installed_O); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__40); - __Pyx_GIVEREF(__pyx_tuple__40); - - /* "TextAdapter/textadapter/TextAdapter.pyx":234 - * # TODO: download and parse remote text file in chunks - * if isinstance(fh, string_types) and \ - * (fh[0:7] == 'http://' or fh[0:6] == 'ftp://'): # <<<<<<<<<<<<<< - * url_socket = urlopen(fh) - * fh = io.BytesIO(url_socket.read()) - */ - __pyx_slice__41 = PySlice_New(__pyx_int_0, __pyx_int_7, Py_None); if (unlikely(!__pyx_slice__41)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__41); - __Pyx_GIVEREF(__pyx_slice__41); - __pyx_slice__42 = PySlice_New(__pyx_int_0, __pyx_int_6, Py_None); if (unlikely(!__pyx_slice__42)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__42); - __Pyx_GIVEREF(__pyx_slice__42); - - /* "TextAdapter/textadapter/TextAdapter.pyx":244 - * if isinstance(fh, (StringIO, io.StringIO, io.BytesIO)): - * if isinstance(fh, (StringIO, io.StringIO)): - * self.data = fh.read().encode('utf_8') # <<<<<<<<<<<<<< - * else: - * self.data = fh.read() - */ - __pyx_tuple__43 = PyTuple_Pack(1, __pyx_n_s_utf_8); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - - /* "TextAdapter/textadapter/TextAdapter.pyx":253 - * input_data = open_s3(self.data) - * elif isinstance(fh, string_types): - * input_data = open_file(fh.encode('ascii')) # <<<<<<<<<<<<<< - * if compression is None and fh.endswith('.gz'): - * compression = 'gzip' - */ - __pyx_tuple__44 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - - /* "TextAdapter/textadapter/TextAdapter.pyx":254 - * elif isinstance(fh, string_types): - * input_data = open_file(fh.encode('ascii')) - * if compression is None and fh.endswith('.gz'): # <<<<<<<<<<<<<< - * compression = 'gzip' - * elif isinstance(fh, types.GeneratorType): - */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_gz); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); - - /* "TextAdapter/textadapter/TextAdapter.pyx":261 - * if isinstance(temp[0], string_types): - * temp = '\n'.join(temp) - * self.data = temp.encode('utf_8') # <<<<<<<<<<<<<< - * else: - * self.data = b'\n'.join(temp) - */ - __pyx_tuple__46 = PyTuple_Pack(1, __pyx_n_s_utf_8); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - - /* "TextAdapter/textadapter/TextAdapter.pyx":271 - * - * if input_data == NULL: - * raise IOError('Could not initialize data source') # <<<<<<<<<<<<<< - * - * # Setup read/seek functions for compressed data. Functions pointers - */ - __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_Could_not_initialize_data_source); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__47); - __Pyx_GIVEREF(__pyx_tuple__47); - - /* "TextAdapter/textadapter/TextAdapter.pyx":290 - * self.adapter = open_text_adapter(input_data) - * if self.adapter == NULL: - * raise IOError('Could not initialize text adapter') # <<<<<<<<<<<<<< - * - * # num_records sets a hard limit on the number of records read. - */ - __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_Could_not_initialize_text_adapte); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - - /* "TextAdapter/textadapter/TextAdapter.pyx":452 - * field_filter.append(index) - * else: - * raise TypeError('Field must be int or string') # <<<<<<<<<<<<<< - * self._field_filter = sorted(field_filter) - * self.logger.debug('set_field_filter() setting field filter to [{0}]' - */ - __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_Field_must_be_int_or_string); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__49); - __Pyx_GIVEREF(__pyx_tuple__49); - - /* "TextAdapter/textadapter/TextAdapter.pyx":496 - * """ - * if self.adapter.fields.num_fields == 0: - * raise errors.ConfigurationError('Adapter has no fields specified') # <<<<<<<<<<<<<< - * - * # Reset field types to type infer and default to u8 - */ - __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_Adapter_has_no_fields_specified); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 496, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__52); - __Pyx_GIVEREF(__pyx_tuple__52); - - /* "TextAdapter/textadapter/TextAdapter.pyx":508 - * field = self._field_names.index(field) - * numpy_dtype = numpy.dtype(dtype) - * if numpy.version.version[0:3] == '1.6' and \ # <<<<<<<<<<<<<< - * (numpy_dtype.kind == 'M' or numpy_dtype.kind == 'm'): - * raise TypeError('NumPy 1.6 datetime/timedelta not supported') - */ - __pyx_slice__53 = PySlice_New(__pyx_int_0, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__53)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__53); - __Pyx_GIVEREF(__pyx_slice__53); - - /* "TextAdapter/textadapter/TextAdapter.pyx":510 - * if numpy.version.version[0:3] == '1.6' and \ - * (numpy_dtype.kind == 'M' or numpy_dtype.kind == 'm'): - * raise TypeError('NumPy 1.6 datetime/timedelta not supported') # <<<<<<<<<<<<<< - * self.mapping[int(field)] = numpy_dtype - * self.adapter.fields.field_info[field].infer_type = 0 - */ - __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_NumPy_1_6_datetime_timedelta_not); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__54); - __Pyx_GIVEREF(__pyx_tuple__54); - - /* "TextAdapter/textadapter/TextAdapter.pyx":514 - * self.adapter.fields.field_info[field].infer_type = 0 - * elif types is not None: - * raise TypeError('types must be dict of fields/dtypes, ' # <<<<<<<<<<<<<< - * 'or None to reset field types') - * self.logger.debug('set_field_types() setting dtypes to {0}' - */ - __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_types_must_be_dict_of_fields_dty); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__55); - __Pyx_GIVEREF(__pyx_tuple__55); - - /* "TextAdapter/textadapter/TextAdapter.pyx":576 - * if isinstance(field, (int, long)): - * if field < 0 or field > self.field_count: - * raise ValueError('Invalid field number') # <<<<<<<<<<<<<< - * elif isinstance(field, string_types): - * if field in self._field_names: - */ - __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_Invalid_field_number); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__57); - __Pyx_GIVEREF(__pyx_tuple__57); - - /* "TextAdapter/textadapter/TextAdapter.pyx":581 - * field = self._field_names.index(field) - * else: - * raise ValueError('Invalid field name') # <<<<<<<<<<<<<< - * else: - * raise TypeError('field must be int in string') - */ - __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_Invalid_field_name); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__58); - __Pyx_GIVEREF(__pyx_tuple__58); - - /* "TextAdapter/textadapter/TextAdapter.pyx":583 - * raise ValueError('Invalid field name') - * else: - * raise TypeError('field must be int in string') # <<<<<<<<<<<<<< - * - * self.build_converter[field] = \ - */ - __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_s_field_must_be_int_in_string); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 583, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__59); - __Pyx_GIVEREF(__pyx_tuple__59); - - /* "TextAdapter/textadapter/TextAdapter.pyx":708 - * """ Read all records and return Pandas dataframe """ - * if not pandas_installed: - * raise errors.AdapterException('Pandas module is not installed.') # <<<<<<<<<<<<<< - * return pandas.DataFrame.from_records(self.to_array()) - * - */ - __pyx_tuple__60 = PyTuple_Pack(1, __pyx_kp_s_Pandas_module_is_not_installed); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 708, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__60); - __Pyx_GIVEREF(__pyx_tuple__60); - - /* "TextAdapter/textadapter/TextAdapter.pyx":717 - * class TextAdapterFields(object): - * - * def __init__(self, adapter, fields): # <<<<<<<<<<<<<< - * self.adapter = adapter - * self.default_field_filter = self.adapter.field_filter - */ - __pyx_tuple__61 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_adapter, __pyx_n_s_fields); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 717, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__61); - __Pyx_GIVEREF(__pyx_tuple__61); - __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt, __pyx_n_s_init, 717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 717, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":722 - * self.temp_field_filter = fields - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * - * self.adapter.field_filter = self.temp_field_filter - */ - __pyx_tuple__63 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_index, __pyx_n_s_array); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 722, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__63); - __Pyx_GIVEREF(__pyx_tuple__63); - __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt, __pyx_n_s_getitem, 722, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 722, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":729 - * return array - * - * array = numpy.empty(0) # <<<<<<<<<<<<<< - * - * if isinstance(index, (int, long)): - */ - __pyx_tuple__65 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__65); - __Pyx_GIVEREF(__pyx_tuple__65); - - /* "TextAdapter/textadapter/TextAdapter.pyx":761 - * return TextAdapterFields(self, index) - * else: - * raise IndexError('index must be int, slice, fancy indexing, or field name') # <<<<<<<<<<<<<< - * - * array.shape = (-1,) - */ - __pyx_tuple__66 = PyTuple_Pack(1, __pyx_kp_s_index_must_be_int_slice_fancy_in); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 761, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__66); - __Pyx_GIVEREF(__pyx_tuple__66); - - /* "TextAdapter/textadapter/TextAdapter.pyx":763 - * raise IndexError('index must be int, slice, fancy indexing, or field name') - * - * array.shape = (-1,) # <<<<<<<<<<<<<< - * - * if self.default_output == 'dataframe': - */ - __pyx_tuple__67 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 763, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__67); - __Pyx_GIVEREF(__pyx_tuple__67); - - /* "TextAdapter/textadapter/TextAdapter.pyx":793 - * else: - * if recstep < 0: - * raise NotImplementedError('reverse stepping not implemented yet') # <<<<<<<<<<<<<< - * - * return (recstart, recstop, recstep) - */ - __pyx_tuple__68 = PyTuple_Pack(1, __pyx_kp_s_reverse_stepping_not_implemented); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 793, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__68); - __Pyx_GIVEREF(__pyx_tuple__68); - - /* "TextAdapter/textadapter/TextAdapter.pyx":804 - * for field in self._field_filter: - * if self.adapter.fields.field_info[field].infer_type: - * self.mapping[field] = numpy.dtype('u8') # <<<<<<<<<<<<<< - * self.__build_converters() - * self.__set_fill_values(None) - */ - __pyx_tuple__69 = PyTuple_Pack(1, __pyx_n_s_u8); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__69); - __Pyx_GIVEREF(__pyx_tuple__69); - - /* "TextAdapter/textadapter/TextAdapter.pyx":806 - * self.mapping[field] = numpy.dtype('u8') - * self.__build_converters() - * self.__set_fill_values(None) # <<<<<<<<<<<<<< - * - * # Try to make a good guess about the field dtypes from first 1000 records. - */ - __pyx_tuple__70 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 806, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__70); - __Pyx_GIVEREF(__pyx_tuple__70); - - /* "TextAdapter/textadapter/TextAdapter.pyx":916 - * data = calloc(self.REC_CHUNK_SIZE, rec_size) - * if data == 0: - * raise MemoryError('out of memory') # <<<<<<<<<<<<<< - * - * num_recs = 0 - */ - __pyx_tuple__71 = PyTuple_Pack(1, __pyx_kp_s_out_of_memory); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 916, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__71); - __Pyx_GIVEREF(__pyx_tuple__71); - - /* "TextAdapter/textadapter/TextAdapter.pyx":939 - * data = realloc(data, num_recs * rec_size) - * if data == 0: - * raise MemoryError('out of memory') # <<<<<<<<<<<<<< - * array = create_array(data, numpy.dtype(dtype), num_recs) - * break - */ - __pyx_tuple__72 = PyTuple_Pack(1, __pyx_kp_s_out_of_memory); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 939, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__72); - __Pyx_GIVEREF(__pyx_tuple__72); - - /* "TextAdapter/textadapter/TextAdapter.pyx":949 - * (num_recs + self.REC_CHUNK_SIZE) * rec_size) - * if data == 0: - * raise MemoryError('out of memory') # <<<<<<<<<<<<<< - * - * # We know exactly how many records to read, - */ - __pyx_tuple__73 = PyTuple_Pack(1, __pyx_kp_s_out_of_memory); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 949, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__73); - __Pyx_GIVEREF(__pyx_tuple__73); - - /* "TextAdapter/textadapter/TextAdapter.pyx":958 - * data = calloc(num_recs, rec_size) - * if data == 0: - * raise MemoryError('out of memory') # <<<<<<<<<<<<<< - * - * result = read_records(self.adapter, stop_rec - start_rec, step_rec, - */ - __pyx_tuple__74 = PyTuple_Pack(1, __pyx_kp_s_out_of_memory); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 958, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__74); - __Pyx_GIVEREF(__pyx_tuple__74); - - /* "TextAdapter/textadapter/TextAdapter.pyx":968 - * data = realloc(data, recs_read * rec_size) - * if data == 0: - * raise MemoryError('out of memory') # <<<<<<<<<<<<<< - * - * array = create_array(data, numpy.dtype(dtype), recs_read) - */ - __pyx_tuple__75 = PyTuple_Pack(1, __pyx_kp_s_out_of_memory); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 968, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__75); - __Pyx_GIVEREF(__pyx_tuple__75); - - /* "TextAdapter/textadapter/TextAdapter.pyx":990 - * index = self._field_names.index(field) - * else: - * raise TypeError('field to map must be int or string') # <<<<<<<<<<<<<< - * if self._field_filter is None or index in self._field_filter: - * if field in self.build_converter: - */ - __pyx_tuple__76 = PyTuple_Pack(1, __pyx_kp_s_field_to_map_must_be_int_or_stri); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 990, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__76); - __Pyx_GIVEREF(__pyx_tuple__76); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1159 - * - * if not boto_installed: - * raise errors.AdapterException("Cannot use s3 interface: boto not installed") # <<<<<<<<<<<<<< - * - * try: - */ - __pyx_tuple__77 = PyTuple_Pack(1, __pyx_kp_s_Cannot_use_s3_interface_boto_not); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 1159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__77); - __Pyx_GIVEREF(__pyx_tuple__77); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1246 - * self.adapter.any_whitespace_as_delim = 1 - * except csv.Error: - * raise errors.ParserError('could not guess delimiter character') # <<<<<<<<<<<<<< - * - * # Set delimiter character - */ - __pyx_tuple__81 = PyTuple_Pack(1, __pyx_kp_s_could_not_guess_delimiter_charac); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 1246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__81); - __Pyx_GIVEREF(__pyx_tuple__81); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1255 - * self.adapter.delim_char = ord(delimiter[0]) - * except OverflowError: - * raise errors.ArgumentError("delimiter must be ASCII character") # <<<<<<<<<<<<<< - * - * # set number of fields in file - */ - __pyx_tuple__82 = PyTuple_Pack(1, __pyx_kp_s_delimiter_must_be_ASCII_characte); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__82); - __Pyx_GIVEREF(__pyx_tuple__82); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1265 - * # encode the line string as bytes - * if sys.version < '3': - * line2 = line.encode('utf_8') # <<<<<<<<<<<<<< - * else: - * line2 = line - */ - __pyx_tuple__83 = PyTuple_Pack(1, __pyx_n_s_utf_8); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__83); - __Pyx_GIVEREF(__pyx_tuple__83); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1289 - * # encode the line string as bytes - * if sys.version < '3': - * comment_line2 = comment_line.encode('utf_8') # <<<<<<<<<<<<<< - * else: - * comment_line2 = comment_line - */ - __pyx_tuple__84 = PyTuple_Pack(1, __pyx_n_s_utf_8); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 1289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__84); - __Pyx_GIVEREF(__pyx_tuple__84); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1300 - * # encode the line string as bytes - * if sys.version < '3': - * line2 = line.encode('utf_8') # <<<<<<<<<<<<<< - * else: - * line2 = line - */ - __pyx_tuple__85 = PyTuple_Pack(1, __pyx_n_s_utf_8); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 1300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__85); - __Pyx_GIVEREF(__pyx_tuple__85); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1357 - * if isinstance(field_widths, (int, long)): - * if field_widths <= 0: - * raise ValueError('field width must be greater than 0') # <<<<<<<<<<<<<< - * try: - * record_iter = create_record_iter(self.adapter) - */ - __pyx_tuple__86 = PyTuple_Pack(1, __pyx_kp_s_field_width_must_be_greater_than); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 1357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__86); - __Pyx_GIVEREF(__pyx_tuple__86); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1370 - * for i in field_widths: - * if i <= 0: - * raise ValueError('field width must be greater than 0') # <<<<<<<<<<<<<< - * set_num_fields(self.adapter.fields, len(field_widths)) - * for i in range(0, self.adapter.fields.num_fields): - */ - __pyx_tuple__87 = PyTuple_Pack(1, __pyx_kp_s_field_width_must_be_greater_than); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 1370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__87); - __Pyx_GIVEREF(__pyx_tuple__87); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1375 - * set_field_width(self.adapter.fields, i, field_widths[i]) - * else: - * raise ValueError('field widths must be specified by int or list of ints') # <<<<<<<<<<<<<< - * - * self.field_filter = range(self.field_count) - */ - __pyx_tuple__88 = PyTuple_Pack(1, __pyx_kp_s_field_widths_must_be_specified_b); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 1375, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__88); - __Pyx_GIVEREF(__pyx_tuple__88); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1468 - * record = json.loads(line, object_pairs_hook=OrderedDict) - * - * def count_fields(rec, num): # <<<<<<<<<<<<<< - * for field in rec: - * if isinstance(field, list): - */ - __pyx_tuple__89 = PyTuple_Pack(3, __pyx_n_s_rec, __pyx_n_s_num, __pyx_n_s_field); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 1468, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__89); - __Pyx_GIVEREF(__pyx_tuple__89); - __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt, __pyx_n_s_count_fields, 1468, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(0, 1468, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1647 - * &str2str_object_converter - * - * carray = numpy.ndarray(1, dtype='O') # <<<<<<<<<<<<<< - * cdef uint64_t num_recs_read = 0 - * result = read_records(self.adapter, 1, 1, - */ - __pyx_tuple__92 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 1647, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__92); - __Pyx_GIVEREF(__pyx_tuple__92); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1694 - * &str2str_object_converter - * - * carray = numpy.ndarray(1, dtype='O') # <<<<<<<<<<<<<< - * result = read_records(self.adapter, 1, 1, (carray.data), NULL) - * line = numpy.asarray(carray) - */ - __pyx_tuple__93 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 1694, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__93); - __Pyx_GIVEREF(__pyx_tuple__93); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1736 - * &str2str_object_converter - * - * carray = numpy.ndarray(1, dtype='O') # <<<<<<<<<<<<<< - * result = read_records(self.adapter, 1, 1, (carray.data), NULL) - * line = numpy.asarray(carray) - */ - __pyx_tuple__94 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 1736, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__94); - __Pyx_GIVEREF(__pyx_tuple__94); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1802 - * 'Reason: {4}'.format(token, str(record), str(field), dtype, reason)) - * elif error == ADAPTER_ERROR_SEEK: - * e = errors.SourceError('Seek error') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_SEEK_EOF: - * e = errors.AdapterIndexError('Record {0} is out of bounds'.format(str(record))) - */ - __pyx_tuple__95 = PyTuple_Pack(1, __pyx_kp_s_Seek_error); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 1802, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__95); - __Pyx_GIVEREF(__pyx_tuple__95); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1806 - * e = errors.AdapterIndexError('Record {0} is out of bounds'.format(str(record))) - * elif error == ADAPTER_ERROR_SEEK_S3: - * e = errors.SourceError('S3 seek error') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_READ: - * e = errors.SourceError('Read error') - */ - __pyx_tuple__96 = PyTuple_Pack(1, __pyx_kp_s_S3_seek_error); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 1806, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__96); - __Pyx_GIVEREF(__pyx_tuple__96); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1808 - * e = errors.SourceError('S3 seek error') - * elif error == ADAPTER_ERROR_READ: - * e = errors.SourceError('Read error') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_READ_S3: - * e = errors.SourceError('S3 read error') - */ - __pyx_tuple__97 = PyTuple_Pack(1, __pyx_kp_s_Read_error); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 1808, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__97); - __Pyx_GIVEREF(__pyx_tuple__97); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1810 - * e = errors.SourceError('Read error') - * elif error == ADAPTER_ERROR_READ_S3: - * e = errors.SourceError('S3 read error') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_NO_FIELDS: - * e = errors.NoSuchFieldError('No fields found or no converters set') - */ - __pyx_tuple__98 = PyTuple_Pack(1, __pyx_kp_s_S3_read_error); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 1810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__98); - __Pyx_GIVEREF(__pyx_tuple__98); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1812 - * e = errors.SourceError('S3 read error') - * elif error == ADAPTER_ERROR_NO_FIELDS: - * e = errors.NoSuchFieldError('No fields found or no converters set') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_INDEX: - * e = errors.DataIndexError('Could not find record offset in index') - */ - __pyx_tuple__99 = PyTuple_Pack(1, __pyx_kp_s_No_fields_found_or_no_converters); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 1812, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__99); - __Pyx_GIVEREF(__pyx_tuple__99); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1814 - * e = errors.NoSuchFieldError('No fields found or no converters set') - * elif error == ADAPTER_ERROR_INDEX: - * e = errors.DataIndexError('Could not find record offset in index') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_PROCESS_TOKEN: - * e = errors.ParserError('Error processing token') - */ - __pyx_tuple__100 = PyTuple_Pack(1, __pyx_kp_s_Could_not_find_record_offset_in); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(0, 1814, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__100); - __Pyx_GIVEREF(__pyx_tuple__100); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1816 - * e = errors.DataIndexError('Could not find record offset in index') - * elif error == ADAPTER_ERROR_PROCESS_TOKEN: - * e = errors.ParserError('Error processing token') # <<<<<<<<<<<<<< - * e.token = token - * elif error == ADAPTER_ERROR_READ_TOKENS: - */ - __pyx_tuple__101 = PyTuple_Pack(1, __pyx_kp_s_Error_processing_token); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 1816, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__101); - __Pyx_GIVEREF(__pyx_tuple__101); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1819 - * e.token = token - * elif error == ADAPTER_ERROR_READ_TOKENS: - * e = errors.ParserError('Error reading tokens') # <<<<<<<<<<<<<< - * e.token = token - * elif error == ADAPTER_ERROR_READ_RECORDS: - */ - __pyx_tuple__102 = PyTuple_Pack(1, __pyx_kp_s_Error_reading_tokens); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(0, 1819, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__102); - __Pyx_GIVEREF(__pyx_tuple__102); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1822 - * e.token = token - * elif error == ADAPTER_ERROR_READ_RECORDS: - * e = errors.ParserError('Error reading records') # <<<<<<<<<<<<<< - * e.token = token - * elif error == ADAPTER_ERROR_READ_EOF: - */ - __pyx_tuple__103 = PyTuple_Pack(1, __pyx_kp_s_Error_reading_records); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 1822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__103); - __Pyx_GIVEREF(__pyx_tuple__103); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1825 - * e.token = token - * elif error == ADAPTER_ERROR_READ_EOF: - * e = errors.AdapterIndexError('Invalid record number or slice') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_INVALID_CHAR_CODE: - * e = errors.ParserError('Invalid character in input data') - */ - __pyx_tuple__104 = PyTuple_Pack(1, __pyx_kp_s_Invalid_record_number_or_slice); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 1825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__104); - __Pyx_GIVEREF(__pyx_tuple__104); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1827 - * e = errors.AdapterIndexError('Invalid record number or slice') - * elif error == ADAPTER_ERROR_INVALID_CHAR_CODE: - * e = errors.ParserError('Invalid character in input data') # <<<<<<<<<<<<<< - * e.token = token - * else: - */ - __pyx_tuple__105 = PyTuple_Pack(1, __pyx_kp_s_Invalid_character_in_input_data); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 1827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__105); - __Pyx_GIVEREF(__pyx_tuple__105); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":218 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_tuple__106 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(4, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__106); - __Pyx_GIVEREF(__pyx_tuple__106); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":222 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_tuple__107 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(4, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__107); - __Pyx_GIVEREF(__pyx_tuple__107); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":259 - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_tuple__108 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(4, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__108); - __Pyx_GIVEREF(__pyx_tuple__108); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":799 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == c'>' and little_endian) or - */ - __pyx_tuple__109 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(4, 799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__109); - __Pyx_GIVEREF(__pyx_tuple__109); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":803 - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_tuple__110 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(4, 803, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__110); - __Pyx_GIVEREF(__pyx_tuple__110); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":823 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_tuple__111 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__111)) __PYX_ERR(4, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__111); - __Pyx_GIVEREF(__pyx_tuple__111); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":989 - * _import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_umath() except -1: - */ - __pyx_tuple__112 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(4, 989, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__112); - __Pyx_GIVEREF(__pyx_tuple__112); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":995 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_ufunc() except -1: - */ - __pyx_tuple__113 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__113)) __PYX_ERR(4, 995, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__113); - __Pyx_GIVEREF(__pyx_tuple__113); - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1001 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - */ - __pyx_tuple__114 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(4, 1001, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__114); - __Pyx_GIVEREF(__pyx_tuple__114); - - /* "TextAdapter/textadapter/Index.pyx":160 - * HEADER_SIZE = 64 - * - * def __init__(self, index_name=None, density=DEFAULT_INDEX_DENSITY, typesize=8, num_records=0): # <<<<<<<<<<<<<< - * if density > 2**16-1: - * raise ValueError("density is too large") - */ - __pyx_tuple__115 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_index_name, __pyx_n_s_density, __pyx_n_s_typesize, __pyx_n_s_num_records); if (unlikely(!__pyx_tuple__115)) __PYX_ERR(1, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__115); - __Pyx_GIVEREF(__pyx_tuple__115); - __pyx_codeobj__116 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__115, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_init, 160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__116)) __PYX_ERR(1, 160, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":188 - * - * - * def create_disk_index(self): # <<<<<<<<<<<<<< - * """Create an exact index following the format specifcation.""" - * - */ - __pyx_tuple__117 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_idxh, __pyx_n_s_bytes); if (unlikely(!__pyx_tuple__117)) __PYX_ERR(1, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__117); - __Pyx_GIVEREF(__pyx_tuple__117); - __pyx_codeobj__118 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__117, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_create_disk_index, 188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__118)) __PYX_ERR(1, 188, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":226 - * - * - * def open_disk_index(self): # <<<<<<<<<<<<<< - * """Open an existing index""" - * self.idxh = idxh = open(self.idxfile, 'r+b') - */ - __pyx_tuple__119 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_idxh, __pyx_n_s_magic, __pyx_n_s_version, __pyx_n_s_options, __pyx_n_s_checksum, __pyx_n_s_typesize, __pyx_n_s_num_offsets, __pyx_n_s_num_gzip_access_points, __pyx_n_s_total_num_records); if (unlikely(!__pyx_tuple__119)) __PYX_ERR(1, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__119); - __Pyx_GIVEREF(__pyx_tuple__119); - __pyx_codeobj__120 = (PyObject*)__Pyx_PyCode_New(1, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__119, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_open_disk_index, 226, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__120)) __PYX_ERR(1, 226, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":254 - * - * - * def open_s3_index(self): # <<<<<<<<<<<<<< - * """Open an existing S3 index""" - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(0, self.HEADER_SIZE)})) - */ - __pyx_tuple__121 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_magic, __pyx_n_s_version, __pyx_n_s_options, __pyx_n_s_checksum, __pyx_n_s_typesize, __pyx_n_s_num_offsets, __pyx_n_s_num_gzip_access_points, __pyx_n_s_total_num_records); if (unlikely(!__pyx_tuple__121)) __PYX_ERR(1, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__121); - __Pyx_GIVEREF(__pyx_tuple__121); - __pyx_codeobj__122 = (PyObject*)__Pyx_PyCode_New(1, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__121, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_open_s3_index, 254, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__122)) __PYX_ERR(1, 254, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":283 - * - * - * def get_offset(self, rec_num): # <<<<<<<<<<<<<< - * """Get the offset for `rec_num`.""" - * global boto_installed - */ - __pyx_tuple__123 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_rec_num, __pyx_n_s_ioffset, __pyx_n_s_num_offsets, __pyx_n_s_pos, __pyx_n_s_offset, __pyx_n_s_data); if (unlikely(!__pyx_tuple__123)) __PYX_ERR(1, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__123); - __Pyx_GIVEREF(__pyx_tuple__123); - __pyx_codeobj__124 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__123, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_get_offset, 283, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__124)) __PYX_ERR(1, 283, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":313 - * - * - * def set_offset(self, rec_num, offset): # <<<<<<<<<<<<<< - * """ - * Set offset for rec_num. - */ - __pyx_tuple__125 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_rec_num, __pyx_n_s_offset, __pyx_n_s_ioffset, __pyx_n_s_num_offsets); if (unlikely(!__pyx_tuple__125)) __PYX_ERR(1, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__125); - __Pyx_GIVEREF(__pyx_tuple__125); - __pyx_codeobj__126 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__125, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_set_offset, 313, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__126)) __PYX_ERR(1, 313, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":333 - * self.num_offsets += 1 - * - * def add_gzip_access_point(self, window, compressed_offset, uncompressed_offset, avail_in, avail_out, bits): # <<<<<<<<<<<<<< - * - * if self.idxfile is None: - */ - __pyx_tuple__127 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_window, __pyx_n_s_compressed_offset, __pyx_n_s_uncompressed_offset, __pyx_n_s_avail_in, __pyx_n_s_avail_out, __pyx_n_s_bits); if (unlikely(!__pyx_tuple__127)) __PYX_ERR(1, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__127); - __Pyx_GIVEREF(__pyx_tuple__127); - __pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__127, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_add_gzip_access_point, 333, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) __PYX_ERR(1, 333, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":347 - * - * - * def get_gzip_access_point(self, offset): # <<<<<<<<<<<<<< - * - * if self.idxfile is None: - */ - __pyx_tuple__129 = PyTuple_Pack(13, __pyx_n_s_self, __pyx_n_s_offset, __pyx_n_s_i, __pyx_n_s_access_point, __pyx_n_s_pos, __pyx_n_s_prev_bits, __pyx_n_s_prev_compressed_offset, __pyx_n_s_prev_uncompressed_offset, __pyx_n_s_prev_window, __pyx_n_s_bits, __pyx_n_s_compressed_offset, __pyx_n_s_uncompressed_offset, __pyx_n_s_window); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(1, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__129); - __Pyx_GIVEREF(__pyx_tuple__129); - __pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_get_gzip_access_point, 347, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(1, 347, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":381 - * - * - * def finalize(self, total_num_records): # <<<<<<<<<<<<<< - * """ - * This function is called by C parsing engine when parsing is finished. - */ - __pyx_tuple__131 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_total_num_records, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__131)) __PYX_ERR(1, 381, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__131); - __Pyx_GIVEREF(__pyx_tuple__131); - __pyx_codeobj__132 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__131, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_finalize, 381, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__132)) __PYX_ERR(1, 381, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":403 - * - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.num_offsets - * - */ - __pyx_tuple__133 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__133)) __PYX_ERR(1, 403, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__133); - __Pyx_GIVEREF(__pyx_tuple__133); - __pyx_codeobj__134 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__133, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_len, 403, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__134)) __PYX_ERR(1, 403, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":406 - * return self.num_offsets - * - * def get_density(self): # <<<<<<<<<<<<<< - * return self.density - * - */ - __pyx_tuple__135 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(1, 406, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__135); - __Pyx_GIVEREF(__pyx_tuple__135); - __pyx_codeobj__136 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_get_density, 406, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__136)) __PYX_ERR(1, 406, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":409 - * return self.density - * - * def close(self): # <<<<<<<<<<<<<< - * if isinstance(self.idxfile, basestring): - * self.idxh.close() - */ - __pyx_tuple__137 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__137)) __PYX_ERR(1, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__137); - __Pyx_GIVEREF(__pyx_tuple__137); - __pyx_codeobj__138 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_close, 409, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__138)) __PYX_ERR(1, 409, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":420 - * """Implementation of a fuzzy index""" - * - * def __init__(self, textfileh, skip): # <<<<<<<<<<<<<< - * self.textfileh = textfileh - * self.skip = skip - */ - __pyx_tuple__139 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_textfileh, __pyx_n_s_skip, __pyx_n_s_isizes, __pyx_n_s_esizes, __pyx_n_s_allsizes, __pyx_n_s_shmean); if (unlikely(!__pyx_tuple__139)) __PYX_ERR(1, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__139); - __Pyx_GIVEREF(__pyx_tuple__139); - __pyx_codeobj__140 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__139, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_init, 420, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__140)) __PYX_ERR(1, 420, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":451 - * #print "nrecords:", self.nrecords - * - * def chunk_sizes(self, where=0, skipbytes=0, chunksize=CS): # <<<<<<<<<<<<<< - * """Return the sizes for records in a chunk of text.""" - * if where == 0: - */ - __pyx_tuple__141 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_where, __pyx_n_s_skipbytes, __pyx_n_s_chunksize, __pyx_n_s_chunk, __pyx_n_s_start, __pyx_n_s_sizes, __pyx_n_s_end, __pyx_n_s_asizes); if (unlikely(!__pyx_tuple__141)) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__141); - __Pyx_GIVEREF(__pyx_tuple__141); - __pyx_codeobj__142 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__141, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_chunk_sizes, 451, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__142)) __PYX_ERR(1, 451, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":472 - * return asizes - * - * def get_sample_chunksize(self): # <<<<<<<<<<<<<< - * isizes = numpy.empty(0, dtype='i4') - * chunksize = CS; skipbytes = self.skipbytes - */ - __pyx_tuple__143 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_isizes, __pyx_n_s_chunksize, __pyx_n_s_skipbytes, __pyx_n_s_asizes); if (unlikely(!__pyx_tuple__143)) __PYX_ERR(1, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__143); - __Pyx_GIVEREF(__pyx_tuple__143); - __pyx_codeobj__144 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__143, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_get_sample_chunksize, 472, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__144)) __PYX_ERR(1, 472, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":480 - * return chunksize, isizes - * - * def align_fuzzy(self, offset): # <<<<<<<<<<<<<< - * """Aling an offset so that it starts after a newline.""" - * # The number of bytes to read (should be a multiple of 2) - */ - __pyx_tuple__145 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_offset, __pyx_n_s_NB, __pyx_n_s_hnb, __pyx_n_s_chunk, __pyx_n_s_bpos, __pyx_n_s_fpos, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__145)) __PYX_ERR(1, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__145); - __Pyx_GIVEREF(__pyx_tuple__145); - __pyx_codeobj__146 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__145, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_align_fuzzy, 480, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__146)) __PYX_ERR(1, 480, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":514 - * return offset - hnb + pos - * - * def seek_offset(self, rec_num): # <<<<<<<<<<<<<< - * """Get the offset for `rec_num` *and* positionate there.""" - * if not -self.nrecords <= rec_num < self.nrecords: - */ - __pyx_tuple__147 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_rec_num, __pyx_n_s_fuzzy, __pyx_n_s_offset, __pyx_n_s_inv_rec_num); if (unlikely(!__pyx_tuple__147)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__147); - __Pyx_GIVEREF(__pyx_tuple__147); - __pyx_codeobj__148 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__147, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_seek_offset, 514, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__148)) __PYX_ERR(1, 514, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":553 - * self.textfileh.seek(offset, os.SEEK_END) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.nrecords - * - */ - __pyx_tuple__149 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__149)) __PYX_ERR(1, 553, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__149); - __Pyx_GIVEREF(__pyx_tuple__149); - __pyx_codeobj__150 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__149, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_len, 553, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__150)) __PYX_ERR(1, 553, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":556 - * return self.nrecords - * - * def close(self): # <<<<<<<<<<<<<< - * pass - * - */ - __pyx_tuple__151 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__151)) __PYX_ERR(1, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__151); - __Pyx_GIVEREF(__pyx_tuple__151); - __pyx_codeobj__152 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt_2, __pyx_n_s_close, 556, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__152)) __PYX_ERR(1, 556, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":79 - * - * __all__ = ( - * "text_adapter", # <<<<<<<<<<<<<< - * "s3_text_adapter", - * "CSVTextAdapter", - */ - __pyx_tuple__153 = PyTuple_Pack(7, __pyx_n_s_text_adapter, __pyx_n_s_s3_text_adapter, __pyx_n_s_CSVTextAdapter, __pyx_n_s_RegexTextAdapter, __pyx_n_s_FixedWidthTextAdapter, __pyx_n_s_JSONTextAdapter, __pyx_n_s_AdapterException); if (unlikely(!__pyx_tuple__153)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__153); - __Pyx_GIVEREF(__pyx_tuple__153); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1074 - * 'json':JSONTextAdapter} - * - * def text_adapter(source, parser='csv', *args, **kwargs): # <<<<<<<<<<<<<< - * """ - * Create a text adapter for reading CSV, JSON, or fixed width - */ - __pyx_tuple__154 = PyTuple_Pack(4, __pyx_n_s_source, __pyx_n_s_parser, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__154)) __PYX_ERR(0, 1074, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__154); - __Pyx_GIVEREF(__pyx_tuple__154); - __pyx_codeobj__155 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__154, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt, __pyx_n_s_text_adapter, 1074, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__155)) __PYX_ERR(0, 1074, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1117 - * return parser(source, *args, **kwargs) - * - * def s3_text_adapter(access_key, secret_key, bucket_name, key_name, # <<<<<<<<<<<<<< - * remote_s3_index=False, parser='csv', *args, **kwargs): - * """ - */ - __pyx_tuple__156 = PyTuple_Pack(11, __pyx_n_s_access_key, __pyx_n_s_secret_key, __pyx_n_s_bucket_name, __pyx_n_s_key_name, __pyx_n_s_remote_s3_index, __pyx_n_s_parser, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_conn, __pyx_n_s_bucket, __pyx_n_s_k); if (unlikely(!__pyx_tuple__156)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__156); - __Pyx_GIVEREF(__pyx_tuple__156); - __pyx_codeobj__157 = (PyObject*)__Pyx_PyCode_New(6, 0, 11, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__156, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt, __pyx_n_s_s3_text_adapter, 1117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__157)) __PYX_ERR(0, 1117, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1784 - * } - * - * def text_adapter_exception(error, convert_error=None, token=None, record=None, # <<<<<<<<<<<<<< - * field=None, dtype=None): - * """ - */ - __pyx_tuple__158 = PyTuple_Pack(8, __pyx_n_s_error, __pyx_n_s_convert_error, __pyx_n_s_token, __pyx_n_s_record, __pyx_n_s_field, __pyx_n_s_dtype, __pyx_n_s_reason, __pyx_n_s_e); if (unlikely(!__pyx_tuple__158)) __PYX_ERR(0, 1784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__158); - __Pyx_GIVEREF(__pyx_tuple__158); - __pyx_codeobj__159 = (PyObject*)__Pyx_PyCode_New(6, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__158, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_TextAdapt, __pyx_n_s_text_adapter_exception, 1784, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__159)) __PYX_ERR(0, 1784, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_65535 = PyInt_FromLong(65535L); if (unlikely(!__pyx_int_65535)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_100000 = PyInt_FromLong(100000L); if (unlikely(!__pyx_int_100000)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_131072 = PyInt_FromLong(131072L); if (unlikely(!__pyx_int_131072)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_4294967295 = PyInt_FromString((char *)"4294967295", 0, 0); if (unlikely(!__pyx_int_4294967295)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initTextAdapter(void); /*proto*/ -PyMODINIT_FUNC initTextAdapter(void) -#else -PyMODINIT_FUNC PyInit_TextAdapter(void); /*proto*/ -PyMODINIT_FUNC PyInit_TextAdapter(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - __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_TextAdapter(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __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("TextAdapter", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_TextAdapter__textadapter__TextAdapter) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "TextAdapter.textadapter.TextAdapter")) { - if (unlikely(PyDict_SetItemString(modules, "TextAdapter.textadapter.TextAdapter", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc) < 0) __PYX_ERR(0, 62, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "ArrayDealloc", (PyObject *)&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc) < 0) __PYX_ERR(0, 62, __pyx_L1_error) - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter_ArrayDealloc; - __pyx_vtabptr_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator = &__pyx_vtable_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator; - __pyx_vtable_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator.getSize = (PyObject *(*)(struct __pyx_obj_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator *))__pyx_f_5TextAdapter_11textadapter_11TextAdapter_18ConverterDecorator_getSize; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator) < 0) __PYX_ERR(0, 98, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator.tp_print = 0; - if (__Pyx_SetVtable(__pyx_type_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator.tp_dict, __pyx_vtabptr_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator) < 0) __PYX_ERR(0, 98, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "ConverterDecorator", (PyObject *)&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator) < 0) __PYX_ERR(0, 98, __pyx_L1_error) - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter_ConverterDecorator; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_TextAdapter) < 0) __PYX_ERR(0, 111, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_TextAdapter.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 111, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_36__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_36__getitem__.doc = __pyx_doc_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_36__getitem__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5TextAdapter_11textadapter_11TextAdapter_11TextAdapter_36__getitem__; - } - } - #endif - if (PyObject_SetAttrString(__pyx_m, "TextAdapter", (PyObject *)&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_TextAdapter) < 0) __PYX_ERR(0, 111, __pyx_L1_error) - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter_TextAdapter; - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter.tp_base = __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter) < 0) __PYX_ERR(0, 1176, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "CSVTextAdapter", (PyObject *)&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter) < 0) __PYX_ERR(0, 1176, __pyx_L1_error) - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter; - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter.tp_base = __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter) < 0) __PYX_ERR(0, 1335, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "FixedWidthTextAdapter", (PyObject *)&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter) < 0) __PYX_ERR(0, 1335, __pyx_L1_error) - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter; - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter.tp_base = __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter) < 0) __PYX_ERR(0, 1440, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "JSONTextAdapter", (PyObject *)&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter) < 0) __PYX_ERR(0, 1440, __pyx_L1_error) - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter; - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter.tp_base = __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter) < 0) __PYX_ERR(0, 1505, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "RegexTextAdapter", (PyObject *)&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter) < 0) __PYX_ERR(0, 1505, __pyx_L1_error) - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_LineIter) < 0) __PYX_ERR(0, 1614, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_LineIter.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "LineIter", (PyObject *)&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_LineIter) < 0) __PYX_ERR(0, 1614, __pyx_L1_error) - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_LineIter = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter_LineIter; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_RecordIter) < 0) __PYX_ERR(0, 1672, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_RecordIter.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "RecordIter", (PyObject *)&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_RecordIter) < 0) __PYX_ERR(0, 1672, __pyx_L1_error) - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_RecordIter = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter_RecordIter; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter) < 0) __PYX_ERR(0, 1714, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "JSONRecordIter", (PyObject *)&__pyx_type_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter) < 0) __PYX_ERR(0, 1714, __pyx_L1_error) - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter_JSONRecordIter; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter) < 0) __PYX_ERR(0, 431, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter.tp_print = 0; - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct__set_field_filter; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 455, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr.tp_print = 0; - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_1_genexpr; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names) < 0) __PYX_ERR(0, 465, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names.tp_print = 0; - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_2_set_field_names; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 478, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr.tp_print = 0; - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_3_genexpr; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types) < 0) __PYX_ERR(0, 488, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types.tp_print = 0; - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_4_set_field_types; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(0, 517, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr.tp_print = 0; - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_5_genexpr; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter) < 0) __PYX_ERR(0, 565, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter.tp_print = 0; - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_6_set_converter; - if (PyType_Ready(&__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__) < 0) __PYX_ERR(0, 1444, __pyx_L1_error) - __pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__.tp_print = 0; - __pyx_ptype_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__ = &__pyx_type_5TextAdapter_11textadapter_11TextAdapter___pyx_scope_struct_7___cinit__; - /*--- Type import code ---*/ - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", - #if CYTHON_COMPILING_IN_PYPY - sizeof(PyTypeObject), - #else - sizeof(PyHeapTypeObject), - #endif - 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(5, 9, __pyx_L1_error) - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(4, 155, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(4, 168, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(4, 172, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(4, 181, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(4, 861, __pyx_L1_error) - /*--- Variable import code ---*/ - /*--- Function import code ---*/ - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "TextAdapter/textadapter/TextAdapter.pyx":1 - * import numpy # <<<<<<<<<<<<<< - * import re - * import sys - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":2 - * import numpy - * import re # <<<<<<<<<<<<<< - * import sys - * import io - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_re, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":3 - * import numpy - * import re - * import sys # <<<<<<<<<<<<<< - * import io - * import warnings - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":4 - * import re - * import sys - * import io # <<<<<<<<<<<<<< - * import warnings - * import os - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_io, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":5 - * import sys - * import io - * import warnings # <<<<<<<<<<<<<< - * import os - * import types - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":6 - * import io - * import warnings - * import os # <<<<<<<<<<<<<< - * import types - * import logging - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":7 - * import warnings - * import os - * import types # <<<<<<<<<<<<<< - * import logging - * import csv - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_types, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_types, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":8 - * import os - * import types - * import logging # <<<<<<<<<<<<<< - * import csv - * import encodings - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_logging, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":9 - * import types - * import logging - * import csv # <<<<<<<<<<<<<< - * import encodings - * import math - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_csv, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_csv, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":10 - * import logging - * import csv - * import encodings # <<<<<<<<<<<<<< - * import math - * from TextAdapter.lib import errors - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_encodings, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_encodings, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":11 - * import csv - * import encodings - * import math # <<<<<<<<<<<<<< - * from TextAdapter.lib import errors - * from six import string_types, StringIO - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_math, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":12 - * import encodings - * import math - * from TextAdapter.lib import errors # <<<<<<<<<<<<<< - * from six import string_types, StringIO - * from cpython.ref cimport Py_INCREF - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_errors); - __Pyx_GIVEREF(__pyx_n_s_errors); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_errors); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_TextAdapter_lib, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_errors, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":13 - * import math - * from TextAdapter.lib import errors - * from six import string_types, StringIO # <<<<<<<<<<<<<< - * from cpython.ref cimport Py_INCREF - * - */ - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_string_types); - __Pyx_GIVEREF(__pyx_n_s_string_types); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_string_types); - __Pyx_INCREF(__pyx_n_s_StringIO); - __Pyx_GIVEREF(__pyx_n_s_StringIO); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_StringIO); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_six, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_string_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_string_types, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_StringIO); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_StringIO, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":16 - * from cpython.ref cimport Py_INCREF - * - * if sys.version > '3': # <<<<<<<<<<<<<< - * from urllib.request import urlopen - * else: - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_kp_s_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - - /* "TextAdapter/textadapter/TextAdapter.pyx":17 - * - * if sys.version > '3': - * from urllib.request import urlopen # <<<<<<<<<<<<<< - * else: - * from urllib import urlopen - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_urlopen); - __Pyx_GIVEREF(__pyx_n_s_urlopen); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_urlopen); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_urllib_request, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_urlopen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_urlopen, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":16 - * from cpython.ref cimport Py_INCREF - * - * if sys.version > '3': # <<<<<<<<<<<<<< - * from urllib.request import urlopen - * else: - */ - goto __pyx_L2; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":19 - * from urllib.request import urlopen - * else: - * from urllib import urlopen # <<<<<<<<<<<<<< - * - * try: - */ - /*else*/ { - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_urlopen); - __Pyx_GIVEREF(__pyx_n_s_urlopen); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_urlopen); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_urllib, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_urlopen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_urlopen, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L2:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":21 - * from urllib import urlopen - * - * try: # <<<<<<<<<<<<<< - * from collections import OrderedDict - * except ImportError: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __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:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":22 - * - * try: - * from collections import OrderedDict # <<<<<<<<<<<<<< - * except ImportError: - * from ordereddict import OrderedDict - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_OrderedDict); - __Pyx_GIVEREF(__pyx_n_s_OrderedDict); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_OrderedDict); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_OrderedDict, __pyx_t_1) < 0) __PYX_ERR(0, 22, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":21 - * from urllib import urlopen - * - * try: # <<<<<<<<<<<<<< - * from collections import OrderedDict - * except ImportError: - */ - } - __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_L10_try_end; - __pyx_L3_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":23 - * try: - * from collections import OrderedDict - * except ImportError: # <<<<<<<<<<<<<< - * from ordereddict import OrderedDict - * - */ - __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError); - if (__pyx_t_7) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_8) < 0) __PYX_ERR(0, 23, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_8); - - /* "TextAdapter/textadapter/TextAdapter.pyx":24 - * from collections import OrderedDict - * except ImportError: - * from ordereddict import OrderedDict # <<<<<<<<<<<<<< - * - * try: - */ - __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 24, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_n_s_OrderedDict); - __Pyx_GIVEREF(__pyx_n_s_OrderedDict); - PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_OrderedDict); - __pyx_t_10 = __Pyx_Import(__pyx_n_s_ordereddict, __pyx_t_9, -1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 24, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_10, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 24, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_OrderedDict, __pyx_t_9) < 0) __PYX_ERR(0, 24, __pyx_L5_except_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L4_exception_handled; - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":21 - * from urllib import urlopen - * - * try: # <<<<<<<<<<<<<< - * from collections import OrderedDict - * except ImportError: - */ - __Pyx_PyThreadState_assign - __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_L4_exception_handled:; - __Pyx_PyThreadState_assign - __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_L10_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":26 - * from ordereddict import OrderedDict - * - * try: # <<<<<<<<<<<<<< - * import boto - * from boto.s3 import key - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":27 - * - * try: - * import boto # <<<<<<<<<<<<<< - * from boto.s3 import key - * boto_installed = True - */ - __pyx_t_8 = __Pyx_Import(__pyx_n_s_boto, 0, -1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 27, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_boto, __pyx_t_8) < 0) __PYX_ERR(0, 27, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":28 - * try: - * import boto - * from boto.s3 import key # <<<<<<<<<<<<<< - * boto_installed = True - * except ImportError: - */ - __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 28, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_n_s_key); - __Pyx_GIVEREF(__pyx_n_s_key); - PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_key); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_boto_s3, __pyx_t_8, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_key); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 28, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_key, __pyx_t_8) < 0) __PYX_ERR(0, 28, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":29 - * import boto - * from boto.s3 import key - * boto_installed = True # <<<<<<<<<<<<<< - * except ImportError: - * boto_installed = False - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_boto_installed, Py_True) < 0) __PYX_ERR(0, 29, __pyx_L13_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":26 - * from ordereddict import OrderedDict - * - * try: # <<<<<<<<<<<<<< - * import boto - * from boto.s3 import key - */ - } - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L20_try_end; - __pyx_L13_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":30 - * from boto.s3 import key - * boto_installed = True - * except ImportError: # <<<<<<<<<<<<<< - * boto_installed = False - * - */ - __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError); - if (__pyx_t_7) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_8, &__pyx_t_2) < 0) __PYX_ERR(0, 30, __pyx_L15_except_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_2); - - /* "TextAdapter/textadapter/TextAdapter.pyx":31 - * boto_installed = True - * except ImportError: - * boto_installed = False # <<<<<<<<<<<<<< - * - * try: - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_boto_installed, Py_False) < 0) __PYX_ERR(0, 31, __pyx_L15_except_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L14_exception_handled; - } - goto __pyx_L15_except_error; - __pyx_L15_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":26 - * from ordereddict import OrderedDict - * - * try: # <<<<<<<<<<<<<< - * import boto - * from boto.s3 import key - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_5, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L14_exception_handled:; - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_5, __pyx_t_4); - __pyx_L20_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":33 - * boto_installed = False - * - * try: # <<<<<<<<<<<<<< - * import pandas - * pandas_installed = True - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __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:*/ { - - /* "TextAdapter/textadapter/TextAdapter.pyx":34 - * - * try: - * import pandas # <<<<<<<<<<<<<< - * pandas_installed = True - * except ImportError: - */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_pandas, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L23_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pandas, __pyx_t_2) < 0) __PYX_ERR(0, 34, __pyx_L23_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":35 - * try: - * import pandas - * pandas_installed = True # <<<<<<<<<<<<<< - * except ImportError: - * pandas_installed = False - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pandas_installed, Py_True) < 0) __PYX_ERR(0, 35, __pyx_L23_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":33 - * boto_installed = False - * - * try: # <<<<<<<<<<<<<< - * import pandas - * pandas_installed = True - */ - } - __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_L30_try_end; - __pyx_L23_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":36 - * import pandas - * pandas_installed = True - * except ImportError: # <<<<<<<<<<<<<< - * pandas_installed = False - * - */ - __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError); - if (__pyx_t_7) { - __Pyx_AddTraceback("TextAdapter.textadapter.TextAdapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_8, &__pyx_t_1) < 0) __PYX_ERR(0, 36, __pyx_L25_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_1); - - /* "TextAdapter/textadapter/TextAdapter.pyx":37 - * pandas_installed = True - * except ImportError: - * pandas_installed = False # <<<<<<<<<<<<<< - * - * - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pandas_installed, Py_False) < 0) __PYX_ERR(0, 37, __pyx_L25_except_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L24_exception_handled; - } - goto __pyx_L25_except_error; - __pyx_L25_except_error:; - - /* "TextAdapter/textadapter/TextAdapter.pyx":33 - * boto_installed = False - * - * try: # <<<<<<<<<<<<<< - * import pandas - * pandas_installed = True - */ - __Pyx_PyThreadState_assign - __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_L24_exception_handled:; - __Pyx_PyThreadState_assign - __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_L30_try_end:; - } - - /* "TextAdapter/textadapter/TextAdapter.pyx":43 - * # how to decode strings into objects. This should probably be passed in to the - * # converter function's void *args parameter. - * config = {'encoding': 'utf_8'} # <<<<<<<<<<<<<< - * - * supported_encodings = ['ascii', 'utf_8'] - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_encoding, __pyx_n_s_utf_8) < 0) __PYX_ERR(0, 43, __pyx_L1_error) - if (PyDict_SetItem(__pyx_d, __pyx_n_s_config, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":45 - * config = {'encoding': 'utf_8'} - * - * supported_encodings = ['ascii', 'utf_8'] # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_ascii); - __Pyx_GIVEREF(__pyx_n_s_ascii); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ascii); - __Pyx_INCREF(__pyx_n_s_utf_8); - __Pyx_GIVEREF(__pyx_n_s_utf_8); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_utf_8); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_supported_encodings, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":1 - * import numpy # <<<<<<<<<<<<<< - * import os - * from six import StringIO - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":2 - * import numpy - * import os # <<<<<<<<<<<<<< - * from six import StringIO - * - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "TextAdapter/textadapter/Index.pyx":3 - * import numpy - * import os - * from six import StringIO # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_StringIO); - __Pyx_GIVEREF(__pyx_n_s_StringIO); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_StringIO); - __pyx_t_8 = __Pyx_Import(__pyx_n_s_six, __pyx_t_1, -1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_8, __pyx_n_s_StringIO); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_StringIO, __pyx_t_1) < 0) __PYX_ERR(1, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/Index.pyx":46 - * - * - * class ExactIndex(object): # <<<<<<<<<<<<<< - * """Implementation of an exact index on-disk. - * - */ - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_builtin_object); - __Pyx_GIVEREF(__pyx_builtin_object); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_builtin_object); - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_8, __pyx_n_s_ExactIndex, __pyx_n_s_ExactIndex, (PyObject *) NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_kp_s_Implementation_of_an_exact_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "TextAdapter/textadapter/Index.pyx":131 - * """ - * - * TAG_OFFSET = 0 # <<<<<<<<<<<<<< - * TAG_SIZE = 4 - * - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_TAG_OFFSET, __pyx_int_0) < 0) __PYX_ERR(1, 131, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":132 - * - * TAG_OFFSET = 0 - * TAG_SIZE = 4 # <<<<<<<<<<<<<< - * - * VERSION_OFFSET = 4 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_TAG_SIZE, __pyx_int_4) < 0) __PYX_ERR(1, 132, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":134 - * TAG_SIZE = 4 - * - * VERSION_OFFSET = 4 # <<<<<<<<<<<<<< - * VERSION_SIZE = 1 - * OPTIONS_OFFSET = 5 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_VERSION_OFFSET, __pyx_int_4) < 0) __PYX_ERR(1, 134, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":135 - * - * VERSION_OFFSET = 4 - * VERSION_SIZE = 1 # <<<<<<<<<<<<<< - * OPTIONS_OFFSET = 5 - * OPTIONS_SIZE = 1 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_VERSION_SIZE, __pyx_int_1) < 0) __PYX_ERR(1, 135, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":136 - * VERSION_OFFSET = 4 - * VERSION_SIZE = 1 - * OPTIONS_OFFSET = 5 # <<<<<<<<<<<<<< - * OPTIONS_SIZE = 1 - * CHECKSUM_OFFSET = 6 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_OPTIONS_OFFSET, __pyx_int_5) < 0) __PYX_ERR(1, 136, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":137 - * VERSION_SIZE = 1 - * OPTIONS_OFFSET = 5 - * OPTIONS_SIZE = 1 # <<<<<<<<<<<<<< - * CHECKSUM_OFFSET = 6 - * CHECKSUM_SIZE = 1 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_OPTIONS_SIZE, __pyx_int_1) < 0) __PYX_ERR(1, 137, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":138 - * OPTIONS_OFFSET = 5 - * OPTIONS_SIZE = 1 - * CHECKSUM_OFFSET = 6 # <<<<<<<<<<<<<< - * CHECKSUM_SIZE = 1 - * TYPESIZE_OFFSET = 7 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_CHECKSUM_OFFSET, __pyx_int_6) < 0) __PYX_ERR(1, 138, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":139 - * OPTIONS_SIZE = 1 - * CHECKSUM_OFFSET = 6 - * CHECKSUM_SIZE = 1 # <<<<<<<<<<<<<< - * TYPESIZE_OFFSET = 7 - * TYPESIZE_SIZE = 1 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_CHECKSUM_SIZE, __pyx_int_1) < 0) __PYX_ERR(1, 139, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":140 - * CHECKSUM_OFFSET = 6 - * CHECKSUM_SIZE = 1 - * TYPESIZE_OFFSET = 7 # <<<<<<<<<<<<<< - * TYPESIZE_SIZE = 1 - * - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_TYPESIZE_OFFSET, __pyx_int_7) < 0) __PYX_ERR(1, 140, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":141 - * CHECKSUM_SIZE = 1 - * TYPESIZE_OFFSET = 7 - * TYPESIZE_SIZE = 1 # <<<<<<<<<<<<<< - * - * DENSITY_OFFSET = 8 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_TYPESIZE_SIZE, __pyx_int_1) < 0) __PYX_ERR(1, 141, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":143 - * TYPESIZE_SIZE = 1 - * - * DENSITY_OFFSET = 8 # <<<<<<<<<<<<<< - * DENSITY_OFFSET = 4 - * - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_DENSITY_OFFSET, __pyx_int_8) < 0) __PYX_ERR(1, 143, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":144 - * - * DENSITY_OFFSET = 8 - * DENSITY_OFFSET = 4 # <<<<<<<<<<<<<< - * - * RESERVED1_OFFSET = 12 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_DENSITY_OFFSET, __pyx_int_4) < 0) __PYX_ERR(1, 144, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":146 - * DENSITY_OFFSET = 4 - * - * RESERVED1_OFFSET = 12 # <<<<<<<<<<<<<< - * RESERVED1_SIZE = 4 - * - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_RESERVED1_OFFSET, __pyx_int_12) < 0) __PYX_ERR(1, 146, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":147 - * - * RESERVED1_OFFSET = 12 - * RESERVED1_SIZE = 4 # <<<<<<<<<<<<<< - * - * NUMOFFSETS_OFFSET = 16 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_RESERVED1_SIZE, __pyx_int_4) < 0) __PYX_ERR(1, 147, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":149 - * RESERVED1_SIZE = 4 - * - * NUMOFFSETS_OFFSET = 16 # <<<<<<<<<<<<<< - * NUMOFFSETS_SIZE = 8 - * - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_NUMOFFSETS_OFFSET, __pyx_int_16) < 0) __PYX_ERR(1, 149, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":150 - * - * NUMOFFSETS_OFFSET = 16 - * NUMOFFSETS_SIZE = 8 # <<<<<<<<<<<<<< - * - * NUM_GZIP_ACCESS_POINTS_OFFSET = 24 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_NUMOFFSETS_SIZE, __pyx_int_8) < 0) __PYX_ERR(1, 150, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":152 - * NUMOFFSETS_SIZE = 8 - * - * NUM_GZIP_ACCESS_POINTS_OFFSET = 24 # <<<<<<<<<<<<<< - * NUM_GZIP_ACCESS_POINTS_SIZE = 8 - * - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_NUM_GZIP_ACCESS_POINTS_OFFSET, __pyx_int_24) < 0) __PYX_ERR(1, 152, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":153 - * - * NUM_GZIP_ACCESS_POINTS_OFFSET = 24 - * NUM_GZIP_ACCESS_POINTS_SIZE = 8 # <<<<<<<<<<<<<< - * - * TOTAL_NUM_RECORDS_OFFSET = 32 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_NUM_GZIP_ACCESS_POINTS_SIZE, __pyx_int_8) < 0) __PYX_ERR(1, 153, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":155 - * NUM_GZIP_ACCESS_POINTS_SIZE = 8 - * - * TOTAL_NUM_RECORDS_OFFSET = 32 # <<<<<<<<<<<<<< - * TOTAL_NUM_RECORDS_SIZE = 8 - * - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_TOTAL_NUM_RECORDS_OFFSET, __pyx_int_32) < 0) __PYX_ERR(1, 155, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":156 - * - * TOTAL_NUM_RECORDS_OFFSET = 32 - * TOTAL_NUM_RECORDS_SIZE = 8 # <<<<<<<<<<<<<< - * - * HEADER_SIZE = 64 - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_TOTAL_NUM_RECORDS_SIZE, __pyx_int_8) < 0) __PYX_ERR(1, 156, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":158 - * TOTAL_NUM_RECORDS_SIZE = 8 - * - * HEADER_SIZE = 64 # <<<<<<<<<<<<<< - * - * def __init__(self, index_name=None, density=DEFAULT_INDEX_DENSITY, typesize=8, num_records=0): - */ - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_HEADER_SIZE, __pyx_int_64) < 0) __PYX_ERR(1, 158, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":160 - * HEADER_SIZE = 64 - * - * def __init__(self, index_name=None, density=DEFAULT_INDEX_DENSITY, typesize=8, num_records=0): # <<<<<<<<<<<<<< - * if density > 2**16-1: - * raise ValueError("density is too large") - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_1__init__, 0, __pyx_n_s_ExactIndex___init, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__116)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_10, sizeof(__pyx_defaults), 1)) __PYX_ERR(1, 160, __pyx_L1_error) - __pyx_t_9 = __Pyx_PyInt_From_int(DEFAULT_INDEX_DENSITY); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_10)->__pyx_arg_density = __pyx_t_9; - __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_9 = 0; - __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_10, __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_6__defaults__); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_init, __pyx_t_10) < 0) __PYX_ERR(1, 160, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":188 - * - * - * def create_disk_index(self): # <<<<<<<<<<<<<< - * """Create an exact index following the format specifcation.""" - * - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_3create_disk_index, 0, __pyx_n_s_ExactIndex_create_disk_index, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__118)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_create_disk_index, __pyx_t_10) < 0) __PYX_ERR(1, 188, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":226 - * - * - * def open_disk_index(self): # <<<<<<<<<<<<<< - * """Open an existing index""" - * self.idxh = idxh = open(self.idxfile, 'r+b') - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_5open_disk_index, 0, __pyx_n_s_ExactIndex_open_disk_index, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__120)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_open_disk_index, __pyx_t_10) < 0) __PYX_ERR(1, 226, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":254 - * - * - * def open_s3_index(self): # <<<<<<<<<<<<<< - * """Open an existing S3 index""" - * data = StringIO(self.idxfile.get_contents_as_string(headers={'Range' : 'bytes={0}-{1}'.format(0, self.HEADER_SIZE)})) - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_7open_s3_index, 0, __pyx_n_s_ExactIndex_open_s3_index, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__122)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_open_s3_index, __pyx_t_10) < 0) __PYX_ERR(1, 254, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":283 - * - * - * def get_offset(self, rec_num): # <<<<<<<<<<<<<< - * """Get the offset for `rec_num`.""" - * global boto_installed - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_9get_offset, 0, __pyx_n_s_ExactIndex_get_offset, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__124)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_get_offset, __pyx_t_10) < 0) __PYX_ERR(1, 283, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":313 - * - * - * def set_offset(self, rec_num, offset): # <<<<<<<<<<<<<< - * """ - * Set offset for rec_num. - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_11set_offset, 0, __pyx_n_s_ExactIndex_set_offset, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__126)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_set_offset, __pyx_t_10) < 0) __PYX_ERR(1, 313, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":333 - * self.num_offsets += 1 - * - * def add_gzip_access_point(self, window, compressed_offset, uncompressed_offset, avail_in, avail_out, bits): # <<<<<<<<<<<<<< - * - * if self.idxfile is None: - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_13add_gzip_access_point, 0, __pyx_n_s_ExactIndex_add_gzip_access_point, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__128)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_add_gzip_access_point, __pyx_t_10) < 0) __PYX_ERR(1, 333, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":347 - * - * - * def get_gzip_access_point(self, offset): # <<<<<<<<<<<<<< - * - * if self.idxfile is None: - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_15get_gzip_access_point, 0, __pyx_n_s_ExactIndex_get_gzip_access_point, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__130)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_get_gzip_access_point, __pyx_t_10) < 0) __PYX_ERR(1, 347, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":381 - * - * - * def finalize(self, total_num_records): # <<<<<<<<<<<<<< - * """ - * This function is called by C parsing engine when parsing is finished. - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_17finalize, 0, __pyx_n_s_ExactIndex_finalize, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__132)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 381, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_finalize, __pyx_t_10) < 0) __PYX_ERR(1, 381, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":403 - * - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.num_offsets - * - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_19__len__, 0, __pyx_n_s_ExactIndex___len, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__134)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 403, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_len, __pyx_t_10) < 0) __PYX_ERR(1, 403, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":406 - * return self.num_offsets - * - * def get_density(self): # <<<<<<<<<<<<<< - * return self.density - * - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_21get_density, 0, __pyx_n_s_ExactIndex_get_density, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__136)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 406, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_get_density, __pyx_t_10) < 0) __PYX_ERR(1, 406, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":409 - * return self.density - * - * def close(self): # <<<<<<<<<<<<<< - * if isinstance(self.idxfile, basestring): - * self.idxh.close() - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_10ExactIndex_23close, 0, __pyx_n_s_ExactIndex_close, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__138)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_close, __pyx_t_10) < 0) __PYX_ERR(1, 409, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":46 - * - * - * class ExactIndex(object): # <<<<<<<<<<<<<< - * """Implementation of an exact index on-disk. - * - */ - __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_ExactIndex, __pyx_t_8, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ExactIndex, __pyx_t_10) < 0) __PYX_ERR(1, 46, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/Index.pyx":415 - * - * # The chunksize that is read by default - * CS = 128 * 1024 # 128 KB # <<<<<<<<<<<<<< - * - * class FuzzyIdx(object): - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_CS, __pyx_int_131072) < 0) __PYX_ERR(1, 415, __pyx_L1_error) - - /* "TextAdapter/textadapter/Index.pyx":417 - * CS = 128 * 1024 # 128 KB - * - * class FuzzyIdx(object): # <<<<<<<<<<<<<< - * """Implementation of a fuzzy index""" - * - */ - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_builtin_object); - __Pyx_GIVEREF(__pyx_builtin_object); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_builtin_object); - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_8, __pyx_n_s_FuzzyIdx, __pyx_n_s_FuzzyIdx, (PyObject *) NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_kp_s_Implementation_of_a_fuzzy_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "TextAdapter/textadapter/Index.pyx":420 - * """Implementation of a fuzzy index""" - * - * def __init__(self, textfileh, skip): # <<<<<<<<<<<<<< - * self.textfileh = textfileh - * self.skip = skip - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_1__init__, 0, __pyx_n_s_FuzzyIdx___init, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__140)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_init, __pyx_t_10) < 0) __PYX_ERR(1, 420, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":451 - * #print "nrecords:", self.nrecords - * - * def chunk_sizes(self, where=0, skipbytes=0, chunksize=CS): # <<<<<<<<<<<<<< - * """Return the sizes for records in a chunk of text.""" - * if where == 0: - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_3chunk_sizes, 0, __pyx_n_s_FuzzyIdx_chunk_sizes, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__142)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_10, sizeof(__pyx_defaults1), 1)) __PYX_ERR(1, 451, __pyx_L1_error) - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_CS); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_10)->__pyx_arg_chunksize = __pyx_t_9; - __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_9 = 0; - __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_10, __pyx_pf_5TextAdapter_11textadapter_11TextAdapter_8__defaults__); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_chunk_sizes, __pyx_t_10) < 0) __PYX_ERR(1, 451, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":472 - * return asizes - * - * def get_sample_chunksize(self): # <<<<<<<<<<<<<< - * isizes = numpy.empty(0, dtype='i4') - * chunksize = CS; skipbytes = self.skipbytes - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_5get_sample_chunksize, 0, __pyx_n_s_FuzzyIdx_get_sample_chunksize, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__144)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 472, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_get_sample_chunksize, __pyx_t_10) < 0) __PYX_ERR(1, 472, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":480 - * return chunksize, isizes - * - * def align_fuzzy(self, offset): # <<<<<<<<<<<<<< - * """Aling an offset so that it starts after a newline.""" - * # The number of bytes to read (should be a multiple of 2) - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_7align_fuzzy, 0, __pyx_n_s_FuzzyIdx_align_fuzzy, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__146)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_align_fuzzy, __pyx_t_10) < 0) __PYX_ERR(1, 480, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":514 - * return offset - hnb + pos - * - * def seek_offset(self, rec_num): # <<<<<<<<<<<<<< - * """Get the offset for `rec_num` *and* positionate there.""" - * if not -self.nrecords <= rec_num < self.nrecords: - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_9seek_offset, 0, __pyx_n_s_FuzzyIdx_seek_offset, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__148)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_seek_offset, __pyx_t_10) < 0) __PYX_ERR(1, 514, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":553 - * self.textfileh.seek(offset, os.SEEK_END) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.nrecords - * - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_11__len__, 0, __pyx_n_s_FuzzyIdx___len, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__150)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 553, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_len, __pyx_t_10) < 0) __PYX_ERR(1, 553, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":556 - * return self.nrecords - * - * def close(self): # <<<<<<<<<<<<<< - * pass - * - */ - __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_8FuzzyIdx_13close, 0, __pyx_n_s_FuzzyIdx_close, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter, __pyx_d, ((PyObject *)__pyx_codeobj__152)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_close, __pyx_t_10) < 0) __PYX_ERR(1, 556, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "TextAdapter/textadapter/Index.pyx":417 - * CS = 128 * 1024 # 128 KB - * - * class FuzzyIdx(object): # <<<<<<<<<<<<<< - * """Implementation of a fuzzy index""" - * - */ - __pyx_t_10 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FuzzyIdx, __pyx_t_8, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FuzzyIdx, __pyx_t_10) < 0) __PYX_ERR(1, 417, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/lib/Converters.pyx":1 - * import numpy # <<<<<<<<<<<<<< - * cimport numpy - * - */ - __pyx_t_8 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_8) < 0) __PYX_ERR(3, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":75 - * # Enable C api. This must be called before any - * # other numpy C api methods are called. - * numpy.import_array() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_7 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 75, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":79 - * - * __all__ = ( - * "text_adapter", # <<<<<<<<<<<<<< - * "s3_text_adapter", - * "CSVTextAdapter", - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_tuple__153) < 0) __PYX_ERR(0, 78, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":89 - * - * - * default_missing_values = ['NA', 'NaN', 'inf', '-inf', 'None', 'none', ''] # <<<<<<<<<<<<<< - * - * default_fill_values = {'u':0, 'i':0, 'f':numpy.nan, 'c':0, 'b':False, - */ - __pyx_t_8 = PyList_New(7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_n_s_NA); - __Pyx_GIVEREF(__pyx_n_s_NA); - PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_NA); - __Pyx_INCREF(__pyx_n_s_NaN); - __Pyx_GIVEREF(__pyx_n_s_NaN); - PyList_SET_ITEM(__pyx_t_8, 1, __pyx_n_s_NaN); - __Pyx_INCREF(__pyx_n_s_inf); - __Pyx_GIVEREF(__pyx_n_s_inf); - PyList_SET_ITEM(__pyx_t_8, 2, __pyx_n_s_inf); - __Pyx_INCREF(__pyx_kp_s_inf_2); - __Pyx_GIVEREF(__pyx_kp_s_inf_2); - PyList_SET_ITEM(__pyx_t_8, 3, __pyx_kp_s_inf_2); - __Pyx_INCREF(__pyx_n_s_None); - __Pyx_GIVEREF(__pyx_n_s_None); - PyList_SET_ITEM(__pyx_t_8, 4, __pyx_n_s_None); - __Pyx_INCREF(__pyx_n_s_none); - __Pyx_GIVEREF(__pyx_n_s_none); - PyList_SET_ITEM(__pyx_t_8, 5, __pyx_n_s_none); - __Pyx_INCREF(__pyx_kp_s__25); - __Pyx_GIVEREF(__pyx_kp_s__25); - PyList_SET_ITEM(__pyx_t_8, 6, __pyx_kp_s__25); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_missing_values, __pyx_t_8) < 0) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":91 - * default_missing_values = ['NA', 'NaN', 'inf', '-inf', 'None', 'none', ''] - * - * default_fill_values = {'u':0, 'i':0, 'f':numpy.nan, 'c':0, 'b':False, # <<<<<<<<<<<<<< - * 'O':'', 'S':'', 'M':None, 'U':''} - * - */ - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_u, __pyx_int_0) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_i, __pyx_int_0) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_f, __pyx_t_2) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_c, __pyx_int_0) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_b, Py_False) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_O, __pyx_kp_s__25) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_S, __pyx_kp_s__25) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":92 - * - * default_fill_values = {'u':0, 'i':0, 'f':numpy.nan, 'c':0, 'b':False, - * 'O':'', 'S':'', 'M':None, 'U':''} # <<<<<<<<<<<<<< - * - * - */ - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_M, Py_None) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_U, __pyx_kp_s__25) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_fill_values, __pyx_t_8) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":458 - * - * - * field_filter = property(get_field_filter, set_field_filter) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_8 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, __pyx_n_s_get_field_filter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, __pyx_n_s_set_field_filter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __pyx_t_8 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter->tp_dict, __pyx_n_s_field_filter, __pyx_t_2) < 0) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyType_Modified(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter); - - /* "TextAdapter/textadapter/TextAdapter.pyx":480 - * .format(','.join(str(x) for x in self._field_names))) - * - * field_names = property(get_field_names, set_field_names) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, __pyx_n_s_get_field_names); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, __pyx_n_s_set_field_names); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); - __pyx_t_2 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter->tp_dict, __pyx_n_s_field_names, __pyx_t_1) < 0) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter); - - /* "TextAdapter/textadapter/TextAdapter.pyx":520 - * - * - * field_types = property(get_field_types, set_field_types) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, __pyx_n_s_get_field_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter, __pyx_n_s_set_field_types); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8); - __pyx_t_1 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter->tp_dict, __pyx_n_s_field_types, __pyx_t_8) < 0) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - PyType_Modified(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter); - - /* "TextAdapter/textadapter/TextAdapter.pyx":523 - * - * - * def create_index(self, index_name=None, density=DEFAULT_INDEX_DENSITY): # <<<<<<<<<<<<<< - * """ - * Build index of record offsets to allow fast random access. - */ - __pyx_t_8 = __Pyx_PyInt_From_int(DEFAULT_INDEX_DENSITY); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 523, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_k__56 = __pyx_t_8; - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1069 - * - * - * parser_classes = {'csv':CSVTextAdapter, # <<<<<<<<<<<<<< - * 'fixed_width':FixedWidthTextAdapter, - * 'regex':RegexTextAdapter, - */ - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1069, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_csv, ((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_CSVTextAdapter)) < 0) __PYX_ERR(0, 1069, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1070 - * - * parser_classes = {'csv':CSVTextAdapter, - * 'fixed_width':FixedWidthTextAdapter, # <<<<<<<<<<<<<< - * 'regex':RegexTextAdapter, - * 'json':JSONTextAdapter} - */ - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_fixed_width, ((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter)) < 0) __PYX_ERR(0, 1069, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1071 - * parser_classes = {'csv':CSVTextAdapter, - * 'fixed_width':FixedWidthTextAdapter, - * 'regex':RegexTextAdapter, # <<<<<<<<<<<<<< - * 'json':JSONTextAdapter} - * - */ - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_regex, ((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter)) < 0) __PYX_ERR(0, 1069, __pyx_L1_error) - - /* "TextAdapter/textadapter/TextAdapter.pyx":1072 - * 'fixed_width':FixedWidthTextAdapter, - * 'regex':RegexTextAdapter, - * 'json':JSONTextAdapter} # <<<<<<<<<<<<<< - * - * def text_adapter(source, parser='csv', *args, **kwargs): - */ - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_json, ((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_JSONTextAdapter)) < 0) __PYX_ERR(0, 1069, __pyx_L1_error) - if (PyDict_SetItem(__pyx_d, __pyx_n_s_parser_classes, __pyx_t_8) < 0) __PYX_ERR(0, 1069, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1074 - * 'json':JSONTextAdapter} - * - * def text_adapter(source, parser='csv', *args, **kwargs): # <<<<<<<<<<<<<< - * """ - * Create a text adapter for reading CSV, JSON, or fixed width - */ - __pyx_t_8 = PyCFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_1text_adapter, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1074, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_text_adapter, __pyx_t_8) < 0) __PYX_ERR(0, 1074, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1117 - * return parser(source, *args, **kwargs) - * - * def s3_text_adapter(access_key, secret_key, bucket_name, key_name, # <<<<<<<<<<<<<< - * remote_s3_index=False, parser='csv', *args, **kwargs): - * """ - */ - __pyx_t_8 = PyCFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_3s3_text_adapter, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_s3_text_adapter, __pyx_t_8) < 0) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1342 - * field_widths - list of field widths, or single field width for all fields - * """ - * __doc__ += TextAdapter.__doc__ # <<<<<<<<<<<<<< - * - * def __cinit__(self, fh, field_widths, encoding='utf_8', compression=None, - */ - __pyx_t_8 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter, __pyx_n_s_doc); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter), __pyx_n_s_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter->tp_dict, __pyx_n_s_doc, __pyx_t_1) < 0) __PYX_ERR(0, 1342, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_FixedWidthTextAdapter); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1512 - * regex_string - regular expression string that defines fields in record - * """ - * __doc__ += TextAdapter.__doc__ # <<<<<<<<<<<<<< - * - * cdef RegexTokenizerArgs *regex_args - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter, __pyx_n_s_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_TextAdapter), __pyx_n_s_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter->tp_dict, __pyx_n_s_doc, __pyx_t_8) < 0) __PYX_ERR(0, 1512, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - PyType_Modified(__pyx_ptype_5TextAdapter_11textadapter_11TextAdapter_RegexTextAdapter); - - /* "TextAdapter/textadapter/TextAdapter.pyx":1774 - * - * convert_error_reasons = { - * CONVERT_SUCCESS: "no conversion error", # <<<<<<<<<<<<<< - * CONVERT_ERROR_OVERFLOW: "overflow", - * CONVERT_ERROR_INPUT_TYPE: "input type", - */ - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyInt_From_ConvertError(CONVERT_SUCCESS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_2, __pyx_kp_s_no_conversion_error) < 0) __PYX_ERR(0, 1774, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1775 - * convert_error_reasons = { - * CONVERT_SUCCESS: "no conversion error", - * CONVERT_ERROR_OVERFLOW: "overflow", # <<<<<<<<<<<<<< - * CONVERT_ERROR_INPUT_TYPE: "input type", - * CONVERT_ERROR_INPUT_SIZE: "input size", - */ - __pyx_t_2 = __Pyx_PyInt_From_ConvertError(CONVERT_ERROR_OVERFLOW); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1775, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_2, __pyx_n_s_overflow) < 0) __PYX_ERR(0, 1774, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1776 - * CONVERT_SUCCESS: "no conversion error", - * CONVERT_ERROR_OVERFLOW: "overflow", - * CONVERT_ERROR_INPUT_TYPE: "input type", # <<<<<<<<<<<<<< - * CONVERT_ERROR_INPUT_SIZE: "input size", - * CONVERT_ERROR_OUTPUT_SIZE: "output size", - */ - __pyx_t_2 = __Pyx_PyInt_From_ConvertError(CONVERT_ERROR_INPUT_TYPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1776, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_2, __pyx_kp_s_input_type) < 0) __PYX_ERR(0, 1774, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1777 - * CONVERT_ERROR_OVERFLOW: "overflow", - * CONVERT_ERROR_INPUT_TYPE: "input type", - * CONVERT_ERROR_INPUT_SIZE: "input size", # <<<<<<<<<<<<<< - * CONVERT_ERROR_OUTPUT_SIZE: "output size", - * CONVERT_ERROR_INPUT_STRING: "input string", - */ - __pyx_t_2 = __Pyx_PyInt_From_ConvertError(CONVERT_ERROR_INPUT_SIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1777, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_2, __pyx_kp_s_input_size) < 0) __PYX_ERR(0, 1774, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1778 - * CONVERT_ERROR_INPUT_TYPE: "input type", - * CONVERT_ERROR_INPUT_SIZE: "input size", - * CONVERT_ERROR_OUTPUT_SIZE: "output size", # <<<<<<<<<<<<<< - * CONVERT_ERROR_INPUT_STRING: "input string", - * CONVERT_ERROR_USER_CONVERTER: "user converter", - */ - __pyx_t_2 = __Pyx_PyInt_From_ConvertError(CONVERT_ERROR_OUTPUT_SIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1778, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_2, __pyx_kp_s_output_size) < 0) __PYX_ERR(0, 1774, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1779 - * CONVERT_ERROR_INPUT_SIZE: "input size", - * CONVERT_ERROR_OUTPUT_SIZE: "output size", - * CONVERT_ERROR_INPUT_STRING: "input string", # <<<<<<<<<<<<<< - * CONVERT_ERROR_USER_CONVERTER: "user converter", - * CONVERT_ERROR_OBJECT_CONVERTER: "object converter" - */ - __pyx_t_2 = __Pyx_PyInt_From_ConvertError(CONVERT_ERROR_INPUT_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1779, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_2, __pyx_kp_s_input_string) < 0) __PYX_ERR(0, 1774, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1780 - * CONVERT_ERROR_OUTPUT_SIZE: "output size", - * CONVERT_ERROR_INPUT_STRING: "input string", - * CONVERT_ERROR_USER_CONVERTER: "user converter", # <<<<<<<<<<<<<< - * CONVERT_ERROR_OBJECT_CONVERTER: "object converter" - * } - */ - __pyx_t_2 = __Pyx_PyInt_From_ConvertError(CONVERT_ERROR_USER_CONVERTER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_2, __pyx_kp_s_user_converter) < 0) __PYX_ERR(0, 1774, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1781 - * CONVERT_ERROR_INPUT_STRING: "input string", - * CONVERT_ERROR_USER_CONVERTER: "user converter", - * CONVERT_ERROR_OBJECT_CONVERTER: "object converter" # <<<<<<<<<<<<<< - * } - * - */ - __pyx_t_2 = __Pyx_PyInt_From_ConvertError(CONVERT_ERROR_OBJECT_CONVERTER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_8, __pyx_t_2, __pyx_kp_s_object_converter) < 0) __PYX_ERR(0, 1774, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_convert_error_reasons, __pyx_t_8) < 0) __PYX_ERR(0, 1773, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1784 - * } - * - * def text_adapter_exception(error, convert_error=None, token=None, record=None, # <<<<<<<<<<<<<< - * field=None, dtype=None): - * """ - */ - __pyx_t_8 = PyCFunction_NewEx(&__pyx_mdef_5TextAdapter_11textadapter_11TextAdapter_5text_adapter_exception, NULL, __pyx_n_s_TextAdapter_textadapter_TextAdapter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_text_adapter_exception, __pyx_t_8) < 0) __PYX_ERR(0, 1784, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "TextAdapter/textadapter/TextAdapter.pyx":1 - * import numpy # <<<<<<<<<<<<<< - * import re - * import sys - */ - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_8) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "../../anaconda/envs/TextAdapter/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":997 - * raise ImportError("numpy.core.umath failed to import") - * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init TextAdapter.textadapter.TextAdapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init TextAdapter.textadapter.TextAdapter"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#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 - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - 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_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* WriteUnraisableException */ -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; -#endif -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); - } - #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); - } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); -#endif -} - -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - PyObject *result; - int flags; - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); -} -#endif // CYTHON_FAST_PYCCALL - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* SaveResetException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - 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); -} -#endif - -/* GetException */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { -#endif - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - 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; -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) -#endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - 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; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); -#endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; -} - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* IterFinish */ - static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = PyThreadState_GET(); - PyObject* exc_type = tstate->curexc_type; - if (unlikely(exc_type)) { - if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { - return -1; - } - } - return 0; -#endif -} - -/* UnpackItemEndCheck */ - static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else { - return __Pyx_IterFinish(); - } - return 0; -} - -/* RaiseDoubleKeywords */ - 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_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ - 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; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* RaiseArgTupleInvalid */ - 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, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - 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; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - 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)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } -#if PY_VERSION_HEX >= 0x03030000 - if (cause) { -#else - if (cause && cause != Py_None) { -#endif - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else 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; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - 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); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* GetModuleGlobalName */ - static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* SetItemInt */ - static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, - CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); - if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { - PyObject* old = PyList_GET_ITEM(o, n); - Py_INCREF(v); - PyList_SET_ITEM(o, n, v); - Py_DECREF(old); - return 1; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_ass_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return -1; - PyErr_Clear(); - } - } - return m->sq_ass_item(o, i, v); - } - } -#else -#if CYTHON_COMPILING_IN_PYPY - if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) { -#else - if (is_list || PySequence_Check(o)) { -#endif - return PySequence_SetItem(o, i, v); - } -#endif - return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); -} - -/* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -#endif -} - -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - if (op1 == op2) { - Py_RETURN_TRUE; - } - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long a = PyInt_AS_LONG(op1); - if (a == b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a; - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15 - default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ); - #else - default: Py_RETURN_FALSE; - #endif - } - } - if (a == b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - if ((double)a == (double)b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - return PyObject_RichCompare(op1, op2, Py_EQ); -} -#endif - -/* GetItemInt */ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a - b); - if (likely((x^a) >= 0 || (x^~b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - } - x = a - b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla - llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("subtract", return NULL) - result = ((double)a) - (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); -} -#endif - -/* PyObjectCallMethod1 */ - static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { - PyObject *method, *result = NULL; - method = __Pyx_PyObject_GetAttrStr(obj, method_name); - if (unlikely(!method)) goto done; -#if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(method))) { - PyObject *self = PyMethod_GET_SELF(method); - if (likely(self)) { - PyObject *args; - PyObject *function = PyMethod_GET_FUNCTION(method); - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {self, arg}; - result = __Pyx_PyFunction_FastCall(function, args, 2); - goto done; - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {self, arg}; - result = __Pyx_PyCFunction_FastCall(function, args, 2); - goto done; - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(self); - PyTuple_SET_ITEM(args, 0, self); - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 1, arg); - Py_INCREF(function); - Py_DECREF(method); method = NULL; - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); - return result; - } - } -#endif - result = __Pyx_PyObject_CallOneArg(method, arg); -done: - Py_XDECREF(method); - return result; -} - -/* append */ - static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; - } else { - PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); - if (unlikely(!retval)) - return -1; - Py_DECREF(retval); - } - return 0; -} - -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); -} -#endif - -/* SliceObject */ - static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, - Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { -#if CYTHON_USE_TYPE_SLOTS - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; - } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; - } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; - } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - goto bad; - PyErr_Clear(); - } - } - return ms->sq_slice(obj, cstart, cstop); - } -#endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_subscript)) -#endif - { - PyObject* result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; - } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; - } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; - } -#if CYTHON_USE_TYPE_SLOTS - result = mp->mp_subscript(obj, py_slice); -#else - result = PyObject_GetItem(obj, py_slice); -#endif - if (!_py_slice) { - Py_DECREF(py_slice); - } - return result; - } - PyErr_Format(PyExc_TypeError, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); -bad: - return NULL; -} - -/* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { - PyObject *exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - return PyErr_GivenExceptionMatches(exc_type, err); -} -#endif - -/* SwapException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - 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; - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#endif - -/* KeywordStringCheck */ - static CYTHON_INLINE int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; -#endif -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -/* StringJoin */ - #if !CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { - return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); -} -#endif - -/* UnicodeAsUCS4 */ - static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) { - Py_ssize_t length; - #if CYTHON_PEP393_ENABLED - length = PyUnicode_GET_LENGTH(x); - if (likely(length == 1)) { - return PyUnicode_READ_CHAR(x, 0); - } - #else - length = PyUnicode_GET_SIZE(x); - if (likely(length == 1)) { - return PyUnicode_AS_UNICODE(x)[0]; - } - #if Py_UNICODE_SIZE == 2 - else if (PyUnicode_GET_SIZE(x) == 2) { - Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0]; - if (high_val >= 0xD800 && high_val <= 0xDBFF) { - Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1]; - if (low_val >= 0xDC00 && low_val <= 0xDFFF) { - return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1))); - } - } - } - #endif - #endif - PyErr_Format(PyExc_ValueError, - "only single character unicode strings can be converted to Py_UCS4, " - "got length %" CYTHON_FORMAT_SSIZE_T "d", length); - return (Py_UCS4)-1; -} - -/* object_ord */ - static long __Pyx__PyObject_Ord(PyObject* c) { - Py_ssize_t size; - if (PyBytes_Check(c)) { - size = PyBytes_GET_SIZE(c); - if (likely(size == 1)) { - return (unsigned char) PyBytes_AS_STRING(c)[0]; - } -#if PY_MAJOR_VERSION < 3 - } else if (PyUnicode_Check(c)) { - return (long)__Pyx_PyUnicode_AsPy_UCS4(c); -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - } else if (PyByteArray_Check(c)) { - size = PyByteArray_GET_SIZE(c); - if (likely(size == 1)) { - return (unsigned char) PyByteArray_AS_STRING(c)[0]; - } -#endif - } else { - PyErr_Format(PyExc_TypeError, - "ord() expected string of length 1, but %.200s found", c->ob_type->tp_name); - return (long)(Py_UCS4)-1; - } - PyErr_Format(PyExc_TypeError, - "ord() expected a character, but string of length %zd found", size); - return (long)(Py_UCS4)-1; -} - -/* None */ - static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { - PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); -} - -/* PyObjectCallMethod0 */ - static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { - PyObject *method, *result = NULL; - method = __Pyx_PyObject_GetAttrStr(obj, method_name); - if (unlikely(!method)) goto bad; -#if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(method))) { - PyObject *self = PyMethod_GET_SELF(method); - if (likely(self)) { - PyObject *function = PyMethod_GET_FUNCTION(method); - result = __Pyx_PyObject_CallOneArg(function, self); - Py_DECREF(method); - return result; - } - } -#endif - result = __Pyx_PyObject_CallNoArg(method); - Py_DECREF(method); -bad: - return result; -} - -/* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -/* UnpackTupleError */ - static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(index); - } -} - -/* UnpackTuple2 */ - static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, - int is_tuple, int has_known_size, int decref_tuple) { - Py_ssize_t index; - PyObject *value1 = NULL, *value2 = NULL, *iter = NULL; - if (!is_tuple && unlikely(!PyTuple_Check(tuple))) { - iternextfunc iternext; - iter = PyObject_GetIter(tuple); - if (unlikely(!iter)) goto bad; - if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; } - iternext = Py_TYPE(iter)->tp_iternext; - value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; } - value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; } - if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad; - Py_DECREF(iter); - } else { - if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) { - __Pyx_UnpackTupleError(tuple, 2); - goto bad; - } -#if CYTHON_COMPILING_IN_PYPY - value1 = PySequence_ITEM(tuple, 0); - if (unlikely(!value1)) goto bad; - value2 = PySequence_ITEM(tuple, 1); - if (unlikely(!value2)) goto bad; -#else - value1 = PyTuple_GET_ITEM(tuple, 0); - value2 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(value1); - Py_INCREF(value2); -#endif - if (decref_tuple) { Py_DECREF(tuple); } - } - *pvalue1 = value1; - *pvalue2 = value2; - return 0; -unpacking_failed: - if (!has_known_size && __Pyx_IterFinish() == 0) - __Pyx_RaiseNeedMoreValuesError(index); -bad: - Py_XDECREF(iter); - Py_XDECREF(value1); - Py_XDECREF(value2); - if (decref_tuple) { Py_XDECREF(tuple); } - return -1; -} - -/* dict_iter */ - static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name, - Py_ssize_t* p_orig_length, int* p_source_is_dict) { - is_dict = is_dict || likely(PyDict_CheckExact(iterable)); - *p_source_is_dict = is_dict; -#if !CYTHON_COMPILING_IN_PYPY - if (is_dict) { - *p_orig_length = PyDict_Size(iterable); - Py_INCREF(iterable); - return iterable; - } -#endif - *p_orig_length = 0; - if (method_name) { - PyObject* iter; - iterable = __Pyx_PyObject_CallMethod0(iterable, method_name); - if (!iterable) - return NULL; -#if !CYTHON_COMPILING_IN_PYPY - if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable)) - return iterable; -#endif - iter = PyObject_GetIter(iterable); - Py_DECREF(iterable); - return iter; - } - return PyObject_GetIter(iterable); -} -static CYTHON_INLINE int __Pyx_dict_iter_next( - PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos, - PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) { - PyObject* next_item; -#if !CYTHON_COMPILING_IN_PYPY - if (source_is_dict) { - PyObject *key, *value; - if (unlikely(orig_length != PyDict_Size(iter_obj))) { - PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); - return -1; - } - if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) { - return 0; - } - if (pitem) { - PyObject* tuple = PyTuple_New(2); - if (unlikely(!tuple)) { - return -1; - } - Py_INCREF(key); - Py_INCREF(value); - PyTuple_SET_ITEM(tuple, 0, key); - PyTuple_SET_ITEM(tuple, 1, value); - *pitem = tuple; - } else { - if (pkey) { - Py_INCREF(key); - *pkey = key; - } - if (pvalue) { - Py_INCREF(value); - *pvalue = value; - } - } - return 1; - } else if (PyTuple_CheckExact(iter_obj)) { - Py_ssize_t pos = *ppos; - if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0; - *ppos = pos + 1; - next_item = PyTuple_GET_ITEM(iter_obj, pos); - Py_INCREF(next_item); - } else if (PyList_CheckExact(iter_obj)) { - Py_ssize_t pos = *ppos; - if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0; - *ppos = pos + 1; - next_item = PyList_GET_ITEM(iter_obj, pos); - Py_INCREF(next_item); - } else -#endif - { - next_item = PyIter_Next(iter_obj); - if (unlikely(!next_item)) { - return __Pyx_IterFinish(); - } - } - if (pitem) { - *pitem = next_item; - } else if (pkey && pvalue) { - if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1)) - return -1; - } else if (pkey) { - *pkey = next_item; - } else { - *pvalue = next_item; - } - return 1; -} - -/* FetchCommonType */ - static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); - if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); - goto bad; - } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); - goto bad; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; - } -done: - Py_DECREF(fake_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} - -/* CythonFunction */ - static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) -{ - if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); -#endif - if (unlikely(op->func_doc == NULL)) - return NULL; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - Py_INCREF(op->func_doc); - return op->func_doc; -} -static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp = op->func_doc; - if (value == NULL) { - value = Py_None; - } - Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); -#else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); -#endif - if (unlikely(op->func_name == NULL)) - return NULL; - } - Py_INCREF(op->func_name); - return op->func_name; -} -static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - tmp = op->func_name; - Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) -{ - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - tmp = op->func_qualname; - Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_dict == NULL)) { - op->func_dict = PyDict_New(); - if (unlikely(op->func_dict == NULL)) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - tmp = op->func_dict; - Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) -{ - Py_INCREF(op->func_globals); - return op->func_globals; -} -static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) -{ - Py_INCREF(Py_None); - return Py_None; -} -static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) -{ - PyObject* result = (op->func_code) ? op->func_code : Py_None; - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { - int result = 0; - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - op->defaults_tuple = PyTuple_GET_ITEM(res, 0); - Py_INCREF(op->defaults_tuple); - op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); - Py_INCREF(op->defaults_kwdict); - #else - op->defaults_tuple = PySequence_ITEM(res, 0); - if (unlikely(!op->defaults_tuple)) result = -1; - else { - op->defaults_kwdict = PySequence_ITEM(res, 1); - if (unlikely(!op->defaults_kwdict)) result = -1; - } - #endif - Py_DECREF(res); - return result; -} -static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_tuple; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_tuple; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__kwdefaults__ must be set to a dict object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_kwdict; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_kwdict; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value || value == Py_None) { - value = NULL; - } else if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__annotations__ must be set to a dict object"); - return -1; - } - Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { - PyObject* result = op->func_annotations; - if (unlikely(!result)) { - result = PyDict_New(); - if (unlikely(!result)) return NULL; - op->func_annotations = result; - } - Py_INCREF(result); - return result; -} -static PyGetSetDef __pyx_CyFunction_getsets[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, - {0, 0, 0, 0, 0} -}; -static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, - {0, 0, 0, 0, 0} -}; -static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(m->func.m_ml->ml_name); -#else - return PyString_FromString(m->func.m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -#if PY_VERSION_HEX < 0x030500A0 -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) -#else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) -#endif -static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); - if (op == NULL) - return NULL; - op->flags = flags; - __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; - Py_XINCREF(closure); - op->func_closure = closure; - Py_XINCREF(module); - op->func.m_module = module; - op->func_dict = NULL; - op->func_name = NULL; - Py_INCREF(qualname); - op->func_qualname = qualname; - op->func_doc = NULL; - op->func_classobj = NULL; - op->func_globals = globals; - Py_INCREF(op->func_globals); - Py_XINCREF(code); - op->func_code = code; - op->defaults_pyobjects = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - PyObject_GC_Track(op); - return (PyObject *) op; -} -static int -__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) -{ - Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_globals); - Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); - Py_CLEAR(m->defaults_tuple); - Py_CLEAR(m->defaults_kwdict); - Py_CLEAR(m->func_annotations); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyObject_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); -} -static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_globals); - Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); - Py_VISIT(m->defaults_tuple); - Py_VISIT(m->defaults_kwdict); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; - return __Pyx_PyMethod_New(func, obj, type); -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = f->m_ml->ml_meth; - Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { - case METH_VARARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 0)) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 1)) { - PyObject *result, *arg0 = PySequence_ITEM(arg, 0); - if (unlikely(!arg0)) return NULL; - result = (*meth)(self, arg0); - Py_DECREF(arg0); - return result; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); - return NULL; - } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; -} -static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); -} -static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { - PyObject *result; - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - Py_ssize_t argc; - PyObject *new_args; - PyObject *self; - argc = PyTuple_GET_SIZE(args); - new_args = PyTuple_GetSlice(args, 1, argc); - if (unlikely(!new_args)) - return NULL; - self = PyTuple_GetItem(args, 0); - if (unlikely(!self)) { - Py_DECREF(new_args); - return NULL; - } - result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); - Py_DECREF(new_args); - } else { - result = __Pyx_CyFunction_Call(func, args, kw); - } - return result; -} -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, - 0, - 0, - 0, -#if PY_MAJOR_VERSION < 3 - 0, -#else - 0, -#endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_CallAsMethod, - 0, - 0, - 0, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), -#endif - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_CyFunction_descr_get, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -}; -static int __pyx_CyFunction_init(void) { - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); - if (__pyx_CyFunctionType == NULL) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (!m->defaults) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(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; -} - -/* CalculateMetaclass */ - static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { - Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); - for (i=0; i < nbases; i++) { - PyTypeObject *tmptype; - PyObject *tmp = PyTuple_GET_ITEM(bases, i); - tmptype = Py_TYPE(tmp); -#if PY_MAJOR_VERSION < 3 - if (tmptype == &PyClass_Type) - continue; -#endif - if (!metaclass) { - metaclass = tmptype; - continue; - } - if (PyType_IsSubtype(metaclass, tmptype)) - continue; - if (PyType_IsSubtype(tmptype, metaclass)) { - metaclass = tmptype; - continue; - } - PyErr_SetString(PyExc_TypeError, - "metaclass conflict: " - "the metaclass of a derived class " - "must be a (non-strict) subclass " - "of the metaclasses of all its bases"); - return NULL; - } - if (!metaclass) { -#if PY_MAJOR_VERSION < 3 - metaclass = &PyClass_Type; -#else - metaclass = &PyType_Type; -#endif - } - Py_INCREF((PyObject*) metaclass); - return (PyObject*) metaclass; -} - -/* Py3ClassCreate */ - static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, - PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { - PyObject *ns; - if (metaclass) { - PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); - if (prep) { - PyObject *pargs = PyTuple_Pack(2, name, bases); - if (unlikely(!pargs)) { - Py_DECREF(prep); - return NULL; - } - ns = PyObject_Call(prep, pargs, mkw); - Py_DECREF(prep); - Py_DECREF(pargs); - } else { - if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - PyErr_Clear(); - ns = PyDict_New(); - } - } else { - ns = PyDict_New(); - } - if (unlikely(!ns)) - return NULL; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; - if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; - return ns; -bad: - Py_DECREF(ns); - return NULL; -} -static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, - PyObject *dict, PyObject *mkw, - int calculate_metaclass, int allow_py2_metaclass) { - PyObject *result, *margs; - PyObject *owned_metaclass = NULL; - if (allow_py2_metaclass) { - owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); - if (owned_metaclass) { - metaclass = owned_metaclass; - } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { - PyErr_Clear(); - } else { - return NULL; - } - } - if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { - metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); - Py_XDECREF(owned_metaclass); - if (unlikely(!metaclass)) - return NULL; - owned_metaclass = metaclass; - } - margs = PyTuple_Pack(3, name, bases, dict); - if (unlikely(!margs)) { - result = NULL; - } else { - result = PyObject_Call(metaclass, margs, mkw); - Py_DECREF(margs); - } - Py_XDECREF(owned_metaclass); - return result; -} - -/* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -/* MergeKeywords */ - static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) { - PyObject *iter, *key = NULL, *value = NULL; - int source_is_dict, result; - Py_ssize_t orig_length, ppos = 0; - iter = __Pyx_dict_iterator(source_mapping, 0, __pyx_n_s_items, &orig_length, &source_is_dict); - if (unlikely(!iter)) { - PyObject *args; - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - args = PyTuple_Pack(1, source_mapping); - if (likely(args)) { - PyObject *fallback = PyObject_Call((PyObject*)&PyDict_Type, args, NULL); - Py_DECREF(args); - if (likely(fallback)) { - iter = __Pyx_dict_iterator(fallback, 1, __pyx_n_s_items, &orig_length, &source_is_dict); - Py_DECREF(fallback); - } - } - if (unlikely(!iter)) goto bad; - } - while (1) { - result = __Pyx_dict_iter_next(iter, orig_length, &ppos, &key, &value, NULL, source_is_dict); - if (unlikely(result < 0)) goto bad; - if (!result) break; - if (unlikely(PyDict_Contains(kwdict, key))) { - __Pyx_RaiseDoubleKeywordsError("function", key); - result = -1; - } else { - result = PyDict_SetItem(kwdict, key, value); - } - Py_DECREF(key); - Py_DECREF(value); - if (unlikely(result < 0)) goto bad; - } - Py_XDECREF(iter); - return 0; -bad: - Py_XDECREF(iter); - return -1; -} - -/* IterNext */ - static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) { - PyObject* next; - iternextfunc iternext = Py_TYPE(iterator)->tp_iternext; -#if CYTHON_USE_TYPE_SLOTS - if (unlikely(!iternext)) { -#else - if (unlikely(!iternext) || unlikely(!PyIter_Check(iterator))) { -#endif - PyErr_Format(PyExc_TypeError, - "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name); - return NULL; - } - next = iternext(iterator); - if (likely(next)) - return next; -#if CYTHON_USE_TYPE_SLOTS -#if PY_VERSION_HEX >= 0x02070000 - if (unlikely(iternext == &_PyObject_NextNotImplemented)) - return NULL; -#endif -#endif - if (defval) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (unlikely(exc_type != PyExc_StopIteration) && - !PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) - return NULL; - PyErr_Clear(); - } - Py_INCREF(defval); - return defval; - } - if (!PyErr_Occurred()) - PyErr_SetNone(PyExc_StopIteration); - return NULL; -} - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - 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_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - #endif - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_VERSION_HEX < 0x03030000 - 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 - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_VERSION_HEX < 0x03030000 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -/* GetNameInClass */ - static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) { - PyObject *result; - result = __Pyx_PyObject_GetAttrStr(nmspace, name); - if (!result) - result = __Pyx_GetModuleGlobalName(name); - return result; -} - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #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_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __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,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ConvertError(ConvertError value) { - const ConvertError neg_one = (ConvertError) -1, const_zero = (ConvertError) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(ConvertError) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(ConvertError) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(ConvertError) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(ConvertError) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(ConvertError) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(ConvertError), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) { - const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(uint64_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(uint64_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(uint64_t), - little, !is_unsigned); - } -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) { - const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(uint32_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(uint32_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(uint32_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(uint32_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value) { - const uint8_t neg_one = (uint8_t) -1, const_zero = (uint8_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(uint8_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(uint8_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(uint8_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint8_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(uint8_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_AdapterError(AdapterError value) { - const AdapterError neg_one = (AdapterError) -1, const_zero = (AdapterError) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(AdapterError) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(AdapterError) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(AdapterError) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(AdapterError) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(AdapterError) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(AdapterError), - little, !is_unsigned); - } -} - -/* Declarations */ - #if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return ::std::complex< float >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -/* Arithmetic */ - #if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - #if 1 - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - if (b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); - } else if (fabsf(b.real) >= fabsf(b.imag)) { - if (b.real == 0 && b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); - } else { - float r = b.imag / b.real; - float s = 1.0 / (b.real + b.imag * r); - return __pyx_t_float_complex_from_parts( - (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); - } - } else { - float r = b.real / b.imag; - float s = 1.0 / (b.imag + b.real * r); - return __pyx_t_float_complex_from_parts( - (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); - } - } - #else - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - if (b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); - } else { - float denom = b.real * b.real + b.imag * b.imag; - return __pyx_t_float_complex_from_parts( - (a.real * b.real + a.imag * b.imag) / denom, - (a.imag * b.real - a.real * b.imag) / denom); - } - } - #endif - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrtf(z.real*z.real + z.imag*z.imag); - #else - return hypotf(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - float denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prod_float(a, a); - return __Pyx_c_prod_float(a, a); - case 3: - z = __Pyx_c_prod_float(a, a); - return __Pyx_c_prod_float(z, a); - case 4: - z = __Pyx_c_prod_float(a, a); - return __Pyx_c_prod_float(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_abs_float(a); - theta = atan2f(a.imag, a.real); - } - lnr = logf(r); - z_r = expf(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cosf(z_theta); - z.imag = z_r * sinf(z_theta); - return z; - } - #endif -#endif - -/* Declarations */ - #if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return ::std::complex< double >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -/* Arithmetic */ - #if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - #if 1 - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - if (b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); - } else if (fabs(b.real) >= fabs(b.imag)) { - if (b.real == 0 && b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); - } else { - double r = b.imag / b.real; - double s = 1.0 / (b.real + b.imag * r); - return __pyx_t_double_complex_from_parts( - (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); - } - } else { - double r = b.real / b.imag; - double s = 1.0 / (b.imag + b.real * r); - return __pyx_t_double_complex_from_parts( - (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); - } - } - #else - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - if (b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); - } else { - double denom = b.real * b.real + b.imag * b.imag; - return __pyx_t_double_complex_from_parts( - (a.real * b.real + a.imag * b.imag) / denom, - (a.imag * b.real - a.real * b.imag) / denom); - } - } - #endif - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrt(z.real*z.real + z.imag*z.imag); - #else - return hypot(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - double denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prod_double(a, a); - return __Pyx_c_prod_double(a, a); - case 3: - z = __Pyx_c_prod_double(a, a); - return __Pyx_c_prod_double(z, a); - case 4: - z = __Pyx_c_prod_double(a, a); - return __Pyx_c_prod_double(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_abs_double(a); - theta = atan2(a.imag, a.real); - } - lnr = log(r); - z_r = exp(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cos(z_theta); - z.imag = z_r * sin(z_theta); - return z; - } - #endif -#endif - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { - const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(enum NPY_TYPES) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(enum NPY_TYPES) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { - const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(size_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (size_t) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) - case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { - return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { - return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { - return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (size_t) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(size_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) - case -2: - if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { - return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - } -#endif - if (sizeof(size_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - size_t val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - 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; - } -#endif - return (size_t) -1; - } - } else { - size_t val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (size_t) -1; - val = __Pyx_PyInt_As_size_t(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to size_t"); - return (size_t) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) { - const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(uint64_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (uint64_t) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint64_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0]) - case 2: - if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT) { - return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT) { - return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT) { - return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (uint64_t) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(uint64_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint64_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, +digits[0]) - case -2: - if (8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) { - return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) { - return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) { - return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) { - return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) { - return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) { - return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); - } - } - break; - } -#endif - if (sizeof(uint64_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - uint64_t val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - 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; - } -#endif - return (uint64_t) -1; - } - } else { - uint64_t val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (uint64_t) -1; - val = __Pyx_PyInt_As_uint64_t(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to uint64_t"); - return (uint64_t) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint64_t"); - return (uint64_t) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) { - const uint8_t neg_one = (uint8_t) -1, const_zero = (uint8_t) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(uint8_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (uint8_t) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint8_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, digits[0]) - case 2: - if (8 * sizeof(uint8_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) >= 2 * PyLong_SHIFT) { - return (uint8_t) (((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(uint8_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) >= 3 * PyLong_SHIFT) { - return (uint8_t) (((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(uint8_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) >= 4 * PyLong_SHIFT) { - return (uint8_t) (((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (uint8_t) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(uint8_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint8_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint8_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, +digits[0]) - case -2: - if (8 * sizeof(uint8_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(uint8_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { - return (uint8_t) ((((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(uint8_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { - return (uint8_t) ((((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 4 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(uint8_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 4 * PyLong_SHIFT) { - return (uint8_t) ((((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); - } - } - break; - } -#endif - if (sizeof(uint8_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint8_t, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint8_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint8_t, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - uint8_t val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - 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; - } -#endif - return (uint8_t) -1; - } - } else { - uint8_t val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (uint8_t) -1; - val = __Pyx_PyInt_As_uint8_t(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to uint8_t"); - return (uint8_t) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint8_t"); - return (uint8_t) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - 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; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { - const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(uint32_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (uint32_t) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint32_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) - case 2: - if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { - return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { - return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT) { - return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (uint32_t) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(uint32_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint32_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) - case -2: - if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - } -#endif - if (sizeof(uint32_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - uint32_t val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - 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; - } -#endif - return (uint32_t) -1; - } - } else { - uint32_t val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (uint32_t) -1; - val = __Pyx_PyInt_As_uint32_t(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to uint32_t"); - return (uint32_t) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint32_t"); - return (uint32_t) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - 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; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CoroutineBase */ - #include -#include -static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); -static PyObject *__Pyx_Coroutine_Close(PyObject *self); -static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); -#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) -#if 1 || PY_VERSION_HEX < 0x030300B0 -static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { - PyObject *et, *ev, *tb; - PyObject *value = NULL; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&et, &ev, &tb); - if (!et) { - Py_XDECREF(tb); - Py_XDECREF(ev); - Py_INCREF(Py_None); - *pvalue = Py_None; - return 0; - } - if (likely(et == PyExc_StopIteration)) { - if (!ev) { - Py_INCREF(Py_None); - value = Py_None; - } -#if PY_VERSION_HEX >= 0x030300A0 - else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) { - value = ((PyStopIterationObject *)ev)->value; - Py_INCREF(value); - Py_DECREF(ev); - } -#endif - else if (unlikely(PyTuple_Check(ev))) { - if (PyTuple_GET_SIZE(ev) >= 1) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - value = PyTuple_GET_ITEM(ev, 0); - Py_INCREF(value); -#else - value = PySequence_ITEM(ev, 0); -#endif - } else { - Py_INCREF(Py_None); - value = Py_None; - } - Py_DECREF(ev); - } - else if (!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { - value = ev; - } - if (likely(value)) { - Py_XDECREF(tb); - Py_DECREF(et); - *pvalue = value; - return 0; - } - } else if (!PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { - __Pyx_ErrRestore(et, ev, tb); - return -1; - } - PyErr_NormalizeException(&et, &ev, &tb); - if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { - __Pyx_ErrRestore(et, ev, tb); - return -1; - } - Py_XDECREF(tb); - Py_DECREF(et); -#if PY_VERSION_HEX >= 0x030300A0 - value = ((PyStopIterationObject *)ev)->value; - Py_INCREF(value); - Py_DECREF(ev); -#else - { - PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args); - Py_DECREF(ev); - if (likely(args)) { - value = PySequence_GetItem(args, 0); - Py_DECREF(args); - } - if (unlikely(!value)) { - __Pyx_ErrRestore(NULL, NULL, NULL); - Py_INCREF(Py_None); - value = Py_None; - } - } -#endif - *pvalue = value; - return 0; -} -#endif -static CYTHON_INLINE -void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) { - PyObject *exc_type = self->exc_type; - PyObject *exc_value = self->exc_value; - PyObject *exc_traceback = self->exc_traceback; - self->exc_type = NULL; - self->exc_value = NULL; - self->exc_traceback = NULL; - Py_XDECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_traceback); -} -static CYTHON_INLINE -int __Pyx_Coroutine_CheckRunning(__pyx_CoroutineObject *gen) { - if (unlikely(gen->is_running)) { - PyErr_SetString(PyExc_ValueError, - "generator already executing"); - return 1; - } - return 0; -} -static CYTHON_INLINE -PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) { - PyObject *retval; - __Pyx_PyThreadState_declare - assert(!self->is_running); - if (unlikely(self->resume_label == 0)) { - if (unlikely(value && value != Py_None)) { - PyErr_SetString(PyExc_TypeError, - "can't send non-None value to a " - "just-started generator"); - return NULL; - } - } - if (unlikely(self->resume_label == -1)) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - __Pyx_PyThreadState_assign - if (value) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON -#else - if (self->exc_traceback) { - PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; - PyFrameObject *f = tb->tb_frame; - Py_XINCREF(__pyx_tstate->frame); - assert(f->f_back == NULL); - f->f_back = __pyx_tstate->frame; - } -#endif - __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, - &self->exc_traceback); - } else { - __Pyx_Coroutine_ExceptionClear(self); - } - self->is_running = 1; - retval = self->body((PyObject *) self, value); - self->is_running = 0; - if (retval) { - __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, - &self->exc_traceback); -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON -#else - if (self->exc_traceback) { - PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; - PyFrameObject *f = tb->tb_frame; - Py_CLEAR(f->f_back); - } -#endif - } else { - __Pyx_Coroutine_ExceptionClear(self); - } - return retval; -} -static CYTHON_INLINE -PyObject *__Pyx_Coroutine_MethodReturn(PyObject *retval) { - if (unlikely(!retval && !PyErr_Occurred())) { - PyErr_SetNone(PyExc_StopIteration); - } - return retval; -} -static CYTHON_INLINE -PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { - PyObject *ret; - PyObject *val = NULL; - __Pyx_Coroutine_Undelegate(gen); - __Pyx_PyGen_FetchStopIterationValue(&val); - ret = __Pyx_Coroutine_SendEx(gen, val); - Py_XDECREF(val); - return ret; -} -static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { - PyObject *retval; - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; - PyObject *yf = gen->yieldfrom; - if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) - return NULL; - if (yf) { - PyObject *ret; - gen->is_running = 1; - #ifdef __Pyx_Generator_USED - if (__Pyx_Generator_CheckExact(yf)) { - ret = __Pyx_Coroutine_Send(yf, value); - } else - #endif - #ifdef __Pyx_Coroutine_USED - if (__Pyx_Coroutine_CheckExact(yf)) { - ret = __Pyx_Coroutine_Send(yf, value); - } else - #endif - { - if (value == Py_None) - ret = Py_TYPE(yf)->tp_iternext(yf); - else - ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); - } - gen->is_running = 0; - if (likely(ret)) { - return ret; - } - retval = __Pyx_Coroutine_FinishDelegation(gen); - } else { - retval = __Pyx_Coroutine_SendEx(gen, value); - } - return __Pyx_Coroutine_MethodReturn(retval); -} -static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { - PyObject *retval = NULL; - int err = 0; - #ifdef __Pyx_Generator_USED - if (__Pyx_Generator_CheckExact(yf)) { - retval = __Pyx_Coroutine_Close(yf); - if (!retval) - return -1; - } else - #endif - #ifdef __Pyx_Coroutine_USED - if (__Pyx_Coroutine_CheckExact(yf)) { - retval = __Pyx_Coroutine_Close(yf); - if (!retval) - return -1; - } else - #endif - { - PyObject *meth; - gen->is_running = 1; - meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close); - if (unlikely(!meth)) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_WriteUnraisable(yf); - } - PyErr_Clear(); - } else { - retval = PyObject_CallFunction(meth, NULL); - Py_DECREF(meth); - if (!retval) - err = -1; - } - gen->is_running = 0; - } - Py_XDECREF(retval); - return err; -} -static PyObject *__Pyx_Generator_Next(PyObject *self) { - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; - PyObject *yf = gen->yieldfrom; - if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) - return NULL; - if (yf) { - PyObject *ret; - gen->is_running = 1; - #ifdef __Pyx_Generator_USED - if (__Pyx_Generator_CheckExact(yf)) { - ret = __Pyx_Generator_Next(yf); - } else - #endif - ret = Py_TYPE(yf)->tp_iternext(yf); - gen->is_running = 0; - if (likely(ret)) { - return ret; - } - return __Pyx_Coroutine_FinishDelegation(gen); - } - return __Pyx_Coroutine_SendEx(gen, Py_None); -} -static PyObject *__Pyx_Coroutine_Close(PyObject *self) { - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; - PyObject *retval, *raised_exception; - PyObject *yf = gen->yieldfrom; - int err = 0; - if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) - return NULL; - if (yf) { - Py_INCREF(yf); - err = __Pyx_Coroutine_CloseIter(gen, yf); - __Pyx_Coroutine_Undelegate(gen); - Py_DECREF(yf); - } - if (err == 0) - PyErr_SetNone(PyExc_GeneratorExit); - retval = __Pyx_Coroutine_SendEx(gen, NULL); - if (retval) { - Py_DECREF(retval); - PyErr_SetString(PyExc_RuntimeError, - "generator ignored GeneratorExit"); - return NULL; - } - raised_exception = PyErr_Occurred(); - if (!raised_exception - || raised_exception == PyExc_StopIteration - || raised_exception == PyExc_GeneratorExit - || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit) - || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration)) - { - if (raised_exception) PyErr_Clear(); - Py_INCREF(Py_None); - return Py_None; - } - return NULL; -} -static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; - PyObject *typ; - PyObject *tb = NULL; - PyObject *val = NULL; - PyObject *yf = gen->yieldfrom; - if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) - return NULL; - if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) - return NULL; - if (yf) { - PyObject *ret; - Py_INCREF(yf); - if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { - int err = __Pyx_Coroutine_CloseIter(gen, yf); - Py_DECREF(yf); - __Pyx_Coroutine_Undelegate(gen); - if (err < 0) - return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL)); - goto throw_here; - } - gen->is_running = 1; - #ifdef __Pyx_Generator_USED - if (__Pyx_Generator_CheckExact(yf)) { - ret = __Pyx_Coroutine_Throw(yf, args); - } else - #endif - #ifdef __Pyx_Coroutine_USED - if (__Pyx_Coroutine_CheckExact(yf)) { - ret = __Pyx_Coroutine_Throw(yf, args); - } else - #endif - { - PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw); - if (unlikely(!meth)) { - Py_DECREF(yf); - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { - gen->is_running = 0; - return NULL; - } - PyErr_Clear(); - __Pyx_Coroutine_Undelegate(gen); - gen->is_running = 0; - goto throw_here; - } - ret = PyObject_CallObject(meth, args); - Py_DECREF(meth); - } - gen->is_running = 0; - Py_DECREF(yf); - if (!ret) { - ret = __Pyx_Coroutine_FinishDelegation(gen); - } - return __Pyx_Coroutine_MethodReturn(ret); - } -throw_here: - __Pyx_Raise(typ, val, tb, NULL); - return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL)); -} -static int __Pyx_Coroutine_traverse(PyObject *self, visitproc visit, void *arg) { - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; - Py_VISIT(gen->closure); - Py_VISIT(gen->classobj); - Py_VISIT(gen->yieldfrom); - Py_VISIT(gen->exc_type); - Py_VISIT(gen->exc_value); - Py_VISIT(gen->exc_traceback); - return 0; -} -static int __Pyx_Coroutine_clear(PyObject *self) { - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; - Py_CLEAR(gen->closure); - Py_CLEAR(gen->classobj); - Py_CLEAR(gen->yieldfrom); - Py_CLEAR(gen->exc_type); - Py_CLEAR(gen->exc_value); - Py_CLEAR(gen->exc_traceback); - Py_CLEAR(gen->gi_name); - Py_CLEAR(gen->gi_qualname); - return 0; -} -static void __Pyx_Coroutine_dealloc(PyObject *self) { - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; - PyObject_GC_UnTrack(gen); - if (gen->gi_weakreflist != NULL) - PyObject_ClearWeakRefs(self); - if (gen->resume_label > 0) { - PyObject_GC_Track(self); -#if PY_VERSION_HEX >= 0x030400a1 - if (PyObject_CallFinalizerFromDealloc(self)) -#else - Py_TYPE(gen)->tp_del(self); - if (self->ob_refcnt > 0) -#endif - { - return; - } - PyObject_GC_UnTrack(self); - } - __Pyx_Coroutine_clear(self); - PyObject_GC_Del(gen); -} -static void __Pyx_Coroutine_del(PyObject *self) { - PyObject *res; - PyObject *error_type, *error_value, *error_traceback; - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; - __Pyx_PyThreadState_declare - if (gen->resume_label <= 0) - return ; -#if PY_VERSION_HEX < 0x030400a1 - assert(self->ob_refcnt == 0); - self->ob_refcnt = 1; -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); - res = __Pyx_Coroutine_Close(self); - if (res == NULL) - PyErr_WriteUnraisable(self); - else - Py_DECREF(res); - __Pyx_ErrRestore(error_type, error_value, error_traceback); -#if PY_VERSION_HEX < 0x030400a1 - assert(self->ob_refcnt > 0); - if (--self->ob_refcnt == 0) { - return; - } - { - Py_ssize_t refcnt = self->ob_refcnt; - _Py_NewReference(self); - self->ob_refcnt = refcnt; - } -#if CYTHON_COMPILING_IN_CPYTHON - assert(PyType_IS_GC(self->ob_type) && - _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); - _Py_DEC_REFTOTAL; -#endif -#ifdef COUNT_ALLOCS - --Py_TYPE(self)->tp_frees; - --Py_TYPE(self)->tp_allocs; -#endif -#endif -} -static PyObject * -__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self) -{ - PyObject *name = self->gi_name; - if (unlikely(!name)) name = Py_None; - Py_INCREF(name); - return name; -} -static int -__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - tmp = self->gi_name; - Py_INCREF(value); - self->gi_name = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self) -{ - PyObject *name = self->gi_qualname; - if (unlikely(!name)) name = Py_None; - Py_INCREF(name); - return name; -} -static int -__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - tmp = self->gi_qualname; - Py_INCREF(value); - self->gi_qualname = value; - Py_XDECREF(tmp); - return 0; -} -static __pyx_CoroutineObject *__Pyx__Coroutine_New( - PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *closure, - PyObject *name, PyObject *qualname, PyObject *module_name) { - __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); - if (gen == NULL) - return NULL; - gen->body = body; - gen->closure = closure; - Py_XINCREF(closure); - gen->is_running = 0; - gen->resume_label = 0; - gen->classobj = NULL; - gen->yieldfrom = NULL; - gen->exc_type = NULL; - gen->exc_value = NULL; - gen->exc_traceback = NULL; - gen->gi_weakreflist = NULL; - Py_XINCREF(qualname); - gen->gi_qualname = qualname; - Py_XINCREF(name); - gen->gi_name = name; - Py_XINCREF(module_name); - gen->gi_modulename = module_name; - PyObject_GC_Track(gen); - return gen; -} - -/* PatchModuleWithCoroutine */ - static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { -#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - int result; - PyObject *globals, *result_obj; - globals = PyDict_New(); if (unlikely(!globals)) goto ignore; - result = PyDict_SetItemString(globals, "_cython_coroutine_type", - #ifdef __Pyx_Coroutine_USED - (PyObject*)__pyx_CoroutineType); - #else - Py_None); - #endif - if (unlikely(result < 0)) goto ignore; - result = PyDict_SetItemString(globals, "_cython_generator_type", - #ifdef __Pyx_Generator_USED - (PyObject*)__pyx_GeneratorType); - #else - Py_None); - #endif - if (unlikely(result < 0)) goto ignore; - if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore; - if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore; - result_obj = PyRun_String(py_code, Py_file_input, globals, globals); - if (unlikely(!result_obj)) goto ignore; - Py_DECREF(result_obj); - Py_DECREF(globals); - return module; -ignore: - Py_XDECREF(globals); - PyErr_WriteUnraisable(module); - if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) { - Py_DECREF(module); - module = NULL; - } -#else - py_code++; -#endif - return module; -} - -/* PatchGeneratorABC */ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) -static PyObject* __Pyx_patch_abc_module(PyObject *module); -static PyObject* __Pyx_patch_abc_module(PyObject *module) { - module = __Pyx_Coroutine_patch_module( - module, "" -"if _cython_generator_type is not None:\n" -" try: Generator = _module.Generator\n" -" except AttributeError: pass\n" -" else: Generator.register(_cython_generator_type)\n" -"if _cython_coroutine_type is not None:\n" -" try: Coroutine = _module.Coroutine\n" -" except AttributeError: pass\n" -" else: Coroutine.register(_cython_coroutine_type)\n" - ); - return module; -} -#endif -static int __Pyx_patch_abc(void) { -#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - static int abc_patched = 0; - if (!abc_patched) { - PyObject *module; - module = PyImport_ImportModule((PY_VERSION_HEX >= 0x03030000) ? "collections.abc" : "collections"); - if (!module) { - PyErr_WriteUnraisable(NULL); - if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, - ((PY_VERSION_HEX >= 0x03030000) ? - "Cython module failed to register with collections.abc module" : - "Cython module failed to register with collections module"), 1) < 0)) { - return -1; - } - } else { - module = __Pyx_patch_abc_module(module); - abc_patched = 1; - if (unlikely(!module)) - return -1; - Py_DECREF(module); - } - module = PyImport_ImportModule("backports_abc"); - if (module) { - module = __Pyx_patch_abc_module(module); - Py_XDECREF(module); - } - if (!module) { - PyErr_Clear(); - } - } -#else - if (0) __Pyx_Coroutine_patch_module(NULL, NULL); -#endif - return 0; -} - -/* Generator */ - static PyMethodDef __pyx_Generator_methods[] = { - {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, - (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, - {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, - (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, - {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS, - (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, - {0, 0, 0, 0} -}; -static PyMemberDef __pyx_Generator_memberlist[] = { - {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL}, - {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, - (char*) PyDoc_STR("object being iterated by 'yield from', or None")}, - {0, 0, 0, 0, 0} -}; -static PyGetSetDef __pyx_Generator_getsets[] = { - {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, - (char*) PyDoc_STR("name of the generator"), 0}, - {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, - (char*) PyDoc_STR("qualified name of the generator"), 0}, - {0, 0, 0, 0, 0} -}; -static PyTypeObject __pyx_GeneratorType_type = { - PyVarObject_HEAD_INIT(0, 0) - "generator", - sizeof(__pyx_CoroutineObject), - 0, - (destructor) __Pyx_Coroutine_dealloc, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, - 0, - (traverseproc) __Pyx_Coroutine_traverse, - 0, - 0, - offsetof(__pyx_CoroutineObject, gi_weakreflist), - 0, - (iternextfunc) __Pyx_Generator_Next, - __pyx_Generator_methods, - __pyx_Generator_memberlist, - __pyx_Generator_getsets, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#else - __Pyx_Coroutine_del, -#endif - 0, -#if PY_VERSION_HEX >= 0x030400a1 - __Pyx_Coroutine_del, -#endif -}; -static int __pyx_Generator_init(void) { - __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr; - __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; - __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type); - if (unlikely(!__pyx_GeneratorType)) { - return -1; - } - return 0; -} - -/* CheckBinaryVersion */ - 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); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* ModuleImport */ - #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; - py_name = __Pyx_PyIdentifier_FromString(name); - 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 - -/* TypeImport */ - #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_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - py_name = __Pyx_PyIdentifier_FromString(class_name); - 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, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (!strict && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - else if ((size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return NULL; -} -#endif - -/* InitStrings */ - 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 - 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; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -#endif - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -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_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - 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 -#else - res = PyNumber_Int(x); -#endif - if (res) { -#if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (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; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - 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) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/TextAdapter/textadapter/numpy_types.h b/TextAdapter/textadapter/numpy_types.h deleted file mode 100644 index 23a3f4f..0000000 --- a/TextAdapter/textadapter/numpy_types.h +++ /dev/null @@ -1,24 +0,0 @@ -// NumPy datatypes previously defined in IOPro within: -// accumuloadapter/AccumuloAdapter.cpp -// postgresadapter/PostgresAdapter.c -typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -typedef npy_double __pyx_t_5numpy_double_t; -typedef npy_float32 __pyx_t_5numpy_float32_t; -typedef npy_float64 __pyx_t_5numpy_float64_t; -typedef npy_int16 __pyx_t_5numpy_int16_t; -typedef npy_int32 __pyx_t_5numpy_int32_t; -typedef npy_int64 __pyx_t_5numpy_int64_t; -typedef npy_int8 __pyx_t_5numpy_int8_t; -typedef npy_intp __pyx_t_5numpy_intp_t; -typedef npy_long __pyx_t_5numpy_int_t; -typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -typedef npy_longlong __pyx_t_5numpy_longlong_t; -typedef npy_uint16 __pyx_t_5numpy_uint16_t; -typedef npy_uint32 __pyx_t_5numpy_uint32_t; -typedef npy_uint64 __pyx_t_5numpy_uint64_t; -typedef npy_uint8 __pyx_t_5numpy_uint8_t; -typedef npy_uintp __pyx_t_5numpy_uintp_t; -typedef npy_ulong __pyx_t_5numpy_uint_t; -typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; diff --git a/buildscripts/condarecipe/bld.bat b/buildscripts/condarecipe/bld.bat index d1f040b..85a7bc3 100644 --- a/buildscripts/condarecipe/bld.bat +++ b/buildscripts/condarecipe/bld.bat @@ -1,3 +1,2 @@ -copy %LIBRARY_LIB%\boost_thread-vc90-mt-1_60.lib %LIBRARY_LIB%\libboost_thread-vc90-mt-1_60.lib %PYTHON% setup.py install if errorlevel 1 exit 1 diff --git a/buildscripts/condarecipe/build.sh b/buildscripts/condarecipe/build.sh index 6471cac..8e25a14 100644 --- a/buildscripts/condarecipe/build.sh +++ b/buildscripts/condarecipe/build.sh @@ -1,7 +1,3 @@ #!/bin/bash -# Use unixodbc for building pyodbc on OS X systems -# without iodbc installed -#export UNIXODBC_PATH=/Users/jayvius/unixODBC-2.3.4/ - $PYTHON setup.py install diff --git a/buildscripts/condarecipe/meta.yaml b/buildscripts/condarecipe/meta.yaml index e5bc166..3003a5b 100644 --- a/buildscripts/condarecipe/meta.yaml +++ b/buildscripts/condarecipe/meta.yaml @@ -1,5 +1,5 @@ package: - name: TextAdapter + name: textadapter version: "2.0.0" source: @@ -10,28 +10,29 @@ build: requirements: build: - - python + - python - numpy - cython - - zlib - - pcre - - boost - - thrift 0.9.3 + + # zlib and pcre versions pinned to fix shared library issues + - zlib 1.2.8 + - pcre 8.31 + run: - - python + - python - numpy - pandas - six - ordereddict [py26] - - boost - - thrift 0.9.3 test: requires: - nose - pytest + imports: - - TextAdapter.textadapter.TextAdapter + - textadapter + - textadapter.core.TextAdapter about: home: https://github.com/ContinuumIO/TextAdapter diff --git a/buildscripts/condarecipe/run_test.py b/buildscripts/condarecipe/run_test.py index a5d7001..d2ab2fc 100644 --- a/buildscripts/condarecipe/run_test.py +++ b/buildscripts/condarecipe/run_test.py @@ -1,5 +1,5 @@ -import TextAdapter +import textadapter -assert TextAdapter.test() +assert textadapter.test() -print('TextAdapter.__version__: %s' % TextAdapter.__version__) +print('textadapter.__version__: %s' % textadapter.__version__) diff --git a/buildscripts/dependency-recipes/postgres/bld.bat b/buildscripts/dependency-recipes/postgres/bld.bat deleted file mode 100644 index 2395914..0000000 --- a/buildscripts/dependency-recipes/postgres/bld.bat +++ /dev/null @@ -1,11 +0,0 @@ -cd src\interfaces\libpq -copy %RECIPE_DIR%\win32.mak . -if errorlevel 1 exit 1 - -nmake /f win32.mak CPU=AMD64 -if errorlevel 1 exit 1 - -copy libpq-fe.h %LIBRARY_INC% -copy ..\..\include\postgres_ext.h %LIBRARY_INC% -copy Release\libpq.lib %LIBRARY_LIB% -if errorlevel 1 exit 1 diff --git a/buildscripts/dependency-recipes/postgres/build.sh b/buildscripts/dependency-recipes/postgres/build.sh deleted file mode 100644 index a8a60ca..0000000 --- a/buildscripts/dependency-recipes/postgres/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -./configure --prefix=$PREFIX -make -make install diff --git a/buildscripts/dependency-recipes/postgres/meta.yaml b/buildscripts/dependency-recipes/postgres/meta.yaml deleted file mode 100644 index f32652f..0000000 --- a/buildscripts/dependency-recipes/postgres/meta.yaml +++ /dev/null @@ -1,11 +0,0 @@ -package: - name: postgresql - version: "9.1.4" - -source: - fn: REL9_1_4.tar.gz - url: https://github.com/postgres/postgres/archive/REL9_1_4.tar.gz - -requirements: - build: - run: diff --git a/buildscripts/dependency-recipes/postgres/win32.mak b/buildscripts/dependency-recipes/postgres/win32.mak deleted file mode 100644 index b6dd50a..0000000 --- a/buildscripts/dependency-recipes/postgres/win32.mak +++ /dev/null @@ -1,344 +0,0 @@ -# Makefile for Microsoft Visual C++ 7.1-8.0 - -# Will build a static library libpq(d).lib -# and a dynamic library libpq(d).dll with import library libpq(d)dll.lib -# USE_SSL=1 will compile with OpenSSL -# USE_KFW=1 will compile with kfw(kerberos for Windows) -# DEBUG=1 compiles with debugging symbols -# ENABLE_THREAD_SAFETY=1 compiles with threading enabled - -ENABLE_THREAD_SAFETY=1 - -# CPU="i386" or CPU environment of nmake.exe (AMD64 or IA64) - -!IF ("$(CPU)" == "")||("$(CPU)" == "i386") -CPU=i386 -!MESSAGE Building the Win32 static library... -!MESSAGE -!ELSEIF ("$(CPU)" == "IA64")||("$(CPU)" == "AMD64") -ADD_DEFINES=/D "WIN64" /Wp64 /GS -ADD_SECLIB=bufferoverflowU.lib -!MESSAGE Building the Win64 static library... -!MESSAGE -!ELSE -!MESSAGE Please check a CPU=$(CPU) ? -!MESSAGE CPU=i386 or AMD64 or IA64 -!ERROR Make aborted. -!ENDIF - -!IFDEF DEBUG -OPT=/Od /Zi /MDd -LOPT=/DEBUG -DEBUGDEF=/D _DEBUG -OUTFILENAME=libpqd -!ELSE -OPT=/O2 /MD -LOPT= -DEBUGDEF=/D NDEBUG -OUTFILENAME=libpq -!ENDIF - -!IF "$(SSL_INC)" == "" -SSL_INC=C:\OpenSSL\include -!MESSAGE Using default OpenSSL Include directory: $(SSL_INC) -!ENDIF - -!IF "$(SSL_LIB_PATH)" == "" -SSL_LIB_PATH=C:\OpenSSL\lib\VC -!MESSAGE Using default OpenSSL Library directory: $(SSL_LIB_PATH) -!ENDIF - -!IF "$(KFW_INC)" == "" -KFW_INC=C:\kfw-2.6.5\inc -!MESSAGE Using default Kerberos Include directory: $(KFW_INC) -!ENDIF - -!IF "$(KFW_LIB_PATH)" == "" -KFW_LIB_PATH=C:\kfw-2.6.5\lib\$(CPU) -!MESSAGE Using default Kerberos Library directory: $(KFW_LIB_PATH) -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -CPP=cl.exe -RSC=rc.exe - -!IFDEF DEBUG -OUTDIR=.\Debug -INTDIR=.\Debug -CPP_OBJS=.\Debug/ -!ELSE -OUTDIR=.\Release -INTDIR=.\Release -CPP_OBJS=.\Release/ -!ENDIF - - -ALL : config "$(OUTDIR)\$(OUTFILENAME).lib" - -CLEAN : - -@erase "$(INTDIR)\getaddrinfo.obj" - -@erase "$(INTDIR)\pgstrcasecmp.obj" - -@erase "$(INTDIR)\thread.obj" - -@erase "$(INTDIR)\inet_aton.obj" - -@erase "$(INTDIR)\crypt.obj" - -@erase "$(INTDIR)\noblock.obj" - -@erase "$(INTDIR)\chklocale.obj" - -@erase "$(INTDIR)\inet_net_ntop.obj" - -@erase "$(INTDIR)\md5.obj" - -@erase "$(INTDIR)\ip.obj" - -@erase "$(INTDIR)\fe-auth.obj" - -@erase "$(INTDIR)\fe-protocol2.obj" - -@erase "$(INTDIR)\fe-protocol3.obj" - -@erase "$(INTDIR)\fe-connect.obj" - -@erase "$(INTDIR)\fe-exec.obj" - -@erase "$(INTDIR)\fe-lobj.obj" - -@erase "$(INTDIR)\fe-misc.obj" - -@erase "$(INTDIR)\fe-print.obj" - -@erase "$(INTDIR)\fe-secure.obj" - -@erase "$(INTDIR)\libpq-events.obj" - -@erase "$(INTDIR)\pqexpbuffer.obj" - -@erase "$(INTDIR)\pqsignal.obj" - -@erase "$(INTDIR)\win32.obj" - -@erase "$(INTDIR)\wchar.obj" - -@erase "$(INTDIR)\encnames.obj" - -@erase "$(INTDIR)\pthread-win32.obj" - -@erase "$(INTDIR)\snprintf.obj" - -@erase "$(INTDIR)\strlcpy.obj" - -@erase "$(INTDIR)\dirent.obj" - -@erase "$(INTDIR)\dirmod.obj" - -@erase "$(INTDIR)\pgsleep.obj" - -@erase "$(INTDIR)\open.obj" - -@erase "$(INTDIR)\win32error.obj" - -@erase "$(INTDIR)\win32setlocale.obj" - -@erase "$(OUTDIR)\$(OUTFILENAME).lib" - -@erase "$(OUTDIR)\$(OUTFILENAME)dll.lib" - -@erase "$(OUTDIR)\libpq.res" - -@erase "$(OUTDIR)\$(OUTFILENAME).dll" - -@erase "$(OUTDIR)\$(OUTFILENAME)dll.exp" - -@erase "$(OUTDIR)\$(OUTFILENAME).dll.manifest" - -@erase "$(OUTDIR)\*.idb" - -@erase pg_config_paths.h" - - -LIB32=link.exe -lib -LIB32_FLAGS=$(LOPT) /nologo /out:"$(OUTDIR)\$(OUTFILENAME).lib" -LIB32_OBJS= \ - "$(INTDIR)\win32.obj" \ - "$(INTDIR)\getaddrinfo.obj" \ - "$(INTDIR)\pgstrcasecmp.obj" \ - "$(INTDIR)\thread.obj" \ - "$(INTDIR)\inet_aton.obj" \ - "$(INTDIR)\crypt.obj" \ - "$(INTDIR)\noblock.obj" \ - "$(INTDIR)\chklocale.obj" \ - "$(INTDIR)\inet_net_ntop.obj" \ - "$(INTDIR)\md5.obj" \ - "$(INTDIR)\ip.obj" \ - "$(INTDIR)\fe-auth.obj" \ - "$(INTDIR)\fe-protocol2.obj" \ - "$(INTDIR)\fe-protocol3.obj" \ - "$(INTDIR)\fe-connect.obj" \ - "$(INTDIR)\fe-exec.obj" \ - "$(INTDIR)\fe-lobj.obj" \ - "$(INTDIR)\fe-misc.obj" \ - "$(INTDIR)\fe-print.obj" \ - "$(INTDIR)\fe-secure.obj" \ - "$(INTDIR)\libpq-events.obj" \ - "$(INTDIR)\pqexpbuffer.obj" \ - "$(INTDIR)\pqsignal.obj" \ - "$(INTDIR)\wchar.obj" \ - "$(INTDIR)\encnames.obj" \ - "$(INTDIR)\snprintf.obj" \ - "$(INTDIR)\strlcpy.obj" \ - "$(INTDIR)\dirent.obj" \ - "$(INTDIR)\dirmod.obj" \ - "$(INTDIR)\pgsleep.obj" \ - "$(INTDIR)\open.obj" \ - "$(INTDIR)\win32error.obj" \ - "$(INTDIR)\win32setlocale.obj" \ - "$(INTDIR)\pthread-win32.obj" - - -config: ..\..\include\pg_config.h pg_config_paths.h ..\..\include\pg_config_os.h - -..\..\include\pg_config.h: ..\..\include\pg_config.h.win32 - copy ..\..\include\pg_config.h.win32 ..\..\include\pg_config.h - -..\..\include\pg_config_os.h: - copy ..\..\include\port\win32.h ..\..\include\pg_config_os.h - -pg_config_paths.h: win32.mak - echo #define SYSCONFDIR "" > pg_config_paths.h - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /W3 /EHsc $(OPT) /I "..\..\include" /I "..\..\include\port\win32" /I "..\..\include\port\win32_msvc" /I "..\..\port" /I. /I "$(SSL_INC)" \ - /D "FRONTEND" $(DEBUGDEF) \ - /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" \ - /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \ - /D "_CRT_SECURE_NO_DEPRECATE" $(ADD_DEFINES) - -!IFDEF USE_SSL -CPP_PROJ=$(CPP_PROJ) /D USE_SSL -SSL_LIBS=ssleay32.lib libeay32.lib gdi32.lib -!ENDIF - -!IFDEF USE_KFW -CPP_PROJ=$(CPP_PROJ) /D KRB5 -KFW_LIBS=krb5_32.lib comerr32.lib gssapi32.lib -!ENDIF - -!IFDEF ENABLE_THREAD_SAFETY -CPP_PROJ=$(CPP_PROJ) /D ENABLE_THREAD_SAFETY -!ENDIF - -CPP_SBRS=. - -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res" - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shfolder.lib wsock32.lib ws2_32.lib secur32.lib $(SSL_LIBS) $(KFW_LIB) $(ADD_SECLIB) \ - /nologo /subsystem:windows /dll $(LOPT) /incremental:no \ - /pdb:"$(OUTDIR)\libpqdll.pdb" /machine:$(CPU) \ - /out:"$(OUTDIR)\$(OUTFILENAME).dll"\ - /implib:"$(OUTDIR)\$(OUTFILENAME)dll.lib" \ - /libpath:"$(SSL_LIB_PATH)" /libpath:"$(KFW_LIB_PATH)" \ - /def:$(OUTFILENAME)dll.def -LINK32_OBJS= \ - "$(OUTDIR)\$(OUTFILENAME).lib" \ - "$(OUTDIR)\libpq.res" - -# @<< is a Response file, http://www.opussoftware.com/tutorial/TutMakefile.htm - -"$(OUTDIR)\$(OUTFILENAME).lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -"$(INTDIR)\libpq.res" : "$(INTDIR)" libpq-dist.rc - $(RSC) $(RSC_PROJ) libpq-dist.rc - - -"$(OUTDIR)\$(OUTFILENAME).dll" : "$(OUTDIR)" "$(INTDIR)\libpq.res" - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< -# Inclusion of manifest -!IF "$(_NMAKE_VER)" != "6.00.8168.0" && "$(_NMAKE_VER)" != "7.00.9466" -!IF "$(_NMAKE_VER)" != "6.00.9782.0" && "$(_NMAKE_VER)" != "7.10.3077" - mt -manifest $(OUTDIR)\$(OUTFILENAME).dll.manifest -outputresource:$(OUTDIR)\$(OUTFILENAME).dll;2 -!ENDIF -!ENDIF - -"$(INTDIR)\getaddrinfo.obj" : ..\..\port\getaddrinfo.c - $(CPP) @<< - $(CPP_PROJ) ..\..\port\getaddrinfo.c -<< - -"$(INTDIR)\pgstrcasecmp.obj" : ..\..\port\pgstrcasecmp.c - $(CPP) @<< - $(CPP_PROJ) ..\..\port\pgstrcasecmp.c -<< - -"$(INTDIR)\thread.obj" : ..\..\port\thread.c - $(CPP) @<< - $(CPP_PROJ) ..\..\port\thread.c -<< - -"$(INTDIR)\inet_aton.obj" : ..\..\port\inet_aton.c - $(CPP) @<< - $(CPP_PROJ) ..\..\port\inet_aton.c -<< - -"$(INTDIR)\crypt.obj" : ..\..\port\crypt.c - $(CPP) @<< - $(CPP_PROJ) ..\..\port\crypt.c -<< - -"$(INTDIR)\noblock.obj" : ..\..\port\noblock.c - $(CPP) @<< - $(CPP_PROJ) ..\..\port\noblock.c -<< - -"$(INTDIR)\chklocale.obj" : ..\..\port\chklocale.c - $(CPP) @<< - $(CPP_PROJ) ..\..\port\chklocale.c -<< - -"$(INTDIR)\inet_net_ntop.obj" : ..\..\port\inet_net_ntop.c - $(CPP) @<< - $(CPP_PROJ) ..\..\port\inet_net_ntop.c -<< - -"$(INTDIR)\md5.obj" : ..\..\backend\libpq\md5.c - $(CPP) @<< - $(CPP_PROJ) ..\..\backend\libpq\md5.c -<< - -"$(INTDIR)\ip.obj" : ..\..\backend\libpq\ip.c - $(CPP) @<< - $(CPP_PROJ) ..\..\backend\libpq\ip.c -<< - -"$(INTDIR)\wchar.obj" : ..\..\backend\utils\mb\wchar.c - $(CPP) @<< - $(CPP_PROJ) /I"." ..\..\backend\utils\mb\wchar.c -<< - - -"$(INTDIR)\encnames.obj" : ..\..\backend\utils\mb\encnames.c - $(CPP) @<< - $(CPP_PROJ) /I"." ..\..\backend\utils\mb\encnames.c -<< - -"$(INTDIR)\snprintf.obj" : ..\..\port\snprintf.c - $(CPP) @<< - $(CPP_PROJ) /I"." ..\..\port\snprintf.c -<< - -"$(INTDIR)\strlcpy.obj" : ..\..\port\strlcpy.c - $(CPP) @<< - $(CPP_PROJ) /I"." ..\..\port\strlcpy.c -<< - -"$(INTDIR)\dirent.obj" : ..\..\port\dirent.c - $(CPP) @<< - $(CPP_PROJ) /I"." ..\..\port\dirent.c -<< - -"$(INTDIR)\dirmod.obj" : ..\..\port\dirmod.c - $(CPP) @<< - $(CPP_PROJ) /I"." ..\..\port\dirmod.c -<< - -"$(INTDIR)\pgsleep.obj" : ..\..\port\pgsleep.c - $(CPP) @<< - $(CPP_PROJ) /I"." ..\..\port\pgsleep.c -<< - -"$(INTDIR)\open.obj" : ..\..\port\open.c - $(CPP) @<< - $(CPP_PROJ) /I"." ..\..\port\open.c -<< - -"$(INTDIR)\win32error.obj" : ..\..\port\win32error.c - $(CPP) @<< - $(CPP_PROJ) /I"." ..\..\port\win32error.c -<< - -"$(INTDIR)\win32setlocale.obj" : ..\..\port\win32setlocale.c - $(CPP) @<< - $(CPP_PROJ) /I"." ..\..\port\win32setlocale.c -<< - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c.obj: - $(CPP) $(CPP_PROJ) $< diff --git a/buildscripts/dependency-recipes/thrift/bld.bat b/buildscripts/dependency-recipes/thrift/bld.bat deleted file mode 100644 index e5cb241..0000000 --- a/buildscripts/dependency-recipes/thrift/bld.bat +++ /dev/null @@ -1,60 +0,0 @@ - -if %PY_VER% == 3.3 ( - xcopy /E %RECIPE_DIR%\vc10 . -) -if %PY_VER% == 3.4 ( - xcopy /E %RECIPE_DIR%\vc10 . -) -if %PY_VER% == 2.6 ( - xcopy /E %RECIPE_DIR%\vc9 . -) -if %PY_VER% == 2.7 ( - xcopy /E %RECIPE_DIR%\vc9 . -) -if errorlevel 1 exit 1 - -copy %RECIPE_DIR%\stdint.h . -if errorlevel 1 exit 1 - -mkdir %LIBRARY_INC%\thrift -mkdir %LIBRARY_INC%\thrift\protocol -mkdir %LIBRARY_INC%\thrift\processor -mkdir %LIBRARY_INC%\thrift\transport -mkdir %LIBRARY_INC%\thrift\windows -mkdir %LIBRARY_INC%\thrift\concurrency -copy lib\cpp\src\thrift\*.h %LIBRARY_INC%\thrift -copy lib\cpp\src\thrift\transport\*.h %LIBRARY_INC%\thrift\transport -copy lib\cpp\src\thrift\protocol\*.h %LIBRARY_INC%\thrift\protocol -copy lib\cpp\src\thrift\protocol\*.tcc %LIBRARY_INC%\thrift\protocol -copy lib\cpp\src\thrift\processor\*.h %LIBRARY_INC%\thrift\processor -copy lib\cpp\src\thrift\windows\*.h %LIBRARY_INC%\thrift\windows -copy lib\cpp\src\thrift\concurrency\*.h %LIBRARY_INC%\thrift\concurrency -if errorlevel 1 exit 1 - -if %PY_VER% == 3.3 ( - msbuild Thrift.sln /property:Configuration=Release /property:Platform=x64 -) -if %PY_VER% == 3.4 ( - msbuild Thrift.sln /property:Configuration=Release /property:Platform=x64 -) -if %PY_VER% == 2.6 ( - vcbuild Thrift.sln -) -if %PY_VER% == 2.7 ( - vcbuild Thrift.sln -) -if errorlevel 1 exit 1 - -if %PY_VER% == 3.3 ( - copy x64\Release\Thrift.lib %LIBRARY_LIB% -) -if %PY_VER% == 3.4 ( - copy x64\Release\Thrift.lib %LIBRARY_LIB% -) -if %PY_VER% == 2.6 ( - copy Release\Thrift.lib %LIBRARY_LIB% -) -if %PY_VER% == 2.7 ( - copy Release\Thrift.lib %LIBRARY_LIB% -) -if errorlevel 1 exit 1 diff --git a/buildscripts/dependency-recipes/thrift/build.sh b/buildscripts/dependency-recipes/thrift/build.sh deleted file mode 100644 index b6d5799..0000000 --- a/buildscripts/dependency-recipes/thrift/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -./configure --prefix=$PREFIX --with-boost=$PREFIX --disable-tests --with-cpp \ - --without-qt4 \ - --without-qt5 \ - --without-c_glib \ - --without-csharp \ - --without-java \ - --without-erlang \ - --without-nodejs \ - --without-lua \ - --without-python \ - --without-perl \ - --without-php \ - --without-php_extension \ - --without-ruby \ - --without-haskell \ - --without-go \ - --without-haxe \ - --without-d -make -make install diff --git a/buildscripts/dependency-recipes/thrift/meta.yaml b/buildscripts/dependency-recipes/thrift/meta.yaml deleted file mode 100644 index b9625ba..0000000 --- a/buildscripts/dependency-recipes/thrift/meta.yaml +++ /dev/null @@ -1,14 +0,0 @@ -package: - name: thrift - version: "0.9.3" - -source: - fn: thrift-0.9.3.tar.gz - url: http://www.us.apache.org/dist/thrift/0.9.3/thrift-0.9.3.tar.gz - -requirements: - build: - - openssl - - boost 1.57.0 [osx] - - boost 1.60.0 [not osx] - run: diff --git a/buildscripts/dependency-recipes/thrift/stdint.h b/buildscripts/dependency-recipes/thrift/stdint.h deleted file mode 100644 index e4367d4..0000000 --- a/buildscripts/dependency-recipes/thrift/stdint.h +++ /dev/null @@ -1,267 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2013 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the product nor the names of its contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#if _MSC_VER >= 1600 // [ -#include -#else // ] _MSC_VER >= 1600 [ - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -<<<<<<< HEAD -<<<<<<< HEAD -// so we give up on __intX for ***REMOVED*** -======= -// so we give up on __intX for them. ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -// so we give up on __intX for them. ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef signed __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -// These #ifndef's are needed to prevent collisions with . -// Check out Issue 9 for the details. -#ifndef INTMAX_C // [ -# define INTMAX_C INT64_C -#endif // INTMAX_C ] -#ifndef UINTMAX_C // [ -# define UINTMAX_C UINT64_C -#endif // UINTMAX_C ] - -#endif // __STDC_CONSTANT_MACROS ] - -#endif // _MSC_VER >= 1600 ] - -#endif // _MSC_STDINT_H_ ] diff --git a/buildscripts/dependency-recipes/thrift/vc10/Thrift.sln b/buildscripts/dependency-recipes/thrift/vc10/Thrift.sln deleted file mode 100644 index 14d5d0d..0000000 --- a/buildscripts/dependency-recipes/thrift/vc10/Thrift.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C++ Express 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Thrift", "Thrift\Thrift.vcxproj", "{8D9563A5-AFD8-4398-97E3-67F30228CF28}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8D9563A5-AFD8-4398-97E3-67F30228CF28}.Debug|Win32.ActiveCfg = Debug|Win32 - {8D9563A5-AFD8-4398-97E3-67F30228CF28}.Debug|Win32.Build.0 = Debug|Win32 - {8D9563A5-AFD8-4398-97E3-67F30228CF28}.Debug|x64.ActiveCfg = Debug|x64 - {8D9563A5-AFD8-4398-97E3-67F30228CF28}.Debug|x64.Build.0 = Debug|x64 - {8D9563A5-AFD8-4398-97E3-67F30228CF28}.Release|Win32.ActiveCfg = Release|Win32 - {8D9563A5-AFD8-4398-97E3-67F30228CF28}.Release|Win32.Build.0 = Release|Win32 - {8D9563A5-AFD8-4398-97E3-67F30228CF28}.Release|x64.ActiveCfg = Release|x64 - {8D9563A5-AFD8-4398-97E3-67F30228CF28}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/buildscripts/dependency-recipes/thrift/vc10/Thrift/Thrift.vcxproj b/buildscripts/dependency-recipes/thrift/vc10/Thrift/Thrift.vcxproj deleted file mode 100644 index e72665a..0000000 --- a/buildscripts/dependency-recipes/thrift/vc10/Thrift/Thrift.vcxproj +++ /dev/null @@ -1,212 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {8D9563A5-AFD8-4398-97E3-67F30228CF28} - Thrift - - - - StaticLibrary - true - MultiByte - - - StaticLibrary - true - MultiByte - - - Application - false - true - MultiByte - - - StaticLibrary - false - true - MultiByte - - - - - - - - - - - - - - - - - - - C:\temp\Thrift\src;C:\temp\boost_1_60_0;$(IncludePath) - - - C:\temp\Thrift\src;C:\temp\boost_1_60_0;$(IncludePath) - - - $(LIBRARY_INC);$(IncludePath) - - - - Level3 - Disabled - - - true - - - MachineX64 - - - - - Level3 - Disabled - - - true - - - MachineX64 - - - - - Level3 - MaxSpeed - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - BOOST_ALL_DYN_LINK;%(PreprocessorDefinitions) - - - true - true - true - - - MachineX64 - - - - - - \ No newline at end of file diff --git a/buildscripts/dependency-recipes/thrift/vc9/Thrift.sln b/buildscripts/dependency-recipes/thrift/vc9/Thrift.sln deleted file mode 100644 index 6de425a..0000000 --- a/buildscripts/dependency-recipes/thrift/vc9/Thrift.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Thrift", "Thrift.vcproj", "{E360BF4A-658B-4136-A833-159034884600}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E360BF4A-658B-4136-A833-159034884600}.Debug|Win32.ActiveCfg = Debug|Win32 - {E360BF4A-658B-4136-A833-159034884600}.Debug|Win32.Build.0 = Debug|Win32 - {E360BF4A-658B-4136-A833-159034884600}.Debug|x64.ActiveCfg = Debug|x64 - {E360BF4A-658B-4136-A833-159034884600}.Debug|x64.Build.0 = Debug|x64 - {E360BF4A-658B-4136-A833-159034884600}.Release|Win32.ActiveCfg = Release|Win32 - {E360BF4A-658B-4136-A833-159034884600}.Release|Win32.Build.0 = Release|Win32 - {E360BF4A-658B-4136-A833-159034884600}.Release|x64.ActiveCfg = Release|x64 - {E360BF4A-658B-4136-A833-159034884600}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/buildscripts/dependency-recipes/thrift/vc9/Thrift.vcproj b/buildscripts/dependency-recipes/thrift/vc9/Thrift.vcproj deleted file mode 100644 index e363c74..0000000 --- a/buildscripts/dependency-recipes/thrift/vc9/Thrift.vcproj +++ /dev/null @@ -1,588 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/buildscripts/fetch-dependencies b/buildscripts/fetch-dependencies index c4fd5c2..5f886c3 100755 --- a/buildscripts/fetch-dependencies +++ b/buildscripts/fetch-dependencies @@ -16,22 +16,6 @@ fi pushd $(mk_depend_path '') >/dev/null -# mongo-c-driver (v.0.7.1) -if [ ! -d mongo-c-driver ]; then - git clone git://github.com/mongodb/mongo-c-driver.git - pushd mongo-c-driver >/dev/null - git checkout v0.7.1 - - # build mongo-c-driver - export MONGO_PATH=$(mk_depend_path 'build/mongo-c-driver') - - make - mkdir temp - make install PREFIX=$(mk_depend_path install/mongo-c-driver/temp) - popd >/dev/null -fi - - # pcre version 8.30 if [ ! -d pcre-8.30 ]; then @@ -70,46 +54,21 @@ if [ -f zlib-1.2.7.tar.bz2 ]; then rm zlib-1.2.7.tar.bz2 fi -# get a unixODBC driver manager -if [ ! -d unixODBC-2.3.1 ]; then - if [ ! -f unixODBC-2.3.1.tar.gz ]; then - wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.1.tar.gz - fi - - tar -zxvf unixODBC-2.3.1.tar.gz - pushd unixODBC-2.3.1 >/dev/null - ./configure - make - popd >/dev/null -fi - -if [ -f unixODBC-2.3.1.tar.gz ]; then - # leave it clean - rm unixODBC-2.3.1.tar.gz -fi - -IOPRO_INCLUDE_PATH=$(mk_depend_path mongo-c-driver/src):$IOPRO_INCLUDE_PATH IOPRO_INCLUDE_PATH=$(mk_depend_path pcre-8.30):$IOPRO_INCLUDE_PATH IOPRO_INCLUDE_PATH=$(mk_depend_path zlib-1.2.7):$IOPRO_INCLUDE_PATH -IOPRO_INCLUDE_PATH=$(mk_depend_path unixODBC-2.3.1):$IOPRO_INCLUDE_PATH -IOPRO_INCLUDE_PATH=$(mk_depend_path unixODBC-2.3.1/include):$IOPRO_INCLUDE_PATH export IOPRO_INCLUDE_PATH echo 'IOPRO_INCLUDE_PATH=' $IOPRO_INCLUDE_PATH -IOPRO_LIBRARY_PATH=$(mk_depend_path mongo-c-driver):$IOPRO_LIBRARY_PATH IOPRO_LIBRARY_PATH=$(mk_depend_path pcre-8.30/.libs):$IOPRO_LIBRARY_PATH IOPRO_LIBRARY_PATH=$(mk_depend_path zlib-1.2.7):$IOPRO_LIBRARY_PATH -IOPRO_LIBRARY_PATH=$(mk_depend_path unixODBC-2.3.1):$IOPRO_LIBRARY_PATH export IOPRO_LIBRARY_PATH echo 'IOPRO_LIBRARY_PATH=' $IOPRO_LIBRARY_PATH -LD_LIBRARY_PATH=$(mk_depend_path install/mongo-c-driver/temp/lib):$LD_LIBRARY_PATH LD_LIBRARY_PATH=$(mk_depend_path pcre-8.30/.libs):$LD_LIBRARY_PATH LD_LIBRARY_PATH=$(mk_depend_path zlib-1.2.7):$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$(mk_depend_path unixODBC-2.3.1/DriverManager/.libs):$LD_LIBRARY_PATH export LD_LIBRARY_PATH echo 'LD_LIBRARY_PATH=' $LD_LIBRARY_PATH diff --git a/buildscripts/jenkins-build b/buildscripts/jenkins-build index 98eed40..d7f20fc 100755 --- a/buildscripts/jenkins-build +++ b/buildscripts/jenkins-build @@ -21,23 +21,8 @@ rm -rf ${PYENV_PREFIX} ~/anaconda/bin/conda create --yes -p ${PYENV_PREFIX} anaconda python=${PYTHON_VERSION} numpy=1.7 || exit 1 export PATH=${PYENV_PREFIX}/bin:${PATH} -# JNB: Get rid of any TextAdapter that conda may have installed -rm -rf ${PYENV_PREFIX}/lib/python2.7/site-packages/TextAdapter* - -# Get and build mongo c driver -if [ ! -d mongo-c-driver ]; then - git clone git://github.com/mongodb/mongo-c-driver.git - cd mongo-c-driver - git checkout v0.7.1 - cd .. -fi - -export MONGO_PATH=${WORKSPACE}/build/mongo-c-driver -cd mongo-c-driver -make -mkdir temp -make install PREFIX=${WORKSPACE}/build/mongo-c-driver/temp -cd .. +# JNB: Get rid of any iopro that conda may have installed +rm -rf ${PYENV_PREFIX}/lib/python2.7/site-packages/iopro* # Get and build pcre lib if [ ! -f ${WORKSPACE}/pcre-8.30.tar.gz ]; then @@ -65,36 +50,18 @@ cd zlib-1.2.7 make cd .. -# Get and build unix odbc lib -if [ ! -f ${WORKSPACE}/unixODBC-2.3.1.tar.gz ]; then - cd .. - wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.1.tar.gz - cd build -fi - -tar -zxvf ../unixODBC-2.3.1.tar.gz -cd unixODBC-2.3.1 -./configure -make -cd .. # Set up include and lib paths since we're not installing in default system paths -export IOPRO_INCLUDE_PATH=${WORKSPACE}/build/mongo-c-driver/src:$IOPRO_INCLUDE_PATH -export IOPRO_LIBRARY_PATH=${WORKSPACE}/build/mongo-c-driver:$IOPRO_LIBRARY_PATH export IOPRO_INCLUDE_PATH=${WORKSPACE}/build/pcre-8.30:$IOPRO_INCLUDE_PATH export IOPRO_LIBRARY_PATH=${WORKSPACE}/build/pcre-8.30/.libs:$IOPRO_LIBRARY_PATH export IOPRO_INCLUDE_PATH=${WORKSPACE}/build/zlib-1.2.7:$IOPRO_INCLUDE_PATH export IOPRO_LIBRARY_PATH=${WORKSPACE}/build/zlib-1.2.7:$IOPRO_LIBRARY_PATH -export IOPRO_INCLUDE_PATH=${WORKSPACE}/build/unixODBC-2.3.1:${WORKSPACE}/build/unixODBC-2.3.1/include:$IOPRO_INCLUDE_PATH -export IOPRO_LIBRARY_PATH=${WORKSPACE}/build/unixODBC-2.3.1/DriverManager/.libs:$IOPRO_LIBRARY_PATH export IOPRO_INCLUDE_PATH=~/anaconda/include/python${PYTHON_VERSION}:$IOPRO_INCLUDE_PATH export IOPRO_LIBRARY_PATH=~/anaconda/lib:$IOPRO_LIBRARY_PATH -export LD_LIBRARY_PATH=${WORKSPACE}/build/mongo-c-driver/temp/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=${WORKSPACE}/build/pcre-8.30/.libs:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=${WORKSPACE}/build/zlib-1.2.7:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH=${WORKSPACE}/build/unixODBC-2.3.1/DriverManager/.libs:$LD_LIBRARY_PATH cd .. python setup.py build_ext --inplace --include-dirs=$IOPRO_INCLUDE_PATH --library-dirs=$IOPRO_LIBRARY_PATH || exit 1 -python -c 'import TextAdapter; import sys; sys.exit(1 - TextAdapter.test(num_records=1000))' +python -c 'import textadapter; import sys; sys.exit(1 - textadapter.test(num_records=1000))' diff --git a/docs/1.8.0/MongoAdapter.rst b/docs/1.8.0/MongoAdapter.rst deleted file mode 100644 index a6b0285..0000000 --- a/docs/1.8.0/MongoAdapter.rst +++ /dev/null @@ -1,173 +0,0 @@ -<<<<<<< HEAD -***REMOVED***- -MongoAdapter -***REMOVED***- - -***REMOVED*** -======= ------------- -MongoAdapter ------------- - -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -
-

Contents

- -***REMOVED*** -======= -
  • Basic Usage
  • - - - -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    The MongoAdapter module reads data from a Mongo database collection and produces a - NumPy array containing the loaded. The following features are currently implemented:

    -
      -
    • The MongoAdapter engine is written in C to ensure data is loaded fast with minimal - memory usage.
    • -
    • Python slicing notation can be used to specify the subset of records to be - read from the data source.
    • -
    • The MongoAdapter engine has automatic type inference so the user does not have to - specify dtypes of the output array.
    • -
    -
    -

    Methods

    -

    The MongoAdapter module contains the follwowing constructor for creating MongoAdapter objects:

    -
    -
    MongoAdapter (host, port, database, collection)
    -
    -
    MongoAdapter contructor
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    host - Host name where Mongo database is running.
    -
    port - Port number where Mongo database is running.
    -
    database - Mongo database to connect to
    -
    collection - Mongo database collection
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    set_field_names (names)
    -
    -
    Set field names to read when creating output NumPy array.
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    get_field_names ()
    -
    -
    Returns names of fields that will be read when reading data from Mongo database.
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    set_field_types (types=None)
    -
    -
    Set NumPy dtypes for each field, specified as a dict of field names/indices and associated - dtype. (Example: {0:’u4’, 1:’f8’, 2:’S10’})
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    get_field_types ()
    -
    -
    Returns dict of field names/indices and associated NumPy dtype.
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    -

    The MongoAdapter object contains the following properties:

    -
    -
    size (readonly)
    -
    -
    Number of documents in the Mongo database + collection specified in constructor.
    -<<<<<<< HEAD -***REMOVED*** -
    -
    -***REMOVED*** -
    -

    ***REMOVED***

    -======= -
    - - -
    -
    -

    Basic Usage

    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
      -
    1. Create MongoAdapter object for data source

      -
      >>> import iopro
      -    >>> adapter = iopro.MongoAdapter('localhost', 27017, 'database_name', 'collection_name')
      -    
      -<<<<<<< HEAD -***REMOVED*** -======= -
      ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    2. -
    3. Load Mongo collection documents into NumPy array using slicing notation

      -
      >>> # read all records for 'field0' field
      -    >>> array = adapter['field0'][:]
      -    
      -<<<<<<< HEAD -***REMOVED*** -
      >>> # read first ten records for 'field0' and 'field1' fields
      -    >>> array = adapter[['field0', 'field1']][0:10]
      -    
      -***REMOVED*** -
      >>> # read last record
      -    >>> array = adapter['field0'][-1]
      -    
      -***REMOVED*** -
      >>> # read every other record
      -    >>> array = adapter['field0'][::2]
      -    
      -***REMOVED*** -
    4. -
    -***REMOVED*** -======= -
    -
    >>> # read first ten records for 'field0' and 'field1' fields
    -    >>> array = adapter[['field0', 'field1']][0:10]
    -    
    -
    -
    >>> # read last record
    -    >>> array = adapter['field0'][-1]
    -    
    -
    -
    >>> # read every other record
    -    >>> array = adapter['field0'][::2]
    -    
    -
    - - - ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/TextAdapter.rst b/docs/1.8.0/TextAdapter.rst deleted file mode 100644 index 369c88f..0000000 --- a/docs/1.8.0/TextAdapter.rst +++ /dev/null @@ -1,507 +0,0 @@ -<<<<<<< HEAD -***REMOVED*** -TextAdapter -***REMOVED*** - -***REMOVED*** -======= ------------ -TextAdapter ------------ - -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -
    -

    Contents

    - -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    The TextAdapter module reads csv data and produces a NumPy array containing the - parsed data. The following features are currently implemented:

    -
      -
    • The TextAdapter engine is written - in C to ensure text is parsed as fast as data can be read from the source. - Text is read and parsed in small chunks instead of reading entire data into - memory at once, which enables very large files to be read and parsed without - running out of memory.
    • -
    • Python slicing notation can be used to specify a subset of records to be - read from the data source, as well as a subset of fields.
    • -
    • In additional to specifying a delimiter character, fields can - be specified by fixed field widths as well as a regular expression. This enables - a larger variety of csv-like and other types of text files to be parsed.
    • -
    • A gzipped file can be parsed without having to uncompress it first. Parsing speed - is about the same as an uncompressed version of same file.
    • -
    • An index of record offsets in a file can be built to allow fast random access to - records. This index can be saved to disk and loaded again later.
    • -
    • Converter functions can be specified for converting parsed text to proper dtype - for storing in NumPy array. If Numba is installed, converter functions will - be compiled to llvm bytecode on the fly for faster execution.
    • -
    • The TextAdapter engine has automatic type inference so the user does not have to - specify dtypes of the output array. The user can still specify dtypes manually if - desired.
    • -
    • Remote data stored in Amazon S3 can be read. An index can be built and stored - with S3 data. Index can be read remotely, allowing for random access to S3 data.
    • -
    -
    -

    Methods

    -

    The TextAdapter module contains the following factory methods for creating TextAdapter objects:

    -
    -
    text_adapter (source, parser=’csv’, compression=None, comment=’#’,
    -
    -<<<<<<< HEAD -***REMOVED***quote=’”’, num_records=0, header=0, field_names=True, -======= -
    quote=’”’, num_records=0, header=0, field_names=True, ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - indexing=False, index_name=None, encoding=’utf-8’)
    -
    -
    Create a text adapter for reading CSV, JSON, or fixed width
    -
    text files, or a text file defined by regular expressions.
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    source - filename, file object, StringIO object, BytesIO object, S3 key, - http url, or python generator
    -
    parser - Type of parser for parsing text. Valid parser types are ‘csv’, ‘fixed width’, ‘regex’, and ‘json’.
    -
    encoding - type of character encoding (current ascii and utf8 are supported)
    -
    compression - type of data compression (currently only gzip is supported)
    -
    comment - character used to indicate comment line
    -
    quote - character used to quote fields
    -
    num_records - limits parsing to specified number of records; defaults - to all records
    -
    header - number of lines in file header; these lines are skipped when parsing
    -
    footer - number of lines in file footer; these lines are skipped when parsing
    -
    indexing - create record index on the fly as characters are read
    -
    index_name - name of file to write index to
    -
    output - type of output object (numpy array or pandas dataframe)
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    If parser is set to ‘csv’, additional parameters include:
    -
    -
    delimiter - Delimiter character used to define fields in data source. Default is ‘,’.
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    If parser is set to ‘fixed_width’, additional parameters include:
    -
    -
    field_widths - List of field widths
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    If parser is set to ‘regex’, additional parameters include:
    -
    -
    regex - Regular expression used to define records and fields in data source. - See the regular expression example in the Advanced Usage section.
    -<<<<<<< HEAD -***REMOVED*** -
    -
    s3_text_adapter (access_key, secret_key, bucket_name, key_name, remote_s3_index=False)
    -
    -***REMOVED***parser=’csv’, compression=None, comment=’#’, -======= -
    - -
    s3_text_adapter (access_key, secret_key, bucket_name, key_name, remote_s3_index=False)
    -
    -
    parser=’csv’, compression=None, comment=’#’, ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - quote=’”’, num_records=0, header=0, field_names=True, - indexing=False, index_name=None, encoding=’utf-8’)
    -
    -
    Create a text adapter for reading a text file from S3. Text file can be
    -
    CSV, JSON, fixed width, or defined by regular expressions
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    - -

    In addition to the arguments described for the text_adapter function above, - the s3_text_adapter function also has the following parameters:

    -
    -<<<<<<< HEAD -***REMOVED***
    -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    access_key - AWS access key
    -
    secret_key - AWS secret key
    -
    bucket_name - name of S3 bucket
    -
    key_name - name of key in S3 bucket
    -
    remote_s3_index - use remote S3 index (index name must be key name + ‘.idx’ extension)
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED***
    -======= - - ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    The TextAdapter object returned by the text_adapter factory method contains the following methods:

    -
    -
    set_converter (field, converter, use_numba=True)
    -
    -
    Set converter function for field
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    field - field to apply converter function
    -
    converter - python function object
    -
    use_numba - If true, numba will be used to compile function. - Otherwise the function will be executed as a normal Python - function, resulting in slower performance.
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    set_missing_values (missing_values)
    -
    -
    Set strings for each field that represents a missing value
    -<<<<<<< HEAD -***REMOVED*** -
    -
    missing_values - dict of field name or number, - and list of missing value strings
    -***REMOVED*** -======= -
    -
    -
    missing_values - dict of field name or number, - and list of missing value strings
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Default missing values: ‘NA’, ‘NaN’, ‘inf’, ‘-inf’, ‘None’, ‘none’, ‘’

    -
    -
    set_fill_values (fill_values, loose=False)
    -
    -
    Set fill values for each field
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    fill_values - dict of field name or number, and fill value
    -
    loose - If value cannot be converted, and value does not match - any of the missing values, replace with fill value anyway.
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Default fill values for each data type: - | int - 0 - | float - numpy.nan - | char - 0 - | bool - False - | object - numpy.nan - | string - numpy.nan

    -
    -
    create_index (index_name=None, density=1)
    -
    -
    Create an index of record offsets in file
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    index_name - Name of file on disk used to store index. If None, index - will be created in memory but not saved.
    -
    density - density of index. Value of 1 will index every record, value of - 2 will index every other record, etc.
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    to_array ()
    -
    -
    Parses entire data source and returns data as NumPy array object
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    to_dataframe ()
    -
    -
    Parses entire data source and returns data as Pandas DataFrame object
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    -

    The TextAdapter object contains the following properties:

    -
    -
    size (readonly)
    -
    -
    Number of records in data source. This value is only set if entire data - source has been read or indexed, or number of recods was specified in - text_adapter factory method when creating object.
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    field_count (readonly)
    -
    -
    Number of fields in each record
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    field_names
    -
    -
    Field names to use when creating output NumPy array. Field names can be - set here before reading data or in text_adapter function with - field_names parameter.
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    field_types
    -
    -
    NumPy dtypes for each field, specified as a dict of fields and associated - dtype. (Example: {0:’u4’, 1:’f8’, 2:’S10’})
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    field_filter
    -
    -
    Fields in data source to parse, specified as a list of field numbers - or names (Examples: [0, 1, 2] or [‘f1’, ‘f3’, ‘f5’]). This filter stays - in effect until it is reset to empty list, or is overridden with array - slicing (Example: adapter[[0, 1, 3, 4]][:]).
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    See the NumPy data types documentation for more details:
    -
    http://docs.continuum.io/anaconda/numpy/reference/arrays.dtypes.html
    -
    -
    -
    -

    The TextAdapter object supports array slicing:

    -
    -<<<<<<< HEAD -***REMOVED***
    -
    Read all records: - adapter[:]
    -***REMOVED*** -
    -
    Read first 100 records: - adapter[0:100]
    -***REMOVED*** -======= -
    -
    Read all records: - adapter[:]
    -
    -
    -
    Read first 100 records: - adapter[0:100]
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    Read last record (only if data has been indexed or entire dataset - has been read once before): - adapter[-1]
    -<<<<<<< HEAD -***REMOVED*** -
    -
    Read first field in all records by specifying field number: - adapter[0][:]
    -***REMOVED*** -
    -
    Read first field in all records by specifying field name: - adapter[‘f0’][:]
    -***REMOVED*** -
    -
    Read first and third fields in all records: - adapter[[0, 2]][:]
    -***REMOVED*** -***REMOVED***
    -***REMOVED*** -
    -

    ***REMOVED***

    -======= -
    -
    -
    Read first field in all records by specifying field number: - adapter[0][:]
    -
    -
    -
    Read first field in all records by specifying field name: - adapter[‘f0’][:]
    -
    -
    -
    Read first and third fields in all records: - adapter[[0, 2]][:]
    -
    - - -
    -

    Basic Usage

    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Create TextAdapter object for data source:

    -
    >>> import iopro
    -    >>> adapter = iopro.text_adapter('data.csv', parser='csv')
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Parse text and store records in NumPy array using slicing notation:

    -
    >>> # read all records
    -    >>> array = adapter[:]
    -
    -    >>> # read first ten records
    -    >>> array = adapter[0:10]
    -
    -    >>> # read last record
    -    >>> array = adapter[-1]
    -
    -    >>> # read every other record
    -    >>> array = adapter[::2]
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Advanced Usage

    -

    user defined converter function for field 0:

    -
    >>> import iopro
    -    >>> import io
    -
    -    >>> data = '1, abc, 3.3\n2, xxx, 9.9'
    -    >>> adapter = iopro.text_adapter(io.StringIO(data), parser='csv', field_names=False)
    -
    -    >>> # Override default converter for first field
    -    >>> adapter.set_converter(0, lambda x: int(x)*2)
    -    >>> adapter[:]
    -    array([(2L, ' abc', 3.3), (4L, ' xxx', 9.9)],
    -              dtype=[('f0', '<u8'), ('f1', 'S4'), ('f2', '<f8')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    overriding default missing and fill values:

    -
    >>> import iopro
    -    >>> import io
    -
    -    >>> data = '1,abc,inf\n2,NA,9.9'
    -    >>> adapter = iopro.text_adapter(io.StringIO(data), parser='csv', field_names=False)
    -
    -    >>> # Define field dtypes (example: set field 1 to string object and field 2 to float)
    -    >>> adapter.field_types = {1:'O', 2:'f4'}
    -
    -    >>> # Define list of strings for each field that represent missing values
    -    >>> adapter.set_missing_values({1:['NA'], 2:['inf']})
    -
    -    >>> # Set fill value for missing values in each field
    -    >>> adapter.set_fill_values({1:'xxx', 2:999.999})
    -    >>> adapter[:]
    -    array([(' abc', 999.9990234375), ('xxx', 9.899999618530273)],
    -              dtype=[('f0', 'O'), ('f1', '<f4')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    creating and saving tuple of index arrays for gzip file, and reloading indices:

    -
    >>> import iopro
    -    >>> adapter = iopro.text_adapter('data.gz', parser='csv', compression='gzip')
    -
    -    >>> # Build index of records and save index to disk.
    -    >>> adapter.create_index(index_name='index_file')
    -
    -    >>> # Create new adapter object and load index from disk.
    -    >>> adapter = iopro.text_adapter('data.gz', parser='csv', compression='gzip', indexing=True, index_name='index_file')
    -
    -    >>> # Read last record
    -    >>> adapter[-1]
    -    array([(100, 101, 102)],dtype=[('f0', '<u4'), ('f1', '<u4'), ('f2', '<u4')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Use regular expression for finer control of extracting data:

    -
    >>> import iopro
    -    >>> import io
    -
    -    >>> # Define regular expression to extract dollar amount, percentage, and month.
    -    >>> # Each set of parentheses defines a field.
    -    >>> data = '$2.56, 50%, September 20 1978\n$1.23, 23%, April 5 1981'
    -    >>> regex_string = '([0-9]\.[0-9][0-9]+)\,\s ([0-9]+)\%\,\s ([A-Za-z]+)'
    -    >>> adapter = iopro.text_adapter(io.StringIO(data), parser='regex', regex_string=regex_string, field_names=False, infer_types=False)
    -
    -    >>> # set dtype of field to float
    -    >>> adapter.field_types = {0:'f4', 1:'u4', 2:'S10'}
    -    >>> adapter[:]
    -    array([(2.56, 50L, 'September'), (1.23, 23L, 'April')],
    -        dtype=[('f0', '<f8'), ('f1', '<u8'), ('f2', 'S9')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/eula.rst b/docs/1.8.0/eula.rst deleted file mode 100644 index ca83f5f..0000000 --- a/docs/1.8.0/eula.rst +++ /dev/null @@ -1,128 +0,0 @@ -================================ -IOPro END USER LICENSE AGREEMENT -================================ - -<<<<<<< HEAD -***REMOVED*** -======= -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -

    IOPro (“the Software Product”) and accompanying documentation is licensed and not sold. The Software Product is protected by copyright laws and treaties, as well as laws and treaties related to other forms of intellectual property. Continuum Analytics, Inc. or its subsidiaries, affiliates, and suppliers (collectively “Continuum”) own intellectual property rights in the Software Product. The Licensee’s (“you” or “your”) license to download, use, copy, or change the Software Product is subject to these rights and to all the terms and conditions of this End User License Agreement (“Agreement”).

    -
    -

    Acceptance

    -

    YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT BY SELECTING THE “ACCEPT” OPTION AND DOWNLOADING THE SOFTWARE PRODUCT OR BY INSTALLING, USING, OR COPYING THE SOFTWARE PRODUCT. YOU MUST AGREE TO ALL OF THE TERMS OF THIS AGREEMENT BEFORE YOU WILL BE ALLOWED TO DOWNLOAD THE SOFTWARE PRODUCT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, YOU MUST SELECT “DECLINE” AND YOU MUST NOT INSTALL, USE, OR COPY THE SOFTWARE PRODUCT.

    -<<<<<<< HEAD -***REMOVED*** -
    -

    Trial Period

    -

    You have the right to use IOPro on a single computer or group of computers for 30 days with no license. After 30 days you must purchase an appropriate license to use the software on one or more machines or stop using the software and remove it from all of your machines on which you installed the software.

    -***REMOVED*** -
    -

    License Grant

    -

    This Agreement entitles you to install and use one copy of the Software Product on as many machines as you will personally use. The Software Product is licensed to a particular user. Only the user to whom the software is licensed may use the software. You must obtain a license for as many users as you wish to use the software. In addition, you may make archival copies of the Software Product Installer.

    -***REMOVED*** -
    -

    Right to Updates

    -

    This license entitles you to updates to the Software Product for one year from the time of payment. The Software Product will continue to function and you may continue to use The Software Product and any updates you have received for as long as you would like however you will no longer be able to receive updates from Continuum unless this License is renewed. Please contact sales@continuum.io with any questions or concerns.

    -***REMOVED*** -
    -

    Restrictions on Transfer

    -

    Without first obtaining the express written consent of Continuum, you may not assign your rights and obligations under this Agreement, or redistribute, encumber, sell, rent, lease, sublicense, or otherwise transfer your rights to the Software Product.

    -***REMOVED*** -
    -

    Restrictions on Use

    -

    You may not use, copy, or install the Software Product on any system where more than one user will be able to use the software unless you have purchased a license for each user of the system. You may not decompile, “reverse-engineer”, disassemble, or otherwise attempt to derive the source code for the Software Product.

    -***REMOVED*** -
    -

    Restrictions on Alteration

    -

    You may not modify the Software Product or create any derivative work of the Software Product or its accompanying documentation. Derivative works include but are not limited to translations. You may not alter any files or libraries in any portion of the Software Product.

    -***REMOVED*** -
    -

    Restrictions on Copying

    -

    You may not copy any part of the Software Product except to the extent that licensed use inherently demands the creation of a temporary copy stored in computer memory and not permanently affixed on storage medium. You may make archival copies of the Software Product installer.

    -***REMOVED*** -
    -

    Limited Software Product Warranty

    -

    For a period of 60 days from the date of shipment or from the date that you download the Software Product, as applicable, Continuum warrants that when properly installed and used under normal conditions, the Software Product will perform substantially as advertised.

    -***REMOVED*** -======= -
    -
    -

    Trial Period

    -

    You have the right to use IOPro on a single computer or group of computers for 30 days with no license. After 30 days you must purchase an appropriate license to use the software on one or more machines or stop using the software and remove it from all of your machines on which you installed the software.

    -
    -
    -

    License Grant

    -

    This Agreement entitles you to install and use one copy of the Software Product on as many machines as you will personally use. The Software Product is licensed to a particular user. Only the user to whom the software is licensed may use the software. You must obtain a license for as many users as you wish to use the software. In addition, you may make archival copies of the Software Product Installer.

    -
    -
    -

    Right to Updates

    -

    This license entitles you to updates to the Software Product for one year from the time of payment. The Software Product will continue to function and you may continue to use The Software Product and any updates you have received for as long as you would like however you will no longer be able to receive updates from Continuum unless this License is renewed. Please contact sales@continuum.io with any questions or concerns.

    -
    -
    -

    Restrictions on Transfer

    -

    Without first obtaining the express written consent of Continuum, you may not assign your rights and obligations under this Agreement, or redistribute, encumber, sell, rent, lease, sublicense, or otherwise transfer your rights to the Software Product.

    -
    -
    -

    Restrictions on Use

    -

    You may not use, copy, or install the Software Product on any system where more than one user will be able to use the software unless you have purchased a license for each user of the system. You may not decompile, “reverse-engineer”, disassemble, or otherwise attempt to derive the source code for the Software Product.

    -
    -
    -

    Restrictions on Alteration

    -

    You may not modify the Software Product or create any derivative work of the Software Product or its accompanying documentation. Derivative works include but are not limited to translations. You may not alter any files or libraries in any portion of the Software Product.

    -
    -
    -

    Restrictions on Copying

    -

    You may not copy any part of the Software Product except to the extent that licensed use inherently demands the creation of a temporary copy stored in computer memory and not permanently affixed on storage medium. You may make archival copies of the Software Product installer.

    -
    -
    -

    Limited Software Product Warranty

    -

    For a period of 60 days from the date of shipment or from the date that you download the Software Product, as applicable, Continuum warrants that when properly installed and used under normal conditions, the Software Product will perform substantially as advertised.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Disclaimer of Warranties and Limitation of Liability

    -

    UNLESS OTHERWISE EXPLICITLY AGREED TO IN WRITING BY CONTINUUM, CONTINUUM MAKES NO OTHER WARRANTIES, EXPRESS OR IMPLIED, IN FACT OR IN LAW, INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OTHER THAN AS SET FORTH IN THIS AGREEMENT OR IN THE LIMITED WARRANTY DOCUMENTS PROVIDED WITH THE SOFTWARE PRODUCT.

    -

    Continuum makes no warranty that the Software Product will meet your requirements or operate under your specific conditions of use. Continuum makes no warranty that operation of the Software Product will be secure, error free, or free from interruption. YOU MUST DETERMINE WHETHER THE SOFTWARE PRODUCT SUFFICIENTLY MEETS YOUR REQUIREMENTS FOR SECURITY AND UNINTERRUPTABILITY. YOU BEAR SOLE RESPONSIBILITY AND ALL LIABILITY FOR ANY LOSS INCURRED DUE TO FAILURE OF THE SOFTWARE PRODUCT TO MEET YOUR REQUIREMENTS. CONTINUUM WILL NOT, UNDER ANY CIRCUMSTANCES, BE RESPONSIBLE OR LIABLE FOR THE LOSS OF DATA ON ANY COMPUTER OR INFORMATION STORAGE DEVICE.ÿ - UNDER NO CIRCUMSTANCES SHALL CONTINUUM, ITS DIRECTORS, OFFICERS, EMPLOYEES OR AGENTS BE LIABLE TO YOU OR ANY OTHER PARTY FOR INDIRECT, CONSEQUENTIAL, SPECIAL, INCIDENTAL, PUNITIVE, OR EXEMPLARY DAMAGES OF ANY KIND (INCLUDING LOST REVENUES OR PROFITS OR LOSS OF BUSINESS) RESULTING FROM THIS AGREEMENT, OR FROM THE FURNISHING, PERFORMANCE, INSTALLATION, OR USE OF THE SOFTWARE PRODUCT, WHETHER DUE TO A BREACH OF CONTRACT, BREACH OF WARRANTY, OR THE NEGLIGENCE OF CONTINUUM OR ANY OTHER PARTY, EVEN IF CONTINUUM IS ADVISED BEFOREHAND OF THE POSSIBILITY OF SUCH DAMAGES. TO THE EXTENT THAT THE APPLICABLE JURISDICTION LIMITS CONTINUUM’S ABILITY TO DISCLAIM ANY IMPLIED WARRANTIES, THIS DISCLAIMER SHALL BE EFFECTIVE TO THE MAXIMUM EXTENT PERMITTED.

    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Limitation of Remedies and Damages

    -

    Your remedy for a breach of this Agreement or of any warranty included in this Agreement is the correction or replacement of the Software Product. Selection of whether to correct or replace shall be solely at the discretion of Continuum. Continuum reserves the right to substitute a functionally equivalent copy of the Software Product as a replacement. If Continuum is unable to provide a replacement or substitute Software Product or corrections to the Software Product, your sole alternate remedy shall be a refund of the purchase price for the Software Product exclusive of any costs for shipping and handling. - Any claim must be made within the applicable warranty period. All warranties cover only defects arising under normal use and do not include malfunctions or failure resulting from misuse, abuse, neglect, alteration, problems with electrical power, acts of nature, unusual temperatures or humidity, improper installation, or damage determined by Continuum to have been caused by you. All limited warranties on the Software Product are granted only to you and are non-transferable. You agree to indemnify and hold Continuum harmless from all claims, judgments, liabilities, expenses, or costs arising from your breach of this Agreement and/or acts or omissions.

    -<<<<<<< HEAD -***REMOVED*** -
    -

    Governing Law, Jurisdiction and Costs

    -

    This Agreement is governed by the laws of Texas, without regard to Texas’s conflict or choice of law provisions.

    -***REMOVED*** -======= -
    -
    -

    Governing Law, Jurisdiction and Costs

    -

    This Agreement is governed by the laws of Texas, without regard to Texas’s conflict or choice of law provisions.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Export Regulations

    -

    Any use or distribution of IOPro is made under conditions that the user and/or distributor is in full compliance with all export and other governing laws of the United States of America, including full and ongoing compliance with the Export Administration Regulations (EAR) of the United States Department of Commerce. See www.commerce.gov/ and - http://www.bis.doc.gov/index.php/regulations/export-administration-regulations-ear. Use or distribution of Continuum software products to any persons, entities or countries currently under US sanctions is strictly prohibited. IOPro is classified with an ECCN of 5D992 with no license required for export to non-embargoed countires.

    -

    The United States currently has embargoes against Cuba, Iran, North Korea, Sudan and Syria. The exportation, re-exportation, sale or supply, directly or indirectly, from the United States, or by a U.S. person wherever located, of any Continuum software to any of these countries is strictly prohibited without prior authorization by the United States Government By accepting this Agreement, you represent to Continuum that you will comply with all applicable export regulations for IOPro.

    -<<<<<<< HEAD -***REMOVED*** -
    -

    Severability

    -

    If any provision of this Agreement shall be held to be invalid or unenforceable, the remainder of this Agreement shall remain in full force and effect. To the extent any express or implied restrictions are not permitted by applicable laws, these express or implied restrictions shall remain in force and effect to the maximum extent permitted by such applicable laws.

    -***REMOVED*** -======= -
    -
    -

    Severability

    -

    If any provision of this Agreement shall be held to be invalid or unenforceable, the remainder of this Agreement shall remain in full force and effect. To the extent any express or implied restrictions are not permitted by applicable laws, these express or implied restrictions shall remain in force and effect to the maximum extent permitted by such applicable laws.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/genfromtxt.rst b/docs/1.8.0/genfromtxt.rst deleted file mode 100644 index d0c45ac..0000000 --- a/docs/1.8.0/genfromtxt.rst +++ /dev/null @@ -1,192 +0,0 @@ -<<<<<<< HEAD -***REMOVED***----- -iopro.genfromtxt -***REMOVED***----- - -***REMOVED*** -======= ----------------- -iopro.genfromtxt ----------------- - -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -

    Load data from a text file, with missing values handled as specified.

    -

    Each line past the first skip_header lines is split at the delimiter - character, and characters following the comments character are discarded.

    -
    -

    Parameters

    -
    -
    fname
    - : file or str
    File, filename, or generator to read. If the filename extension is - .gz or .bz2, the file is first decompressed. Note that - generators must return byte strings in Python 3k.
    -
    dtype
    - : dtype, optional
    Data type of the resulting array. - If None, the dtypes will be determined by the contents of each - column, individually.
    -
    comments
    - : str, optional
    The character used to indicate the start of a comment. - All the characters occurring on a line after a comment are discarded
    -
    delimiter
    - : str, int, or sequence, optional
    The string used to separate values. By default, any consecutive - whitespaces act as delimiter. An integer or sequence of integers - can also be provided as width(s) of each field.
    -
    skip_header
    - : int, optional
    The numbers of lines to skip at the beginning of the file.
    -
    skip_footer
    - : int, optional
    The numbers of lines to skip at the end of the file
    -
    converters
    - : variable, optional
    The set of functions that convert the data of a column to a value. - The converters can also be used to provide a default value - for missing data: converters = {3: lambda s: float(s or 0)}.
    -
    missing_values
    -<<<<<<< HEAD - : variable, optional
    The set of strings corresponding to ***REMOVED***
    -======= - : variable, optional
    The set of strings corresponding to missing data.
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    filling_values
    - : variable, optional
    The set of values to be used as default when the data are missing.
    -
    usecols
    - : sequence, optional
    Which columns to read, with 0 being the first. For example, - usecols = (1, 4, 5) will extract the 2nd, 5th and 6th columns.
    -
    names
    - : {None, True, str, sequence}, optional
    If names is True, the field names are read from the first valid line - after the first skip_header lines. - If names is a sequence or a single-string of comma-separated names, - the names will be used to define the field names in a structured dtype. - If names is None, the names of the dtype fields will be used, if any.
    -
    excludelist
    - : sequence, optional
    A list of names to exclude. This list is appended to the default list - [‘return’,’file’,’print’]. Excluded names are appended an underscore: - for example, file would become file_.
    -
    deletechars
    - : str, optional
    A string combining invalid characters that must be deleted from the - names.
    -
    defaultfmt
    - : str, optional
    A format used to define default field names, such as “f%i” or “f_%02i”.
    -
    autostrip
    - : bool, optional
    Whether to automatically strip white spaces from the variables.
    -
    replace_space
    - : char, optional
    Character(s) used in replacement of white spaces in the variables - names. By default, use a ‘_’.
    -
    case_sensitive
    - : {True, False, ‘upper’, ‘lower’}, optional
    If True, field names are case sensitive. - If False or ‘upper’, field names are converted to upper case. - If ‘lower’, field names are converted to lower case.
    -
    unpack
    - : bool, optional
    If True, the returned array is transposed, so that arguments may be - unpacked using x, y, z = loadtxt(...)
    -
    usemask
    - : bool, optional
    If True, return a masked array. - If False, return a regular array.
    -
    invalid_raise
    - : bool, optional
    If True, an exception is raised if an inconsistency is detected in the - number of columns. - If False, a warning is emitted and the offending lines are skipped.
    -
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Returns

    -
    -
    out
    - : ndarray
    Data read from the text file. If usemask is True, this is a - masked array.
    -
    -<<<<<<< HEAD -***REMOVED*** -
    -

    See Also

    -

    iopro.loadtxt : equivalent function when no data is missing.

    -***REMOVED*** -======= -
    -
    -

    See Also

    -

    iopro.loadtxt : equivalent function when no data is missing.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Notes

    -
      -
    • When spaces are used as delimiters, or when no delimiter has been given - as input, there should not be any missing data between two fields.
    • -
    • When the variables are named (either by a flexible dtype or with names, - there must not be any header in the file (else a ValueError - exception is raised).
    • -
    • Individual values are not stripped of spaces by default. - When using a custom converter, make sure the function does remove spaces.
    • -
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Examples

    -
    >>> import iopro
    -    >>> from io import StringIO
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Comma delimited file with mixed dtype

    -
    >>> s = StringIO("1,1.3,abcde")
    -    >>> data = iopro.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'),
    -    ... ('mystring','S5')], delimiter=",")
    -    >>> data
    -    array((1, 1.3, 'abcde'),
    -          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', '|S5')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Using dtype = None

    -
    >>> s.seek(0) # needed for StringIO example only
    -    >>> data = iopro.genfromtxt(s, dtype=None,
    -    ... names = ['myint','myfloat','mystring'], delimiter=",")
    -    >>> data
    -    array((1, 1.3, 'abcde'),
    -          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', '|S5')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Specifying dtype and names

    -
    >>> s.seek(0)
    -    >>> data = iopro.genfromtxt(s, dtype="i8,f8,S5",
    -    ... names=['myint','myfloat','mystring'], delimiter=",")
    -    >>> data
    -    array((1, 1.3, 'abcde'),
    -          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', '|S5')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    An example with fixed-width columns

    -
    >>> s = StringIO("11.3abcde")
    -    >>> data = iopro.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'],
    -    ...     delimiter=[1,3,5])
    -    >>> data
    -    array((1, 1.3, 'abcde'),
    -          dtype=[('intvar', '<i8'), ('fltvar', '<f8'), ('strvar', '|S5')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/index.rst b/docs/1.8.0/index.rst deleted file mode 100644 index 7e1a7ab..0000000 --- a/docs/1.8.0/index.rst +++ /dev/null @@ -1,172 +0,0 @@ ------ -IOPro ------ - -<<<<<<< HEAD -***REMOVED*** -======= -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -

    IOPro loads NumPy arrays (and Pandas DataFrames) directly from files, SQL - databases, and NoSQL stores, without creating millions of temporary, - intermediate Python objects, or requiring expensive array resizing - operations. It provides a drop-in replacement for the NumPy functions - loadtxt() and genfromtxt(), but drastically improves performance and - reduces the memory overhead.

    -

    IOPro is included with Anaconda Workgroup and Anaconda Enterprise subscriptions.

    -

    To start a 30-day free trial just download and install the IOPro package.

    -

    If you already have Anaconda - (free Python distribution) installed:

    -
    conda update conda
    -    conda install iopro
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    If you do not have Anaconda installed, you can download it - here.

    -

    IOPro can also be installed into your own (non-Anaconda) Python environment. For more information about IOPro please contact sales@continuum.io.

    -
    -

    Getting Started

    -

    Start by attaching to a data source (in this case, a local csv file):

    -
    >>> import iopro
    -    >>> adapter = iopro.text_adapter('table.csv', parser='csv')
    -    
    -<<<<<<< HEAD -***REMOVED*** -

    We can specify the data types for values in the columns of the csv - file being read though here we will instead rely upon the ability of - IOPro’s TextAdapter to ***REMOVED***

    -======= -
    -

    We can specify the data types for values in the columns of the csv - file being read though here we will instead rely upon the ability of - IOPro’s TextAdapter to auto-discover the data types used.

    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    We ask IOPro’s TextAdapter to parse text and return records in NumPy arrays - from selected portions of the csv file using slicing notation:

    -
    >>> # read first ten records
    -    >>> array = adapter[0:10]
    -
    -    >>> # read last five records
    -    >>> array = adapter[-5:]
    -
    -    >>> # read every other record
    -    >>> array = adapter[::2]
    -
    -    >>> # read first and second fields only
    -    >>> array = adapter[[0,1]][:]
    -
    -    >>> # read fields named 'f2' and 'f4' only
    -    >>> array = adapter[['f2','f4']][:]
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    User Guide

    -
    - -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Reference Guide

    -
    - -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Requirements

    -
      -
    • python 2.6, 2.7, or 3.3+
    • -
    • numpy (>= 1.6)
    • -
    -

    Python modules (optional):

    -
      -
    • boto (>= 2.8)
    • -
    • numba (>= 0.8)
    • -
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Release Notes

    -
    - -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    License Agreement

    -
    - -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -.. toctree:: - :maxdepth: 1 - :hidden: - - install - textadapter_advanced - textadapter_firststeps - pyodbc_firststeps - pyodbc_enhancedcapabilities - pyodbc_cancel - TextAdapter - pyodbc - MongoAdapter - loadtxt - genfromtxt - release-notes - eula diff --git a/docs/1.8.0/install.rst b/docs/1.8.0/install.rst deleted file mode 100644 index bf4932a..0000000 --- a/docs/1.8.0/install.rst +++ /dev/null @@ -1,66 +0,0 @@ -Installation -============ - -<<<<<<< HEAD -***REMOVED*** -======= -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -

    If you do not already have Anaconda installed, please download it via the - downloads page and install it.

    -

    IOPro is included with Anaconda Workgroup and Anaconda Enterprise subscriptions.

    -

    To start a 30-day free trial just download and install the IOPro package.

    -

    If you already have Anaconda - (free Python distribution) installed:

    -
    conda update conda
    -    conda install iopro
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    If you do not have Anaconda installed, you can download it - here.

    -

    IOPro can also be installed into your own (non-Anaconda) Python environment. For more information about IOPro please contact sales@continuum.io.

    -
    -

    IOPro Update Instructions

    -

    If you have Anaconda (free Python distribution) installed, first update - the conda package management tool to the latest version, then use conda - to update the IOPro product installation:

    -
    conda update conda
    -    conda update iopro
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Uninstall

    -

    Uninstall using conda:

    -
    conda remove iopro
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    License Agreement

    -
    - -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/loadtxt.rst b/docs/1.8.0/loadtxt.rst deleted file mode 100644 index 9f72f78..0000000 --- a/docs/1.8.0/loadtxt.rst +++ /dev/null @@ -1,130 +0,0 @@ -<<<<<<< HEAD -***REMOVED***-- -iopro.loadtxt -***REMOVED***-- - -***REMOVED*** -======= -------------- -iopro.loadtxt -------------- - -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -

    Load data from a text file.

    -

    Each row in the text file must have the same number of values.

    -
    -

    Parameters

    -
    -
    fname
    - : file or str
    File, filename, or generator to read. If the filename extension is - .gz or .bz2, the file is first decompressed. Note that - generators should return byte strings for Python 3k.
    -
    dtype
    - : data-type, optional
    Data-type of the resulting array; default: float. If this is a - record data-type, the resulting array will be 1-dimensional, and - each row will be interpreted as an element of the array. In this - case, the number of columns used must match the number of fields in - the data-type.
    -
    comments
    - : str, optional
    The character used to indicate the start of a comment; - default: ‘#’.
    -
    delimiter
    - : str, optional
    The string used to separate values. By default, this is any - whitespace.
    -
    converters
    - : dict, optional
    A dictionary mapping column number to a function that will convert - that column to a float. E.g., if column 0 is a date string: - converters = {0: datestr2num}. Converters can also be used to - provide a default value for missing data (but see also iopro.genfromtxt): - converters = {3: lambda s: float(s.strip() or 0)}. Default: None.
    -
    skiprows
    - : int, optional
    Skip the first skiprows lines; default: 0.
    -
    usecols
    - : sequence, optional
    Which columns to read, with 0 being the first. For example, - usecols = (1,4,5) will extract the 2nd, 5th and 6th columns. - The default, None, results in all columns being read.
    -
    unpack
    - : bool, optional
    If True, the returned array is transposed, so that arguments may be - unpacked using x, y, z = iopro.loadtxt(...). When used with a record - data-type, arrays are returned for each field. Default is False.
    -
    ndmin
    - : int, optional
    The returned array will have at least ndmin dimensions. - Otherwise mono-dimensional axes will be squeezed. - Legal values: 0 (default), 1 or 2. - .. versionadded:: 1.6.0
    -
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Returns

    -
    -
    out
    - : ndarray
    Data read from the text file.
    -
    -<<<<<<< HEAD -***REMOVED*** -
    -

    See Also

    -

    iopro.genfromtxt : Load data with missing values handled as specified.

    -***REMOVED*** -======= -
    -
    -

    See Also

    -

    iopro.genfromtxt : Load data with missing values handled as specified.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Examples

    -
    -
    simple parse of StringIO object data
    -
    >>> import iopro
    -    >>> from io import StringIO   # StringIO behaves like a file object
    -    >>> c = StringIO("0 1\\n2 3")
    -    >>> iopro.loadtxt(c)
    -    >>> array([[ 0.,  1.],
    -           [ 2.,  3.]])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    set dtype of output array
    -
    >>> d = StringIO("M 21 72\\nF 35 58")
    -    >>> iopro.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'),
    -    ...                      'formats': ('S1', 'i4', 'f4')})
    -    >>> array([('M', 21, 72.0), ('F', 35, 58.0)],
    -          dtype=[('gender', '|S1'), ('age', '<i4'), ('weight', '<f4')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -
    set delimiter and columns to parse
    -
    >>> c = StringIO("1,0,2\\n3,0,4")
    -    >>> x, y = iopro.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True)
    -    >>> x
    -    >>> array([ 1.,  3.])
    -    >>> y
    -    >>> array([ 2.,  4.])
    -    
    -<<<<<<< HEAD -***REMOVED*** -
    -
    -***REMOVED*** -======= -
    - - -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/pyodbc.rst b/docs/1.8.0/pyodbc.rst deleted file mode 100644 index 72ca727..0000000 --- a/docs/1.8.0/pyodbc.rst +++ /dev/null @@ -1,179 +0,0 @@ -<<<<<<< HEAD -***REMOVED***- -iopro.pyodbc -***REMOVED***- - -***REMOVED*** -======= ------------- -iopro.pyodbc ------------- - -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -

    This project is an enhancement of the Python database module for ODBC - that implements the Python DB API 2.0 specification. You can see the - original project here:

    - - - - - - - - - - - -<<<<<<< HEAD -***REMOVED*** -======= -
    homepage:http://code.google.com/p/pyodbc
    source:http://github.com/mkleehammer/pyodbc
    source:http://code.google.com/p/pyodbc/source/list
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    The enhancements are documented in this file. For general info about - the pyodbc package, please refer to the original project - documentation.

    -

    This module enhancement requires:

    -
      -
    • Python 2.4 or greater
    • -
    • ODBC 3.0 or greater
    • -
    • NumPy 1.5 or greater (1.7 is required for datetime64 support)
    • -
    -

    The enhancements in this module consist mainly in the addition of some - new methods for fetching the data after a query and put it in a - variety of NumPy containers.

    -

    Using NumPy as data containers instead of the classical list of tuples - has a couple of advantages:

    -

    1) The NumPy container is much more compact, and hence, it - requires much less memory, than the original approach.

    -

    2) As a NumPy container can hold arbitrarily large arrays, it requires - much less object creation than the original approach (one Python - object per datum retrieved).

    -

    This means that this enhancements will allow to fetch data out of - relational databases in a much faster way, while consuming - significantly less resources.

    -
    -

    API additions

    -
    -

    Variables

    -
      -
    • pyodbc.npversion The version for the NumPy additions
    • -
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Methods

    -

    Cursor.fetchdictarray (size=cursor.arraysize)

    -

    This is similar to the original Cursor.fetchmany(size), but the data - is returned in a dictionary where the keys are the names of the - columns and the values are NumPy containers.

    -

    For example, it a SELECT is returning 3 columns with names ‘a’, ‘b’ - and ‘c’ and types varchar(10), integer and timestamp, the - returned object will be something similar to:

    -
    {'a': array([...], dtype='S11'),
    -     'b': array([...], dtype=int32),
    -     'c': array([...], dtype=datetime64[us])}
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Note that the varchar(10) type is translated automatically to a - string type of 11 elements (‘S11’). This is because the ODBC driver - needs one additional space to put the trailing ‘0’ in strings, and - NumPy needs to provide the room for this.

    -

    Also, it is important to stress that all the timestamp types are - translated into a NumPy datetime64 type with a resolution of - microseconds by default.

    -

    Cursor.fetchsarray (size=cursor.arraysize)

    -

    This is similar to the original Cursor.fetchmany(size), but the data - is returned in a NumPy structured array, where the name and type of - the fields matches to those resulting from the SELECT.

    -

    Here it is an example of the output for the SELECT above:

    -
    array([(...),
    -           (...)],
    -          dtype=[('a', '|S11'), ('b', '<i4'), ('c', ('<M8[us]', {}))])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Note that, due to efficiency considerations, this method is calling the - fetchdictarray() behind the scenes, and then doing a conversion to - get an structured array. So, in general, this is a bit slower than - its fetchdictarray() counterpart.

    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Data types supported

    -

    The new methods listed above have support for a subset of the standard - ODBC. In particular:

    -
      -
    • String support (SQL_VARCHAR) is supported.
    • -
    • Numerical types, be them integers or floats (single and double - precision) are fully supported. Here it is the complete list: - SQL_INTEGER, SQL_TINYINT, SQL_SMALLINT, SQL_FLOAT and SQL_DOUBLE.
    • -
    • Dates, times, and timestamps are mapped to the datetime64 and - timedelta NumPy types. The list of supported data types are: - SQL_DATE, SQL_TIME and SQL_TIMESTAMP,
    • -
    • Binary data is not supported yet.
    • -
    • Unicode strings are not supported yet.
    • -
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    NULL values

    -

    As there is not (yet) a definitive support for missing values (NA) in - NumPy, this module represents NA data as particular values depending - on the data type. Here it is the current table of the particular - values:

    -
    int8: -128 (-2**7)
    -    uint8: 255 (2**8-1)
    -    int16: -32768 (-2**15)
    -    uint16: 65535 (2**16-1)
    -    int32: -2147483648 (-2**31)
    -    uint32: 4294967295 (2**32-1)
    -    int64: -9223372036854775808 (-2**63)
    -    uint64: 18446744073709551615 (2**64-1)
    -    float32: NaN
    -    float64: NaN
    -    datetime64: NaT
    -    timedelta64: NaT (or -2**63)
    -    string: 'NA'
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Improvements for 1.1 release

    -
      -
    • The rowcount is not trusted anymore for the fetchdict() and - fetchsarray() methods. Now the NumPy containers are built - incrementally, using realloc for a better use of resources.
    • -
    • The Python interpreter does not exit anymore when fetching an exotic - datatype not supported by NumPy.
    • -
    • The docsctrings for fetchdict() and fetchsarray() have been improved.
    • -
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/pyodbc_cancel.rst b/docs/1.8.0/pyodbc_cancel.rst deleted file mode 100644 index 31db7d8..0000000 --- a/docs/1.8.0/pyodbc_cancel.rst +++ /dev/null @@ -1,92 +0,0 @@ -================================= - iopro.pyodbc Cancelling Queries -================================= - -<<<<<<< HEAD -***REMOVED*** -======= -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -

    Starting with version 1.5, the pyodbc submodule of IOPro makes it - possible to cancel operations. This is done by exposing the SQLCancel - ODBC function as a cancel method in the Cursor object.

    -
    -

    A Simple Example

    -

    A very simple example would be:

    -
    conn = iopro.pyodbc.connect(conn_str)
    -    cursor = conn.cursor()
    -    cursor.execute('SELECT something FROM sample_table')
    -    result = cursor.fetchone()
    -    cursor.cancel()
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    This is not very interesting, and it doesn’t add much to the - functionality of pyodbc.

    -

    What makes the cancel method more interesting is that it is possible - to cancel running statements that are blocking another thread.

    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    A Sample With Threading

    -

    Having access to the cancel method it is possible to stop running - queries following different criteria. For example, it would be - possible to execute queries with a time-out. If the time runs out, the - query gets cancelled.

    -
    import iopro.pyodbc
    -    import time
    -    import threading
    -
    -    def query_with_time_out(conn, query, timeout):
    -        def watchdog(cursor, time_out):
    -            time.sleep(wait_time)
    -            cursor.cancel()
    -
    -        cursor = conn.cursor()
    -
    -        t = threading.Thread(target=watchdog, args=(cursor, timeout))
    -        t.start()
    -        try:
    -            cursor.execute(query)
    -
    -            result = cursor.fetchall()
    -        except iopro.pyodbc.Error:
    -            result = 'timed out'
    -
    -        return result
    -    
    -<<<<<<< HEAD -***REMOVED*** -

    This is just one possibility. As cursor exposes directly the - SQLCancel, many oportunities open in implementing policies to cancel - running queries.

    -***REMOVED*** -======= -
    -

    This is just one possibility. As cursor exposes directly the - SQLCancel, many oportunities open in implementing policies to cancel - running queries.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Finishing notes

    -

    In order for this to work, the underlying ODBC driver must support - SQLCancel.

    -

    The pyodbc submodule of IOPro releases the Python GIL when it calls - ODBC, so while queries are being executed other Python threads - continue to execute while the thread that performed the query is - blocked. This allows for cancel to be called by another - thread. Coupled with threading, the cancel method is a very useful - primitive.

    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/pyodbc_enhancedcapabilities.rst b/docs/1.8.0/pyodbc_enhancedcapabilities.rst deleted file mode 100644 index 32dcfde..0000000 --- a/docs/1.8.0/pyodbc_enhancedcapabilities.rst +++ /dev/null @@ -1,153 +0,0 @@ -<<<<<<< HEAD -***REMOVED******REMOVED*** -iopro.pyodbc Enhanced Capabilities -***REMOVED******REMOVED*** - -***REMOVED*** -======= ----------------------------------- -iopro.pyodbc Enhanced Capabilities ----------------------------------- - -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -
    -

    Demo code showing the enhanced capabilities of iopro.pyodbc submodule

    -

    This demo shows the basic capabilities for the iopro.pyodbc module. It first will connect with the database of your choice by ODBC, create and fill a new table (market) and then retrieve data with different methods (fetchall(), fetchdictarray() and fetchsarray()).

    -

    Author: Francesc Alted, Continuum Analytics

    -
    >>> import iopro.pyodbc as pyodbc
    -    >>> # Open the database (use the most appropriate for you)
    -    >>> connect_string = 'DSN=odbcsqlite;DATABASE=market.sqlite'  # SQLite
    -    >>> #connect_string = 'Driver={SQL Server};SERVER=MyWinBox;DATABASE=Test;USER=Devel;PWD=XXX'  # SQL Server
    -    >>> #connect_string = 'DSN=myodbc3;UID=devel;PWD=XXX;DATABASE=test'  # MySQL
    -    >>> #connect_string = 'DSN=PSQL;UID=devel;PWD=XXX;DATABASE=test'   # PostgreSQL
    -    >>> connection = pyodbc.connect(connect_string)
    -    >>> cursor = connection.cursor()
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Create the test table (optional if already done)

    -
    >>> try:
    -    ...     cursor.execute('drop table market')
    -    ... except:
    -    ...     pass
    -    >>> cursor.execute('create table market (symbol_ varchar(5), open_ float, low_ float, high_ float, close_ float, volume_ int)')
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Fill the test table (optional if already done)

    -
    >>> from time import time
    -    >>> t0 = time()
    -    >>> N = 1000*1000
    -    >>> for i in xrange(N):
    -    ...     cursor.execute(
    -    ...         "insert into market(symbol_, open_, low_, high_, close_, volume_)"
    -    ...         " values (?, ?, ?, ?, ?, ?)",
    -    ...         (str(i), float(i), float(2*i), None, float(4*i), i))
    -    >>> cursor.execute("commit")             # not supported by SQLite
    -    >>> t1 = time() - t0
    -    >>> print "Stored %d rows in %.3fs" % (N, t1)
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Do the query in the traditional way

    -
    >>> # Query of the full table using the traditional fetchall
    -    >>> query = "select * from market"
    -    >>> cursor.execute(query)
    -    >>> %time all = cursor.fetchall()
    -    CPU times: user 5.23 s, sys: 0.56 s, total: 5.79 s
    -    Wall time: 7.09 s
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Do the query and get a dictionary of NumPy arrays

    -
    >>> # Query of the full table using the fetchdictarray (retrieve a dictionary of arrays)
    -    >>> cursor.execute(query)
    -    >>> %time dictarray = cursor.fetchdictarray()
    -    CPU times: user 0.92 s, sys: 0.10 s, total: 1.02 s
    -    Wall time: 1.44 s
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Peek into the retrieved data

    -
    >>> dictarray.keys()
    -    ['high_', 'close_', 'open_', 'low_', 'volume_', 'symbol_']
    -    >>> dictarray['high_']
    -    array([ nan,  nan,  nan, ...,  nan,  nan,  nan])
    -    >>> dictarray['symbol_']
    -    array(['0', '1', '2', ..., '99999', '99999', '99999'], dtype='|S6')
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Do the query and get a NumPy structured array

    -
    >>> # Query of the full table using the fetchsarray (retrieve a structured array)
    -    >>> cursor.execute(query)
    -    >>> %time sarray = cursor.fetchsarray()
    -    CPU times: user 1.08 s, sys: 0.11 s, total: 1.20 s
    -    Wall time: 1.99 s
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Peek into retrieved data

    -
    >>> sarray.dtype
    -    dtype([('symbol_', 'S6'), ('open_', '&lt;f8'), ('low_', '&lt;f8'), ('high_', '&lt;f8'), ('close_', '&lt;f8'), ('volume_', '&lt;i4')])
    -    >>> sarray[0:10]
    -    array([('0', 0.0, 0.0, nan, 0.0, 0), ('1', 1.0, 2.0, nan, 4.0, 1),
    -           ('2', 2.0, 4.0, nan, 8.0, 2), ('3', 3.0, 6.0, nan, 12.0, 3),
    -           ('4', 4.0, 8.0, nan, 16.0, 4), ('5', 5.0, 10.0, nan, 20.0, 5),
    -           ('6', 6.0, 12.0, nan, 24.0, 6), ('7', 7.0, 14.0, nan, 28.0, 7),
    -           ('8', 8.0, 16.0, nan, 32.0, 8), ('9', 9.0, 18.0, nan, 36.0, 9)],
    -          dtype=[('symbol_', 'S6'), ('open_', '&lt;f8'), ('low_', '&lt;f8'), ('high_', '&lt;f8'), ('close_', '&lt;f8'), ('volume_', '&lt;i4')])
    -    >>> sarray['symbol_']
    -    array(['0', '1', '2', ..., '99999', '99999', '99999'], dtype='|S6')
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/pyodbc_firststeps.rst b/docs/1.8.0/pyodbc_firststeps.rst deleted file mode 100644 index f3a57e5..0000000 --- a/docs/1.8.0/pyodbc_firststeps.rst +++ /dev/null @@ -1,397 +0,0 @@ -<<<<<<< HEAD -***REMOVED***-- -iopro.pyodbc First Steps -***REMOVED***-- - -***REMOVED*** -======= -------------------------- -iopro.pyodbc First Steps -------------------------- - -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -

    iopro.pyodbc extends pyodbc with methods that allow data to be fetched directly into numpy containers. These functions are faster than regular fetch calls in pyodbc, providing also the convenience of being returned in a container appropriate to fast analysis.

    -

    This notebook is intended to be a tutorial on iopro.pyodbc. Most of the material is applicable to pyodbc (and based on pyodbc tutorials). There will be some examples specific to iopro.pyodbc. When that’s the case, it will be noted.

    -
    -

    Concepts

    -
    -
    In pyodbc there are two main classes to understand:
    -
      -
    • connection
    • -
    • cursor
    • -
    -
    -
    -

    A connection is, as its name says, a connection to a datasource. A datasource is your database. It may be a database handled by a DBMS or just a plain file. - A cursor allows you to interface with statements. Interaction with queries and other commands is performed through a cursor. A cursor is associated to a connection and commands over a cursor are performed over that connection to the datasource. - In order to use iopro.pyodbc you must import it:

    -
    >>> import iopro.pyodbc as pyodbc
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Connection to a datasource

    -

    In order to operate with pyodbc you need to connect to a datasource. Typically this will be a database. This is done by creating a connection object. - To create a connection object you need a connection string. This string describes the datasource to use as well as some extra parameters. You can learn more about connection strings here.:

    -
    >>> connection_string = '''DSN=SQLServerTest;DATABASE=Test'''
    -    >>> connection = pyodbc.connect(connection_string)
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    pyodbc.connect supports a keyword parameter autocommit. This controls the way the connection is handle. The default value (False) means that the commands that modify the database statements need to be committed explicitly. All commands between commits will form a single transaction. If autocommit is enabled every command will be issued and committed. - It is also possible to change autocommit status after the connection is established.:

    -
    >>> connection.autocommit = True #enable autocommit
    -    >>> connection.autocommit = False # disable autocommit
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    When not in autocommit mode, you can end a transaction by either commiting it or rolling it back.:

    -
    In[6]: connection.commit() # commit the transaction
    -    In[7]: connection.rollback() # rollback the transaction
    -    
    -<<<<<<< HEAD -***REMOVED*** -

    Note that commit/rollback is always performed at the connection level. pyodbc provides a commit/rollback method in the cursor objects, but they will act on the associated connection.

    -***REMOVED*** -======= -
    -

    Note that commit/rollback is always performed at the connection level. pyodbc provides a commit/rollback method in the cursor objects, but they will act on the associated connection.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Working with cursors

    -

    Command execution in pyodbc is handled through cursors. You can create a cursor from a connection using the cursor() method. The first step is creating a cursor:

    -
    In[8]: cursor = connection.cursor()
    -    
    -<<<<<<< HEAD -***REMOVED*** -

    With a cursor created, we can start issuing SQL commands using the execute method.

    -***REMOVED*** -======= -
    -

    With a cursor created, we can start issuing SQL commands using the execute method.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Creating a sample table

    -

    First, create a sample table in the database. The following code will create a sample table with three columns of different types.:

    -
    >>> def create_test_table(cursor):
    -    ...    try:
    -    ...        cursor.execute('drop table test_table')
    -    ...    except:
    -    ...        pass
    -    ...    cursor.execute('''create table test_table (
    -    ...                                    name varchar(10),
    -    ...                                    fval float(24),
    -    ...                                    ival int)''')
    -    ...    cursor.commit()
    -
    -    >>> create_test_table(cursor)
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Filling the sample table with sample data

    -

    After creating the table, rows can be inserted by executing insert into the table. Note you can pass parameters by placing a ? into the SQL statement. The parameters will be taken in order for the sequence appears in the next parameter.:

    -
    >>> cursor.execute('''insert into test_table values (?,?,?)''', ('foo', 3.0, 2))
    -    >>> cursor.rowcount
    -    1
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Using executemany a sequence of parameters to the SQL statement can be passed and the statement will be executed many times, each time with a different parameter set. This allows us to easily insert several rows into the database so that we have a small test set::

    -
    >>> cursor.executemany('''insert into test_table values (?,?,?)''', [
    -    ...                        ('several', 2.1, 3),
    -    ...                        ('tuples', -1.0, 2),
    -    ...                        ('can', 3.0, 1),
    -    ...                        ('be', 12.0, -3),
    -    ...                        ('inserted', 0.0, -2),
    -    ...                        ('at', 33.0, 0),
    -    ...                        ('once', 0.0, 0)
    -    ...                        ])
    -    
    -<<<<<<< HEAD -***REMOVED*** -

    Remember that if autocommit is turned off the changes won’t be visible to any other connection unless we commit.:

    -
    >>> cursor.commit() # remember this is a shortcut to connection.commit() method
    -    
    -***REMOVED*** -***REMOVED*** -======= -
    -

    Remember that if autocommit is turned off the changes won’t be visible to any other connection unless we commit.:

    -
    >>> cursor.commit() # remember this is a shortcut to connection.commit() method
    -    
    -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Querying the sample data from the sample table

    -

    Having populated our sample database, we can retrieve the inserted data by executing select statements::

    -
    >>> cursor.execute('''select * from test_table''')
    -    <pyodbc.Cursor at 0x6803510>
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    After calling execute with the select statement we need to retrieve the data. This can be achieved by calling fetch methods in the cursor - fetchone fetches the next row in the cursor, returning it in a tuple:

    -
    >>> cursor.fetchone()
    -    ('foo', 3.0, 2)
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    fetchmany retrieves several rows at a time in a list of tuples:

    -
    >>> cursor.fetchmany(3)
    -    [('several', 2.0999999046325684, 3), ('tuples', -1.0, 2), ('can', 3.0, 1)]
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    fetchall retrieves all the remaining rows in a list of tuples:

    -
    >>> cursor.fetchall()
    -    [('be', 12.0, -3), ('inserted', 0.0, -2), ('at', 33.0, 0), ('once', 0.0, 0)]
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    All the calls to any kind of fetch advances the cursor, so the next fetch starts in the row after the last row fetched. - execute returns the cursor object. This is handy to retrieve the full query by chaining fetchall. This results in a one-liner::

    -
    >>> cursor.execute('''select * from test_table''').fetchall()
    -    [('foo', 3.0, 2),
    -     ('several', 2.0999999046325684, 3),
    -     ('tuples', -1.0, 2),
    -     ('can', 3.0, 1),
    -     ('be', 12.0, -3),
    -     ('inserted', 0.0, -2),
    -     ('at', 33.0, 0),
    -     ('once', 0.0, 0)]
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -
    -

    iopro.pyodbc extensions

    -

    When using iopro.pyodbc it is possible to retrieve the results from queries directly into numpy containers. This is accomplished by using the new cursor methods fetchdictarray and fetchsarray.

    -***REMOVED*** -======= -
    -
    -
    -

    iopro.pyodbc extensions

    -

    When using iopro.pyodbc it is possible to retrieve the results from queries directly into numpy containers. This is accomplished by using the new cursor methods fetchdictarray and fetchsarray.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    fetchdictarray

    -

    fetchdictarray fetches the results of a query in a dictionary. By default fetchdictarray fetches all remaining rows in the cursor.:

    -
    >>> cursor.execute('''select * from test_table''')
    -    >>> dictarray = cursor.fetchdictarray()
    -    >>> type(dictarray)
    -    dict
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    The keys in the dictionary are the column names::

    -
    >>> dictarray.keys()
    -    ['ival', 'name', 'fval']
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Each column name is mapped to a numpy array (ndarray) as its value::

    -
    >>> ', '.join([type(dictarray[i]).__name__ for i in dictarray.keys()])
    -    'ndarray, ndarray, ndarray'
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    The types of the numpy arrays are infered from the database column information. So for our columns we get an appropriate numpy type. Note that in the case of name the type is a string of 11 characters even if in test_table is defined as varchar(10). The extra parameter is there to null-terminate the string::

    -
    >>> ', '.join([repr(dictarray[i].dtype) for i in dictarray.keys()])
    -    "dtype('int32'), dtype('|S11'), dtype('float32')"
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    The numpy arrays will have a shape containing a single dimension with the number of rows fetched::

    -
    >>> ', '.join([repr(dictarray[i].shape) for i in dictarray.keys()])
    -    '(8L,), (8L,), (8L,)'
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    The values in the different column arrays are index coherent. So in order to get the values associated to a given row it suffices to access each column using the appropriate index. The following snippet shows this correspondence::

    -
    >>> print '\n'.join(
    -    ... [', '.join(
    -    ...     [repr(dictarray[i][j]) for i in dictarray.keys()])
    -    ...         for j in range(dictarray['name'].shape[0])])
    -    2, 'foo', 3.0
    -    3, 'several', 2.0999999
    -    2, 'tuples', -1.0
    -    1, 'can', 3.0
    -    -3, 'be', 12.0
    -    -2, 'inserted', 0.0
    -    0, 'at', 33.0
    -    0, 'once', 0.0
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Having the results in numpy containers makes it easy to use numpy to analyze the data::

    -
    >>> import numpy as np
    -    >>> np.mean(dictarray['fval'])
    -    6.5124998092651367
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    fetchdictarray accepts an optional parameter that places an upper bound to the number of rows to fetch. If there are not enough elements left to be fetched in the cursor the arrays resulting will be sized accordingly. This way it is possible to work with big tables in chunks of rows.:

    -
    >>> cursor.execute('''select * from test_table''')
    -    >>> dictarray = cursor.fetchdictarray(6)
    -    >>> print dictarray['name'].shape
    -    (6L,)
    -    >>> dictarray = cursor.fetchdictarray(6)
    -    >>> print dictarray['name'].shape
    -    (2L,)
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    fetchsarray

    -

    fetchsarray fetches the result of a query in a numpy structured array.:

    -
    >>> cursor.execute('''select * from test_table''')
    -    >>> sarray = cursor.fetchsarray()
    -    >>> print sarray
    -    [('foo', 3.0, 2) ('several', 2.0999999046325684, 3) ('tuples', -1.0, 2)
    -     ('can', 3.0, 1) ('be', 12.0, -3) ('inserted', 0.0, -2) ('at', 33.0, 0)
    -     ('once', 0.0, 0)]
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    The type of the result is a numpy array (ndarray)::

    -
    >>> type(sarray)
    -    numpy.ndarray
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    The dtype of the numpy array contains the description of the columns and their types::

    -
    >>> sarray.dtype
    -    dtype([('name', '|S11'), ('fval', '&lt;f4'), ('ival', '&lt;i4')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    The shape of the array will be one-dimensional, with cardinality equal to the number of rows fetched::

    -
    >>> sarray.shape
    -    (8L,)
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    It is also possible to get the shape of a column. In this way it will look similar to the code needed when using dictarrays:

    -
    >>> sarray['name'].shape
    -    (8L,)
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    In a structured array it is as easy to access data by row or by column::

    -
    >>> sarray['name']
    -    array(['foo', 'several', 'tuples', 'can', 'be', 'inserted', 'at', 'once'],
    -          dtype='|S11')
    -
    -
    -
    -
    -
    -
    -
    -    >>> sarray[0]
    -    ('foo', 3.0, 2)
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    It is also very easy and efficient to feed data into numpy functions::

    -
    >>> np.mean(sarray['fval'])
    -    6.5124998092651367
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -
    -

    fetchdictarray vs fetchsarray

    -

    Both methods provide ways to input data from a database into a numpy-friendly container. The structured array version provides more flexibility extracting rows in an easier way. The main difference is in the memory layout of the resulting object. An in-depth analysis of this is beyond the scope of this notebook. Suffice it to say that you can view the dictarray laid out in memory as an structure of arrays (in fact, a dictionary or arrays), while the structured array would be laid out in memory like an array of structures. This can make a lot of difference performance-wise when working with large chunks of data.

    -***REMOVED*** -======= -
    -
    -
    -

    fetchdictarray vs fetchsarray

    -

    Both methods provide ways to input data from a database into a numpy-friendly container. The structured array version provides more flexibility extracting rows in an easier way. The main difference is in the memory layout of the resulting object. An in-depth analysis of this is beyond the scope of this notebook. Suffice it to say that you can view the dictarray laid out in memory as an structure of arrays (in fact, a dictionary or arrays), while the structured array would be laid out in memory like an array of structures. This can make a lot of difference performance-wise when working with large chunks of data.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/release-notes.rst b/docs/1.8.0/release-notes.rst deleted file mode 100644 index 59063e8..0000000 --- a/docs/1.8.0/release-notes.rst +++ /dev/null @@ -1,428 +0,0 @@ -IOPro Release Notes -=================== - -<<<<<<< HEAD -***REMOVED*** -======= -.. raw:: html ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -
    -

    2016-04-05: 1.8.0:

    -
    -<<<<<<< HEAD -***REMOVED***
      -
    • Add PostgresAdapter for reading data from PostgreSQL databases
    • -
    • Add AccumuloAdapter for reading data from Accumulo databases
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2015-10-09: 1.7.2:

    -
    -***REMOVED***
      -======= -
        -
      • Add PostgresAdapter for reading data from PostgreSQL databases
      • -
      • Add AccumuloAdapter for reading data from Accumulo databases
      • -
      -
    -
    -
    -

    2015-10-09: 1.7.2:

    -
    -
      ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    • Fix an issue with pyodbc where result NumPy arrays could return - uninitialized data after the actual data null character. Now it pads - the results with nulls.
    • -
    -<<<<<<< HEAD -***REMOVED***
    -***REMOVED*** -
    -

    2015-05-04: 1.7.1

    -
    -***REMOVED***
      -
    • Properly cache output string objects for better performance
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2015-03-02: 1.7.0

    -
    -***REMOVED***
      -======= -
    -
    -
    -

    2015-05-04: 1.7.1

    -
    -
      -
    • Properly cache output string objects for better performance
    • -
    -
    -
    -
    -

    2015-03-02: 1.7.0

    -
    -
      ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    • Add Python 3 support
    • -
    • Add support for parsing utf8 text files
    • -
    • Add ability to set/get field types in MongoAdapter
    • -
    -<<<<<<< HEAD -***REMOVED***
    -***REMOVED*** -
    -

    2015-02-02: 1.6.11

    -
    -***REMOVED***
      -
    • Fix issue with escape char not being parsed correctly inside quoted strings
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2014-12-17: 1.6.10

    -
    -***REMOVED***
      -
    • Fix issue with using field filters with json parser
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2014-12-02: 1.6.9

    -
    -***REMOVED***
      -
    • Fix issue with json field names getting mixed up
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2014-11-20: 1.6.8

    -
    -***REMOVED***
      -======= -
    -
    -
    -

    2015-02-02: 1.6.11

    -
    -
      -
    • Fix issue with escape char not being parsed correctly inside quoted strings
    • -
    -
    -
    -
    -

    2014-12-17: 1.6.10

    -
    -
      -
    • Fix issue with using field filters with json parser
    • -
    -
    -
    -
    -

    2014-12-02: 1.6.9

    -
    -
      -
    • Fix issue with json field names getting mixed up
    • -
    -
    -
    -
    -

    2014-11-20: 1.6.8

    -
    -
      ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    • Fix issue with return nulls returning wrong “null” for large queries - (more than 10000 rows) in some circumpstances.
    • -
    • Fix issue with reading slices of json data
    • -
    • Change json parser so that strings fields of numbers do not get converted - to number type by default
    • -
    • Allow json field names to be specified with field_names constructor - argument
    • -
    • If user does not specify json field names, use json attribute names as - field names in array result
    • -
    -<<<<<<< HEAD -***REMOVED***
    -***REMOVED*** -
    -

    2014-07-03: 1.6.7

    -
    -***REMOVED***
      -
    • Fix issue when reading more than 10000 rows containing unicode strings in platfrom where ODBC uses UTF-16/UCS2 encoding (notably Windows and unixODBC). The resulting data could be corrupt.
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2014-06-16: 1.6.6

    -
    -***REMOVED***
      -======= -
    -
    -
    -

    2014-07-03: 1.6.7

    -
    -
      -
    • Fix issue when reading more than 10000 rows containing unicode strings in platfrom where ODBC uses UTF-16/UCS2 encoding (notably Windows and unixODBC). The resulting data could be corrupt.
    • -
    -
    -
    -
    -

    2014-06-16: 1.6.6

    -
    -
      ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    • Fix possible segfault when dealing with unicode strings in platforms where ODBC uses UTF-16/UCS2 encoding (notably Windows and unixODBC)
    • -
    • Add iopro_set_text_limit function to iopro. It globally limits the size of text fields read by fetchdictarray and fetchsarray. By default it is set to 1024 characters.
    • -
    • Fix possible segfault in fetchdictarray and fetchsarray when failing to allocate some NumPy array. This could notably happen in the presence of “TEXT” fields. Now it will raise an OutOfMemory error.
    • -
    • Add lazy loading of submodules in IOPro. This reduces upfront import time of IOPro. Features are imported as they are used for the first time.
    • -
    -<<<<<<< HEAD -***REMOVED***
    -***REMOVED*** -
    -

    2014-05-07: 1.6.5

    -
    -***REMOVED***
      -
    • Fix crash when building textadapter index
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2014-04-29: 1.6.4

    -
    -***REMOVED***
      -
    • Fix default value for null strings in IOPro/pyodbc changed to be an empty string instead of ‘NA’. NA was not appropriate as it can collide with valid data (Namibia country code is ‘NA’, for example), and it failed with single character columns.
    • -
    • Ignore SQlRowCount when performing queries with fetchsarray and fetchdictarray, since SQLRowCount sometimes returns incorrect number of rows.
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2014-03-25: 1.6.3

    -
    -***REMOVED***
      -
    • Fix SQL TINYINT is now returned as an unsigned 8 bit integer in fetchdictarray/fetchsarray. This is to match the range specified in SQL (0...255). It was being returned as a signed 8 bit integer before (range -128...127)
    • -
    • Add Preliminary unicode string support in fetchdictarray/fetchsarray.
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2014-02-12: 1.6.2

    -
    -***REMOVED***
      -
    • Disable Numba support for version 0.12 due to lack of string support.
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2014-01-30: 1.6.1

    -
    -***REMOVED***
      -======= -
    -
    -
    -

    2014-05-07: 1.6.5

    -
    -
      -
    • Fix crash when building textadapter index
    • -
    -
    -
    -
    -

    2014-04-29: 1.6.4

    -
    -
      -
    • Fix default value for null strings in IOPro/pyodbc changed to be an empty string instead of ‘NA’. NA was not appropriate as it can collide with valid data (Namibia country code is ‘NA’, for example), and it failed with single character columns.
    • -
    • Ignore SQlRowCount when performing queries with fetchsarray and fetchdictarray, since SQLRowCount sometimes returns incorrect number of rows.
    • -
    -
    -
    -
    -

    2014-03-25: 1.6.3

    -
    -
      -
    • Fix SQL TINYINT is now returned as an unsigned 8 bit integer in fetchdictarray/fetchsarray. This is to match the range specified in SQL (0...255). It was being returned as a signed 8 bit integer before (range -128...127)
    • -
    • Add Preliminary unicode string support in fetchdictarray/fetchsarray.
    • -
    -
    -
    -
    -

    2014-02-12: 1.6.2

    -
    -
      -
    • Disable Numba support for version 0.12 due to lack of string support.
    • -
    -
    -
    -
    -

    2014-01-30: 1.6.1

    -
    -
      ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    • Fix a regression that made possible some garbage in string fields when using fetchdictarray/fetchsarray.
    • -
    • Fix a problem where heap corruption could happen in IOPro.pyodbc fetchdictarray/fetchsarray related to nullable string fields.
    • -
    • Fix the allocation guard debugging code: iopro.pyodbc.enable_mem_guards(True|False) should no longer crash.
    • -
    • Merge Vertica fix for cancelling queries
    • -
    -<<<<<<< HEAD -***REMOVED***
    -***REMOVED*** -
    -

    2013-10-30: 1.6.0

    -
    -***REMOVED***
      -======= -
    -
    -
    -

    2013-10-30: 1.6.0

    -
    -
      ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    • Add JSON support
    • -
    • Misc bug fixes
    • -
    • Fix crash in IOPro.pyodbc when dealing with nullable datetimes in fetch_dictarray and fetch_sarray.
    • -
    -<<<<<<< HEAD -***REMOVED***
    -***REMOVED*** -
    -

    2013-06-12: 1.5.5

    -
    -***REMOVED***
      -
    • Fix issue parsing negative ints with leading whitespace in csv data.
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2013-06-10: 1.5.4

    -
    -***REMOVED***
      -======= -
    -
    -
    -

    2013-06-12: 1.5.5

    -
    -
      -
    • Fix issue parsing negative ints with leading whitespace in csv data.
    • -
    -
    -
    -
    -

    2013-06-10: 1.5.4

    -
    -
      ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    • Allow delimiter to be set to None for csv files with single field.
    • -
    • Fill in missing csv fields with fill values.
    • -
    • Fill in blank csv lines with fill values for pandas dataframe output.
    • -
    • Allow list of field names for TextAdapter field_names parameter.
    • -
    • Change default missing fill value to empty string for string fields.
    • -
    -<<<<<<< HEAD -***REMOVED***
    -***REMOVED*** -
    -

    2013-06-05: 1.5.3

    -
    -***REMOVED***
      -
    • Temporary fix for IndexError exception in TextAdapter.__read_slice method.
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2013-05-28: 1.5.2

    -
    -***REMOVED***
      -
    • Add ability to specify escape character in csv data
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2013-05-23: 1.5.1

    -
    -***REMOVED***
      -
    • fixed coredump when using datetime with numpy < 1.7
    • -
    -***REMOVED***
    -***REMOVED*** -
    -

    2013-05-22: 1.5.0

    -
    -***REMOVED***
      -======= -
    -
    -
    -

    2013-06-05: 1.5.3

    -
    -
      -
    • Temporary fix for IndexError exception in TextAdapter.__read_slice method.
    • -
    -
    -
    -
    -

    2013-05-28: 1.5.2

    -
    -
      -
    • Add ability to specify escape character in csv data
    • -
    -
    -
    -
    -

    2013-05-23: 1.5.1

    -
    -
      -
    • fixed coredump when using datetime with numpy < 1.7
    • -
    -
    -
    -
    -

    2013-05-22: 1.5.0

    -
    -
      ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    • Added a cancel method to the Cursor object in iopro.pyodbc. - This method wraps ODBC SQLCancel.
    • -
    • DECIMAL and NUMERIC types are now working on iopro.pyodbc on regular fetch - functions. They are still unsupported in fetchsarray and fetchdict and - fetchsarray
    • -
    • Add ftp support
    • -
    • Performance improvements to S3 support
    • -
    • Misc bug fixes
    • -
    -<<<<<<< HEAD -***REMOVED***
    -***REMOVED*** -
    -

    2013-04-05: 1.4.3

    -
    -***REMOVED***
      -======= -
    -
    -
    -

    2013-04-05: 1.4.3

    -
    -
      ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    • Update loadtxt and genfromtxt to reflect numpy versions’ behavior - for dealing with whitespace (default to any whitespace as delimiter, - and treat multiple whitespace as one delimiter)
    • -
    • Add read/write field_names property
    • -
    • Add support for pandas dataframes as output
    • -
    • Misc bug fixes
    • -
    -<<<<<<< HEAD -***REMOVED***
    -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/textadapter_advanced.rst b/docs/1.8.0/textadapter_advanced.rst deleted file mode 100644 index 141bfd0..0000000 --- a/docs/1.8.0/textadapter_advanced.rst +++ /dev/null @@ -1,198 +0,0 @@ -<<<<<<< HEAD -***REMOVED*** -==================== - -***REMOVED*** - -
    -

    ***REMOVED***

    -======= -Advanced TextAdapter -==================== - -.. raw:: html - -
    -

    Gzip Support

    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    IOPro can decompress gzip data on the fly, like so:

    -
    >>> adapter = iopro.text_adapter('data.gz', compression='gzip')
    -    >>> array = adapter[:]
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Aside from the obvious advantage of being able to store and work with your - compressed data without having to decompress first, you also don’t need to - sacrifice any performance in doing so. For example, with a 419 MB csv file - of numerical data, and a 105 MB file of the same data compressed with gzip, - the following are the “best of three” run times for loading the entire - contents of each file into a NumPy array:

    -

    uncompressed: 13.38 sec gzip compressed: 14.54 sec

    -

    The compressed file takes slightly longer, but consider having to uncompress - the file to disk before loading with IOPro:

    -

    uncompressed: 13.38 sec gzip compressed: 14.54 sec gzip compressed (decompress to disk, then load): 21.56 sec

    -<<<<<<< HEAD -***REMOVED*** -
    -

    ***REMOVED***

    -

    ***REMOVED*** allow - for fast random lookup.

    -

    ***REMOVED*** dataset we used above:

    -
    >>> adapter = iopro.text_adapter('data.gz', parser='csv', compression='gzip')
    -    >>> array = adapter[-1]
    -    
    -***REMOVED*** -

    ***REMOVED*** about the same as the time - to read the entire record, because the entire ***REMOVED***

    -

    ***REMOVED***

    -
    >>> adapter.create_index('index_file')
    -    
    -***REMOVED*** -

    ***REMOVED*** 9.48 sec. - Now when seeking to and reading the last record again, it ***REMOVED***

    -======= -
    -
    -

    Indexing CSV Data

    -

    One of the most useful features of IOPro is the ability to index data to allow - for fast random lookup.

    -

    For example, to retrieve the last record of the compressed 109 MB dataset we used above:

    -
    >>> adapter = iopro.text_adapter('data.gz', parser='csv', compression='gzip')
    -    >>> array = adapter[-1]
    -    
    -
    -

    Retrieving the last record into a NumPy array takes 14.82 sec. This is about the same as the time - to read the entire record, because the entire dataset has to be parsed to get to the last record.

    -

    To make seeking faster, we can build an index:

    -
    >>> adapter.create_index('index_file')
    -    
    -
    -

    The above method creates an index in memory and saves it to disk, taking 9.48 sec. - Now when seeking to and reading the last record again, it takes a mere 0.02 sec.

    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Reloading the index only takes 0.18 sec. Build an index once, and get near instant random access - to your data forever:

    -
    >>> adapter = iopro.text_adapter('data.gz', parser='csv', compression='gzip', index_name='index_file')
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -
    -

    Advanced ***REMOVED***

    -

    IOPro supports using regular expressions to help parse messy data. - Take ***REMOVED*** ***REMOVED***

    -======= -
    -
    -
    -

    Advanced Regular Expressions

    -

    IOPro supports using regular expressions to help parse messy data. - Take for example the following snippet of actual NASDAQ stock data found on the Internet:

    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    Apple,AAPL,NasdaqNM,363.32 - 705.07
    -    Google,GOOG,NasdaqNM,523.20 - 774.38
    -    Microsoft,MSFT,NasdaqNM,24.30 - 32.95
    -    
    -<<<<<<< HEAD -***REMOVED*** -

    ***REMOVED*** fourth field presents a bit of a problem. - Let’s try IOPro’s regular ***REMOVED***

    -======= -
    -

    The first three fields are easy enough: name, symbol, and exchange. The fourth field presents a bit of a problem. - Let’s try IOPro’s regular expression based parser:

    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    >>> regex_string = '([A-Za-z]+),([A-Z]{1-4}),([A-Za-z]+),([0-9]+\.[0-9]{2})\s*-\s*([0-9]+\.[0-9]{2})'
    -    >>> adapter = iopro.text_adapter('data.csv', parser='regex', regex_string=regex_string)
    -    >>> array = adapter[:]
    -    
    -<<<<<<< HEAD -***REMOVED*** -

    Regular expressions can admittedly get pretty ugly, but they can also be very powerful. - By using the above regular expression with the grouping operators ‘(‘ and ‘)’, we can define - exactly how each record should be parsed into fields. Let’s break it down into individual ***REMOVED***

    -======= -
    -

    Regular expressions can admittedly get pretty ugly, but they can also be very powerful. - By using the above regular expression with the grouping operators ‘(‘ and ‘)’, we can define - exactly how each record should be parsed into fields. Let’s break it down into individual fields:

    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    ([A-Za-z]+) defines the first field (stock name) in our output array,

    -

    ([A-Z]{1-4}) defines the second (stock symbol),

    -

    ([A-Za-z]+) defines the third (company name),

    -

    ([0-9]+.[0-9]{2}) defines the fourth field (low price), and

    -

    ([0-9]+.[0-9]{2}) defines the fifth field (high price)

    -<<<<<<< HEAD -

    The output array contains five ***REMOVED*** three string fields and two float ***REMOVED***

    -***REMOVED*** -======= -

    The output array contains five fields: three string fields and two float fields. Exactly what we want.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Numba Integration

    -

    IOPro comes with experimental integration with NumbaPro, the amazing NumPy aware Python compiler - also available in Anaconda. Previously when parsing messy csv data, you had to use either a very slow - custom Python converter function to convert the string data to the target data type, or use a complex - regular expression to define the fields in each record string. Using the regular expression feature of - IOPro will certainly still be a useful and valid option for certain types of data, but it would be nice - if custom Python converter functions weren’t so slow as to be almost unusable. Numba solves this problem - by compiling your converter functions on the fly without any action on your part. Simply set the converter - function with a call to set_converter_function() as before, and IOPro + NumbaPro will handle the rest. - To illustrate, I’ll show a trivial example using the sdss data set again. Take the following converter - function which converts the input string to a floating point value and rounds to the nearest integer, - returning the integer value:

    -
    >>> def convert_value(input_str):
    -    ...     float_value = float(input_str)
    -    ...     return int(round(float_value))
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    We’ll use it to convert field 1 from the sdss dataset to an integer. By calling the set_converter method - with the use_numba parameter set to either True or False (the default is True), we can test the converter - function being called as both interpreted Python and as Numba compiled llvm bytecode. In this case, - compiling the converter function with NumbaPro gives us a 5x improvement in run time performance. To put - that in perspective, the Numba compiled converter function takes about the same time as converting field 1 - to a float value using IOPro’s built in C compiled float converter function. That isn’t quite an - “apples to apples” comparison, but it does show that NumbaPro enables user defined python converter - functions to achieve speeds in the same league as compiled C code.

    -<<<<<<< HEAD -***REMOVED*** -
    -

    ***REMOVED***

    -======= -
    -
    -

    S3 Support

    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Also in IOPro is the ability to parse csv data stored in Amazon’s S3 cloud storage service. - The S3 text adapter constructor looks slightly different than the normal text adapter constructor:

    -
    >>> adapter = iopro.s3_text_adapter(aws_access_key, aws_secret_key, 'dev-wakari-public', 'FEC/FEC_ALL.csv')
    -    
    -<<<<<<< HEAD -***REMOVED*** -

    ***REMOVED*** followed by the S3 bucket name and key name. - The S3 csv data is ***REMOVED*** need to save the - entire S3 data set to disk first. IOPro can also build an index for S3 data just as with disk based csv data, - and use the index for fast random access lookup. If an index file is created with IOPro and stored with the S3 - dataset in the cloud, IOPro ***REMOVED*** records requested. - This allows you to generate an index file once and share it on the cloud along with the data set, and does not - require ***REMOVED***

    -***REMOVED*** -======= -
    -

    The first two parameters are your AWS access key and secret key, followed by the S3 bucket name and key name. - The S3 csv data is downloaded in 128K chunks and parsed directly from memory, bypassing the need to save the - entire S3 data set to disk first. IOPro can also build an index for S3 data just as with disk based csv data, - and use the index for fast random access lookup. If an index file is created with IOPro and stored with the S3 - dataset in the cloud, IOPro can use this remote index to download and parse just the subset of records requested. - This allows you to generate an index file once and share it on the cloud along with the data set, and does not - require others to download the entire index file to use it.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/1.8.0/textadapter_firststeps.rst b/docs/1.8.0/textadapter_firststeps.rst deleted file mode 100644 index 179e64a..0000000 --- a/docs/1.8.0/textadapter_firststeps.rst +++ /dev/null @@ -1,194 +0,0 @@ -<<<<<<< HEAD -***REMOVED*** -======================= - -***REMOVED*** - -
    -

    ***REMOVED***

    -======= -TextAdapter First Steps -======================= - -.. raw:: html - -
    -

    Basic Usage

    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Create TextAdapter object for data source:

    -
    >>> import iopro
    -    >>> adapter = iopro.text_adapter('data.csv', parser='csv')
    -    
    -<<<<<<< HEAD -***REMOVED*** -

    Define field dtypes (example: set field 0 to unsigned int and field 4 to float):

    -
    >>> adapter.set_field_types({0: 'u4', 4:'f4'})
    -    
    -***REMOVED*** -======= -
    -

    Define field dtypes (example: set field 0 to unsigned int and field 4 to float):

    -
    >>> adapter.set_field_types({0: 'u4', 4:'f4'})
    -    
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Parse text and store records in NumPy array using slicing notation:

    -
    >>> # read all records
    -    >>> array = adapter[:]
    -
    -    >>> # read first ten records
    -    >>> array = adapter[0:10]
    -
    -    >>> # read last record
    -    >>> array = adapter[-1]
    -
    -    >>> # read every other record
    -    >>> array = adapter[::2]
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -
    -

    ***REMOVED***

    -

    Text data in JSON format can be parsed by specifying ‘json’ for the ***REMOVED***

    -
    >>> adapter = iopro.text_adapter('data.json', parser='json')
    -    
    -***REMOVED*** -

    ***REMOVED*** NumPy -======= -

    -
    -
    -

    JSON Support

    -

    Text data in JSON format can be parsed by specifying ‘json’ for the parser argument:

    -
    >>> adapter = iopro.text_adapter('data.json', parser='json')
    -    
    -
    -

    Currently, each JSON object at the root level is interpreted as a single NumPy ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - record. Each JSON object can be part of an array, or separated by a newline. - Examples of valid JSON documents that can be parsed by IOPro, with the NumPy - array result:

    -
    >>> # Single JSON object
    -    >>> data = StringIO('{"id":123, "name":"xxx"}')
    -    >>> iopro.text_adapter(data, parser='json')[:]
    -    array([(123L, 'xxx')],
    -          dtype=[('f0', 'u8'), ('f1', 'O')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    >>> # Array of two JSON objects
    -    >>> data = StringIO('[{"id":123, "name":"xxx"}, {"id":456, "name":"yyy"}]')
    -    >>> iopro.text_adapter(data, parser='json')[:]
    -    array([(123L, 'xxx'), (456L, 'yyy')],
    -          dtype=[('f0', 'u8'), ('f1', 'O')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    >>> # Two JSON objects separated by newline
    -    >>> data = StringIO('{"id":123, "name":"xxx"}\n{"id":456, "name":"yyy"}')
    -    >>> iopro.text_adapter(data, parser='json')[:]
    -    array([(123L, 'xxx'), (456L, 'yyy')],
    -          dtype=[('f0', 'u8'), ('f1', 'O')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -

    Future versions of IOPro will have support for selecting specific JSON fields, - using a query language similar to XPath for XML.

    -***REMOVED*** -======= -
    -

    Future versions of IOPro will have support for selecting specific JSON fields, - using a query language similar to XPath for XML.

    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -
    -

    Advanced Usage

    -

    user defined converter function for field 0:

    -
    >>> import iopro
    -    >>> import io
    -
    -    >>> data = '1, abc, 3.3\n2, xxx, 9.9'
    -    >>> adapter = iopro.text_adapter(io.StringIO(data), parser='csv', field_names=False)
    -
    -    >>> # Override default converter for first field
    -    >>> adapter.set_converter(0, lambda x: int(x)*2)
    -    >>> adapter[:]
    -    array([(2L, ' abc', 3.3), (4L, ' xxx', 9.9)],
    -              dtype=[('f0', '<u8'), ('f1', 'S4'), ('f2', '<f8')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    overriding default missing and fill values:

    -
    >>> import iopro
    -    >>> import io
    -
    -    >>> data = '1,abc,inf\n2,NA,9.9'
    -    >>> adapter = iopro.text_adapter(io.StringIO(data), parser='csv', field_names=False)
    -    >>> adapter.set_field_types({1:'S3', 2:'f4'})
    -
    -    >>> # Define list of strings for each field that represent missing values
    -    >>> adapter.set_missing_values({1:['NA'], 2:['inf']})
    -
    -    >>> # Set fill value for missing values in each field
    -    >>> adapter.set_fill_values({1:'xxx', 2:999.999})
    -    >>> adapter[:]
    -    array([(' abc', 999.9990234375), ('xxx', 9.899999618530273)],
    -              dtype=[('f0', 'S4'), ('f1', '<f4')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    creating and saving tuple of index arrays for gzip file, and reloading indices:

    -
    >>> import iopro
    -    >>> adapter = iopro.text_adapter('data.gz', parser='csv', compression='gzip')
    -
    -    >>> # build index of records and save index to NumPy array
    -    >>> adapter.create_index('index_file')
    -
    -    >>> # reload index
    -    >>> adapter = iopro.text_adapter('data.gz', parser='csv', compression='gzip', index_name='index_file')
    -
    -    >>> # Read last record
    -    >>> adapter[-1]
    -    array([(100, 101, 102)],dtype=[('f0', '<u4'), ('f1', '<u4'), ('f2', '<u4')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -======= -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -

    Use regular expression for finer control of extracting data:

    -
    >>> import iopro
    -    >>> import io
    -
    -    >>> # Define regular expression to extract dollar amount, percentage, and month.
    -    >>> # Each set of parentheses defines a field.
    -    >>> data = '$2.56, 50%, September 20 1978\n$1.23, 23%, April 5 1981'
    -    >>> regex_string = '([0-9]\.[0-9][0-9]+)\,\s ([0-9]+)\%\,\s ([A-Za-z]+)'
    -    >>> adapter = iopro.text_adapter(io.StringIO(data), parser='regex', regex_string=regex_string, field_names=False, infer_types=False)
    -
    -    >>> # set dtype of field to float
    -    >>> adapter.set_field_types({0:'f4', 1:'u4', 2:'S10'})
    -    >>> adapter[:]
    -    array([(2.56, 50L, 'September'), (1.23, 23L, 'April')],
    -        dtype=[('f0', '<f8'), ('f1', '<u8'), ('f2', 'S9')])
    -    
    -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -
    -
    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 diff --git a/docs/AccumuloAdapter.rst b/docs/AccumuloAdapter.rst deleted file mode 100644 index dc25331..0000000 --- a/docs/AccumuloAdapter.rst +++ /dev/null @@ -1,223 +0,0 @@ -<<<<<<< HEAD -***REMOVED***----- -Accumulo Adapter -***REMOVED***----- -======= ----------------- -Accumulo Adapter ----------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -.. contents:: - -The AccumuloAdapter module reads data from Accumulo key/value stores and produces -a NumPy array containing the parsed values. - -* The AccumuloAdapter engine is written in C to ensure returned data is parsed - as fast as data can be read from the source. Data is read and parsed in small - chunks instead of reading entire data into memory at once. - -* Python slicing notation can be used to specify a subset of records to be - read from the data source. - -Adapter Methods -<<<<<<< HEAD -***REMOVED***---- -======= ---------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -Accumulo Adapter Constructor: - -**AccumuloAdapter** (server='localhost', port=42424, username='', password='', table=None, field_type='f8', start_key=None, stop_key=None, start_key_inclusive=True, stop_key_inclusive=False, missing_values=None, fill_value=None): - - | Create an adaptor for connecting to an Accumulo key/value store. - - | server: Accumulo server address - | port: Accumulo port - | username: Accumulo user name - | password: Accumulo user password - | table: Accumulo table to read data from - | field_type: str, NumPy dtype to interpret table values as - | start_key: str, key of record where scanning will start from - | stop_key: str, key of record where scanning will stop at - | start_key_inclusive: If True, start_key is inclusive (default is True) - | stop_key_inclusive: If True, stop_key is inclusive (default is False) - | missing_values: list, missing value strings. Any values in table equal - to one of these strings will be replaced with fill_value. - | fill_value: fill value used to replace missing value when scanning - -**close** () - | Close connection to the database. - -The AccumuloAdapter object supports array slicing: - - | Read all records: - adapter[:] - - | Read first ten records: - adapter[0:10] - - | Read last record: - adapter[-1] - -<<<<<<< HEAD - | ***REMOVED*** -======= - | Read every other record: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - adapter[::2] - - -Adapter Properties -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -**field_type** (readonly) - | Get dtype of output NumPy array - -**start_key** - | Get/set key of record where reading/scanning will start. - | The start_key_inclusive property specifies whether this key is inclusive - | (default is inclusive). - -**stop_key** - | Get/set key of record where reading/scanning will stop. - | The stop_key_inclusive property specifies whether this key is inclusive - | (default is exclusive). - -**start_key_inclusive** - | Toggle whether start key is inclusive. Default is true. - -**stop_key_inclusive** - | Toggle whether stop key is inclusive. Default is False. - -**missing_values** - | Get/Set missing value strings. Any values in Accumulo table matching one - | of these strings will be replaced with fill_value. - -**fill_value** - | Fill value used to replace missing_values. Fill value type should match - | specified output type. - -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** - -Create AccumuloAdapter object for data source:: - -***REMOVED*** -======= -Basic Usage ------------ - -Create AccumuloAdapter object for data source:: - - >>> import iopro ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - >>> adapter = iopro.AccumuloAdapter(server='172.17.0.1', - port=42424, - username='root', - password='password', - field_type='f4', - table='iopro_tutorial_data') - -IOPro adapters use slicing to retrieve data. To retrieve records from the table -or query, the standard NumPy slicing notation can be used: - - >>> # read all records -<<<<<<< HEAD -***REMOVED*** -======= - >>> array = adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - array([ 0.5, 1.5, 2.5, 3.5, 4.5], dtype=float32) - - >>> # read first three records - >>> array = adapter[0:3] - array([ 0.5, 1.5, 2.5], dtype=float32) - - >>> # read every other record from the first four records - >>> array = adapter[:4:2] - array([ 0.5, 2.5], dtype=float32) - -The Accumulo adapter does not support seeking from the last record. - -The field_types property can be used to see what type the output NumPy array -will have: - - >>> adapter.field_type - 'f4' - -Since Accumulo is essentially a key/value store, results can be filtered -based on key. For example, a start key using the start_key property. This will -retrieve all values with a key equal to or greater than the start key. - - >>> adapter.start_key = 'row02' -<<<<<<< HEAD -***REMOVED*** -======= - >>> adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - array([ 1.5, 2.5, 3.5, 4.5], dtype=float32) - -Likewise, a stop key. This will retrieve all values with a key less than the -stop key but equal to or greater than the start key. - - >>> adapter.stop_key = 'row04' -<<<<<<< HEAD -***REMOVED*** -======= - >>> adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - array([ 1.5, 2.5], dtype=float32) - -By default, the start key is inclusive. This can be changed by setting the -start_key_inclusive property to False. - - >>> adapter.start_key_inclusive = False -<<<<<<< HEAD -***REMOVED*** -======= - >>> adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - array([ 2.5], dtype=float32) - -By default, the stop key is exclusive. This can be changed by setting the -stop_key_inclusive property to True. - - >>> adapter.stop_key_inclusive = True -<<<<<<< HEAD -***REMOVED*** -======= - >>> adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - array([ 2.5, 3.5], dtype=float32) - -The Accumulo adapter can handle missing values. If it is known that the strings -'NA' and 'nan' signify missing float values, the missing_values property can be -used to tell the adapter to treat these strings as missing values: Also, the -fill_value property can be used to specify what value to replace missing values -with. - - >>> adapter = iopro.AccumuloAdapter('172.17.0.1', 42424, 'root', 'password', 'iopro_tutorial_missing_data', field_type='S10') -<<<<<<< HEAD -***REMOVED*** -======= - >>> adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - array([b'NA', b'nan'], dtype='|S10') - - >>> adapter = iopro.AccumuloAdapter('172.17.0.1', 42424, 'root', 'secret', 'iopro_tutorial_missing_data', field_type='f8') - >>> adapter.missing_values = ['NA', 'nan'] - >>> adapter.fill_value = np.nan -<<<<<<< HEAD -***REMOVED*** -======= - >>> adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - array([ nan, nan]) - -Close database connection: - >>> adapter.close() diff --git a/docs/Makefile b/docs/Makefile index b05cc2a..484f709 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -77,17 +77,17 @@ qthelp: @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/TextAdapter.qhcp" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/IOPro.qhcp" @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/TextAdapter.qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/IOPro.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/TextAdapter" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/TextAdapter" + @echo "# mkdir -p $$HOME/.local/share/devhelp/IOPro" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/IOPro" @echo "# devhelp" epub: diff --git a/docs/MongoAdapter.rst b/docs/MongoAdapter.rst deleted file mode 100644 index 4029264..0000000 --- a/docs/MongoAdapter.rst +++ /dev/null @@ -1,85 +0,0 @@ -<<<<<<< HEAD -***REMOVED***- -MongoAdapter -***REMOVED***- -======= ------------- -MongoAdapter ------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -.. contents:: - -The MongoAdapter module reads data from a Mongo database collection and produces a -NumPy array containing the loaded. The following features are currently implemented: - -* The MongoAdapter engine is written in C to ensure data is loaded fast with minimal - memory usage. - -* Python slicing notation can be used to specify the subset of records to be - read from the data source. - -* The MongoAdapter engine has automatic type inference so the user does not have to - specify dtypes of the output array. - -Methods -------- -The MongoAdapter module contains the follwowing constructor for creating MongoAdapter objects: - -**MongoAdapter** (host, port, database, collection) - | MongoAdapter contructor - - | host - Host name where Mongo database is running. - | port - Port number where Mongo database is running. - | database - Mongo database to connect to - | collection - Mongo database collection - -**set_field_names** (names) - | Set field names to read when creating output NumPy array. - -**get_field_names** () - | Returns names of fields that will be read when reading data from Mongo database. - -**set_field_types** (types=None) - | Set NumPy dtypes for each field, specified as a dict of field names/indices and associated - dtype. (Example: {0:'u4', 1:'f8', 2:'S10'}) - -**get_field_types** () - | Returns dict of field names/indices and associated NumPy dtype. - -The MongoAdapter object contains the following properties: - -**size** (readonly) - | Number of documents in the Mongo database + collection specified in constructor. - -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** - -1. Create MongoAdapter object for data source - -***REMOVED*** -======= -Basic Usage ------------ - -1. Create MongoAdapter object for data source - - >>> import iopro ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - >>> adapter = iopro.MongoAdapter('localhost', 27017, 'database_name', 'collection_name') - -2. Load Mongo collection documents into NumPy array using slicing notation - - >>> # read all records for 'field0' field - >>> array = adapter['field0'][:] - - >>> # read first ten records for 'field0' and 'field1' fields - >>> array = adapter[['field0', 'field1']][0:10] - - >>> # read last record - >>> array = adapter['field0'][-1] - - >>> # read every other record - >>> array = adapter['field0'][::2] - diff --git a/docs/PostgresAdapter.rst b/docs/PostgresAdapter.rst deleted file mode 100644 index b7df235..0000000 --- a/docs/PostgresAdapter.rst +++ /dev/null @@ -1,283 +0,0 @@ -<<<<<<< HEAD -***REMOVED******REMOVED*** -PostgresAdapter, PostGIS, and GreenPlum -***REMOVED******REMOVED*** -======= ----------------------------------------------- -PostgresAdapter, PostGIS, and GreenPlum ----------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -.. contents:: - -The PostgresAdapter module reads data from PostresSQL based databases and produces -a NumPy array or a Pandas Dataframe containing the parsed data. The PostgresAdapter -can be used to access data from PostgresSQL and GreenPlum, and has enhancements -to support PostGIS points, lines, multilines, polygons, and multipolygons. The -following features are currently implemented: - -* The PostgresAdapter engine is written in C to ensure returned data is parsed - as fast as data can be read from the source. Data is read and parsed in small - chunks instead of reading entire data into memory at once. - -* Python slicing notation can be used to specify a subset of records to be - read from the data source. - -* A subset of columns can be specified to be returned instead of returning all - columns for the records. - -Adapter Methods -<<<<<<< HEAD -***REMOVED***---- -======= ---------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -PostgreSQL Adapter Constructor: - -**PostgresAdapter** (connection_uri, table=None, query=None, field_filter=None, dataframe=False, field_names=None, field_types=None, field_shapes=None): - - | Create an adaptor for connecting to a PostgreSQL based database. - - | connection_uri: string URI describing how to connect to database - | table: string, name of table to read records from. Only table - | parameter or query parameter can be set, but not both. - | query: string, custom query to use for reading records. Only query - parameter or table parameter can be set, but not both. - field_filter parameter cannot be set when query parameter is - set (since it is trivial to specify fields in query string). - | field_filter: names of fields include in query (only valid when table - parameter is specified) - | dataframe: bool, return results as dataframe instead of array - | field_names: list, names of fields in output array or dataframe. - Defaults to database table column names. - | field_types: list, NumPy dtype for each field in output array - or dataframe. Defaults to database table column types. - | field_shapes: list, shape of each field value for geometry field - types with variable length data. For example, for a - 'path' database column with 2d points, the points of - the path will be stored in a list object by default. - If a field shape of '10' is specified, the points will - be stored in a 2x10 float subarray (2 floats per point* 10 points max). - A field shape of the form (x,y) should be specifed for types like - multipolygon where x is the max number of polygons and y is the max - length of each polygon (the size of the point is inferred). - -**close** () - | Close connection to the database. - -The PostgresAdapter object supports array slicing: - - | Read all records: - adapter[:] - - | Read first 100 records: - adapter[0:100] - - | Read last record: - adapter[-1] - -<<<<<<< HEAD - | ***REMOVED*** - adapter[::2] - -Adapter Properties -***REMOVED***------- -======= - | Read every other record: - adapter[::2] - -Adapter Properties ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -**num_records** (readonly) - | Get number of records that will be returned from table or custom query. - -**num_fields** (readonly) - | Get number of fields in records that will be returned from table - or custom query - -**field_names** - | Get/set names of fields in final array or dataframe. Field names can be - set by specifying a list of names, or dict mapping of field number to - field name. If names is a list, the length of list must match the number - of fields in data set. If names is a dict, the field name from the database - will be used if no name in dict is specified for that field. - -**field_types** - | Get/set field types in final array or dataframe. Field types can be set - by specifying a list of NumPy dtypes, or a dict mapping of field number - or name to field type. If types is a list, the length of list must match - the number of fields in data set. If types is a dict, the field type from - the database will be used if type is not specified in dict. - -**field_shapes** - | Get/set field shapes for variable length fields. Field shapes can be set - by specifying a list of shape tuples (or a single integer if shape has - one dimension), or a dict mapping of field number or name to field shape. - If shapes is a list, the length of the list must match the number of fields - in data set. A value of None or zero for a field, or an unspecified shape, - means that an infinite length value will be allowed for field, and value will be - stored in Python list object if field is PostgreSQL geometry type, or - as Well Known Text string objects if field is PostGIS type. - -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** - -Create PostgresAdapter object for data source:: - -***REMOVED*** -======= -Basic Usage ------------ - -Create PostgresAdapter object for data source:: - - >>> import iopro ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - >>> adapter = iopro.PostgresAdapter('host=localhost dbname=db_name user=user table=table_name') - -IOPro adapters use slicing to retrieve data. To retrieve records from the table -or query, the standard NumPy slicing notation can be used: - - >>> # read all records -<<<<<<< HEAD -***REMOVED*** -======= - >>> array = adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - >>> # read first ten records - >>> array = adapter[0:10] - - >>> # read last record -<<<<<<< HEAD - ***REMOVED*** - - >>> # read every other record -***REMOVED*** -======= - >>> array = adapter[-1] - - >>> # read every other record - >>> array = adapter[::2] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -The PostgreSQL adapter has a few properties that we can use to find out -more about our data. To get the number of records in our dataset: - - >>> adapter.num_records - 5 - -<<<<<<< HEAD -or the number of ***REMOVED*** -======= -or the number of fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - >>> adapter.num_fields - 5 - -To find the names of each field: - - >>> adapter.field_names - ['field1', 'real', 'name', 'point2d', 'multipoint3d'] - -These names come from the names of the columns in the database and are used by -default for the field names in the NumPy array result. These names can be changed -by setting the field names property using a list of field names: - - >>> adapter.field_names = ['field1', 'field2', 'field3', 'field4', 'field5'] -<<<<<<< HEAD -***REMOVED***.dtype -======= - >>> adapter[:].dtype ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - dtype([('field1', '>> adapter.field_names = {1: 'AAA'} -<<<<<<< HEAD -***REMOVED***.dtype -======= - >>> adapter[:].dtype ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - dtype([('integer', '>> adapter.field_types ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - ['i4', 'f4', 'U10', 'f8', 'O'] - -Similar to the field names property, the types property can be set using a list -or dict to force a field to be cast to a specific type: - -<<<<<<< HEAD - ***REMOVED*** = {0: 'f4', 1: 'i4', 2: 'U3', 4: 'O'} -======= - >>> adapter.field_types = {0: 'f4', 1: 'i4', 2: 'U3', 4: 'O'} ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -To filter the fields returned by passing a list of field names to the constructor: - - >>> adapter = iopro.PostgresAdapter('host=localhost dbname=db_name user=user', - table='data', - field_filter=['field1', 'field2']) - -For fields like path or multipoint3d with a variable length, the adapter will return -values as a list of tuples containing the float components of each point (if a -PostgreSQL geometric type) or as string objects in Well Known Text format (if a -PostGIS type). For improved performance, a field shape can be specified which -will set the max dimensions of the field values. For example, a multipoint3d -field can be set to have a maximum of two points so that each set of 3d points -will be stored in a 2x3 subarray of floats: - - >>> adapter = iopro.PostgresAdapter('host=localhost dbname=db_name user=user' - table='data', - field_filter=['multipoint3d'], - field_shapes={'multipoint3d': 2}) -<<<<<<< HEAD -***REMOVED*** -======= - >>> adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - array([([[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]],), - ([[6.0, 7.0, 8.0], [9.0, 10.0, 11.0]],), - ([[12.0, 13.0, 14.0], [15.0, 16.0, 17.0]],), - ([[18.0, 19.0, 20.0], [21.0, 22.0, 23.0]],), - ([[24.0, 25.0, 26.0], [27.0, 28.0, 29.0]],)], - dtype=[('multipoint3d', '>> adapter = iopro.PostgresAdapter('host=localhost dbname=db_name user=user', - query='select integer, string from data where data.integer > 2') -<<<<<<< HEAD -***REMOVED*** -======= - >>> adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -Data can also be returned as a pandas dataframe using the adapter constructor's -dataframe' argument: - - >>> adapter = iopro.PostgresAdapter('host=localhost dbname=iopro_tutorial user=jayvius', - table='data', - dataframe=True) - -To retrieve some PostGIS data that falls within a given bounding box: - - >>> adapter = iopro.PostgresAdapter('host=localhost dbname=db_name user=user', - query='select integer, point2d from data ' - 'where data.point2d @ ST_MakeEnvelope(0, 0, 4, 4)') - -Close database connection: - >>> adapter.close() diff --git a/docs/TextAdapter.rst b/docs/TextAdapter.rst index b71139b..341b306 100644 --- a/docs/TextAdapter.rst +++ b/docs/TextAdapter.rst @@ -1,18 +1,6 @@ -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED*** -TextAdapter -***REMOVED*** -======= ----------- TextAdapter ----------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------ -TextAdapter ------------ ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c .. contents:: @@ -197,55 +185,23 @@ The TextAdapter object supports array slicing: | Read first and third fields in all records: adapter[[0, 2]][:] -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED*** -***REMOVED*** -======= -Basic Usage ------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= Basic Usage ----------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c Create TextAdapter object for data source:: - >>> import TextAdapter - >>> adapter = TextAdapter.text_adapter('data.csv', parser='csv') + >>> import iopro + >>> adapter = iopro.text_adapter('data.csv', parser='csv') Parse text and store records in NumPy array using slicing notation:: >>> # read all records -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED*** -======= - >>> array = adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= >>> array = adapter[:] ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c >>> # read first ten records >>> array = adapter[0:10] >>> # read last record -<<<<<<< HEAD -<<<<<<< HEAD - ***REMOVED*** -======= - >>> array = adapter[-1] ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - - >>> # read every other record - >>> array = adapter[::2] - -Advanced Usage -<<<<<<< HEAD -***REMOVED***--- -======= >>> array = adapter[-1] >>> # read every other record @@ -253,79 +209,51 @@ Advanced Usage Advanced Usage -------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= --------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c user defined converter function for field 0:: - >>> import TextAdapter + >>> import iopro >>> import io >>> data = '1, abc, 3.3\n2, xxx, 9.9' - >>> adapter = TextAdapter.text_adapter(io.StringIO(data), parser='csv', field_names=False) + >>> adapter = iopro.text_adapter(io.StringIO(data), parser='csv', field_names=False) >>> # Override default converter for first field >>> adapter.set_converter(0, lambda x: int(x)*2) -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED*** -======= - >>> adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= >>> adapter[:] ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c array([(2L, ' abc', 3.3), (4L, ' xxx', 9.9)], dtype=[('f0', '>> import TextAdapter + >>> import iopro >>> import io >>> data = '1,abc,inf\n2,NA,9.9' - >>> adapter = TextAdapter.text_adapter(io.StringIO(data), parser='csv', field_names=False) + >>> adapter = iopro.text_adapter(io.StringIO(data), parser='csv', field_names=False) >>> # Define field dtypes (example: set field 1 to string object and field 2 to float) -<<<<<<< HEAD -<<<<<<< HEAD - ***REMOVED*** = {1:'O', 2:'f4'} -======= >>> adapter.field_types = {1:'O', 2:'f4'} ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= - >>> adapter.field_types = {1:'O', 2:'f4'} ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c >>> # Define list of strings for each field that represent missing values >>> adapter.set_missing_values({1:['NA'], 2:['inf']}) >>> # Set fill value for missing values in each field >>> adapter.set_fill_values({1:'xxx', 2:999.999}) -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED*** -======= - >>> adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= >>> adapter[:] ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c array([(' abc', 999.9990234375), ('xxx', 9.899999618530273)], dtype=[('f0', 'O'), ('f1', '>> import TextAdapter - >>> adapter = TextAdapter.text_adapter('data.gz', parser='csv', compression='gzip') + >>> import iopro + >>> adapter = iopro.text_adapter('data.gz', parser='csv', compression='gzip') >>> # Build index of records and save index to disk. >>> adapter.create_index(index_name='index_file') >>> # Create new adapter object and load index from disk. - >>> adapter = TextAdapter.text_adapter('data.gz', parser='csv', compression='gzip', indexing=True, index_name='index_file') + >>> adapter = iopro.text_adapter('data.gz', parser='csv', compression='gzip', indexing=True, index_name='index_file') >>> # Read last record >>> adapter[-1] @@ -333,27 +261,17 @@ creating and saving tuple of index arrays for gzip file, and reloading indices:: Use regular expression for finer control of extracting data:: - >>> import TextAdapter + >>> import iopro >>> import io >>> # Define regular expression to extract dollar amount, percentage, and month. >>> # Each set of parentheses defines a field. >>> data = '$2.56, 50%, September 20 1978\n$1.23, 23%, April 5 1981' >>> regex_string = '([0-9]\.[0-9][0-9]+)\,\s ([0-9]+)\%\,\s ([A-Za-z]+)' - >>> adapter = TextAdapter.text_adapter(io.StringIO(data), parser='regex', regex_string=regex_string, field_names=False, infer_types=False) + >>> adapter = iopro.text_adapter(io.StringIO(data), parser='regex', regex_string=regex_string, field_names=False, infer_types=False) >>> # set dtype of field to float -<<<<<<< HEAD -<<<<<<< HEAD - ***REMOVED*** = {0:'f4', 1:'u4', 2:'S10'} -***REMOVED*** -======= - >>> adapter.field_types = {0:'f4', 1:'u4', 2:'S10'} - >>> adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= >>> adapter.field_types = {0:'f4', 1:'u4', 2:'S10'} >>> adapter[:] ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c array([(2.56, 50L, 'September'), (1.23, 23L, 'April')], dtype=[('f0', '>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -# -- General configuration ----------------------------------------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' @@ -48,7 +40,7 @@ master_doc = 'index' # General information about the project. -project = u'TextAdapter' +project = u'IOPro' copyright = u'2016, Continuum Analytics' # The version info for the project you're documenting, acts as replacement for @@ -95,15 +87,7 @@ #modindex_common_prefix = [] -<<<<<<< HEAD -<<<<<<< HEAD -# -- Options for HTML output ***REMOVED******REMOVED***----- -======= -# -- Options for HTML output --------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= # -- Options for HTML output --------------------------------------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. @@ -180,18 +164,10 @@ #html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'TextAdapterdoc' +htmlhelp_basename = 'IOProdoc' -<<<<<<< HEAD -<<<<<<< HEAD -# -- Options for LaTeX output ***REMOVED******REMOVED***---- -======= -# -- Options for LaTeX output -------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= # -- Options for LaTeX output -------------------------------------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c latex_elements = { # The paper size ('letterpaper' or 'a4paper'). @@ -207,7 +183,7 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'TextAdapter.tex', u'TextAdapter Documentation', + ('index', 'IOPro.tex', u'IOPro Documentation', u'Continuum Analytics', 'manual'), ] @@ -232,20 +208,12 @@ #latex_domain_indices = True -<<<<<<< HEAD -<<<<<<< HEAD -# -- Options for manual page output ***REMOVED******REMOVED******REMOVED*** -======= # -- Options for manual page output -------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -# -- Options for manual page output -------------------------------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'TextAdapter', u'TextAdapter Documentation', + ('index', 'iopro', u'IOPro Documentation', ['Continuum Analytics', 'Jay Bourque', 'David Mertz'], 1) ] @@ -253,22 +221,14 @@ #man_show_urls = False -<<<<<<< HEAD -<<<<<<< HEAD -# -- Options for Texinfo output ***REMOVED******REMOVED***-- -======= -# -- Options for Texinfo output ------------------------------------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= # -- Options for Texinfo output ------------------------------------------------ ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'TextAdapter', u'TextAdapter Documentation', - u'Continuum Analytics', 'TextAdapter', 'One line description of project.', + ('index', 'IOPro', u'IOPro Documentation', + u'Continuum Analytics', 'IOPro', 'One line description of project.', 'Miscellaneous'), ] diff --git a/docs/eula.rst b/docs/eula.rst index e69de29..40e1571 100644 --- a/docs/eula.rst +++ b/docs/eula.rst @@ -0,0 +1,179 @@ +================================ +IOPro END USER LICENSE AGREEMENT +================================ + +IOPro ("the Software Product") and accompanying documentation is licensed and +not sold. The Software Product is protected by copyright laws and treaties, as +well as laws and treaties related to other forms of intellectual property. +Continuum Analytics, Inc. or its subsidiaries, affiliates, and suppliers +(collectively "Continuum") own intellectual property rights in the Software +Product. The Licensee's ("you" or "your") license to download, use, copy, or +change the Software Product is subject to these rights and to all the terms +and conditions of this End User License Agreement ("Agreement"). + +Acceptance +========== + +YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT BY SELECTING +THE "ACCEPT" OPTION AND DOWNLOADING THE SOFTWARE PRODUCT OR BY INSTALLING, +USING, OR COPYING THE SOFTWARE PRODUCT. YOU MUST AGREE TO ALL OF THE TERMS OF +THIS AGREEMENT BEFORE YOU WILL BE ALLOWED TO DOWNLOAD THE SOFTWARE PRODUCT. IF +YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, YOU MUST SELECT +"DECLINE" AND YOU MUST NOT INSTALL, USE, OR COPY THE SOFTWARE PRODUCT. + +Trial Period +============ + +You have the right to use IOPro on a single computer or group of computers for +30 days with no license. After 30 days you must purchase an appropriate +license to use the software on one or more machines or stop using the software +and remove it from all of your machines on which you installed the software. + +License Grant +============= + +This Agreement entitles you to install and use one copy of the Software +Product on as many machines as you will personally use. The Software Product +is licensed to a particular user. Only the user to whom the software is +licensed may use the software. You must obtain a license for as many users as +you wish to use the software. In addition, you may make archival copies of +the Software Product Installer. + +Right to Updates +================ + +This license entitles you to updates to the Software Product for one year from +the time of payment. The Software Product will continue to function and you +may continue to use The Software Product and any updates you have received for +as long as you would like however you will no longer be able to receive +updates from Continuum unless this License is renewed. Please contact +sales@continuum.io with any questions or concerns. + +Restrictions on Transfer +======================== + +Without first obtaining the express written consent of Continuum, you may not +assign your rights and obligations under this Agreement, or redistribute, +encumber, sell, rent, lease, sublicense, or otherwise transfer your rights to +the Software Product. + +Restrictions on Use +=================== + +You may not use, copy, or install the Software Product on any system where +more than one user will be able to use the software unless you have purchased +a license for each user of the system. You may not decompile, +"reverse-engineer", disassemble, or otherwise attempt to derive the source +code for the Software Product. + +Restrictions on Alteration +========================== + +You may not modify the Software Product or create any derivative work of the +Software Product or its accompanying documentation. Derivative works include +but are not limited to translations. You may not alter any files or libraries +in any portion of the Software Product. + +Restrictions on Copying +======================= + +You may not copy any part of the Software Product except to the extent that +licensed use inherently demands the creation of a temporary copy stored in +computer memory and not permanently affixed on storage medium. You may make +archival copies of the Software Product installer. + +Limited Software Product Warranty +================================= + +For a period of 60 days from the date of shipment or from the date that you +download the Software Product, as applicable, Continuum warrants that when +properly installed and used under normal conditions, the Software Product will +perform substantially as advertised. + +Disclaimer of Warranties and Limitation of Liability +==================================================== + +UNLESS OTHERWISE EXPLICITLY AGREED TO IN WRITING BY CONTINUUM, CONTINUUM MAKES +NO OTHER WARRANTIES, EXPRESS OR IMPLIED, IN FACT OR IN LAW, INCLUDING, BUT NOT +LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A +PARTICULAR PURPOSE OTHER THAN AS SET FORTH IN THIS AGREEMENT OR IN THE LIMITED +WARRANTY DOCUMENTS PROVIDED WITH THE SOFTWARE PRODUCT. + +Continuum makes no warranty that the Software Product will meet your +requirements or operate under your specific conditions of use. Continuum makes +no warranty that operation of the Software Product will be secure, error free, +or free from interruption. YOU MUST DETERMINE WHETHER THE SOFTWARE PRODUCT +SUFFICIENTLY MEETS YOUR REQUIREMENTS FOR SECURITY AND UNINTERRUPTABILITY. YOU +BEAR SOLE RESPONSIBILITY AND ALL LIABILITY FOR ANY LOSS INCURRED DUE TO +FAILURE OF THE SOFTWARE PRODUCT TO MEET YOUR REQUIREMENTS. CONTINUUM WILL NOT, +UNDER ANY CIRCUMSTANCES, BE RESPONSIBLE OR LIABLE FOR THE LOSS OF DATA ON ANY +COMPUTER OR INFORMATION STORAGE DEVICE.ÿ UNDER NO CIRCUMSTANCES SHALL +CONTINUUM, ITS DIRECTORS, OFFICERS, EMPLOYEES OR AGENTS BE LIABLE TO YOU OR +ANY OTHER PARTY FOR INDIRECT, CONSEQUENTIAL, SPECIAL, INCIDENTAL, PUNITIVE, OR +EXEMPLARY DAMAGES OF ANY KIND (INCLUDING LOST REVENUES OR PROFITS OR LOSS OF +BUSINESS) RESULTING FROM THIS AGREEMENT, OR FROM THE FURNISHING, PERFORMANCE, +INSTALLATION, OR USE OF THE SOFTWARE PRODUCT, WHETHER DUE TO A BREACH OF +CONTRACT, BREACH OF WARRANTY, OR THE NEGLIGENCE OF CONTINUUM OR ANY OTHER +PARTY, EVEN IF CONTINUUM IS ADVISED BEFOREHAND OF THE POSSIBILITY OF SUCH +DAMAGES. TO THE EXTENT THAT THE APPLICABLE JURISDICTION LIMITS CONTINUUM'S +ABILITY TO DISCLAIM ANY IMPLIED WARRANTIES, THIS DISCLAIMER SHALL BE EFFECTIVE +TO THE MAXIMUM EXTENT PERMITTED. + +Limitation of Remedies and Damages +================================== + +Your remedy for a breach of this Agreement or of any warranty included in this +Agreement is the correction or replacement of the Software Product. Selection +of whether to correct or replace shall be solely at the discretion of +Continuum. Continuum reserves the right to substitute a functionally +equivalent copy of the Software Product as a replacement. If Continuum is +unable to provide a replacement or substitute Software Product or corrections +to the Software Product, your sole alternate remedy shall be a refund of the +purchase price for the Software Product exclusive of any costs for shipping +and handling. Any claim must be made within the applicable warranty period. +All warranties cover only defects arising under normal use and do not include +malfunctions or failure resulting from misuse, abuse, neglect, alteration, +problems with electrical power, acts of nature, unusual temperatures or +humidity, improper installation, or damage determined by Continuum to have +been caused by you. All limited warranties on the Software Product are granted +only to you and are non-transferable. You agree to indemnify and hold +Continuum harmless from all claims, judgments, liabilities, expenses, or costs +arising from your breach of this Agreement and/or acts or omissions. + +Governing Law, Jurisdiction and Costs +===================================== + +This Agreement is governed by the laws of Texas, without regard to Texas's +conflict or choice of law provisions. + +Export Regulations +================== + +Any use or distribution of IOPro is made under conditions that the user and/or +distributor is in full compliance with all export and other governing laws of +the United States of America, including full and ongoing compliance with the +Export Administration Regulations (EAR) of the United States Department of +Commerce. See www.commerce.gov/ and +http://www.bis.doc.gov/index.php/regulations/export-administration-regulations-ear. +Use or distribution of Continuum software products to any persons, entities or +countries currently under US sanctions is strictly prohibited. IOPro is +classified with an ECCN of 5D992 with no license required for export to +non-embargoed countires. + +The United States currently has embargoes against Cuba, Iran, North Korea, +Sudan and Syria. The exportation, re-exportation, sale or supply, directly or +indirectly, from the United States, or by a U.S. person wherever located, of +any Continuum software to any of these countries is strictly prohibited +without prior authorization by the United States Government By accepting this +Agreement, you represent to Continuum that you will comply with all applicable +export regulations for IOPro. + + +Severability +============ + +If any provision of this Agreement shall be held to be invalid or +unenforceable, the remainder of this Agreement shall remain in full force and +effect. To the extent any express or implied restrictions are not permitted by +applicable laws, these express or implied restrictions shall remain in force +and effect to the maximum extent permitted by such applicable laws. diff --git a/docs/genfromtxt.rst b/docs/genfromtxt.rst index e5cbda4..b6668f0 100644 --- a/docs/genfromtxt.rst +++ b/docs/genfromtxt.rst @@ -1,18 +1,6 @@ -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***----- -TextAdapter.genfromtxt -***REMOVED***----- -======= ---------------- -TextAdapter.genfromtxt +iopro.genfromtxt ---------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ----------------- -TextAdapter.genfromtxt ----------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c Load data from a text file, with missing values handled as specified. @@ -20,15 +8,7 @@ Each line past the first `skip_header` lines is split at the `delimiter` character, and characters following the `comments` character are discarded. Parameters -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED*** -======= ---------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ----------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c fname : file or str File, filename, or generator to read. If the filename extension is `.gz` or `.bz2`, the file is first decompressed. Note that @@ -53,15 +33,7 @@ converters : variable, optional The converters can also be used to provide a default value for missing data: ``converters = {3: lambda s: float(s or 0)}``. missing_values : variable, optional -<<<<<<< HEAD -<<<<<<< HEAD - The set of strings corresponding to ***REMOVED*** -======= - The set of strings corresponding to missing data. ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= The set of strings corresponding to missing data. ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c filling_values : variable, optional The set of values to be used as default when the data are missing. usecols : sequence, optional @@ -110,7 +82,7 @@ out : ndarray See Also -------- -TextAdapter.loadtxt : equivalent function when no data is missing. +iopro.loadtxt : equivalent function when no data is missing. Notes ----- @@ -124,13 +96,13 @@ Notes Examples --------- - >>> import TextAdapter + >>> import iopro >>> from io import StringIO Comma delimited file with mixed dtype >>> s = StringIO("1,1.3,abcde") - >>> data = TextAdapter.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), + >>> data = iopro.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'), ... ('mystring','S5')], delimiter=",") >>> data array((1, 1.3, 'abcde'), @@ -139,7 +111,7 @@ Comma delimited file with mixed dtype Using dtype = None >>> s.seek(0) # needed for StringIO example only - >>> data = TextAdapter.genfromtxt(s, dtype=None, + >>> data = iopro.genfromtxt(s, dtype=None, ... names = ['myint','myfloat','mystring'], delimiter=",") >>> data array((1, 1.3, 'abcde'), @@ -148,7 +120,7 @@ Using dtype = None Specifying dtype and names >>> s.seek(0) - >>> data = TextAdapter.genfromtxt(s, dtype="i8,f8,S5", + >>> data = iopro.genfromtxt(s, dtype="i8,f8,S5", ... names=['myint','myfloat','mystring'], delimiter=",") >>> data array((1, 1.3, 'abcde'), @@ -157,7 +129,7 @@ Specifying dtype and names An example with fixed-width columns >>> s = StringIO("11.3abcde") - >>> data = TextAdapter.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], + >>> data = iopro.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'], ... delimiter=[1,3,5]) >>> data array((1, 1.3, 'abcde'), diff --git a/docs/index.rst b/docs/index.rst index 34ed1c8..a18194c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,51 +1,68 @@ ----- -TextAdapter +IOPro ----- -TextAdapter loads NumPy arrays (and Pandas DataFrames) directly from files, -including ones with millions of rows--without creating millions of -temporary, intermediate Python objects, or requiring expensive array -resizing operations. +IOPro loads NumPy arrays (and Pandas DataFrames) directly from files, SQL +databases, and NoSQL stores--including ones with millions of rows--without +creating millions of temporary, intermediate Python objects, or requiring +expensive array resizing operations. -TextAdapter provides a drop-in replacement for the NumPy functions -:code:`loadtxt()` and :code:`genfromtxt()`, but dramatically improves -performance and reduces memory overhead. +IOPro provides a drop-in replacement for the +NumPy functions :code:`loadtxt()` and :code:`genfromtxt()`, but dramatically +improves performance and reduces memory overhead. + +The current version of IOPro 1.9 was released on July 30, 2016. + +How to get IOPro +---------------- + +IOPro is included with `Anaconda Workgroup and Anaconda Enterprise +subscriptions `_. + +To start a 30-day free trial just download and install the IOPro package. If you already have `Anaconda `_ (free Python platform) or `Miniconda `_ installed:: conda update conda - conda install TextAdapter + conda install iopro If you do not have Anaconda installed, you can `download it `_. +For more information about IOPro please contact `sales@continuum.io +`_. + +Requirements +------------ + +* Python 2.7 or 3.4+ +* NumPy 1.10+ + +Optional Python modules: + +* Boto (for S3 support) +* Pandas (to use DataFrames) + +What's new in version 1.9? +-------------------------- + +The documentation has been substantially updated for version 1.9.0. +Numba has been removed and the code has been cleaned up, but no other +features were added or removed. Some refactoring was done that didn't +change functionality. We recommend that users not use older versions. +See :doc:`Release notes ` for additional detail. + Getting started -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***---- -======= ---------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= --------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c Some of the basic usage patterns look like these. Create TextAdapter object for data source:: -<<<<<<< HEAD -***REMOVED*** -<<<<<<< HEAD -======= >>> import iopro ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 >>> adapter = iopro.text_adapter('data.csv', parser='csv') -======= - >>> adapter = TextAdapter.text_adapter('data.csv', parser='csv') ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c Define field dtypes (example: set field 0 to unsigned int and field 4 to float):: @@ -55,62 +72,30 @@ float):: Parse text and store records in NumPy array using slicing notation:: >>> # read all records -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED*** -======= >>> array = adapter[:] ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= - >>> array = adapter[:] ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c >>> # read first ten records >>> array = adapter[0:10] >>> # read last record -<<<<<<< HEAD -<<<<<<< HEAD - ***REMOVED*** -======= >>> array = adapter[-1] ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c >>> # read every other record >>> array = adapter[::2] User guide -<<<<<<< HEAD -***REMOVED*** -======= - >>> array = adapter[-1] - - >>> # read every other record - >>> array = adapter[::2] - -User guide ----------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ---------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c .. toctree:: :maxdepth: 1 install textadapter_examples + eula + release-notes Reference guide -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***---- -======= ---------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= --------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c .. toctree:: :maxdepth: 1 @@ -119,80 +104,9 @@ Reference guide loadtxt genfromtxt -Requirements -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***- -======= ------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* python 2.7, or 3.5+ -* numpy 1.10+ - -Python modules (optional): - -* boto (for S3 support) -* Pandas (to use DataFrames) - -<<<<<<< HEAD -What's new in version 1.9? -<<<<<<< HEAD -***REMOVED***--- -======= --------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -What's new in version 2.0? --------------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -The documentation has been substantially updated for version IOPro -1.9.0 and TextAdapter 2.0. - -Numba has been removed and the code has been cleaned up, but no other -features were added or removed. Some refactoring was done that didn't -change functionality. We recommend that users not use older versions. -See Release notes for additional detail. - -Release notes -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-- -======= -------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -.. toctree:: - :maxdepth: 1 - - release-notes - -<<<<<<< HEAD -License Agreement -<<<<<<< HEAD -***REMOVED***------ -======= ------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -.. toctree:: - :maxdepth: 1 - - eula Previous Versions -<<<<<<< HEAD -***REMOVED***------ -======= ----------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 This documentation is provided for the use of our customers who have not yet upgraded to the current version. @@ -203,5 +117,3 @@ NOTE: We recommend that users not use older versions of IOPro. :maxdepth: 1 IOPro 1.8.0 <1.8.0/index> -======= ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c diff --git a/docs/install.rst b/docs/install.rst index 97808d6..f66df95 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -4,65 +4,47 @@ Installation If you do not already have Anaconda installed, please download it via the `downloads page `_ and install it. -<<<<<<< HEAD -======= -TextAdapter is included with `Anaconda Workgroup and Anaconda Enterprise +IOPro is included with `Anaconda Workgroup and Anaconda Enterprise subscriptions `_. -To start a 30-day free trial just download and install the TextAdapter package. +To start a 30-day free trial just download and install the IOPro package. ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c If you already have `Anaconda `_ (free Python platform) or `Miniconda ` installed:: conda update conda - conda install TextAdapter + conda install iopro If you do not have Anaconda installed, you can `download it `_. -<<<<<<< HEAD - -TextAdapter Update Instructions -<<<<<<< HEAD -***REMOVED***-- -======= -------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -TextAdapter can also be installed into your own (non-Anaconda) Python environment. -For more information about TextAdapter please contact `sales@continuum.io +For more information about IOPro please contact `sales@continuum.io `_. -TextAdapter Update Instructions +IOPro Update Instructions ------------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c If you have Anaconda (free Python platform) installed, first update the conda package management tool to the latest version, then use conda -to update the TextAdapter product installation:: +to update the IOPro product installation:: conda update conda - conda update TextAdapter + conda update iopro Uninstall --------- To uninstall using conda:: - conda remove TextAdapter -<<<<<<< HEAD - -======= + conda remove iopro Installing license ------------------ -The TextAdapter license can be installed with the graphical Anaconda Navigator license +The IOPro license can be installed with the graphical Anaconda Navigator license manager or manually with your operating system. In your organization this may be handled by your site administrator or IT department. Both installation methods are explained in the :doc:`License installation ` page. ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c diff --git a/docs/loadtxt.rst b/docs/loadtxt.rst index c732fcf..106045c 100644 --- a/docs/loadtxt.rst +++ b/docs/loadtxt.rst @@ -1,33 +1,13 @@ -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-- -TextAdapter.loadtxt -***REMOVED***-- -======= ------------- -TextAdapter.loadtxt +iopro.loadtxt ------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------- -TextAdapter.loadtxt -------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c Load data from a text file. Each row in the text file must have the same number of values. Parameters -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED*** -======= ----------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ---------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c fname : file or str File, filename, or generator to read. If the filename extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note that @@ -48,7 +28,7 @@ converters : dict, optional A dictionary mapping column number to a function that will convert that column to a float. E.g., if column 0 is a date string: ``converters = {0: datestr2num}``. Converters can also be used to - provide a default value for missing data (but see also `TextAdapter.genfromtxt`): + provide a default value for missing data (but see also `iopro.genfromtxt`): ``converters = {3: lambda s: float(s.strip() or 0)}``. Default: None. skiprows : int, optional Skip the first `skiprows` lines; default: 0. @@ -58,7 +38,7 @@ usecols : sequence, optional The default, None, results in all columns being read. unpack : bool, optional If True, the returned array is transposed, so that arguments may be - unpacked using ``x, y, z = TextAdapter.loadtxt(...)``. When used with a record + unpacked using ``x, y, z = iopro.loadtxt(...)``. When used with a record data-type, arrays are returned for each field. Default is False. ndmin : int, optional The returned array will have at least `ndmin` dimensions. @@ -73,29 +53,29 @@ out : ndarray See Also -------- -TextAdapter.genfromtxt : Load data with missing values handled as specified. +iopro.genfromtxt : Load data with missing values handled as specified. Examples -------- simple parse of StringIO object data - >>> import TextAdapter + >>> import iopro >>> from io import StringIO # StringIO behaves like a file object >>> c = StringIO("0 1\\n2 3") - >>> TextAdapter.loadtxt(c) + >>> iopro.loadtxt(c) >>> array([[ 0., 1.], [ 2., 3.]]) set dtype of output array >>> d = StringIO("M 21 72\\nF 35 58") - >>> TextAdapter.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), + >>> iopro.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), ... 'formats': ('S1', 'i4', 'f4')}) >>> array([('M', 21, 72.0), ('F', 35, 58.0)], dtype=[('gender', '|S1'), ('age', '>> c = StringIO("1,0,2\\n3,0,4") - >>> x, y = TextAdapter.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) + >>> x, y = iopro.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) >>> x >>> array([ 1., 3.]) >>> y diff --git a/docs/make.bat b/docs/make.bat index 37eb1d4..66810dd 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -99,9 +99,9 @@ if "%1" == "qthelp" ( echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\TextAdapter.qhcp + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\IOPro.qhcp echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\TextAdapter.ghc + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\IOPro.ghc goto end ) diff --git a/docs/pyodbc.rst b/docs/pyodbc.rst deleted file mode 100644 index f89d3ef..0000000 --- a/docs/pyodbc.rst +++ /dev/null @@ -1,155 +0,0 @@ -<<<<<<< HEAD -***REMOVED***- -iopro.pyodbc -***REMOVED***- -======= ------------- -iopro.pyodbc ------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -This project is an enhancement of the Python database module for ODBC -that implements the Python DB API 2.0 specification. You can see the -original project here: - -:homepage: http://code.google.com/p/pyodbc -:source: http://github.com/mkleehammer/pyodbc -:source: http://code.google.com/p/pyodbc/source/list - -The enhancements are documented in this file. For general info about -the pyodbc package, please refer to the original project -documentation. - -This module enhancement requires: - -* Python 2.4 or greater -* ODBC 3.0 or greater -* NumPy 1.5 or greater (1.7 is required for datetime64 support) - -The enhancements in this module consist mainly in the addition of some -new methods for fetching the data after a query and put it in a -variety of NumPy containers. - -Using NumPy as data containers instead of the classical list of tuples -has a couple of advantages: - -1) The NumPy container is much more compact, and hence, it -requires much less memory, than the original approach. - -2) As a NumPy container can hold arbitrarily large arrays, it requires -much less object creation than the original approach (one Python -object per datum retrieved). - -This means that this enhancements will allow to fetch data out of -relational databases in a much faster way, while consuming -significantly less resources. - - -API additions -============= - -Variables -~~~~~~~~~ - -* `pyodbc.npversion` The version for the NumPy additions - -Methods -~~~~~~~ - -**Cursor.fetchdictarray** (size=cursor.arraysize) - -This is similar to the original `Cursor.fetchmany(size)`, but the data -is returned in a dictionary where the keys are the names of the -columns and the values are NumPy containers. - -For example, it a SELECT is returning 3 columns with names 'a', 'b' -and 'c' and types `varchar(10)`, `integer` and `timestamp`, the -returned object will be something similar to:: - - {'a': array([...], dtype='S11'), - 'b': array([...], dtype=int32), - 'c': array([...], dtype=datetime64[us])} - -Note that the `varchar(10)` type is translated automatically to a -string type of 11 elements ('S11'). This is because the ODBC driver -needs one additional space to put the trailing '\0' in strings, and -NumPy needs to provide the room for this. - -Also, it is important to stress that all the `timestamp` types are -translated into a NumPy `datetime64` type with a resolution of -microseconds by default. - -**Cursor.fetchsarray** (size=cursor.arraysize) - -This is similar to the original `Cursor.fetchmany(size)`, but the data -is returned in a NumPy structured array, where the name and type of -the fields matches to those resulting from the SELECT. - -Here it is an example of the output for the SELECT above:: - - array([(...), - (...)], - dtype=[('a', '|S11'), ('b', '>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - -This demo shows the basic capabilities for the iopro.pyodbc module. It first will connect with the database of your choice by ODBC, create and fill a new table (market) and then retrieve data with different methods (fetchall(), fetchdictarray() and fetchsarray()). - -Author: Francesc Alted, Continuum Analytics - - -:: - -<<<<<<< HEAD -***REMOVED***.pyodbc as pyodbc -======= - >>> import iopro.pyodbc as pyodbc ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - >>> # Open the database (use the most appropriate for you) - >>> connect_string = 'DSN=odbcsqlite;DATABASE=market.sqlite' # SQLite - >>> #connect_string = 'Driver={SQL Server};SERVER=MyWinBox;DATABASE=Test;USER=Devel;PWD=XXX' # SQL Server - >>> #connect_string = 'DSN=myodbc3;UID=devel;PWD=XXX;DATABASE=test' # MySQL - >>> #connect_string = 'DSN=PSQL;UID=devel;PWD=XXX;DATABASE=test' # PostgreSQL - >>> connection = pyodbc.connect(connect_string) - >>> cursor = connection.cursor() - - - - - - - -Create the test table (optional if already done) -<<<<<<< HEAD -***REMOVED******REMOVED***-- -======= ------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - -:: - - >>> try: - ... cursor.execute('drop table market') - ... except: - ... pass - >>> cursor.execute('create table market (symbol_ varchar(5), open_ float, low_ float, high_ float, close_ float, volume_ int)') - - - - - - - -Fill the test table (optional if already done) -<<<<<<< HEAD -***REMOVED******REMOVED*** -======= ----------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - -:: - - >>> from time import time - >>> t0 = time() - >>> N = 1000*1000 - >>> for i in xrange(N): - ... cursor.execute( - ... "insert into market(symbol_, open_, low_, high_, close_, volume_)" - ... " values (?, ?, ?, ?, ?, ?)", - ... (str(i), float(i), float(2*i), None, float(4*i), i)) - >>> cursor.execute("commit") # not supported by SQLite - >>> t1 = time() - t0 - >>> print "Stored %d rows in %.3fs" % (N, t1) - - - - - - - -Do the query in the traditional way -<<<<<<< HEAD -***REMOVED******REMOVED***- -======= ------------------------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - -:: - - >>> # Query of the full table using the traditional fetchall - >>> query = "select * from market" - >>> cursor.execute(query) - >>> %time all = cursor.fetchall() - CPU times: user 5.23 s, sys: 0.56 s, total: 5.79 s - Wall time: 7.09 s - - - - - - - - -Do the query and get a dictionary of NumPy arrays -<<<<<<< HEAD -***REMOVED******REMOVED***--- -======= -------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - -:: - - >>> # Query of the full table using the fetchdictarray (retrieve a dictionary of arrays) - >>> cursor.execute(query) - >>> %time dictarray = cursor.fetchdictarray() - CPU times: user 0.92 s, sys: 0.10 s, total: 1.02 s - Wall time: 1.44 s - - - - - - - - -Peek into the retrieved data -<<<<<<< HEAD -***REMOVED***----- -======= ----------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - -:: - - >>> dictarray.keys() - ['high_', 'close_', 'open_', 'low_', 'volume_', 'symbol_'] - >>> dictarray['high_'] - array([ nan, nan, nan, ..., nan, nan, nan]) - >>> dictarray['symbol_'] - array(['0', '1', '2', ..., '99999', '99999', '99999'], dtype='|S6') - - - - - - - -Do the query and get a NumPy structured array -<<<<<<< HEAD -***REMOVED******REMOVED******REMOVED*** -======= ---------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - -:: - - >>> # Query of the full table using the fetchsarray (retrieve a structured array) - >>> cursor.execute(query) - >>> %time sarray = cursor.fetchsarray() - CPU times: user 1.08 s, sys: 0.11 s, total: 1.20 s - Wall time: 1.99 s - - - - - - - - -Peek into retrieved data -<<<<<<< HEAD -***REMOVED***- -======= ------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - -:: - - >>> sarray.dtype - dtype([('symbol_', 'S6'), ('open_', '<f8'), ('low_', '<f8'), ('high_', '<f8'), ('close_', '<f8'), ('volume_', '<i4')]) - >>> sarray[0:10] - array([('0', 0.0, 0.0, nan, 0.0, 0), ('1', 1.0, 2.0, nan, 4.0, 1), - ('2', 2.0, 4.0, nan, 8.0, 2), ('3', 3.0, 6.0, nan, 12.0, 3), - ('4', 4.0, 8.0, nan, 16.0, 4), ('5', 5.0, 10.0, nan, 20.0, 5), - ('6', 6.0, 12.0, nan, 24.0, 6), ('7', 7.0, 14.0, nan, 28.0, 7), - ('8', 8.0, 16.0, nan, 32.0, 8), ('9', 9.0, 18.0, nan, 36.0, 9)], - dtype=[('symbol_', 'S6'), ('open_', '<f8'), ('low_', '<f8'), ('high_', '<f8'), ('close_', '<f8'), ('volume_', '<i4')]) - >>> sarray['symbol_'] - array(['0', '1', '2', ..., '99999', '99999', '99999'], dtype='|S6') - - - - - - - - diff --git a/docs/pyodbc_firststeps.rst b/docs/pyodbc_firststeps.rst deleted file mode 100644 index 0193630..0000000 --- a/docs/pyodbc_firststeps.rst +++ /dev/null @@ -1,481 +0,0 @@ -<<<<<<< HEAD -***REMOVED***-- -iopro.pyodbc First Steps -***REMOVED***-- -======= -------------------------- -iopro.pyodbc First Steps -------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -iopro.pyodbc extends pyodbc with methods that allow data to be fetched directly into numpy containers. These functions are faster than regular fetch calls in pyodbc, providing also the convenience of being returned in a container appropriate to fast analysis. - - -This notebook is intended to be a tutorial on iopro.pyodbc. Most of the material is applicable to pyodbc (and based on pyodbc tutorials). There will be some examples specific to iopro.pyodbc. When that's the case, it will be noted. - - -Concepts --------- - - - -In pyodbc there are two main classes to understand: - * connection - * cursor - -A connection is, as its name says, a connection to a datasource. A datasource is your database. It may be a database handled by a DBMS or just a plain file. -A cursor allows you to interface with statements. Interaction with queries and other commands is performed through a cursor. A cursor is associated to a connection and commands over a cursor are performed over that connection to the datasource. -In order to use iopro.pyodbc you must import it:: - -<<<<<<< HEAD -***REMOVED***.pyodbc as pyodbc - -Connection to a datasource -***REMOVED***--- -======= - >>> import iopro.pyodbc as pyodbc - -Connection to a datasource --------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - -In order to operate with pyodbc you need to connect to a datasource. Typically this will be a database. This is done by creating a connection object. -To create a connection object you need a connection string. This string describes the datasource to use as well as some extra parameters. You can learn more about connection strings here.:: - - >>> connection_string = '''DSN=SQLServerTest;DATABASE=Test''' - >>> connection = pyodbc.connect(connection_string) - -pyodbc.connect supports a keyword parameter autocommit. This controls the way the connection is handle. The default value (False) means that the commands that modify the database statements need to be committed explicitly. All commands between commits will form a single transaction. If autocommit is enabled every command will be issued and committed. -It is also possible to change autocommit status after the connection is established.:: - - >>> connection.autocommit = True #enable autocommit - >>> connection.autocommit = False # disable autocommit - -When not in autocommit mode, you can end a transaction by either commiting it or rolling it back.:: - - In[6]: connection.commit() # commit the transaction - In[7]: connection.rollback() # rollback the transaction - -Note that commit/rollback is always performed at the connection level. pyodbc provides a commit/rollback method in the cursor objects, but they will act on the associated connection. - - - -Working with cursors -<<<<<<< HEAD -***REMOVED***--------- -======= --------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - -Command execution in pyodbc is handled through cursors. You can create a cursor from a connection using the cursor() method. The first step is creating a cursor:: - - In[8]: cursor = connection.cursor() - -With a cursor created, we can start issuing SQL commands using the execute method. - - - -Creating a sample table -<<<<<<< HEAD -***REMOVED*** -======= ------------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - - -First, create a sample table in the database. The following code will create a sample table with three columns of different types.:: - - >>> def create_test_table(cursor): - ... try: - ... cursor.execute('drop table test_table') - ... except: - ... pass - ... cursor.execute('''create table test_table ( - ... name varchar(10), - ... fval float(24), - ... ival int)''') - ... cursor.commit() - - >>> create_test_table(cursor) - -Filling the sample table with sample data -<<<<<<< HEAD -***REMOVED******REMOVED***------- -======= ------------------------------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - - -After creating the table, rows can be inserted by executing insert into the table. Note you can pass parameters by placing a ? into the SQL statement. The parameters will be taken in order for the sequence appears in the next parameter.:: - - - - >>> cursor.execute('''insert into test_table values (?,?,?)''', ('foo', 3.0, 2)) - >>> cursor.rowcount - 1 - - - - - - -Using executemany a sequence of parameters to the SQL statement can be passed and the statement will be executed many times, each time with a different parameter set. This allows us to easily insert several rows into the database so that we have a small test set::: - - - - >>> cursor.executemany('''insert into test_table values (?,?,?)''', [ - ... ('several', 2.1, 3), - ... ('tuples', -1.0, 2), - ... ('can', 3.0, 1), - ... ('be', 12.0, -3), - ... ('inserted', 0.0, -2), - ... ('at', 33.0, 0), - ... ('once', 0.0, 0) - ... ]) - - - - - - -Remember that if autocommit is turned off the changes won't be visible to any other connection unless we commit.:: - - - - >>> cursor.commit() # remember this is a shortcut to connection.commit() method - - - - - - - -Querying the sample data from the sample table -<<<<<<< HEAD -***REMOVED******REMOVED*** -======= ----------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - - -Having populated our sample database, we can retrieve the inserted data by executing select statements::: - - - - >>> cursor.execute('''select * from test_table''') - - - - - - - -After calling execute with the select statement we need to retrieve the data. This can be achieved by calling fetch methods in the cursor -fetchone fetches the next row in the cursor, returning it in a tuple:: - - - - >>> cursor.fetchone() - ('foo', 3.0, 2) - - - - - - -fetchmany retrieves several rows at a time in a list of tuples:: - - - - >>> cursor.fetchmany(3) - [('several', 2.0999999046325684, 3), ('tuples', -1.0, 2), ('can', 3.0, 1)] - - - - - - -fetchall retrieves all the remaining rows in a list of tuples:: - - - - >>> cursor.fetchall() - [('be', 12.0, -3), ('inserted', 0.0, -2), ('at', 33.0, 0), ('once', 0.0, 0)] - - - - - - -All the calls to any kind of fetch advances the cursor, so the next fetch starts in the row after the last row fetched. -execute returns the cursor object. This is handy to retrieve the full query by chaining fetchall. This results in a one-liner::: - - - - >>> cursor.execute('''select * from test_table''').fetchall() - [('foo', 3.0, 2), - ('several', 2.0999999046325684, 3), - ('tuples', -1.0, 2), - ('can', 3.0, 1), - ('be', 12.0, -3), - ('inserted', 0.0, -2), - ('at', 33.0, 0), - ('once', 0.0, 0)] - - - - - - - -iopro.pyodbc extensions -<<<<<<< HEAD -***REMOVED*** -======= ------------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - - -When using iopro.pyodbc it is possible to retrieve the results from queries directly into numpy containers. This is accomplished by using the new cursor methods fetchdictarray and fetchsarray. - - - -fetchdictarray -<<<<<<< HEAD -***REMOVED***--- -======= --------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - - -fetchdictarray fetches the results of a query in a dictionary. By default fetchdictarray fetches all remaining rows in the cursor.:: - - - - >>> cursor.execute('''select * from test_table''') - >>> dictarray = cursor.fetchdictarray() - >>> type(dictarray) - dict - - - - - - -The keys in the dictionary are the column names::: - - >>> dictarray.keys() - ['ival', 'name', 'fval'] - - - - - - -Each column name is mapped to a numpy array (ndarray) as its value::: - - - - >>> ', '.join([type(dictarray[i]).__name__ for i in dictarray.keys()]) - 'ndarray, ndarray, ndarray' - - - - - - -The types of the numpy arrays are infered from the database column information. So for our columns we get an appropriate numpy type. Note that in the case of name the type is a string of 11 characters even if in test_table is defined as varchar(10). The extra parameter is there to null-terminate the string::: - - >>> ', '.join([repr(dictarray[i].dtype) for i in dictarray.keys()]) - "dtype('int32'), dtype('|S11'), dtype('float32')" - - - - - - -The numpy arrays will have a shape containing a single dimension with the number of rows fetched::: - - - - >>> ', '.join([repr(dictarray[i].shape) for i in dictarray.keys()]) - '(8L,), (8L,), (8L,)' - - - - - - -The values in the different column arrays are index coherent. So in order to get the values associated to a given row it suffices to access each column using the appropriate index. The following snippet shows this correspondence::: - - - - >>> print '\n'.join( - ... [', '.join( - ... [repr(dictarray[i][j]) for i in dictarray.keys()]) - ... for j in range(dictarray['name'].shape[0])]) - 2, 'foo', 3.0 - 3, 'several', 2.0999999 - 2, 'tuples', -1.0 - 1, 'can', 3.0 - -3, 'be', 12.0 - -2, 'inserted', 0.0 - 0, 'at', 33.0 - 0, 'once', 0.0 - - - - - - - -Having the results in numpy containers makes it easy to use numpy to analyze the data::: - - - - >>> import numpy as np - >>> np.mean(dictarray['fval']) - 6.5124998092651367 - - - - - - -fetchdictarray accepts an optional parameter that places an upper bound to the number of rows to fetch. If there are not enough elements left to be fetched in the cursor the arrays resulting will be sized accordingly. This way it is possible to work with big tables in chunks of rows.:: - - - - >>> cursor.execute('''select * from test_table''') - >>> dictarray = cursor.fetchdictarray(6) - >>> print dictarray['name'].shape - (6L,) - >>> dictarray = cursor.fetchdictarray(6) - >>> print dictarray['name'].shape - (2L,) - -fetchsarray -<<<<<<< HEAD -***REMOVED*** -======= ------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - - -fetchsarray fetches the result of a query in a numpy structured array.:: - - - - >>> cursor.execute('''select * from test_table''') - >>> sarray = cursor.fetchsarray() - >>> print sarray - [('foo', 3.0, 2) ('several', 2.0999999046325684, 3) ('tuples', -1.0, 2) - ('can', 3.0, 1) ('be', 12.0, -3) ('inserted', 0.0, -2) ('at', 33.0, 0) - ('once', 0.0, 0)] - - - -The type of the result is a numpy array (ndarray)::: - - - - >>> type(sarray) - numpy.ndarray - - - - - - -The dtype of the numpy array contains the description of the columns and their types::: - - - - >>> sarray.dtype - dtype([('name', '|S11'), ('fval', '<f4'), ('ival', '<i4')]) - - - - - - -The shape of the array will be one-dimensional, with cardinality equal to the number of rows fetched::: - - - - >>> sarray.shape - (8L,) - - - - - - -It is also possible to get the shape of a column. In this way it will look similar to the code needed when using dictarrays:: - - - - >>> sarray['name'].shape - (8L,) - - - - - - -In a structured array it is as easy to access data by row or by column::: - - - - >>> sarray['name'] - array(['foo', 'several', 'tuples', 'can', 'be', 'inserted', 'at', 'once'], - dtype='|S11') - - - - - - - - >>> sarray[0] - ('foo', 3.0, 2) - - - - - - -It is also very easy and efficient to feed data into numpy functions::: - - - - >>> np.mean(sarray['fval']) - 6.5124998092651367 - - - - - - - -fetchdictarray vs fetchsarray -<<<<<<< HEAD -***REMOVED***------ -======= ------------------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - - -Both methods provide ways to input data from a database into a numpy-friendly container. The structured array version provides more flexibility extracting rows in an easier way. The main difference is in the memory layout of the resulting object. An in-depth analysis of this is beyond the scope of this notebook. Suffice it to say that you can view the dictarray laid out in memory as an structure of arrays (in fact, a dictionary or arrays), while the structured array would be laid out in memory like an array of structures. This can make a lot of difference performance-wise when working with large chunks of data. - - - diff --git a/docs/release-notes.rst b/docs/release-notes.rst deleted file mode 100644 index 01e38eb..0000000 --- a/docs/release-notes.rst +++ /dev/null @@ -1,391 +0,0 @@ -TextAdapter Release Notes -========================= - -2016-10-30: 2.0.0 -<<<<<<< HEAD -***REMOVED***------ -======= ------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -* Release the closed source of IOPro as Freee Software. Touch up some -naming issues and small tweaks to build scripts, documentation, etc. - -IOPro Release Notes -=================== - -2016-07-30: 1.9.0 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Remove warnings and documentation for unsupported Numba use -* Rewrite most documentation for clarity and accuracy -* Improve unit tests - - -2016-04-05: 1.8.0: -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-------- -======= -------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Add PostgresAdapter for reading data from PostgreSQL databases -* Add AccumuloAdapter for reading data from Accumulo databases - - -2015-10-09: 1.7.2: -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-------- -======= -------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix an issue with pyodbc where result NumPy arrays could return - uninitialized data after the actual data null character. Now it pads - the results with nulls. - - -2015-05-04: 1.7.1 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Properly cache output string objects for better performance - - -2015-03-02: 1.7.0 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-------- -======= -------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Add Python 3 support -* Add support for parsing utf8 text files -* Add ability to set/get field types in MongoAdapter - - -2015-02-02: 1.6.11 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-------- -======= -------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue with escape char not being parsed correctly inside quoted strings - - -2014-12-17: 1.6.10 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***-------- -======= -------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue with using field filters with json parser - - -2014-12-02: 1.6.9 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue with json field names getting mixed up - - -2014-11-20: 1.6.8 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue with return nulls returning wrong "null" for large queries - (more than 10000 rows) in some circumstances. -* Fix issue with reading slices of json data -* Change json parser so that strings fields of numbers do not get converted - to number type by default -* Allow json field names to be specified with field_names constructor - argument -* If user does not specify json field names, use json attribute names as - field names in array result - - -2014-07-03: 1.6.7 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue when reading more than 10000 rows containing unicode strings in platform where ODBC uses UTF-16/UCS2 encoding (notably Windows and unixODBC). The resulting data could be corrupt. - - -2014-06-16: 1.6.6 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix possible segfault when dealing with unicode strings in platforms where ODBC uses UTF-16/UCS2 encoding (notably Windows and unixODBC) -* Add iopro_set_text_limit function to iopro. It globally limits the size of text fields read by fetchdictarray and fetchsarray. By default it is set to 1024 characters. -* Fix possible segfault in fetchdictarray and fetchsarray when failing to allocate some NumPy array. This could notably happen in the presence of "TEXT" fields. Now it will raise an OutOfMemory error. -* Add lazy loading of submodules in IOPro. This reduces upfront import time of IOPro. Features are imported as they are used for the first time. - - -2014-05-07: 1.6.5 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix crash when building textadapter index - - -2014-04-29: 1.6.4 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix default value for null strings in IOPro/pyodbc changed to be an empty string instead of 'NA'. NA was not appropriate as it can collide with valid data (Namibia country code is 'NA', for example), and it failed with single character columns. -* Ignore SQlRowCount when performing queries with fetchsarray and fetchdictarray, since SQLRowCount sometimes returns incorrect number of rows. - - -2014-03-25: 1.6.3 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix SQL TINYINT is now returned as an unsigned 8 bit integer in fetchdictarray/fetchsarray. This is to match the range specified in SQL (0...255). It was being returned as a signed 8 bit integer before (range -128...127) -* Add Preliminary unicode string support in fetchdictarray/fetchsarray. - - -2014-02-12: 1.6.2 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Disable Numba support for version 0.12 due to lack of string support. - - -2014-01-30: 1.6.1 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix a regression that made possible some garbage in string fields when using fetchdictarray/fetchsarray. -* Fix a problem where heap corruption could happen in IOPro.pyodbc fetchdictarray/fetchsarray related to nullable string fields. -* Fix the allocation guard debugging code: iopro.pyodbc.enable_mem_guards(True|False) should no longer crash. -* Merge Vertica fix for cancelling queries - - -2013-10-30: 1.6.0 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Add JSON support -* Misc bug fixes -* Fix crash in IOPro.pyodbc when dealing with nullable datetimes in fetch_dictarray and fetch_sarray. - - -2013-06-12: 1.5.5 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Fix issue parsing negative ints with leading whitespace in csv data. - - -2013-06-10: 1.5.4 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Allow delimiter to be set to None for csv files with single field. -* Fill in missing csv fields with fill values. -* Fill in blank csv lines with fill values for pandas dataframe output. -* Allow list of field names for TextAdapter field_names parameter. -* Change default missing fill value to empty string for string fields. - - -2013-06-05: 1.5.3 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Temporary fix for IndexError exception in TextAdapter.__read_slice method. - - -2013-05-28: 1.5.2 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Add ability to specify escape character in csv data - - -2013-05-23: 1.5.1 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* fixed coredump when using datetime with numpy < 1.7 - - -2013-05-22: 1.5.0 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Added a cancel method to the Cursor object in iopro.pyodbc. - This method wraps ODBC SQLCancel. -* DECIMAL and NUMERIC types are now working on iopro.pyodbc on regular fetch - functions. They are still unsupported in fetchsarray and fetchdict and - fetchsarray -* Add ftp support -* Performance improvements to S3 support -* Misc bug fixes - - -2013-04-05: 1.4.3 -<<<<<<< HEAD -<<<<<<< HEAD -***REMOVED***------- -======= ------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c - -* Update loadtxt and genfromtxt to reflect numpy versions' behavior - for dealing with whitespace (default to any whitespace as delimiter, - and treat multiple whitespace as one delimiter) -* Add read/write field_names property -* Add support for pandas dataframes as output -* Misc bug fixes diff --git a/docs/release-notes.rst b/docs/release-notes.rst new file mode 120000 index 0000000..a535994 --- /dev/null +++ b/docs/release-notes.rst @@ -0,0 +1 @@ +../CHANGELOG \ No newline at end of file diff --git a/docs/textadapter_examples.rst b/docs/textadapter_examples.rst index bb6760b..32f03eb 100644 --- a/docs/textadapter_examples.rst +++ b/docs/textadapter_examples.rst @@ -5,7 +5,7 @@ TextAdapter First Steps Basic Usage ----------- -TextAdapter works by attaching to a data source, such as a local CSV file. Before we +IOPro works by attaching to a data source, such as a local CSV file. Before we get started, let's create a sample CSV file to work with:: from random import random, randint, shuffle @@ -31,16 +31,16 @@ easily fits in memory it would work to use the :code:`csv` or :code:`pandas` modules, but we will demonstrate the interfaces and capabilities that will apply to much larger data. - >>> import TextAdapter - >>> adapter = TextAdapter.text_adapter('data/table.csv', parser='csv') + >>> import iopro + >>> adapter = iopro.text_adapter('data/table.csv', parser='csv') >>> adapter.get_field_names() ['f1', 'f2', 'f3', 'f4', 'comment'] We can specify the data types for values in the columns of the CSV file being -read; but first we look at the ability of TextAdapter's TextAdapter to +read; but first we look at the ability of IOPro's TextAdapter to auto-discover the data types used. -We can ask TextAdapter's TextAdapter to parse text and return records in NumPy +We can ask IOPro's TextAdapter to parse text and return records in NumPy arrays from selected portions of the CSV file using slicing notation: >>> # the inferred datatypes @@ -135,14 +135,14 @@ Content of file :code:`data/one.json`: Single JSON object: - >>> adapter = TextAdapter.text_adapter('data/one.json', parser='json') + >>> adapter = iopro.text_adapter('data/one.json', parser='json') >>> adapter[:] array([(123, 'xxx')], dtype=[('id', '>> TextAdapter.text_adapter('data/two.json', parser='json')[:] + >>> iopro.text_adapter('data/two.json', parser='json')[:] array([(123, 'xxx'), (456, 'yyy')], dtype=[('id', '>> TextAdapter.text_adapter('data/three.json', parser='json')[:] + >>> iopro.text_adapter('data/three.json', parser='json')[:] array([(123, 'xxx'), (456, 'yyy')], dtype=[('id', '>> import TextAdapter, io, math + >>> import iopro, io, math >>> stream = io.StringIO('3,abc,3.3\n7,xxx,9.9\n4,,') - >>> adapter = TextAdapter.text_adapter(stream, parser='csv', field_names=False) + >>> adapter = iopro.text_adapter(stream, parser='csv', field_names=False) Override default converter for first field: @@ -192,7 +192,7 @@ We can also force data types and set fill values for missing data. Apply data types to columns: >>> stream = io.StringIO('3,abc,3.3\n7,xxx,9.9\n4,,') - >>> adapter = TextAdapter.text_adapter(stream, parser='csv', field_names=False) + >>> adapter = iopro.text_adapter(stream, parser='csv', field_names=False) >>> adapter.set_field_types({1:'S3', 2:'f4'}) >>> adapter[:] array([(3, b'abc', 3.299999952316284), (7, b'xxx', 9.899999618530273), @@ -212,7 +212,7 @@ Combining regular expressions and typecasting --------------------------------------------- A later section discusses regular expressions in more detail. This example -is a quick peek into using them with TextAdapter. +is a quick peek into using them with IOPro. Content of the file :code:`data/transactions.csv`: @@ -223,9 +223,9 @@ Content of the file :code:`data/transactions.csv`: Combining features: - >>> import TextAdapter + >>> import iopro >>> regex_string = '\$(\d)\.(\d{2}),\s*([0-9]+)\%,\s*([A-Za-z]+)' - >>> adapter = TextAdapter.text_adapter('data/transactions.csv', + >>> adapter = iopro.text_adapter('data/transactions.csv', ... parser='regex', ... regex_string=regex_string, ... field_names=False, @@ -245,10 +245,10 @@ Set dtype of fields and their names: Advanced TextAdapter -------------------- -``TextAdapter.loadtext()`` versus ``TextAdapter.genfromtxt()`` +``iopro.loadtext()`` versus ``iopro.genfromtxt()`` -------------------------------------------------- -Within TextAdapter there are two closely related functions. ``loadtext()``, +Within IOPro there are two closely related functions. ``loadtext()``, which we have been looking at, makes a more optimistic assumption that your data is well-formatted. ``genfromtxt()`` has a number of arguments for handling messier data, and special behaviors for dealing with @@ -262,10 +262,10 @@ a superset of these arguments. Gzip Support ------------ -TextAdapter can decompress gzip'd data on the fly, simply by indicating a +IOPro can decompress gzip'd data on the fly, simply by indicating a ``compression`` keyword argument. - >>> adapter = TextAdapter.text_adapter('data.gz', parser='csv', compression='gzip') + >>> adapter = iopro.text_adapter('data.gz', parser='csv', compression='gzip') >>> array = adapter[:] As well as being able to store and work with your compressed data without @@ -280,7 +280,7 @@ machines, especially between machines with HDD and SSD architecture.:: - gzip compressed: 14.54 sec In the test, the compressed file takes slightly longer, but consider having to -uncompress the file to disk before loading with TextAdapter: +uncompress the file to disk before loading with IOPro: - uncompressed: 13.38 sec - gzip compressed: 14.54 sec @@ -290,13 +290,13 @@ uncompress the file to disk before loading with TextAdapter: Indexing CSV Data ----------------- -One of the most useful features of TextAdapter is the ability to index data to +One of the most useful features of IOPro is the ability to index data to allow for fast random lookup. For example, to retrieve the last record of the compressed 109 MB dataset we used above:: - >>> adapter = TextAdapter.text_adapter('data.gz', parser='csv', compression='gzip') + >>> adapter = iopro.text_adapter('data.gz', parser='csv', compression='gzip') >>> array = adapter[-1] Retrieving the last record into a NumPy array takes 14.82 sec. This is @@ -315,14 +315,14 @@ Reloading the index only takes 0.18 sec. If you build an index once, you get near instant random access to your data forever (assuming the data remains static):: - >>> adapter = TextAdapter.text_adapter('data.gz', parser='csv', + >>> adapter = iopro.text_adapter('data.gz', parser='csv', ... compression='gzip', ... index_name='index_file') Let's try it with a moderate sized example. You can download this data from the `Exoplanets Data Explorer `_ site. - >>> adapter = TextAdapter.text_adapter('data/exoplanets.csv.gz', + >>> adapter = iopro.text_adapter('data/exoplanets.csv.gz', ... parser='csv', compression='gzip') >>> print(len(adapter[:]), "rows") >>> print(', '.join(adapter.field_names[:3]), @@ -369,7 +369,7 @@ Do some timing (using an IPython magic): CPU times: user 18.3 ms, sys: 1.96 ms, total: 20.3 ms Wall time: 20.1 ms - >>> new_adapter = TextAdapter.text_adapter('data/exoplanets.csv.gz', parser='csv', + >>> new_adapter = iopro.text_adapter('data/exoplanets.csv.gz', parser='csv', ... compression='gzip', ... index_name='data/exoplanets.index') @@ -384,7 +384,7 @@ Regular Expressions Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. --Jamie Zawinski -TextAdapter supports using regular expressions to help parse messy data. Take +IOPro supports using regular expressions to help parse messy data. Take for example the following snippet of actual NASDAQ stock data found on the Internet: @@ -398,12 +398,12 @@ The content of the file :code:`data/stocks.csv`: Microsoft,MSFT,NasdaqNM,24.30 - 32.95 The first three fields are easy enough: name, symbol, and exchange. The -fourth field presents a bit of a problem. Let's try TextAdapter's regular +fourth field presents a bit of a problem. Let's try IOPro's regular expression based parser: >>> regex_string = '([A-Za-z]+),([A-Z]{1,4}),([A-Za-z]+),'\ ... '(\d+.\.\d{2})\s*\-\s*(\d+.\.\d{2})' - >>> adapter = TextAdapter.text_adapter('data/stocks.csv', parser='regex', + >>> adapter = iopro.text_adapter('data/stocks.csv', parser='regex', ... regex_string=regex_string) >>> # Notice that header does not now match the regex @@ -441,7 +441,7 @@ fields. Exactly what we want. S3 Support ---------- -TextAdapter can parse CSV data stored in Amazon's S3 cloud storage service. In +IOPro can parse CSV data stored in Amazon's S3 cloud storage service. In order to access S3 files, you need to specify some credentials along with the resource you are accessing. @@ -499,14 +499,16 @@ raw XML query results. In simple form, we see details about some S3 resources. Let's access one of -them. +them. Note that you will need to fill in your actual AWS access key and secret key. - >>> from secrets import user_name, aws_access_key, aws_secret_key - >>> bucket = 'testing' + >>> user_name = "class1" + >>> aws_access_key = "ABCD" + >>> aws_secret_key = "EFGH/IJK" + >>> bucket = 'product-training' >>> key_name = 'BusinessRules.csv' # 21k lines, 8MB >>> # key_name = 'PlanAttributes.csv' # 77k lines, 95MB >>> # key_name = 'Rate.csv.gzip' # 13M lines, 2GB raw, 110MB compressed - >>> adapter = TextAdapter.s3_text_adapter(aws_access_key, aws_secret_key, + >>> adapter = iopro.s3_text_adapter(aws_access_key, aws_secret_key, ... bucket, key_name) >>> # Don't try with the really large datasets, works with the default one >>> df = adapter.to_dataframe() @@ -586,10 +588,10 @@ them.
    -TextAdapter can also build an index for S3 data just as with disk based CSV -data, and use the index for fast random access lookup. If an index file is -created with TextAdapter and stored with the S3 dataset in the cloud, -TextAdapter can use this remote index to download and parse just the subset -of records requested. This allows you to generate an index file once and -share it on the cloud along with the data set, and does not require others -to download the entire index file to use it. +IOPro can also build an index for S3 data just as with disk based CSV +data, and use the index for fast random access lookup. If an index file +is created with IOPro and stored with the S3 dataset in the cloud, IOPro +can use this remote index to download and parse just the subset of +records requested. This allows you to generate an index file once and +share it on the cloud along with the data set, and does not require +others to download the entire index file to use it. diff --git a/environment.yml b/environment.yml index aba5ee1..54a825e 100644 --- a/environment.yml +++ b/environment.yml @@ -1,4 +1,4 @@ -name: TextAdapter +name: textadapter dependencies: - ipython - numpy @@ -6,8 +6,5 @@ dependencies: - pytest - cython - pcre -- mongo-driver - zlib -- openssl -- postgresql - +- nose diff --git a/iopro/accumuloadapter/AccumuloAdapter.cpp b/iopro/accumuloadapter/AccumuloAdapter.cpp deleted file mode 100644 index 241ca3e..0000000 --- a/iopro/accumuloadapter/AccumuloAdapter.cpp +++ /dev/null @@ -1,11561 +0,0 @@ -/* Generated by Cython 0.24.1 */ - -#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. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. -#else -#define CYTHON_ABI "0_24_1" -#include -#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 -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 -#endif -#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 - #define CYTHON_USE_PYLONG_INTERNALS 1 -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#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_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#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 - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - 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_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if PY_VERSION_HEX >= 0x030500B1 -#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods -#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) -#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; -} __Pyx_PyAsyncMethodsStruct; -#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) -#else -#define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef __cplusplus - #error "Cython files generated with the C++ option must be compiled with a C++ compiler." -#endif -#ifndef CYTHON_INLINE - #define CYTHON_INLINE inline -#endif -template -void __Pyx_call_destructor(T& x) { - x.~T(); -} -template -class __Pyx_FakeReference { - public: - __Pyx_FakeReference() : ptr(NULL) { } - __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } - T *operator->() { return ptr; } - operator T&() { return *ptr; } - private: - T *ptr; -}; - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#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_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#endif - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__iopro__accumuloadapter__AccumuloAdapter -#define __PYX_HAVE_API__iopro__accumuloadapter__AccumuloAdapter -#include "string.h" -#include "stdio.h" -#include "stdlib.h" -#include "numpy/arrayobject.h" -#include "numpy/ufuncobject.h" -#include -#include "ios" -#include "new" -#include "stdexcept" -#include "typeinfo" -#include "_stdint.h" -#include "accumulo_adapter.h" -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -#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) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_COMPILING_IN_CPYTHON -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - -/* None.proto */ -#if !defined(CYTHON_CCOMPLEX) - #if defined(__cplusplus) - #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) - #define CYTHON_CCOMPLEX 1 - #else - #define CYTHON_CCOMPLEX 0 - #endif -#endif -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #include - #else - #include - #endif -#endif -#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) - #undef _Complex_I - #define _Complex_I 1.0fj -#endif - - -static const char *__pyx_f[] = { - "iopro/accumuloadapter/AccumuloAdapter.pyx", - "__init__.pxd", - "stringsource", - "type.pxd", -}; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":725 - * # in Cython to enable them only on the right systems. - * - * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t - */ -typedef npy_int8 __pyx_t_5numpy_int8_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":726 - * - * ctypedef npy_int8 int8_t - * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< - * ctypedef npy_int32 int32_t - * ctypedef npy_int64 int64_t - */ -typedef npy_int16 __pyx_t_5numpy_int16_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":727 - * ctypedef npy_int8 int8_t - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< - * ctypedef npy_int64 int64_t - * #ctypedef npy_int96 int96_t - */ -typedef npy_int32 __pyx_t_5numpy_int32_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":728 - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t - * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< - * #ctypedef npy_int96 int96_t - * #ctypedef npy_int128 int128_t - */ -typedef npy_int64 __pyx_t_5numpy_int64_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":732 - * #ctypedef npy_int128 int128_t - * - * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t - */ -typedef npy_uint8 __pyx_t_5numpy_uint8_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":733 - * - * ctypedef npy_uint8 uint8_t - * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< - * ctypedef npy_uint32 uint32_t - * ctypedef npy_uint64 uint64_t - */ -typedef npy_uint16 __pyx_t_5numpy_uint16_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":734 - * ctypedef npy_uint8 uint8_t - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< - * ctypedef npy_uint64 uint64_t - * #ctypedef npy_uint96 uint96_t - */ -typedef npy_uint32 __pyx_t_5numpy_uint32_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":735 - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t - * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< - * #ctypedef npy_uint96 uint96_t - * #ctypedef npy_uint128 uint128_t - */ -typedef npy_uint64 __pyx_t_5numpy_uint64_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":739 - * #ctypedef npy_uint128 uint128_t - * - * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< - * ctypedef npy_float64 float64_t - * #ctypedef npy_float80 float80_t - */ -typedef npy_float32 __pyx_t_5numpy_float32_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":740 - * - * ctypedef npy_float32 float32_t - * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< - * #ctypedef npy_float80 float80_t - * #ctypedef npy_float128 float128_t - */ -typedef npy_float64 __pyx_t_5numpy_float64_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":749 - * # The int types are mapped a bit surprising -- - * # numpy.int corresponds to 'l' and numpy.long to 'q' - * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t - * ctypedef npy_longlong longlong_t - */ -typedef npy_long __pyx_t_5numpy_int_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":750 - * # numpy.int corresponds to 'l' and numpy.long to 'q' - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":751 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t - * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< - * - * ctypedef npy_ulong uint_t - */ -typedef npy_longlong __pyx_t_5numpy_longlong_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":753 - * ctypedef npy_longlong longlong_t - * - * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t - * ctypedef npy_ulonglong ulonglong_t - */ -typedef npy_ulong __pyx_t_5numpy_uint_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":754 - * - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t - * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":755 - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t - * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< - * - * ctypedef npy_intp intp_t - */ -typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":757 - * ctypedef npy_ulonglong ulonglong_t - * - * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< - * ctypedef npy_uintp uintp_t - * - */ -typedef npy_intp __pyx_t_5numpy_intp_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":758 - * - * ctypedef npy_intp intp_t - * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< - * - * ctypedef npy_double float_t - */ -typedef npy_uintp __pyx_t_5numpy_uintp_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":760 - * ctypedef npy_uintp uintp_t - * - * ctypedef npy_double float_t # <<<<<<<<<<<<<< - * ctypedef npy_double double_t - * ctypedef npy_longdouble longdouble_t - */ -typedef npy_double __pyx_t_5numpy_float_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":761 - * - * ctypedef npy_double float_t - * ctypedef npy_double double_t # <<<<<<<<<<<<<< - * ctypedef npy_longdouble longdouble_t - * - */ -typedef npy_double __pyx_t_5numpy_double_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":762 - * ctypedef npy_double float_t - * ctypedef npy_double double_t - * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< - * - * ctypedef npy_cfloat cfloat_t - */ -typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* None.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< float > __pyx_t_float_complex; - #else - typedef float _Complex __pyx_t_float_complex; - #endif -#else - typedef struct { float real, imag; } __pyx_t_float_complex; -#endif - -/* None.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< double > __pyx_t_double_complex; - #else - typedef double _Complex __pyx_t_double_complex; - #endif -#else - typedef struct { double real, imag; } __pyx_t_double_complex; -#endif - - -/*--- Type declarations ---*/ -struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":764 - * ctypedef npy_longdouble longdouble_t - * - * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< - * ctypedef npy_cdouble cdouble_t - * ctypedef npy_clongdouble clongdouble_t - */ -typedef npy_cfloat __pyx_t_5numpy_cfloat_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":765 - * - * ctypedef npy_cfloat cfloat_t - * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< - * ctypedef npy_clongdouble clongdouble_t - * - */ -typedef npy_cdouble __pyx_t_5numpy_cdouble_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":766 - * ctypedef npy_cfloat cfloat_t - * ctypedef npy_cdouble cdouble_t - * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< - * - * ctypedef npy_cdouble complex_t - */ -typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":768 - * ctypedef npy_clongdouble clongdouble_t - * - * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew1(a): - */ -typedef npy_cdouble __pyx_t_5numpy_complex_t; - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":66 - * DEFAULT_BUFFER_SIZE = 1000 - * - * cdef class AccumuloAdapter: # <<<<<<<<<<<<<< - * """ - * Accumulo Adapter for reading data from Accumulo database into NumPy arrays - */ -struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter { - PyObject_HEAD - accumulo_adapter_t *_adapter; - PyObject *_field_type; - PyObject *_missing_values; - PyObject *_fill_value; -}; - - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#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); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #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, acquire_gil) - #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 -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* RaiseArgTupleInvalid.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); - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyThreadStateGet.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectSetAttrStr.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); -#endif - return PyObject_SetAttr(obj, attr_name, value); -} -#else -#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) -#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) -#endif - -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - -/* PyIntBinop.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif - -/* IncludeCppStringH.proto */ -#include - -/* decode_c_bytes.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( - const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); - -/* decode_cpp_string.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_cpp_string( - std::string cppstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - return __Pyx_decode_c_bytes( - cppstring.data(), cppstring.size(), start, stop, encoding, errors, decode_func); -} - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -/* PyIntBinop.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\ - PyObject_RichCompare(op1, op2, Py_EQ) - #endif - -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - -/* PyIntBinop.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace)\ - (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) -#endif - -/* DictGetItem.proto */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) - PyErr_SetObject(PyExc_KeyError, args); - Py_XDECREF(args); - } - return NULL; - } - Py_INCREF(value); - return value; -} -#else - #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#endif - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* GetNameInClass.proto */ -static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* None.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #define __Pyx_CREAL(z) ((z).real()) - #define __Pyx_CIMAG(z) ((z).imag()) - #else - #define __Pyx_CREAL(z) (__real__(z)) - #define __Pyx_CIMAG(z) (__imag__(z)) - #endif -#else - #define __Pyx_CREAL(z) ((z).real) - #define __Pyx_CIMAG(z) ((z).imag) -#endif -#if defined(__cplusplus) && CYTHON_CCOMPLEX && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) - #define __Pyx_SET_CREAL(z,x) ((z).real(x)) - #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) -#else - #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) - #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) -#endif - -/* None.proto */ -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - -/* None.proto */ -#if CYTHON_CCOMPLEX - #define __Pyx_c_eqf(a, b) ((a)==(b)) - #define __Pyx_c_sumf(a, b) ((a)+(b)) - #define __Pyx_c_difff(a, b) ((a)-(b)) - #define __Pyx_c_prodf(a, b) ((a)*(b)) - #define __Pyx_c_quotf(a, b) ((a)/(b)) - #define __Pyx_c_negf(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zerof(z) ((z)==(float)0) - #define __Pyx_c_conjf(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_absf(z) (::std::abs(z)) - #define __Pyx_c_powf(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zerof(z) ((z)==0) - #define __Pyx_c_conjf(z) (conjf(z)) - #if 1 - #define __Pyx_c_absf(z) (cabsf(z)) - #define __Pyx_c_powf(a, b) (cpowf(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - #if 1 - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); - #endif -#endif - -/* None.proto */ -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - -/* None.proto */ -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq(a, b) ((a)==(b)) - #define __Pyx_c_sum(a, b) ((a)+(b)) - #define __Pyx_c_diff(a, b) ((a)-(b)) - #define __Pyx_c_prod(a, b) ((a)*(b)) - #define __Pyx_c_quot(a, b) ((a)/(b)) - #define __Pyx_c_neg(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero(z) ((z)==(double)0) - #define __Pyx_c_conj(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_abs(z) (::std::abs(z)) - #define __Pyx_c_pow(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zero(z) ((z)==0) - #define __Pyx_c_conj(z) (conj(z)) - #if 1 - #define __Pyx_c_abs(z) (cabs(z)) - #define __Pyx_c_pow(a, b) (cpow(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - #if 1 - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); - #endif -#endif - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* TypeImport.proto */ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - - -/* Module declarations from 'cpython.buffer' */ - -/* Module declarations from 'libc.string' */ - -/* Module declarations from 'libc.stdio' */ - -/* Module declarations from '__builtin__' */ - -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; - -/* Module declarations from 'cpython' */ - -/* Module declarations from 'cpython.object' */ - -/* Module declarations from 'cpython.ref' */ - -/* Module declarations from 'libc.stdlib' */ - -/* Module declarations from 'numpy' */ - -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ - -/* Module declarations from 'libcpp' */ - -/* Module declarations from 'libcpp.string' */ - -/* Module declarations from 'iopro.accumuloadapter.AccumuloAdapter' */ -static PyTypeObject *__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter = 0; -static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/ -#define __Pyx_MODULE_NAME "iopro.accumuloadapter.AccumuloAdapter" -int __pyx_module_is_main_iopro__accumuloadapter__AccumuloAdapter = 0; - -/* Implementation of 'iopro.accumuloadapter.AccumuloAdapter' */ -static PyObject *__pyx_builtin_property; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_IOError; -static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_builtin_range; -static const char __pyx_k_[] = ""; -static const char __pyx_k_O[] = "O"; -static const char __pyx_k_S[] = "S"; -static const char __pyx_k_f[] = "f"; -static const char __pyx_k_i[] = "i"; -static const char __pyx_k_u[] = "u"; -static const char __pyx_k_f8[] = "f8"; -static const char __pyx_k_nan[] = "nan"; -static const char __pyx_k_ceil[] = "ceil"; -static const char __pyx_k_kind[] = "kind"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_math[] = "math"; -static const char __pyx_k_port[] = "port"; -static const char __pyx_k_size[] = "size"; -static const char __pyx_k_step[] = "step"; -static const char __pyx_k_stop[] = "stop"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_warn[] = "warn"; -static const char __pyx_k_array[] = "array"; -static const char __pyx_k_ascii[] = "ascii"; -static const char __pyx_k_close[] = "close"; -static const char __pyx_k_dtype[] = "dtype"; -static const char __pyx_k_numpy[] = "numpy"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_start[] = "start"; -static const char __pyx_k_table[] = "table"; -static const char __pyx_k_encode[] = "encode"; -static const char __pyx_k_format[] = "format"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_resize[] = "resize"; -static const char __pyx_k_server[] = "server"; -static const char __pyx_k_IOError[] = "IOError"; -static const char __pyx_k_asarray[] = "asarray"; -static const char __pyx_k_itemsize[] = "itemsize"; -static const char __pyx_k_password[] = "password"; -static const char __pyx_k_property[] = "property"; -static const char __pyx_k_stop_key[] = "stop_key"; -static const char __pyx_k_to_array[] = "_to_array"; -static const char __pyx_k_username[] = "username"; -static const char __pyx_k_warnings[] = "warnings"; -static const char __pyx_k_localhost[] = "localhost"; -static const char __pyx_k_start_key[] = "start_key"; -static const char __pyx_k_ValueError[] = "ValueError"; -static const char __pyx_k_field_type[] = "field_type"; -static const char __pyx_k_fill_value[] = "fill_value"; -static const char __pyx_k_RuntimeError[] = "RuntimeError"; -static const char __pyx_k_get_stop_key[] = "get_stop_key"; -static const char __pyx_k_set_stop_key[] = "set_stop_key"; -static const char __pyx_k_get_start_key[] = "get_start_key"; -static const char __pyx_k_invalid_slice[] = "invalid slice"; -static const char __pyx_k_set_start_key[] = "set_start_key"; -static const char __pyx_k_get_fill_value[] = "get_fill_value"; -static const char __pyx_k_missing_values[] = "missing_values"; -static const char __pyx_k_set_fill_value[] = "set_fill_value"; -static const char __pyx_k_check_connection[] = "_check_connection"; -static const char __pyx_k_Invalid_fill_value[] = "Invalid fill value"; -static const char __pyx_k_Invalid_table_name[] = "Invalid table name"; -static const char __pyx_k_get_missing_values[] = "get_missing_values"; -static const char __pyx_k_set_missing_values[] = "set_missing_values"; -static const char __pyx_k_stop_key_inclusive[] = "stop_key_inclusive"; -static const char __pyx_k_DEFAULT_BUFFER_SIZE[] = "DEFAULT_BUFFER_SIZE"; -static const char __pyx_k_Invalid_record_read[] = "Invalid record read"; -static const char __pyx_k_start_key_inclusive[] = "start_key_inclusive"; -static const char __pyx_k_Invalid_start_record[] = "Invalid start record"; -static const char __pyx_k_Table_name_is_required[] = "Table name is required"; -static const char __pyx_k_get_stop_key_inclusive[] = "get_stop_key_inclusive"; -static const char __pyx_k_set_stop_key_inclusive[] = "set_stop_key_inclusive"; -static const char __pyx_k_get_start_key_inclusive[] = "get_start_key_inclusive"; -static const char __pyx_k_set_start_key_inclusive[] = "set_start_key_inclusive"; -static const char __pyx_k_slice_step_cannot_be_zero[] = "slice step cannot be zero"; -static const char __pyx_k_Invalid_Accumulo_table_name[] = "Invalid Accumulo table name"; -static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; -static const char __pyx_k_0_records_successfully_read_but[] = "{0} records successfully read, but at least one result was truncated to fit in the specified NumPy dtype"; -static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; -static const char __pyx_k_Connection_already_closed_Please[] = "Connection already closed. Please create a new adapter."; -static const char __pyx_k_Error_connecting_to_Accumulo_ser[] = "Error connecting to Accumulo server"; -static const char __pyx_k_Field_type_must_be_set_before_re[] = "Field type must be set before reading records"; -static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; -static const char __pyx_k_Invalid_Accumulo_username_or_pas[] = "Invalid Accumulo username or password"; -static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; -static const char __pyx_k_Output_field_type_0_not_supporte[] = "Output field type {0} not supported"; -static const char __pyx_k_Unable_to_connect_to_Accumulo_se[] = "Unable to connect to Accumulo server"; -static const char __pyx_k_Unable_to_convert_table_values_t[] = "Unable to convert table values to '{0}' dtype"; -static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; -static const char __pyx_k_reading_records_in_reverse_not_s[] = "reading records in reverse not supported"; -static const char __pyx_k_seeking_from_end_of_table_not_su[] = "seeking from end of table not supported"; -static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; -static PyObject *__pyx_kp_s_; -static PyObject *__pyx_kp_s_0_records_successfully_read_but; -static PyObject *__pyx_kp_s_Connection_already_closed_Please; -static PyObject *__pyx_n_s_DEFAULT_BUFFER_SIZE; -static PyObject *__pyx_kp_s_Error_connecting_to_Accumulo_ser; -static PyObject *__pyx_kp_s_Field_type_must_be_set_before_re; -static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; -static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; -static PyObject *__pyx_n_s_IOError; -static PyObject *__pyx_kp_s_Invalid_Accumulo_table_name; -static PyObject *__pyx_kp_s_Invalid_Accumulo_username_or_pas; -static PyObject *__pyx_kp_s_Invalid_fill_value; -static PyObject *__pyx_kp_s_Invalid_record_read; -static PyObject *__pyx_kp_s_Invalid_start_record; -static PyObject *__pyx_kp_s_Invalid_table_name; -static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; -static PyObject *__pyx_n_s_O; -static PyObject *__pyx_kp_s_Output_field_type_0_not_supporte; -static PyObject *__pyx_n_s_RuntimeError; -static PyObject *__pyx_n_s_S; -static PyObject *__pyx_kp_s_Table_name_is_required; -static PyObject *__pyx_kp_s_Unable_to_connect_to_Accumulo_se; -static PyObject *__pyx_kp_s_Unable_to_convert_table_values_t; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s_array; -static PyObject *__pyx_n_s_asarray; -static PyObject *__pyx_n_s_ascii; -static PyObject *__pyx_n_s_ceil; -static PyObject *__pyx_n_s_check_connection; -static PyObject *__pyx_n_s_close; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_f; -static PyObject *__pyx_n_s_f8; -static PyObject *__pyx_n_s_field_type; -static PyObject *__pyx_n_s_fill_value; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_get_fill_value; -static PyObject *__pyx_n_s_get_missing_values; -static PyObject *__pyx_n_s_get_start_key; -static PyObject *__pyx_n_s_get_start_key_inclusive; -static PyObject *__pyx_n_s_get_stop_key; -static PyObject *__pyx_n_s_get_stop_key_inclusive; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_kp_s_invalid_slice; -static PyObject *__pyx_n_s_itemsize; -static PyObject *__pyx_n_s_kind; -static PyObject *__pyx_n_s_localhost; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_math; -static PyObject *__pyx_n_s_missing_values; -static PyObject *__pyx_n_s_nan; -static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; -static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_n_s_password; -static PyObject *__pyx_n_s_port; -static PyObject *__pyx_n_s_property; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_kp_s_reading_records_in_reverse_not_s; -static PyObject *__pyx_n_s_resize; -static PyObject *__pyx_kp_s_seeking_from_end_of_table_not_su; -static PyObject *__pyx_n_s_server; -static PyObject *__pyx_n_s_set_fill_value; -static PyObject *__pyx_n_s_set_missing_values; -static PyObject *__pyx_n_s_set_start_key; -static PyObject *__pyx_n_s_set_start_key_inclusive; -static PyObject *__pyx_n_s_set_stop_key; -static PyObject *__pyx_n_s_set_stop_key_inclusive; -static PyObject *__pyx_n_s_size; -static PyObject *__pyx_kp_s_slice_step_cannot_be_zero; -static PyObject *__pyx_n_s_start; -static PyObject *__pyx_n_s_start_key; -static PyObject *__pyx_n_s_start_key_inclusive; -static PyObject *__pyx_n_s_step; -static PyObject *__pyx_n_s_stop; -static PyObject *__pyx_n_s_stop_key; -static PyObject *__pyx_n_s_stop_key_inclusive; -static PyObject *__pyx_n_s_table; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_to_array; -static PyObject *__pyx_n_s_u; -static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; -static PyObject *__pyx_n_s_username; -static PyObject *__pyx_n_s_warn; -static PyObject *__pyx_n_s_warnings; -static int __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter___cinit__(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_server, PyObject *__pyx_v_port, PyObject *__pyx_v_username, PyObject *__pyx_v_password, PyObject *__pyx_v_table, PyObject *__pyx_v_field_type, PyObject *__pyx_v_start_key, PyObject *__pyx_v_stop_key, PyObject *__pyx_v_start_key_inclusive, PyObject *__pyx_v_stop_key_inclusive, PyObject *__pyx_v_missing_values, PyObject *__pyx_v_fill_value); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_2close(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self); /* proto */ -static void __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_4__dealloc__(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_6_check_connection(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_10field_type___get__(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_8__getitem__(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_10get_start_key(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_12set_start_key(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_14get_stop_key(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_16set_stop_key(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_18get_start_key_inclusive(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_20set_start_key_inclusive(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_inclusive); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_22get_stop_key_inclusive(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_24set_stop_key_inclusive(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_inclusive); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_26set_missing_values(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_missing_values); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_28get_missing_values(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_30set_fill_value(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_fill_value); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_32get_fill_value(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_34_to_array(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_step); /* proto */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ -static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ -static PyObject *__pyx_tp_new_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_1000; -static PyObject *__pyx_int_42424; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__24; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_tuple__28; -static PyObject *__pyx_tuple__29; -static PyObject *__pyx_tuple__30; - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":91 - * cdef object _fill_value - * - * def __cinit__(self, # <<<<<<<<<<<<<< - * server='localhost', - * port=42424, - */ - -/* Python wrapper */ -static int __pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_server = 0; - PyObject *__pyx_v_port = 0; - PyObject *__pyx_v_username = 0; - PyObject *__pyx_v_password = 0; - PyObject *__pyx_v_table = 0; - PyObject *__pyx_v_field_type = 0; - PyObject *__pyx_v_start_key = 0; - PyObject *__pyx_v_stop_key = 0; - PyObject *__pyx_v_start_key_inclusive = 0; - PyObject *__pyx_v_stop_key_inclusive = 0; - PyObject *__pyx_v_missing_values = 0; - PyObject *__pyx_v_fill_value = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_server,&__pyx_n_s_port,&__pyx_n_s_username,&__pyx_n_s_password,&__pyx_n_s_table,&__pyx_n_s_field_type,&__pyx_n_s_start_key,&__pyx_n_s_stop_key,&__pyx_n_s_start_key_inclusive,&__pyx_n_s_stop_key_inclusive,&__pyx_n_s_missing_values,&__pyx_n_s_fill_value,0}; - PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; - values[0] = ((PyObject *)__pyx_n_s_localhost); - values[1] = ((PyObject *)__pyx_int_42424); - values[2] = ((PyObject *)__pyx_kp_s_); - values[3] = ((PyObject *)__pyx_kp_s_); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":96 - * username='', - * password='', - * table=None, # <<<<<<<<<<<<<< - * field_type='f8', - * start_key=None, - */ - values[4] = ((PyObject *)Py_None); - values[5] = ((PyObject *)__pyx_n_s_f8); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":98 - * table=None, - * field_type='f8', - * start_key=None, # <<<<<<<<<<<<<< - * stop_key=None, - * start_key_inclusive=True, - */ - values[6] = ((PyObject *)Py_None); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":99 - * field_type='f8', - * start_key=None, - * stop_key=None, # <<<<<<<<<<<<<< - * start_key_inclusive=True, - * stop_key_inclusive=False, - */ - values[7] = ((PyObject *)Py_None); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":100 - * start_key=None, - * stop_key=None, - * start_key_inclusive=True, # <<<<<<<<<<<<<< - * stop_key_inclusive=False, - * missing_values=None, - */ - values[8] = ((PyObject *)Py_True); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":101 - * stop_key=None, - * start_key_inclusive=True, - * stop_key_inclusive=False, # <<<<<<<<<<<<<< - * missing_values=None, - * fill_value=None): - */ - values[9] = ((PyObject *)Py_False); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":102 - * start_key_inclusive=True, - * stop_key_inclusive=False, - * missing_values=None, # <<<<<<<<<<<<<< - * fill_value=None): - * """ - */ - values[10] = ((PyObject *)Py_None); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":103 - * stop_key_inclusive=False, - * missing_values=None, - * fill_value=None): # <<<<<<<<<<<<<< - * """ - * Accumulo Adapter constructor. - */ - values[11] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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 (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_server); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_port); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_username); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_password); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_table); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_type); - if (value) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_key); - if (value) { values[6] = value; kw_args--; } - } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop_key); - if (value) { values[7] = value; kw_args--; } - } - case 8: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_key_inclusive); - if (value) { values[8] = value; kw_args--; } - } - case 9: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop_key_inclusive); - if (value) { values[9] = value; kw_args--; } - } - case 10: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_missing_values); - if (value) { values[10] = value; kw_args--; } - } - case 11: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fill_value); - if (value) { values[11] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 91, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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; - } - } - __pyx_v_server = values[0]; - __pyx_v_port = values[1]; - __pyx_v_username = values[2]; - __pyx_v_password = values[3]; - __pyx_v_table = values[4]; - __pyx_v_field_type = values[5]; - __pyx_v_start_key = values[6]; - __pyx_v_stop_key = values[7]; - __pyx_v_start_key_inclusive = values[8]; - __pyx_v_stop_key_inclusive = values[9]; - __pyx_v_missing_values = values[10]; - __pyx_v_fill_value = values[11]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter___cinit__(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self), __pyx_v_server, __pyx_v_port, __pyx_v_username, __pyx_v_password, __pyx_v_table, __pyx_v_field_type, __pyx_v_start_key, __pyx_v_stop_key, __pyx_v_start_key_inclusive, __pyx_v_stop_key_inclusive, __pyx_v_missing_values, __pyx_v_fill_value); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":91 - * cdef object _fill_value - * - * def __cinit__(self, # <<<<<<<<<<<<<< - * server='localhost', - * port=42424, - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter___cinit__(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_server, PyObject *__pyx_v_port, PyObject *__pyx_v_username, PyObject *__pyx_v_password, PyObject *__pyx_v_table, PyObject *__pyx_v_field_type, PyObject *__pyx_v_start_key, PyObject *__pyx_v_stop_key, PyObject *__pyx_v_start_key_inclusive, PyObject *__pyx_v_stop_key_inclusive, PyObject *__pyx_v_missing_values, PyObject *__pyx_v_fill_value) { - AdapterError __pyx_v_error; - PyObject *__pyx_v_dtype = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - std::string __pyx_t_5; - int __pyx_t_6; - std::string __pyx_t_7; - std::string __pyx_t_8; - std::string __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":108 - * See above for constructor argument descriptions. - * """ - * if table is None: # <<<<<<<<<<<<<< - * raise ValueError('Table name is required') - * - */ - __pyx_t_1 = (__pyx_v_table == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":109 - * """ - * if table is None: - * raise ValueError('Table name is required') # <<<<<<<<<<<<<< - * - * # JNB: force ascii encoding until I figure out whether Accumulo - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __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_ERR(0, 109, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":108 - * See above for constructor argument descriptions. - * """ - * if table is None: # <<<<<<<<<<<<<< - * raise ValueError('Table name is required') - * - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":113 - * # JNB: force ascii encoding until I figure out whether Accumulo - * # supports unicode, and if so, how to get correct encoding. - * cdef AdapterError error = ADAPTER_SUCCESS # <<<<<<<<<<<<<< - * self._adapter = open_accumulo_adapter(server.encode('ascii'), - * port, - */ - __pyx_v_error = ADAPTER_SUCCESS; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":114 - * # supports unicode, and if so, how to get correct encoding. - * cdef AdapterError error = ADAPTER_SUCCESS - * self._adapter = open_accumulo_adapter(server.encode('ascii'), # <<<<<<<<<<<<<< - * port, - * username.encode('ascii'), - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_server, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":115 - * cdef AdapterError error = ADAPTER_SUCCESS - * self._adapter = open_accumulo_adapter(server.encode('ascii'), - * port, # <<<<<<<<<<<<<< - * username.encode('ascii'), - * password.encode('ascii'), - */ - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_port); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":116 - * self._adapter = open_accumulo_adapter(server.encode('ascii'), - * port, - * username.encode('ascii'), # <<<<<<<<<<<<<< - * password.encode('ascii'), - * table.encode('ascii'), - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_username, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":117 - * port, - * username.encode('ascii'), - * password.encode('ascii'), # <<<<<<<<<<<<<< - * table.encode('ascii'), - * &error) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_password, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":118 - * username.encode('ascii'), - * password.encode('ascii'), - * table.encode('ascii'), # <<<<<<<<<<<<<< - * &error) - * if self._adapter == NULL: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_table, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":114 - * # supports unicode, and if so, how to get correct encoding. - * cdef AdapterError error = ADAPTER_SUCCESS - * self._adapter = open_accumulo_adapter(server.encode('ascii'), # <<<<<<<<<<<<<< - * port, - * username.encode('ascii'), - */ - __pyx_v_self->_adapter = open_accumulo_adapter(__pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, (&__pyx_v_error)); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":120 - * table.encode('ascii'), - * &error) - * if self._adapter == NULL: # <<<<<<<<<<<<<< - * if error == ADAPTER_ERROR_SOCKET: - * raise IOError('Unable to connect to Accumulo server') - */ - __pyx_t_2 = ((__pyx_v_self->_adapter == NULL) != 0); - if (__pyx_t_2) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":121 - * &error) - * if self._adapter == NULL: - * if error == ADAPTER_ERROR_SOCKET: # <<<<<<<<<<<<<< - * raise IOError('Unable to connect to Accumulo server') - * elif error == ADAPTER_ERROR_LOGIN: - */ - switch (__pyx_v_error) { - case ADAPTER_ERROR_SOCKET: - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":122 - * if self._adapter == NULL: - * if error == ADAPTER_ERROR_SOCKET: - * raise IOError('Unable to connect to Accumulo server') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_LOGIN: - * raise IOError('Invalid Accumulo username or password') - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __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_ERR(0, 122, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":121 - * &error) - * if self._adapter == NULL: - * if error == ADAPTER_ERROR_SOCKET: # <<<<<<<<<<<<<< - * raise IOError('Unable to connect to Accumulo server') - * elif error == ADAPTER_ERROR_LOGIN: - */ - break; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":123 - * if error == ADAPTER_ERROR_SOCKET: - * raise IOError('Unable to connect to Accumulo server') - * elif error == ADAPTER_ERROR_LOGIN: # <<<<<<<<<<<<<< - * raise IOError('Invalid Accumulo username or password') - * elif error == ADAPTER_ERROR_TABLE_NAME: - */ - case ADAPTER_ERROR_LOGIN: - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":124 - * raise IOError('Unable to connect to Accumulo server') - * elif error == ADAPTER_ERROR_LOGIN: - * raise IOError('Invalid Accumulo username or password') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_TABLE_NAME: - * raise IOError('Invalid Accumulo table name') - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 124, __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_ERR(0, 124, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":123 - * if error == ADAPTER_ERROR_SOCKET: - * raise IOError('Unable to connect to Accumulo server') - * elif error == ADAPTER_ERROR_LOGIN: # <<<<<<<<<<<<<< - * raise IOError('Invalid Accumulo username or password') - * elif error == ADAPTER_ERROR_TABLE_NAME: - */ - break; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":125 - * elif error == ADAPTER_ERROR_LOGIN: - * raise IOError('Invalid Accumulo username or password') - * elif error == ADAPTER_ERROR_TABLE_NAME: # <<<<<<<<<<<<<< - * raise IOError('Invalid Accumulo table name') - * else: - */ - case ADAPTER_ERROR_TABLE_NAME: - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":126 - * raise IOError('Invalid Accumulo username or password') - * elif error == ADAPTER_ERROR_TABLE_NAME: - * raise IOError('Invalid Accumulo table name') # <<<<<<<<<<<<<< - * else: - * raise IOError('Error connecting to Accumulo server') - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __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_ERR(0, 126, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":125 - * elif error == ADAPTER_ERROR_LOGIN: - * raise IOError('Invalid Accumulo username or password') - * elif error == ADAPTER_ERROR_TABLE_NAME: # <<<<<<<<<<<<<< - * raise IOError('Invalid Accumulo table name') - * else: - */ - break; - default: - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":128 - * raise IOError('Invalid Accumulo table name') - * else: - * raise IOError('Error connecting to Accumulo server') # <<<<<<<<<<<<<< - * - * self._adapter.output_type_size = 0 - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __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_ERR(0, 128, __pyx_L1_error) - break; - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":120 - * table.encode('ascii'), - * &error) - * if self._adapter == NULL: # <<<<<<<<<<<<<< - * if error == ADAPTER_ERROR_SOCKET: - * raise IOError('Unable to connect to Accumulo server') - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":130 - * raise IOError('Error connecting to Accumulo server') - * - * self._adapter.output_type_size = 0 # <<<<<<<<<<<<<< - * - * dtype = numpy.dtype(field_type) - */ - __pyx_v_self->_adapter->output_type_size = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":132 - * self._adapter.output_type_size = 0 - * - * dtype = numpy.dtype(field_type) # <<<<<<<<<<<<<< - * if dtype.kind == 'u': - * self._adapter.field_type = UINT_FIELD - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_field_type); - __Pyx_GIVEREF(__pyx_v_field_type); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_field_type); - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_dtype = __pyx_t_4; - __pyx_t_4 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":133 - * - * dtype = numpy.dtype(field_type) - * if dtype.kind == 'u': # <<<<<<<<<<<<<< - * self._adapter.field_type = UINT_FIELD - * elif dtype.kind == 'i': - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_u, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":134 - * dtype = numpy.dtype(field_type) - * if dtype.kind == 'u': - * self._adapter.field_type = UINT_FIELD # <<<<<<<<<<<<<< - * elif dtype.kind == 'i': - * self._adapter.field_type = INT_FIELD - */ - __pyx_v_self->_adapter->field_type = UINT_FIELD; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":133 - * - * dtype = numpy.dtype(field_type) - * if dtype.kind == 'u': # <<<<<<<<<<<<<< - * self._adapter.field_type = UINT_FIELD - * elif dtype.kind == 'i': - */ - goto __pyx_L5; - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":135 - * if dtype.kind == 'u': - * self._adapter.field_type = UINT_FIELD - * elif dtype.kind == 'i': # <<<<<<<<<<<<<< - * self._adapter.field_type = INT_FIELD - * elif dtype.kind == 'f': - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_i, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 135, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":136 - * self._adapter.field_type = UINT_FIELD - * elif dtype.kind == 'i': - * self._adapter.field_type = INT_FIELD # <<<<<<<<<<<<<< - * elif dtype.kind == 'f': - * self._adapter.field_type = FLOAT_FIELD - */ - __pyx_v_self->_adapter->field_type = INT_FIELD; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":135 - * if dtype.kind == 'u': - * self._adapter.field_type = UINT_FIELD - * elif dtype.kind == 'i': # <<<<<<<<<<<<<< - * self._adapter.field_type = INT_FIELD - * elif dtype.kind == 'f': - */ - goto __pyx_L5; - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":137 - * elif dtype.kind == 'i': - * self._adapter.field_type = INT_FIELD - * elif dtype.kind == 'f': # <<<<<<<<<<<<<< - * self._adapter.field_type = FLOAT_FIELD - * elif dtype.kind == 'S': - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_f, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":138 - * self._adapter.field_type = INT_FIELD - * elif dtype.kind == 'f': - * self._adapter.field_type = FLOAT_FIELD # <<<<<<<<<<<<<< - * elif dtype.kind == 'S': - * self._adapter.field_type = STR_FIELD - */ - __pyx_v_self->_adapter->field_type = FLOAT_FIELD; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":137 - * elif dtype.kind == 'i': - * self._adapter.field_type = INT_FIELD - * elif dtype.kind == 'f': # <<<<<<<<<<<<<< - * self._adapter.field_type = FLOAT_FIELD - * elif dtype.kind == 'S': - */ - goto __pyx_L5; - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":139 - * elif dtype.kind == 'f': - * self._adapter.field_type = FLOAT_FIELD - * elif dtype.kind == 'S': # <<<<<<<<<<<<<< - * self._adapter.field_type = STR_FIELD - * else: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_S, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":140 - * self._adapter.field_type = FLOAT_FIELD - * elif dtype.kind == 'S': - * self._adapter.field_type = STR_FIELD # <<<<<<<<<<<<<< - * else: - * raise ValueError('Output field type {0} not supported'.format(field_type)) - */ - __pyx_v_self->_adapter->field_type = STR_FIELD; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":139 - * elif dtype.kind == 'f': - * self._adapter.field_type = FLOAT_FIELD - * elif dtype.kind == 'S': # <<<<<<<<<<<<<< - * self._adapter.field_type = STR_FIELD - * else: - */ - goto __pyx_L5; - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":142 - * self._adapter.field_type = STR_FIELD - * else: - * raise ValueError('Output field type {0} not supported'.format(field_type)) # <<<<<<<<<<<<<< - * - * self._adapter.output_type_size = dtype.itemsize - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Output_field_type_0_not_supporte, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_10) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_field_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_INCREF(__pyx_v_field_type); - __Pyx_GIVEREF(__pyx_v_field_type); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_field_type); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 142, __pyx_L1_error) - } - __pyx_L5:; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":144 - * raise ValueError('Output field type {0} not supported'.format(field_type)) - * - * self._adapter.output_type_size = dtype.itemsize # <<<<<<<<<<<<<< - * self._field_type = field_type - * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_self->_adapter->output_type_size = __pyx_t_6; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":145 - * - * self._adapter.output_type_size = dtype.itemsize - * self._field_type = field_type # <<<<<<<<<<<<<< - * - * self.set_missing_values(missing_values) - */ - __Pyx_INCREF(__pyx_v_field_type); - __Pyx_GIVEREF(__pyx_v_field_type); - __Pyx_GOTREF(__pyx_v_self->_field_type); - __Pyx_DECREF(__pyx_v_self->_field_type); - __pyx_v_self->_field_type = __pyx_v_field_type; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":147 - * self._field_type = field_type - * - * self.set_missing_values(missing_values) # <<<<<<<<<<<<<< - * - * if fill_value is not None: - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_missing_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_11) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_missing_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); __pyx_t_11 = NULL; - __Pyx_INCREF(__pyx_v_missing_values); - __Pyx_GIVEREF(__pyx_v_missing_values); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_missing_values); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":149 - * self.set_missing_values(missing_values) - * - * if fill_value is not None: # <<<<<<<<<<<<<< - * self.fill_value = fill_value - * if dtype.kind == 'f': - */ - __pyx_t_2 = (__pyx_v_fill_value != Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":150 - * - * if fill_value is not None: - * self.fill_value = fill_value # <<<<<<<<<<<<<< - * if dtype.kind == 'f': - * self.fill_value = numpy.nan - */ - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_value, __pyx_v_fill_value) < 0) __PYX_ERR(0, 150, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":149 - * self.set_missing_values(missing_values) - * - * if fill_value is not None: # <<<<<<<<<<<<<< - * self.fill_value = fill_value - * if dtype.kind == 'f': - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":151 - * if fill_value is not None: - * self.fill_value = fill_value - * if dtype.kind == 'f': # <<<<<<<<<<<<<< - * self.fill_value = numpy.nan - * elif dtype.kind in ['u', 'i']: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_f, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_1) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":152 - * self.fill_value = fill_value - * if dtype.kind == 'f': - * self.fill_value = numpy.nan # <<<<<<<<<<<<<< - * elif dtype.kind in ['u', 'i']: - * self.fill_value = 0 - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_nan); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_value, __pyx_t_3) < 0) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":151 - * if fill_value is not None: - * self.fill_value = fill_value - * if dtype.kind == 'f': # <<<<<<<<<<<<<< - * self.fill_value = numpy.nan - * elif dtype.kind in ['u', 'i']: - */ - goto __pyx_L7; - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":153 - * if dtype.kind == 'f': - * self.fill_value = numpy.nan - * elif dtype.kind in ['u', 'i']: # <<<<<<<<<<<<<< - * self.fill_value = 0 - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_u, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 153, __pyx_L1_error) - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_i, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 153, __pyx_L1_error) - __pyx_t_1 = __pyx_t_2; - __pyx_L8_bool_binop_done:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":154 - * self.fill_value = numpy.nan - * elif dtype.kind in ['u', 'i']: - * self.fill_value = 0 # <<<<<<<<<<<<<< - * - * self.set_start_key(start_key) - */ - if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fill_value, __pyx_int_0) < 0) __PYX_ERR(0, 154, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":153 - * if dtype.kind == 'f': - * self.fill_value = numpy.nan - * elif dtype.kind in ['u', 'i']: # <<<<<<<<<<<<<< - * self.fill_value = 0 - * - */ - } - __pyx_L7:; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":156 - * self.fill_value = 0 - * - * self.set_start_key(start_key) # <<<<<<<<<<<<<< - * self.set_stop_key(stop_key) - * self.set_start_key_inclusive(start_key_inclusive) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_start_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_10) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_start_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_INCREF(__pyx_v_start_key); - __Pyx_GIVEREF(__pyx_v_start_key); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_start_key); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":157 - * - * self.set_start_key(start_key) - * self.set_stop_key(stop_key) # <<<<<<<<<<<<<< - * self.set_start_key_inclusive(start_key_inclusive) - * self.set_stop_key_inclusive(stop_key_inclusive) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_stop_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_11) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_stop_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); __pyx_t_11 = NULL; - __Pyx_INCREF(__pyx_v_stop_key); - __Pyx_GIVEREF(__pyx_v_stop_key); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_stop_key); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":158 - * self.set_start_key(start_key) - * self.set_stop_key(stop_key) - * self.set_start_key_inclusive(start_key_inclusive) # <<<<<<<<<<<<<< - * self.set_stop_key_inclusive(stop_key_inclusive) - * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_start_key_inclusive); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_10) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_start_key_inclusive); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_INCREF(__pyx_v_start_key_inclusive); - __Pyx_GIVEREF(__pyx_v_start_key_inclusive); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_start_key_inclusive); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":159 - * self.set_stop_key(stop_key) - * self.set_start_key_inclusive(start_key_inclusive) - * self.set_stop_key_inclusive(stop_key_inclusive) # <<<<<<<<<<<<<< - * - * def close(self): - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_stop_key_inclusive); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_11) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_stop_key_inclusive); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); __pyx_t_11 = NULL; - __Pyx_INCREF(__pyx_v_stop_key_inclusive); - __Pyx_GIVEREF(__pyx_v_stop_key_inclusive); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_stop_key_inclusive); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":91 - * cdef object _fill_value - * - * def __cinit__(self, # <<<<<<<<<<<<<< - * server='localhost', - * port=42424, - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_dtype); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":161 - * self.set_stop_key_inclusive(stop_key_inclusive) - * - * def close(self): # <<<<<<<<<<<<<< - * """ - * Close Accumulo connection - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_2close[] = "\n Close Accumulo connection\n "; -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("close (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_2close(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_2close(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("close", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":165 - * Close Accumulo connection - * """ - * if self._adapter != NULL: # <<<<<<<<<<<<<< - * close_accumulo_adapter(self._adapter) - * self._adapter = NULL - */ - __pyx_t_1 = ((__pyx_v_self->_adapter != NULL) != 0); - if (__pyx_t_1) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":166 - * """ - * if self._adapter != NULL: - * close_accumulo_adapter(self._adapter) # <<<<<<<<<<<<<< - * self._adapter = NULL - * - */ - close_accumulo_adapter(__pyx_v_self->_adapter); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":165 - * Close Accumulo connection - * """ - * if self._adapter != NULL: # <<<<<<<<<<<<<< - * close_accumulo_adapter(self._adapter) - * self._adapter = NULL - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":167 - * if self._adapter != NULL: - * close_accumulo_adapter(self._adapter) - * self._adapter = NULL # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_v_self->_adapter = NULL; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":161 - * self.set_stop_key_inclusive(stop_key_inclusive) - * - * def close(self): # <<<<<<<<<<<<<< - * """ - * Close Accumulo connection - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":169 - * self._adapter = NULL - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * """ - * Accumulo Adapter destructor - */ - -/* Python wrapper */ -static void __pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_5__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_5__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_4__dealloc__(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_4__dealloc__(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":173 - * Accumulo Adapter destructor - * """ - * self.close() # <<<<<<<<<<<<<< - * - * def _check_connection(self): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":169 - * self._adapter = NULL - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * """ - * Accumulo Adapter destructor - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":175 - * self.close() - * - * def _check_connection(self): # <<<<<<<<<<<<<< - * if self._adapter == NULL: - * raise RuntimeError('Connection already closed. ' - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_7_check_connection(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_7_check_connection(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_check_connection (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_6_check_connection(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_6_check_connection(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("_check_connection", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":176 - * - * def _check_connection(self): - * if self._adapter == NULL: # <<<<<<<<<<<<<< - * raise RuntimeError('Connection already closed. ' - * 'Please create a new adapter.') - */ - __pyx_t_1 = ((__pyx_v_self->_adapter == NULL) != 0); - if (__pyx_t_1) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":177 - * def _check_connection(self): - * if self._adapter == NULL: - * raise RuntimeError('Connection already closed. ' # <<<<<<<<<<<<<< - * 'Please create a new adapter.') - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __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_ERR(0, 177, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":176 - * - * def _check_connection(self): - * if self._adapter == NULL: # <<<<<<<<<<<<<< - * raise RuntimeError('Connection already closed. ' - * 'Please create a new adapter.') - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":175 - * self.close() - * - * def _check_connection(self): # <<<<<<<<<<<<<< - * if self._adapter == NULL: - * raise RuntimeError('Connection already closed. ' - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter._check_connection", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":181 - * - * @property - * def field_type(self): # <<<<<<<<<<<<<< - * self._check_connection() - * """ - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_10field_type_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_10field_type_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_10field_type___get__(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_10field_type___get__(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":182 - * @property - * def field_type(self): - * self._check_connection() # <<<<<<<<<<<<<< - * """ - * Get NumPy dtype string for output NumPy array - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":186 - * Get NumPy dtype string for output NumPy array - * """ - * return self._field_type # <<<<<<<<<<<<<< - * - * def __getitem__(self, index): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_field_type); - __pyx_r = __pyx_v_self->_field_type; - goto __pyx_L0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":181 - * - * @property - * def field_type(self): # <<<<<<<<<<<<<< - * self._check_connection() - * """ - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.field_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":188 - * return self._field_type - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * self._check_connection() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_8__getitem__(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_8__getitem__(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = NULL; - __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; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":189 - * - * def __getitem__(self, index): - * self._check_connection() # <<<<<<<<<<<<<< - * - * if isinstance(index, (int, long)): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":191 - * self._check_connection() - * - * if isinstance(index, (int, long)): # <<<<<<<<<<<<<< - * return self._to_array(start=index, stop=index+1) - * elif isinstance(index, slice): - */ - __pyx_t_5 = PyInt_Check(__pyx_v_index); - __pyx_t_6 = (__pyx_t_5 != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_4 = __pyx_t_6; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_6 = PyLong_Check(__pyx_v_index); - __pyx_t_5 = (__pyx_t_6 != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":192 - * - * if isinstance(index, (int, long)): - * return self._to_array(start=index, stop=index+1) # <<<<<<<<<<<<<< - * elif isinstance(index, slice): - * return self._to_array(index.start, index.stop, index.step) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_start, __pyx_v_index) < 0) __PYX_ERR(0, 192, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_stop, __pyx_t_3) < 0) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __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_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":191 - * self._check_connection() - * - * if isinstance(index, (int, long)): # <<<<<<<<<<<<<< - * return self._to_array(start=index, stop=index+1) - * elif isinstance(index, slice): - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":193 - * if isinstance(index, (int, long)): - * return self._to_array(start=index, stop=index+1) - * elif isinstance(index, slice): # <<<<<<<<<<<<<< - * return self._to_array(index.start, index.stop, index.step) - * else: - */ - __pyx_t_5 = PySlice_Check(__pyx_v_index); - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":194 - * return self._to_array(start=index, stop=index+1) - * elif isinstance(index, slice): - * return self._to_array(index.start, index.stop, index.step) # <<<<<<<<<<<<<< - * else: - * raise ValueError('invalid slice') - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - __pyx_t_10 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_10 = 1; - } - } - __pyx_t_11 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_8); - __pyx_t_1 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":193 - * if isinstance(index, (int, long)): - * return self._to_array(start=index, stop=index+1) - * elif isinstance(index, slice): # <<<<<<<<<<<<<< - * return self._to_array(index.start, index.stop, index.step) - * else: - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":196 - * return self._to_array(index.start, index.stop, index.step) - * else: - * raise ValueError('invalid slice') # <<<<<<<<<<<<<< - * - * def get_start_key(self): - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __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_ERR(0, 196, __pyx_L1_error) - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":188 - * return self._field_type - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * self._check_connection() - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":198 - * raise ValueError('invalid slice') - * - * def get_start_key(self): # <<<<<<<<<<<<<< - * """ - * Get/set key of record where reading/scanning will start from. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_11get_start_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_10get_start_key[] = "\n Get/set key of record where reading/scanning will start from.\n The start_key_inclusive attribute specifies whether this key is inclusive.\n "; -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_11get_start_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_start_key (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_10get_start_key(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_10get_start_key(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("get_start_key", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":203 - * The start_key_inclusive attribute specifies whether this key is inclusive. - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * return self._adapter.start_key.decode('ascii') - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":204 - * """ - * self._check_connection() - * return self._adapter.start_key.decode('ascii') # <<<<<<<<<<<<<< - * - * def set_start_key(self, key): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->_adapter->start_key, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":198 - * raise ValueError('invalid slice') - * - * def get_start_key(self): # <<<<<<<<<<<<<< - * """ - * Get/set key of record where reading/scanning will start from. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.get_start_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":206 - * return self._adapter.start_key.decode('ascii') - * - * def set_start_key(self, key): # <<<<<<<<<<<<<< - * self._check_connection() - * if key is None: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_13set_start_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_13set_start_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_start_key (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_12set_start_key(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_key)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_12set_start_key(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_key) { - PyObject *__pyx_r = NULL; - __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; - std::string __pyx_t_6; - __Pyx_RefNannySetupContext("set_start_key", 0); - __Pyx_INCREF(__pyx_v_key); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":207 - * - * def set_start_key(self, key): - * self._check_connection() # <<<<<<<<<<<<<< - * if key is None: - * key = '' - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":208 - * def set_start_key(self, key): - * self._check_connection() - * if key is None: # <<<<<<<<<<<<<< - * key = '' - * self._adapter.start_key = key.encode('ascii') - */ - __pyx_t_4 = (__pyx_v_key == Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":209 - * self._check_connection() - * if key is None: - * key = '' # <<<<<<<<<<<<<< - * self._adapter.start_key = key.encode('ascii') - * - */ - __Pyx_INCREF(__pyx_kp_s_); - __Pyx_DECREF_SET(__pyx_v_key, __pyx_kp_s_); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":208 - * def set_start_key(self, key): - * self._check_connection() - * if key is None: # <<<<<<<<<<<<<< - * key = '' - * self._adapter.start_key = key.encode('ascii') - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":210 - * if key is None: - * key = '' - * self._adapter.start_key = key.encode('ascii') # <<<<<<<<<<<<<< - * - * start_key = property(get_start_key, set_start_key) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_self->_adapter->start_key = __pyx_t_6; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":206 - * return self._adapter.start_key.decode('ascii') - * - * def set_start_key(self, key): # <<<<<<<<<<<<<< - * self._check_connection() - * if key is None: - */ - - /* function exit code */ - __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("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.set_start_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":214 - * start_key = property(get_start_key, set_start_key) - * - * def get_stop_key(self): # <<<<<<<<<<<<<< - * self._check_connection() - * """ - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_15get_stop_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_15get_stop_key(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_stop_key (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_14get_stop_key(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_14get_stop_key(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("get_stop_key", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":215 - * - * def get_stop_key(self): - * self._check_connection() # <<<<<<<<<<<<<< - * """ - * Get/set key of record where reading/scanning will stop. - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":220 - * The stop_key_inclusive attribute specifies whether this key is inclusive. - * """ - * return self._adapter.stop_key.decode('ascii') # <<<<<<<<<<<<<< - * - * def set_stop_key(self, key): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->_adapter->stop_key, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":214 - * start_key = property(get_start_key, set_start_key) - * - * def get_stop_key(self): # <<<<<<<<<<<<<< - * self._check_connection() - * """ - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.get_stop_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":222 - * return self._adapter.stop_key.decode('ascii') - * - * def set_stop_key(self, key): # <<<<<<<<<<<<<< - * self._check_connection() - * if key is None: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_17set_stop_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_17set_stop_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_stop_key (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_16set_stop_key(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_key)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_16set_stop_key(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_key) { - PyObject *__pyx_r = NULL; - __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; - std::string __pyx_t_6; - __Pyx_RefNannySetupContext("set_stop_key", 0); - __Pyx_INCREF(__pyx_v_key); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":223 - * - * def set_stop_key(self, key): - * self._check_connection() # <<<<<<<<<<<<<< - * if key is None: - * key = '' - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":224 - * def set_stop_key(self, key): - * self._check_connection() - * if key is None: # <<<<<<<<<<<<<< - * key = '' - * self._adapter.stop_key = key.encode('ascii') - */ - __pyx_t_4 = (__pyx_v_key == Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":225 - * self._check_connection() - * if key is None: - * key = '' # <<<<<<<<<<<<<< - * self._adapter.stop_key = key.encode('ascii') - * - */ - __Pyx_INCREF(__pyx_kp_s_); - __Pyx_DECREF_SET(__pyx_v_key, __pyx_kp_s_); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":224 - * def set_stop_key(self, key): - * self._check_connection() - * if key is None: # <<<<<<<<<<<<<< - * key = '' - * self._adapter.stop_key = key.encode('ascii') - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":226 - * if key is None: - * key = '' - * self._adapter.stop_key = key.encode('ascii') # <<<<<<<<<<<<<< - * - * stop_key = property(get_stop_key, set_stop_key) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_self->_adapter->stop_key = __pyx_t_6; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":222 - * return self._adapter.stop_key.decode('ascii') - * - * def set_stop_key(self, key): # <<<<<<<<<<<<<< - * self._check_connection() - * if key is None: - */ - - /* function exit code */ - __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("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.set_stop_key", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":230 - * stop_key = property(get_stop_key, set_stop_key) - * - * def get_start_key_inclusive(self): # <<<<<<<<<<<<<< - * self._check_connection() - * """ - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_19get_start_key_inclusive(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_19get_start_key_inclusive(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_start_key_inclusive (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_18get_start_key_inclusive(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_18get_start_key_inclusive(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("get_start_key_inclusive", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":231 - * - * def get_start_key_inclusive(self): - * self._check_connection() # <<<<<<<<<<<<<< - * """ - * Toggle whether start key is inclusive. Default is true. - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":235 - * Toggle whether start key is inclusive. Default is true. - * """ - * return self._adapter.start_key_inclusive # <<<<<<<<<<<<<< - * - * def set_start_key_inclusive(self, inclusive): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_adapter->start_key_inclusive); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":230 - * stop_key = property(get_stop_key, set_stop_key) - * - * def get_start_key_inclusive(self): # <<<<<<<<<<<<<< - * self._check_connection() - * """ - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.get_start_key_inclusive", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":237 - * return self._adapter.start_key_inclusive - * - * def set_start_key_inclusive(self, inclusive): # <<<<<<<<<<<<<< - * self._check_connection() - * self._adapter.start_key_inclusive = inclusive - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_21set_start_key_inclusive(PyObject *__pyx_v_self, PyObject *__pyx_v_inclusive); /*proto*/ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_21set_start_key_inclusive(PyObject *__pyx_v_self, PyObject *__pyx_v_inclusive) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_start_key_inclusive (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_20set_start_key_inclusive(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_inclusive)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_20set_start_key_inclusive(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_inclusive) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - bool __pyx_t_4; - __Pyx_RefNannySetupContext("set_start_key_inclusive", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":238 - * - * def set_start_key_inclusive(self, inclusive): - * self._check_connection() # <<<<<<<<<<<<<< - * self._adapter.start_key_inclusive = inclusive - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":239 - * def set_start_key_inclusive(self, inclusive): - * self._check_connection() - * self._adapter.start_key_inclusive = inclusive # <<<<<<<<<<<<<< - * - * start_key_inclusive = property(get_start_key_inclusive, set_start_key_inclusive) - */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_inclusive); if (unlikely((__pyx_t_4 == (bool)-1) && PyErr_Occurred())) __PYX_ERR(0, 239, __pyx_L1_error) - __pyx_v_self->_adapter->start_key_inclusive = __pyx_t_4; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":237 - * return self._adapter.start_key_inclusive - * - * def set_start_key_inclusive(self, inclusive): # <<<<<<<<<<<<<< - * self._check_connection() - * self._adapter.start_key_inclusive = inclusive - */ - - /* function exit code */ - __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("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.set_start_key_inclusive", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":243 - * start_key_inclusive = property(get_start_key_inclusive, set_start_key_inclusive) - * - * def get_stop_key_inclusive(self): # <<<<<<<<<<<<<< - * """ - * Toggle whether stop key is inclusive. Default is False. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_23get_stop_key_inclusive(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_22get_stop_key_inclusive[] = "\n Toggle whether stop key is inclusive. Default is False.\n "; -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_23get_stop_key_inclusive(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_stop_key_inclusive (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_22get_stop_key_inclusive(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_22get_stop_key_inclusive(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("get_stop_key_inclusive", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":247 - * Toggle whether stop key is inclusive. Default is False. - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * return self._adapter.stop_key_inclusive - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":248 - * """ - * self._check_connection() - * return self._adapter.stop_key_inclusive # <<<<<<<<<<<<<< - * - * def set_stop_key_inclusive(self, inclusive): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_adapter->stop_key_inclusive); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":243 - * start_key_inclusive = property(get_start_key_inclusive, set_start_key_inclusive) - * - * def get_stop_key_inclusive(self): # <<<<<<<<<<<<<< - * """ - * Toggle whether stop key is inclusive. Default is False. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.get_stop_key_inclusive", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":250 - * return self._adapter.stop_key_inclusive - * - * def set_stop_key_inclusive(self, inclusive): # <<<<<<<<<<<<<< - * self._check_connection() - * self._adapter.stop_key_inclusive = inclusive - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_25set_stop_key_inclusive(PyObject *__pyx_v_self, PyObject *__pyx_v_inclusive); /*proto*/ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_25set_stop_key_inclusive(PyObject *__pyx_v_self, PyObject *__pyx_v_inclusive) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_stop_key_inclusive (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_24set_stop_key_inclusive(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_inclusive)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_24set_stop_key_inclusive(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_inclusive) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - bool __pyx_t_4; - __Pyx_RefNannySetupContext("set_stop_key_inclusive", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":251 - * - * def set_stop_key_inclusive(self, inclusive): - * self._check_connection() # <<<<<<<<<<<<<< - * self._adapter.stop_key_inclusive = inclusive - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":252 - * def set_stop_key_inclusive(self, inclusive): - * self._check_connection() - * self._adapter.stop_key_inclusive = inclusive # <<<<<<<<<<<<<< - * - * stop_key_inclusive = property(get_stop_key_inclusive, set_stop_key_inclusive) - */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_inclusive); if (unlikely((__pyx_t_4 == (bool)-1) && PyErr_Occurred())) __PYX_ERR(0, 252, __pyx_L1_error) - __pyx_v_self->_adapter->stop_key_inclusive = __pyx_t_4; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":250 - * return self._adapter.stop_key_inclusive - * - * def set_stop_key_inclusive(self, inclusive): # <<<<<<<<<<<<<< - * self._check_connection() - * self._adapter.stop_key_inclusive = inclusive - */ - - /* function exit code */ - __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("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.set_stop_key_inclusive", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":256 - * stop_key_inclusive = property(get_stop_key_inclusive, set_stop_key_inclusive) - * - * def set_missing_values(self, missing_values): # <<<<<<<<<<<<<< - * self._check_connection() - * if missing_values is None or len(missing_values) == 0: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_27set_missing_values(PyObject *__pyx_v_self, PyObject *__pyx_v_missing_values); /*proto*/ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_27set_missing_values(PyObject *__pyx_v_self, PyObject *__pyx_v_missing_values) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_missing_values (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_26set_missing_values(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_missing_values)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_26set_missing_values(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_missing_values) { - PyObject *__pyx_v_m = NULL; - PyObject *__pyx_r = NULL; - __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; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - std::string __pyx_t_9; - __Pyx_RefNannySetupContext("set_missing_values", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":257 - * - * def set_missing_values(self, missing_values): - * self._check_connection() # <<<<<<<<<<<<<< - * if missing_values is None or len(missing_values) == 0: - * clear_missing_values(self._adapter) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":258 - * def set_missing_values(self, missing_values): - * self._check_connection() - * if missing_values is None or len(missing_values) == 0: # <<<<<<<<<<<<<< - * clear_missing_values(self._adapter) - * self._missing_values = None - */ - __pyx_t_5 = (__pyx_v_missing_values == Py_None); - __pyx_t_6 = (__pyx_t_5 != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_4 = __pyx_t_6; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = PyObject_Length(__pyx_v_missing_values); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 258, __pyx_L1_error) - __pyx_t_6 = ((__pyx_t_7 == 0) != 0); - __pyx_t_4 = __pyx_t_6; - __pyx_L4_bool_binop_done:; - if (__pyx_t_4) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":259 - * self._check_connection() - * if missing_values is None or len(missing_values) == 0: - * clear_missing_values(self._adapter) # <<<<<<<<<<<<<< - * self._missing_values = None - * else: - */ - clear_missing_values(__pyx_v_self->_adapter); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":260 - * if missing_values is None or len(missing_values) == 0: - * clear_missing_values(self._adapter) - * self._missing_values = None # <<<<<<<<<<<<<< - * else: - * for m in missing_values: - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->_missing_values); - __Pyx_DECREF(__pyx_v_self->_missing_values); - __pyx_v_self->_missing_values = Py_None; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":258 - * def set_missing_values(self, missing_values): - * self._check_connection() - * if missing_values is None or len(missing_values) == 0: # <<<<<<<<<<<<<< - * clear_missing_values(self._adapter) - * self._missing_values = None - */ - goto __pyx_L3; - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":262 - * self._missing_values = None - * else: - * for m in missing_values: # <<<<<<<<<<<<<< - * add_missing_value(self._adapter, m.encode('ascii')) - * self._missing_values = missing_values - */ - /*else*/ { - if (likely(PyList_CheckExact(__pyx_v_missing_values)) || PyTuple_CheckExact(__pyx_v_missing_values)) { - __pyx_t_1 = __pyx_v_missing_values; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_missing_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 262, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 262, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 262, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_8(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 262, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_2); - __pyx_t_2 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":263 - * else: - * for m in missing_values: - * add_missing_value(self._adapter, m.encode('ascii')) # <<<<<<<<<<<<<< - * self._missing_values = missing_values - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 263, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - add_missing_value(__pyx_v_self->_adapter, __pyx_t_9); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":262 - * self._missing_values = None - * else: - * for m in missing_values: # <<<<<<<<<<<<<< - * add_missing_value(self._adapter, m.encode('ascii')) - * self._missing_values = missing_values - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":264 - * for m in missing_values: - * add_missing_value(self._adapter, m.encode('ascii')) - * self._missing_values = missing_values # <<<<<<<<<<<<<< - * - * def get_missing_values(self): - */ - __Pyx_INCREF(__pyx_v_missing_values); - __Pyx_GIVEREF(__pyx_v_missing_values); - __Pyx_GOTREF(__pyx_v_self->_missing_values); - __Pyx_DECREF(__pyx_v_self->_missing_values); - __pyx_v_self->_missing_values = __pyx_v_missing_values; - } - __pyx_L3:; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":256 - * stop_key_inclusive = property(get_stop_key_inclusive, set_stop_key_inclusive) - * - * def set_missing_values(self, missing_values): # <<<<<<<<<<<<<< - * self._check_connection() - * if missing_values is None or len(missing_values) == 0: - */ - - /* function exit code */ - __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("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.set_missing_values", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_m); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":266 - * self._missing_values = missing_values - * - * def get_missing_values(self): # <<<<<<<<<<<<<< - * """ - * Get/Set missing value strings. Any values in Accumulo table equal - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_29get_missing_values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_28get_missing_values[] = "\n Get/Set missing value strings. Any values in Accumulo table equal\n to one of these strings will be replaced with fill_value.\n "; -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_29get_missing_values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_missing_values (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_28get_missing_values(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_28get_missing_values(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("get_missing_values", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":271 - * to one of these strings will be replaced with fill_value. - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * return self._missing_values - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":272 - * """ - * self._check_connection() - * return self._missing_values # <<<<<<<<<<<<<< - * - * missing_values = property(get_missing_values, set_missing_values) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_missing_values); - __pyx_r = __pyx_v_self->_missing_values; - goto __pyx_L0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":266 - * self._missing_values = missing_values - * - * def get_missing_values(self): # <<<<<<<<<<<<<< - * """ - * Get/Set missing value strings. Any values in Accumulo table equal - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.get_missing_values", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":276 - * missing_values = property(get_missing_values, set_missing_values) - * - * def set_fill_value(self, fill_value): # <<<<<<<<<<<<<< - * cdef numpy.ndarray carray - * self._check_connection() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_31set_fill_value(PyObject *__pyx_v_self, PyObject *__pyx_v_fill_value); /*proto*/ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_31set_fill_value(PyObject *__pyx_v_self, PyObject *__pyx_v_fill_value) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_fill_value (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_30set_fill_value(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_fill_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_30set_fill_value(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_fill_value) { - PyArrayObject *__pyx_v_carray = 0; - PyObject *__pyx_r = NULL; - __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; - PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - __Pyx_RefNannySetupContext("set_fill_value", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":278 - * def set_fill_value(self, fill_value): - * cdef numpy.ndarray carray - * self._check_connection() # <<<<<<<<<<<<<< - * if fill_value is None: - * clear_fill_value(self._adapter) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":279 - * cdef numpy.ndarray carray - * self._check_connection() - * if fill_value is None: # <<<<<<<<<<<<<< - * clear_fill_value(self._adapter) - * else: - */ - __pyx_t_4 = (__pyx_v_fill_value == Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":280 - * self._check_connection() - * if fill_value is None: - * clear_fill_value(self._adapter) # <<<<<<<<<<<<<< - * else: - * carray = numpy.array([fill_value], self._field_type) - */ - clear_fill_value(__pyx_v_self->_adapter); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":279 - * cdef numpy.ndarray carray - * self._check_connection() - * if fill_value is None: # <<<<<<<<<<<<<< - * clear_fill_value(self._adapter) - * else: - */ - goto __pyx_L3; - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":282 - * clear_fill_value(self._adapter) - * else: - * carray = numpy.array([fill_value], self._field_type) # <<<<<<<<<<<<<< - * if carray.dtype.kind == 'O': - * raise ValueError('Invalid fill value') - */ - /*else*/ { - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_fill_value); - __Pyx_GIVEREF(__pyx_v_fill_value); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_fill_value); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_2); - __Pyx_INCREF(__pyx_v_self->_field_type); - __Pyx_GIVEREF(__pyx_v_self->_field_type); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_self->_field_type); - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 282, __pyx_L1_error) - __pyx_v_carray = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":283 - * else: - * carray = numpy.array([fill_value], self._field_type) - * if carray.dtype.kind == 'O': # <<<<<<<<<<<<<< - * raise ValueError('Invalid fill value') - * set_fill_value(self._adapter, carray.data, carray.itemsize) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_carray), __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_kind); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_O, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 283, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_5) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":284 - * carray = numpy.array([fill_value], self._field_type) - * if carray.dtype.kind == 'O': - * raise ValueError('Invalid fill value') # <<<<<<<<<<<<<< - * set_fill_value(self._adapter, carray.data, carray.itemsize) - * self._fill_value == fill_value - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __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_ERR(0, 284, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":283 - * else: - * carray = numpy.array([fill_value], self._field_type) - * if carray.dtype.kind == 'O': # <<<<<<<<<<<<<< - * raise ValueError('Invalid fill value') - * set_fill_value(self._adapter, carray.data, carray.itemsize) - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":285 - * if carray.dtype.kind == 'O': - * raise ValueError('Invalid fill value') - * set_fill_value(self._adapter, carray.data, carray.itemsize) # <<<<<<<<<<<<<< - * self._fill_value == fill_value - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_carray), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - set_fill_value(__pyx_v_self->_adapter, __pyx_v_carray->data, __pyx_t_9); - } - __pyx_L3:; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":286 - * raise ValueError('Invalid fill value') - * set_fill_value(self._adapter, carray.data, carray.itemsize) - * self._fill_value == fill_value # <<<<<<<<<<<<<< - * - * def get_fill_value(self): - */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_self->_fill_value, __pyx_v_fill_value, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 286, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":276 - * missing_values = property(get_missing_values, set_missing_values) - * - * def set_fill_value(self, fill_value): # <<<<<<<<<<<<<< - * cdef numpy.ndarray carray - * self._check_connection() - */ - - /* function exit code */ - __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_8); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.set_fill_value", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_carray); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":288 - * self._fill_value == fill_value - * - * def get_fill_value(self): # <<<<<<<<<<<<<< - * """ - * Fill value used to replace missing_values - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_33get_fill_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_32get_fill_value[] = "\n Fill value used to replace missing_values\n "; -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_33get_fill_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_fill_value (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_32get_fill_value(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_32get_fill_value(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("get_fill_value", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":292 - * Fill value used to replace missing_values - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * return self._fill_value - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":293 - * """ - * self._check_connection() - * return self._fill_value # <<<<<<<<<<<<<< - * - * fill_value = property(get_fill_value, set_fill_value) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_fill_value); - __pyx_r = __pyx_v_self->_fill_value; - goto __pyx_L0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":288 - * self._fill_value == fill_value - * - * def get_fill_value(self): # <<<<<<<<<<<<<< - * """ - * Fill value used to replace missing_values - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter.get_fill_value", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/accumuloadapter/AccumuloAdapter.pyx":297 - * fill_value = property(get_fill_value, set_fill_value) - * - * def _to_array(self, start=0, stop=None, step=1): # <<<<<<<<<<<<<< - * """ - * Read Accumulo table values into NumPy array - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_35_to_array(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_34_to_array[] = "\n Read Accumulo table values into NumPy array\n Inputs:\n start: record index to start reading from\n stop: record index to stop reading at\n step: number of records to skip between reads\n "; -static PyObject *__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_35_to_array(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_start = 0; - PyObject *__pyx_v_stop = 0; - PyObject *__pyx_v_step = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_to_array (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_step,0}; - PyObject* values[3] = {0,0,0}; - values[0] = ((PyObject *)__pyx_int_0); - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)__pyx_int_1); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_to_array") < 0)) __PYX_ERR(0, 297, __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); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_start = values[0]; - __pyx_v_stop = values[1]; - __pyx_v_step = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_to_array", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 297, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter._to_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_34_to_array(((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)__pyx_v_self), __pyx_v_start, __pyx_v_stop, __pyx_v_step); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_34_to_array(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_step) { - CYTHON_UNUSED PyObject *__pyx_v_start_key = NULL; - CYTHON_UNUSED PyObject *__pyx_v_stop_key = NULL; - PyArrayObject *__pyx_v_carray = 0; - int __pyx_v_num_records_found; - int __pyx_v_dummy; - int __pyx_v_truncation; - AdapterError __pyx_v_result; - PyObject *__pyx_v_total_num_records_found = NULL; - PyObject *__pyx_v_max_num_records = NULL; - PyObject *__pyx_v_num_records = NULL; - PyObject *__pyx_v_offset = NULL; - PyObject *__pyx_r = NULL; - __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; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - __Pyx_RefNannySetupContext("_to_array", 0); - __Pyx_INCREF(__pyx_v_start); - __Pyx_INCREF(__pyx_v_step); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":305 - * step: number of records to skip between reads - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * start_key = self._adapter.start_key.decode('ascii') - * stop_key = self._adapter.stop_key.decode('ascii') - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":306 - * """ - * self._check_connection() - * start_key = self._adapter.start_key.decode('ascii') # <<<<<<<<<<<<<< - * stop_key = self._adapter.stop_key.decode('ascii') - * - */ - __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->_adapter->start_key, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_start_key = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":307 - * self._check_connection() - * start_key = self._adapter.start_key.decode('ascii') - * stop_key = self._adapter.stop_key.decode('ascii') # <<<<<<<<<<<<<< - * - * cdef numpy.ndarray carray - */ - __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->_adapter->stop_key, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_stop_key = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":312 - * cdef int num_records_found - * cdef int dummy - * truncation = False # <<<<<<<<<<<<<< - * - * if self._field_type is None: - */ - __pyx_v_truncation = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":314 - * truncation = False - * - * if self._field_type is None: # <<<<<<<<<<<<<< - * raise RuntimeError('Field type must be set before reading records') - * - */ - __pyx_t_4 = (__pyx_v_self->_field_type == Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":315 - * - * if self._field_type is None: - * raise RuntimeError('Field type must be set before reading records') # <<<<<<<<<<<<<< - * - * if start is None: - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __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_ERR(0, 315, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":314 - * truncation = False - * - * if self._field_type is None: # <<<<<<<<<<<<<< - * raise RuntimeError('Field type must be set before reading records') - * - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":317 - * raise RuntimeError('Field type must be set before reading records') - * - * if start is None: # <<<<<<<<<<<<<< - * start = 0 - * if step is None: - */ - __pyx_t_5 = (__pyx_v_start == Py_None); - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":318 - * - * if start is None: - * start = 0 # <<<<<<<<<<<<<< - * if step is None: - * step = 1 - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_DECREF_SET(__pyx_v_start, __pyx_int_0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":317 - * raise RuntimeError('Field type must be set before reading records') - * - * if start is None: # <<<<<<<<<<<<<< - * start = 0 - * if step is None: - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":319 - * if start is None: - * start = 0 - * if step is None: # <<<<<<<<<<<<<< - * step = 1 - * if start < 0: - */ - __pyx_t_4 = (__pyx_v_step == Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":320 - * start = 0 - * if step is None: - * step = 1 # <<<<<<<<<<<<<< - * if start < 0: - * raise ValueError('seeking from end of table not supported') - */ - __Pyx_INCREF(__pyx_int_1); - __Pyx_DECREF_SET(__pyx_v_step, __pyx_int_1); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":319 - * if start is None: - * start = 0 - * if step is None: # <<<<<<<<<<<<<< - * step = 1 - * if start < 0: - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":321 - * if step is None: - * step = 1 - * if start < 0: # <<<<<<<<<<<<<< - * raise ValueError('seeking from end of table not supported') - * if step == 0: - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 321, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":322 - * step = 1 - * if start < 0: - * raise ValueError('seeking from end of table not supported') # <<<<<<<<<<<<<< - * if step == 0: - * raise ValueError('slice step cannot be zero') - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __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_ERR(0, 322, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":321 - * if step is None: - * step = 1 - * if start < 0: # <<<<<<<<<<<<<< - * raise ValueError('seeking from end of table not supported') - * if step == 0: - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":323 - * if start < 0: - * raise ValueError('seeking from end of table not supported') - * if step == 0: # <<<<<<<<<<<<<< - * raise ValueError('slice step cannot be zero') - * if step < 0: - */ - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_step, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 323, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":324 - * raise ValueError('seeking from end of table not supported') - * if step == 0: - * raise ValueError('slice step cannot be zero') # <<<<<<<<<<<<<< - * if step < 0: - * raise ValueError('reading records in reverse not supported') - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __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_ERR(0, 324, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":323 - * if start < 0: - * raise ValueError('seeking from end of table not supported') - * if step == 0: # <<<<<<<<<<<<<< - * raise ValueError('slice step cannot be zero') - * if step < 0: - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":325 - * if step == 0: - * raise ValueError('slice step cannot be zero') - * if step < 0: # <<<<<<<<<<<<<< - * raise ValueError('reading records in reverse not supported') - * if stop is not None and stop <= start: - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_step, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 325, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":326 - * raise ValueError('slice step cannot be zero') - * if step < 0: - * raise ValueError('reading records in reverse not supported') # <<<<<<<<<<<<<< - * if stop is not None and stop <= start: - * return numpy.array([], dtype=self._field_type) - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __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_ERR(0, 326, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":325 - * if step == 0: - * raise ValueError('slice step cannot be zero') - * if step < 0: # <<<<<<<<<<<<<< - * raise ValueError('reading records in reverse not supported') - * if stop is not None and stop <= start: - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":327 - * if step < 0: - * raise ValueError('reading records in reverse not supported') - * if stop is not None and stop <= start: # <<<<<<<<<<<<<< - * return numpy.array([], dtype=self._field_type) - * - */ - __pyx_t_4 = (__pyx_v_stop != Py_None); - __pyx_t_6 = (__pyx_t_4 != 0); - if (__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_1 = PyObject_RichCompare(__pyx_v_stop, __pyx_v_start, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __pyx_t_6; - __pyx_L10_bool_binop_done:; - if (__pyx_t_5) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":328 - * raise ValueError('reading records in reverse not supported') - * if stop is not None and stop <= start: - * return numpy.array([], dtype=self._field_type) # <<<<<<<<<<<<<< - * - * # Reinitialize accumulo iterator to point to beginning of table/query - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_self->_field_type) < 0) __PYX_ERR(0, 328, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":327 - * if step < 0: - * raise ValueError('reading records in reverse not supported') - * if stop is not None and stop <= start: # <<<<<<<<<<<<<< - * return numpy.array([], dtype=self._field_type) - * - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":331 - * - * # Reinitialize accumulo iterator to point to beginning of table/query - * result = seek_record(self._adapter, start) # <<<<<<<<<<<<<< - * if result == ADAPTER_ERROR_INVALID_SEEK: - * raise ValueError('Invalid start record') - */ - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 331, __pyx_L1_error) - __pyx_v_result = seek_record(__pyx_v_self->_adapter, __pyx_t_8); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":332 - * # Reinitialize accumulo iterator to point to beginning of table/query - * result = seek_record(self._adapter, start) - * if result == ADAPTER_ERROR_INVALID_SEEK: # <<<<<<<<<<<<<< - * raise ValueError('Invalid start record') - * elif result == ADAPTER_ERROR_INVALID_TABLE_NAME: - */ - switch (__pyx_v_result) { - case ADAPTER_ERROR_INVALID_SEEK: - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":333 - * result = seek_record(self._adapter, start) - * if result == ADAPTER_ERROR_INVALID_SEEK: - * raise ValueError('Invalid start record') # <<<<<<<<<<<<<< - * elif result == ADAPTER_ERROR_INVALID_TABLE_NAME: - * raise ValueError('Invalid table name') - */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 333, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":332 - * # Reinitialize accumulo iterator to point to beginning of table/query - * result = seek_record(self._adapter, start) - * if result == ADAPTER_ERROR_INVALID_SEEK: # <<<<<<<<<<<<<< - * raise ValueError('Invalid start record') - * elif result == ADAPTER_ERROR_INVALID_TABLE_NAME: - */ - break; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":334 - * if result == ADAPTER_ERROR_INVALID_SEEK: - * raise ValueError('Invalid start record') - * elif result == ADAPTER_ERROR_INVALID_TABLE_NAME: # <<<<<<<<<<<<<< - * raise ValueError('Invalid table name') - * - */ - case ADAPTER_ERROR_INVALID_TABLE_NAME: - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":335 - * raise ValueError('Invalid start record') - * elif result == ADAPTER_ERROR_INVALID_TABLE_NAME: - * raise ValueError('Invalid table name') # <<<<<<<<<<<<<< - * - * total_num_records_found = 0 - */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 335, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":334 - * if result == ADAPTER_ERROR_INVALID_SEEK: - * raise ValueError('Invalid start record') - * elif result == ADAPTER_ERROR_INVALID_TABLE_NAME: # <<<<<<<<<<<<<< - * raise ValueError('Invalid table name') - * - */ - break; - default: break; - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":337 - * raise ValueError('Invalid table name') - * - * total_num_records_found = 0 # <<<<<<<<<<<<<< - * carray = numpy.ndarray(0, dtype=self.field_type) - * - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_total_num_records_found = __pyx_int_0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":338 - * - * total_num_records_found = 0 - * carray = numpy.ndarray(0, dtype=self.field_type) # <<<<<<<<<<<<<< - * - * if stop is not None: - */ - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_tuple__23, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_carray = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":340 - * carray = numpy.ndarray(0, dtype=self.field_type) - * - * if stop is not None: # <<<<<<<<<<<<<< - * # Round up since we read the first record of each step, so it doesn't - * # matter if, for example, we can only fit 3.5 steps in the full - */ - __pyx_t_5 = (__pyx_v_stop != Py_None); - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":345 - * # range of records we want to read - the first record of last 0.5 step - * # counts as the 4th record we can read. - * max_num_records = int(math.ceil((stop - start) / step)) # <<<<<<<<<<<<<< - * - * while stop is None or total_num_records_found < max_num_records: - */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_ceil); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Subtract(__pyx_v_stop, __pyx_v_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_step); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_max_num_records = __pyx_t_3; - __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":340 - * carray = numpy.ndarray(0, dtype=self.field_type) - * - * if stop is not None: # <<<<<<<<<<<<<< - * # Round up since we read the first record of each step, so it doesn't - * # matter if, for example, we can only fit 3.5 steps in the full - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":347 - * max_num_records = int(math.ceil((stop - start) / step)) - * - * while stop is None or total_num_records_found < max_num_records: # <<<<<<<<<<<<<< - * if stop is None: - * num_records = DEFAULT_BUFFER_SIZE - */ - while (1) { - __pyx_t_5 = (__pyx_v_stop == Py_None); - __pyx_t_4 = (__pyx_t_5 != 0); - if (!__pyx_t_4) { - } else { - __pyx_t_6 = __pyx_t_4; - goto __pyx_L15_bool_binop_done; - } - if (unlikely(!__pyx_v_max_num_records)) { __Pyx_RaiseUnboundLocalError("max_num_records"); __PYX_ERR(0, 347, __pyx_L1_error) } - __pyx_t_3 = PyObject_RichCompare(__pyx_v_total_num_records_found, __pyx_v_max_num_records, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __pyx_t_4; - __pyx_L15_bool_binop_done:; - if (!__pyx_t_6) break; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":348 - * - * while stop is None or total_num_records_found < max_num_records: - * if stop is None: # <<<<<<<<<<<<<< - * num_records = DEFAULT_BUFFER_SIZE - * else: - */ - __pyx_t_6 = (__pyx_v_stop == Py_None); - __pyx_t_4 = (__pyx_t_6 != 0); - if (__pyx_t_4) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":349 - * while stop is None or total_num_records_found < max_num_records: - * if stop is None: - * num_records = DEFAULT_BUFFER_SIZE # <<<<<<<<<<<<<< - * else: - * num_records = max_num_records - total_num_records_found - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_BUFFER_SIZE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 349, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_num_records, __pyx_t_3); - __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":348 - * - * while stop is None or total_num_records_found < max_num_records: - * if stop is None: # <<<<<<<<<<<<<< - * num_records = DEFAULT_BUFFER_SIZE - * else: - */ - goto __pyx_L17; - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":351 - * num_records = DEFAULT_BUFFER_SIZE - * else: - * num_records = max_num_records - total_num_records_found # <<<<<<<<<<<<<< - * if num_records > DEFAULT_BUFFER_SIZE: - * num_records = DEFAULT_BUFFER_SIZE - */ - /*else*/ { - if (unlikely(!__pyx_v_max_num_records)) { __Pyx_RaiseUnboundLocalError("max_num_records"); __PYX_ERR(0, 351, __pyx_L1_error) } - __pyx_t_3 = PyNumber_Subtract(__pyx_v_max_num_records, __pyx_v_total_num_records_found); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_num_records, __pyx_t_3); - __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":352 - * else: - * num_records = max_num_records - total_num_records_found - * if num_records > DEFAULT_BUFFER_SIZE: # <<<<<<<<<<<<<< - * num_records = DEFAULT_BUFFER_SIZE - * - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_BUFFER_SIZE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_num_records, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":353 - * num_records = max_num_records - total_num_records_found - * if num_records > DEFAULT_BUFFER_SIZE: - * num_records = DEFAULT_BUFFER_SIZE # <<<<<<<<<<<<<< - * - * # Resize output array to make room for another buffer of records, - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_BUFFER_SIZE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_num_records, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":352 - * else: - * num_records = max_num_records - total_num_records_found - * if num_records > DEFAULT_BUFFER_SIZE: # <<<<<<<<<<<<<< - * num_records = DEFAULT_BUFFER_SIZE - * - */ - } - } - __pyx_L17:; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":358 - * # or, if first time through and the total number of records is known, - * # allocate final array size. - * carray.resize(total_num_records_found + num_records) # <<<<<<<<<<<<<< - * - * num_records_found = 0 - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_carray), __pyx_n_s_resize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyNumber_Add(__pyx_v_total_num_records_found, __pyx_v_num_records); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":360 - * carray.resize(total_num_records_found + num_records) - * - * num_records_found = 0 # <<<<<<<<<<<<<< - * offset = total_num_records_found * self._adapter.output_type_size - * result = read_records(self._adapter, num_records, step, carray.data + offset, &num_records_found) - */ - __pyx_v_num_records_found = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":361 - * - * num_records_found = 0 - * offset = total_num_records_found * self._adapter.output_type_size # <<<<<<<<<<<<<< - * result = read_records(self._adapter, num_records, step, carray.data + offset, &num_records_found) - * if result == ADAPTER_SUCCESS_TRUNCATION: - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_adapter->output_type_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(__pyx_v_total_num_records_found, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_offset, __pyx_t_3); - __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":362 - * num_records_found = 0 - * offset = total_num_records_found * self._adapter.output_type_size - * result = read_records(self._adapter, num_records, step, carray.data + offset, &num_records_found) # <<<<<<<<<<<<<< - * if result == ADAPTER_SUCCESS_TRUNCATION: - * # set truncation flag so we can throw exception later - */ - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_num_records); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 362, __pyx_L1_error) - __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_step); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 362, __pyx_L1_error) - __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_offset); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 362, __pyx_L1_error) - __pyx_v_result = read_records(__pyx_v_self->_adapter, __pyx_t_8, __pyx_t_10, (__pyx_v_carray->data + ((int)__pyx_t_11)), (&__pyx_v_num_records_found)); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":363 - * offset = total_num_records_found * self._adapter.output_type_size - * result = read_records(self._adapter, num_records, step, carray.data + offset, &num_records_found) - * if result == ADAPTER_SUCCESS_TRUNCATION: # <<<<<<<<<<<<<< - * # set truncation flag so we can throw exception later - * truncation = True - */ - __pyx_t_4 = ((__pyx_v_result == ADAPTER_SUCCESS_TRUNCATION) != 0); - if (__pyx_t_4) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":365 - * if result == ADAPTER_SUCCESS_TRUNCATION: - * # set truncation flag so we can throw exception later - * truncation = True # <<<<<<<<<<<<<< - * elif result in [ADAPTER_ERROR_INT_CONVERSION, ADAPTER_ERROR_FLOAT_CONVERSION]: - * raise RuntimeError("Unable to convert table values to '{0}' dtype".format(self.field_type)) - */ - __pyx_v_truncation = 1; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":363 - * offset = total_num_records_found * self._adapter.output_type_size - * result = read_records(self._adapter, num_records, step, carray.data + offset, &num_records_found) - * if result == ADAPTER_SUCCESS_TRUNCATION: # <<<<<<<<<<<<<< - * # set truncation flag so we can throw exception later - * truncation = True - */ - goto __pyx_L19; - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":366 - * # set truncation flag so we can throw exception later - * truncation = True - * elif result in [ADAPTER_ERROR_INT_CONVERSION, ADAPTER_ERROR_FLOAT_CONVERSION]: # <<<<<<<<<<<<<< - * raise RuntimeError("Unable to convert table values to '{0}' dtype".format(self.field_type)) - * elif result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_EOF: - */ - switch (__pyx_v_result) { - case ADAPTER_ERROR_INT_CONVERSION: - case ADAPTER_ERROR_FLOAT_CONVERSION: - __pyx_t_4 = 1; - break; - default: - __pyx_t_4 = 0; - break; - } - __pyx_t_6 = (__pyx_t_4 != 0); - if (__pyx_t_6) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":367 - * truncation = True - * elif result in [ADAPTER_ERROR_INT_CONVERSION, ADAPTER_ERROR_FLOAT_CONVERSION]: - * raise RuntimeError("Unable to convert table values to '{0}' dtype".format(self.field_type)) # <<<<<<<<<<<<<< - * elif result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_EOF: - * raise RuntimeError('Invalid record read') - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Unable_to_convert_table_values_t, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_9) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 367, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":366 - * # set truncation flag so we can throw exception later - * truncation = True - * elif result in [ADAPTER_ERROR_INT_CONVERSION, ADAPTER_ERROR_FLOAT_CONVERSION]: # <<<<<<<<<<<<<< - * raise RuntimeError("Unable to convert table values to '{0}' dtype".format(self.field_type)) - * elif result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_EOF: - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":368 - * elif result in [ADAPTER_ERROR_INT_CONVERSION, ADAPTER_ERROR_FLOAT_CONVERSION]: - * raise RuntimeError("Unable to convert table values to '{0}' dtype".format(self.field_type)) - * elif result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_EOF: # <<<<<<<<<<<<<< - * raise RuntimeError('Invalid record read') - * total_num_records_found += num_records_found - */ - switch (__pyx_v_result) { - case ADAPTER_SUCCESS: - case ADAPTER_ERROR_EOF: - __pyx_t_6 = 0; - break; - default: - __pyx_t_6 = 1; - break; - } - if (__pyx_t_6) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":369 - * raise RuntimeError("Unable to convert table values to '{0}' dtype".format(self.field_type)) - * elif result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_EOF: - * raise RuntimeError('Invalid record read') # <<<<<<<<<<<<<< - * total_num_records_found += num_records_found - * if ((stop is None and num_records_found < num_records) or - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 369, __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_ERR(0, 369, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":368 - * elif result in [ADAPTER_ERROR_INT_CONVERSION, ADAPTER_ERROR_FLOAT_CONVERSION]: - * raise RuntimeError("Unable to convert table values to '{0}' dtype".format(self.field_type)) - * elif result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_EOF: # <<<<<<<<<<<<<< - * raise RuntimeError('Invalid record read') - * total_num_records_found += num_records_found - */ - } - __pyx_L19:; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":370 - * elif result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_EOF: - * raise RuntimeError('Invalid record read') - * total_num_records_found += num_records_found # <<<<<<<<<<<<<< - * if ((stop is None and num_records_found < num_records) or - * result == ADAPTER_ERROR_EOF): - */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_num_records_found); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_total_num_records_found, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_total_num_records_found, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":371 - * raise RuntimeError('Invalid record read') - * total_num_records_found += num_records_found - * if ((stop is None and num_records_found < num_records) or # <<<<<<<<<<<<<< - * result == ADAPTER_ERROR_EOF): - * # we've found the last records, so break out of read loop - */ - __pyx_t_4 = (__pyx_v_stop == Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (!__pyx_t_5) { - goto __pyx_L22_next_or; - } else { - } - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_num_records_found); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_num_records, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_5) { - } else { - __pyx_t_6 = __pyx_t_5; - goto __pyx_L21_bool_binop_done; - } - __pyx_L22_next_or:; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":372 - * total_num_records_found += num_records_found - * if ((stop is None and num_records_found < num_records) or - * result == ADAPTER_ERROR_EOF): # <<<<<<<<<<<<<< - * # we've found the last records, so break out of read loop - * break - */ - __pyx_t_5 = ((__pyx_v_result == ADAPTER_ERROR_EOF) != 0); - __pyx_t_6 = __pyx_t_5; - __pyx_L21_bool_binop_done:; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":371 - * raise RuntimeError('Invalid record read') - * total_num_records_found += num_records_found - * if ((stop is None and num_records_found < num_records) or # <<<<<<<<<<<<<< - * result == ADAPTER_ERROR_EOF): - * # we've found the last records, so break out of read loop - */ - if (__pyx_t_6) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":374 - * result == ADAPTER_ERROR_EOF): - * # we've found the last records, so break out of read loop - * break # <<<<<<<<<<<<<< - * - * # Seek so that next read starts on step boundary. - */ - goto __pyx_L14_break; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":371 - * raise RuntimeError('Invalid record read') - * total_num_records_found += num_records_found - * if ((stop is None and num_records_found < num_records) or # <<<<<<<<<<<<<< - * result == ADAPTER_ERROR_EOF): - * # we've found the last records, so break out of read loop - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":379 - * # Do a read with no output since a call to seek_record creates a - * # new scanner and seeks from beginning of table. - * result = read_records(self._adapter, step - 1, 1, NULL, &dummy) # <<<<<<<<<<<<<< - * if result == ADAPTER_ERROR_EOF: - * # we've found the last record, so break out of read loop - */ - __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_step, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = read_records(__pyx_v_self->_adapter, __pyx_t_11, 1, NULL, (&__pyx_v_dummy)); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":380 - * # new scanner and seeks from beginning of table. - * result = read_records(self._adapter, step - 1, 1, NULL, &dummy) - * if result == ADAPTER_ERROR_EOF: # <<<<<<<<<<<<<< - * # we've found the last record, so break out of read loop - * break - */ - __pyx_t_6 = ((__pyx_v_result == ADAPTER_ERROR_EOF) != 0); - if (__pyx_t_6) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":382 - * if result == ADAPTER_ERROR_EOF: - * # we've found the last record, so break out of read loop - * break # <<<<<<<<<<<<<< - * - * # Throw away any extra space - */ - goto __pyx_L14_break; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":380 - * # new scanner and seeks from beginning of table. - * result = read_records(self._adapter, step - 1, 1, NULL, &dummy) - * if result == ADAPTER_ERROR_EOF: # <<<<<<<<<<<<<< - * # we've found the last record, so break out of read loop - * break - */ - } - } - __pyx_L14_break:; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":385 - * - * # Throw away any extra space - * if carray.size > total_num_records_found: # <<<<<<<<<<<<<< - * carray.resize(total_num_records_found) - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_carray), __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 385, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_total_num_records_found, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 385, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 385, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_6) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":386 - * # Throw away any extra space - * if carray.size > total_num_records_found: - * carray.resize(total_num_records_found) # <<<<<<<<<<<<<< - * - * if truncation: - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_carray), __pyx_n_s_resize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_total_num_records_found); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_total_num_records_found); - __Pyx_GIVEREF(__pyx_v_total_num_records_found); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_total_num_records_found); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":385 - * - * # Throw away any extra space - * if carray.size > total_num_records_found: # <<<<<<<<<<<<<< - * carray.resize(total_num_records_found) - * - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":388 - * carray.resize(total_num_records_found) - * - * if truncation: # <<<<<<<<<<<<<< - * warnings.warn('{0} records successfully read, but at least one ' - * 'result was truncated to fit in the specified ' - */ - __pyx_t_6 = (__pyx_v_truncation != 0); - if (__pyx_t_6) { - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":389 - * - * if truncation: - * warnings.warn('{0} records successfully read, but at least one ' # <<<<<<<<<<<<<< - * 'result was truncated to fit in the specified ' - * 'NumPy dtype'.format(total_num_records_found)) - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_warnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":391 - * warnings.warn('{0} records successfully read, but at least one ' - * 'result was truncated to fit in the specified ' - * 'NumPy dtype'.format(total_num_records_found)) # <<<<<<<<<<<<<< - * return numpy.asarray(carray) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_records_successfully_read_but, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_9) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_total_num_records_found); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 391, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_INCREF(__pyx_v_total_num_records_found); - __Pyx_GIVEREF(__pyx_v_total_num_records_found); - PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_v_total_num_records_found); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":388 - * carray.resize(total_num_records_found) - * - * if truncation: # <<<<<<<<<<<<<< - * warnings.warn('{0} records successfully read, but at least one ' - * 'result was truncated to fit in the specified ' - */ - } - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":392 - * 'result was truncated to fit in the specified ' - * 'NumPy dtype'.format(total_num_records_found)) - * return numpy.asarray(carray) # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 392, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_asarray); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 392, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_12, ((PyObject *)__pyx_v_carray)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_carray)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_carray)); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_carray)); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":297 - * fill_value = property(get_fill_value, set_fill_value) - * - * def _to_array(self, start=0, stop=None, step=1): # <<<<<<<<<<<<<< - * """ - * Read Accumulo table values into NumPy array - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter._to_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_start_key); - __Pyx_XDECREF(__pyx_v_stop_key); - __Pyx_XDECREF((PyObject *)__pyx_v_carray); - __Pyx_XDECREF(__pyx_v_total_num_records_found); - __Pyx_XDECREF(__pyx_v_max_num_records); - __Pyx_XDECREF(__pyx_v_num_records); - __Pyx_XDECREF(__pyx_v_offset); - __Pyx_XDECREF(__pyx_v_start); - __Pyx_XDECREF(__pyx_v_step); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":197 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_copy_shape; - int __pyx_v_i; - int __pyx_v_ndim; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - int __pyx_v_t; - char *__pyx_v_f; - PyArray_Descr *__pyx_v_descr = 0; - int __pyx_v_offset; - int __pyx_v_hasfields; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - __Pyx_RefNannySetupContext("__getbuffer__", 0); - if (__pyx_v_info != NULL) { - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":203 - * # of flags - * - * if info == NULL: return # <<<<<<<<<<<<<< - * - * cdef int copy_shape, i, ndim - */ - __pyx_t_1 = ((__pyx_v_info == NULL) != 0); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":206 - * - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - */ - __pyx_v_endian_detector = 1; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":207 - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * - * ndim = PyArray_NDIM(self) - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":209 - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":211 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":212 - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * copy_shape = 1 # <<<<<<<<<<<<<< - * else: - * copy_shape = 0 - */ - __pyx_v_copy_shape = 1; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":211 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - goto __pyx_L4; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":214 - * copy_shape = 1 - * else: - * copy_shape = 0 # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - */ - /*else*/ { - __pyx_v_copy_shape = 0; - } - __pyx_L4:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L6_bool_binop_done; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":217 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not C contiguous") - * - */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L6_bool_binop_done:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":218 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __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_ERR(1, 218, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":220 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L9_bool_binop_done; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":221 - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not Fortran contiguous") - * - */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L9_bool_binop_done:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":220 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":222 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 222, __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_ERR(1, 222, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":220 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":224 - * raise ValueError(u"ndarray is not Fortran contiguous") - * - * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< - * info.ndim = ndim - * if copy_shape: - */ - __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":225 - * - * info.buf = PyArray_DATA(self) - * info.ndim = ndim # <<<<<<<<<<<<<< - * if copy_shape: - * # Allocate new buffer for strides and shape info. - */ - __pyx_v_info->ndim = __pyx_v_ndim; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":226 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - */ - __pyx_t_1 = (__pyx_v_copy_shape != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":229 - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< - * info.shape = info.strides + ndim - * for i in range(ndim): - */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":230 - * # This is allocated as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim # <<<<<<<<<<<<<< - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - */ - __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":231 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim - * for i in range(ndim): # <<<<<<<<<<<<<< - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] - */ - __pyx_t_4 = __pyx_v_ndim; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":232 - * info.shape = info.strides + ndim - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":233 - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< - * else: - * info.strides = PyArray_STRIDES(self) - */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":226 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - */ - goto __pyx_L11; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":235 - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - */ - /*else*/ { - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":236 - * else: - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); - } - __pyx_L11:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":237 - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) - */ - __pyx_v_info->suboffsets = NULL; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":238 - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< - * info.readonly = not PyArray_ISWRITEABLE(self) - * - */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":239 - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< - * - * cdef int t - */ - __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":242 - * - * cdef int t - * cdef char* f = NULL # <<<<<<<<<<<<<< - * cdef dtype descr = self.descr - * cdef int offset - */ - __pyx_v_f = NULL; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":243 - * cdef int t - * cdef char* f = NULL - * cdef dtype descr = self.descr # <<<<<<<<<<<<<< - * cdef int offset - * - */ - __pyx_t_3 = ((PyObject *)__pyx_v_self->descr); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":246 - * cdef int offset - * - * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * - * if not hasfields and not copy_shape: - */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":248 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L15_bool_binop_done:; - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":250 - * if not hasfields and not copy_shape: - * # do not call releasebuffer - * info.obj = None # <<<<<<<<<<<<<< - * else: - * # need to call releasebuffer - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = Py_None; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":248 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - goto __pyx_L14; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":253 - * else: - * # need to call releasebuffer - * info.obj = self # <<<<<<<<<<<<<< - * -<<<<<<< HEAD - * if not has***REMOVED*** -======= - * if not hasfields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - */ - /*else*/ { - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - } - __pyx_L14:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":255 - * info.obj = self - * -<<<<<<< HEAD - * if not has***REMOVED*** # <<<<<<<<<<<<<< -======= - * if not hasfields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - */ - __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":256 - * -<<<<<<< HEAD - * if not has***REMOVED*** -======= - * if not hasfields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - */ - __pyx_t_4 = __pyx_v_descr->type_num; - __pyx_v_t = __pyx_t_4; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":257 -<<<<<<< HEAD - * if not has***REMOVED*** -======= - * if not hasfields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0); - if (!__pyx_t_2) { - goto __pyx_L20_next_or; - } else { - } - __pyx_t_2 = (__pyx_v_little_endian != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L19_bool_binop_done; - } - __pyx_L20_next_or:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":258 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - */ - __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L19_bool_binop_done; - } - __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L19_bool_binop_done:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":257 -<<<<<<< HEAD - * if not has***REMOVED*** -======= - * if not hasfields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":259 - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 259, __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_ERR(1, 259, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":257 -<<<<<<< HEAD - * if not has***REMOVED*** -======= - * if not hasfields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":260 - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - */ - switch (__pyx_v_t) { - case NPY_BYTE: - __pyx_v_f = ((char *)"b"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":261 - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - */ - case NPY_UBYTE: - __pyx_v_f = ((char *)"B"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":262 - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - */ - case NPY_SHORT: - __pyx_v_f = ((char *)"h"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":263 - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - */ - case NPY_USHORT: - __pyx_v_f = ((char *)"H"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":264 - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - */ - case NPY_INT: - __pyx_v_f = ((char *)"i"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":265 - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - */ - case NPY_UINT: - __pyx_v_f = ((char *)"I"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":266 - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - */ - case NPY_LONG: - __pyx_v_f = ((char *)"l"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":267 - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - */ - case NPY_ULONG: - __pyx_v_f = ((char *)"L"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":268 - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - */ - case NPY_LONGLONG: - __pyx_v_f = ((char *)"q"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":269 - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - */ - case NPY_ULONGLONG: - __pyx_v_f = ((char *)"Q"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":270 - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - */ - case NPY_FLOAT: - __pyx_v_f = ((char *)"f"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":271 - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - */ - case NPY_DOUBLE: - __pyx_v_f = ((char *)"d"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":272 - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - */ - case NPY_LONGDOUBLE: - __pyx_v_f = ((char *)"g"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":273 - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - */ - case NPY_CFLOAT: - __pyx_v_f = ((char *)"Zf"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":274 - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" - */ - case NPY_CDOUBLE: - __pyx_v_f = ((char *)"Zd"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":275 - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f = "O" - * else: - */ - case NPY_CLONGDOUBLE: - __pyx_v_f = ((char *)"Zg"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":276 - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - case NPY_OBJECT: - __pyx_v_f = ((char *)"O"); - break; - default: - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":278 - * elif t == NPY_OBJECT: f = "O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * info.format = f - * return - */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(1, 278, __pyx_L1_error) - break; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":279 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f # <<<<<<<<<<<<<< - * return - * else: - */ - __pyx_v_info->format = __pyx_v_f; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":280 - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f - * return # <<<<<<<<<<<<<< - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":255 - * info.obj = self - * -<<<<<<< HEAD - * if not has***REMOVED*** # <<<<<<<<<<<<<< -======= - * if not hasfields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":282 - * return - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 - */ - /*else*/ { - __pyx_v_info->format = ((char *)malloc(0xFF)); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":283 - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, - */ - (__pyx_v_info->format[0]) = '^'; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":284 - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 # <<<<<<<<<<<<<< - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - */ - __pyx_v_offset = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":285 - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< - * info.format + _buffer_format_string_len, - * &offset) - */ - __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) __PYX_ERR(1, 285, __pyx_L1_error) - __pyx_v_f = __pyx_t_7; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":288 - * info.format + _buffer_format_string_len, - * &offset) - * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - */ - (__pyx_v_f[0]) = '\x00'; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":197 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(Py_None); - __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; - } - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":290 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - -/* Python wrapper */ -static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); - __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":291 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":292 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) - */ - free(__pyx_v_info->format); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":291 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":293 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block - */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":294 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block - * - */ - free(__pyx_v_info->strides); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":293 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":290 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":770 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":771 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew2(a, b): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 771, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":770 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":773 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":774 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":773 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":776 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":777 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":776 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":779 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":780 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":779 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":782 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":783 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":782 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":785 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child = 0; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - PyObject *__pyx_v_fields = 0; - PyObject *__pyx_v_childname = NULL; - PyObject *__pyx_v_new_offset = NULL; - PyObject *__pyx_v_t = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - long __pyx_t_8; - char *__pyx_t_9; - __Pyx_RefNannySetupContext("_util_dtypestring", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":790 - * - * cdef dtype child - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * cdef tuple fields - */ - __pyx_v_endian_detector = 1; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":791 - * cdef dtype child - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * cdef tuple fields - * - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":794 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - if (unlikely(__pyx_v_descr->names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(1, 794, __pyx_L1_error) - } - __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - for (;;) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 794, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 794, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); - __pyx_t_3 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":795 - * - * for childname in descr.names: - * fields = descr.fields[childname] # <<<<<<<<<<<<<< - * child, new_offset = fields - * - */ - if (unlikely(__pyx_v_descr->fields == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 795, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 795, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 795, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":796 - * for childname in descr.names: - * fields = descr.fields[childname] - * child, new_offset = fields # <<<<<<<<<<<<<< - * - * if (end - f) - (new_offset - offset[0]) < 15: - */ - if (likely(__pyx_v_fields != Py_None)) { - PyObject* sequence = __pyx_v_fields; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 796, __pyx_L1_error) - } - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 796, __pyx_L1_error) - } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 796, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); - __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); - __pyx_t_4 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":798 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 798, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); - if (__pyx_t_6) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":799 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == c'>' and little_endian) or - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 799, __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_ERR(1, 799, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":798 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":801 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); - if (!__pyx_t_7) { - goto __pyx_L8_next_or; - } else { - } - __pyx_t_7 = (__pyx_v_little_endian != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L7_bool_binop_done; - } - __pyx_L8_next_or:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":802 - * - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * # One could encode it in the format string and have Cython - */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); - if (__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_6 = __pyx_t_7; - __pyx_L7_bool_binop_done:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":801 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - if (__pyx_t_6) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":803 - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 803, __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_ERR(1, 803, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":801 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":813 - * - * # Output padding bytes - * while offset[0] < new_offset: # <<<<<<<<<<<<<< - * f[0] = 120 # "x"; pad byte - * f += 1 - */ - while (1) { - __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 813, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 813, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 813, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_6) break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":814 - * # Output padding bytes - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< - * f += 1 - * offset[0] += 1 - */ - (__pyx_v_f[0]) = 0x78; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":815 - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte - * f += 1 # <<<<<<<<<<<<<< - * offset[0] += 1 - * - */ - __pyx_v_f = (__pyx_v_f + 1); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":816 - * f[0] = 120 # "x"; pad byte - * f += 1 - * offset[0] += 1 # <<<<<<<<<<<<<< - * - * offset[0] += child.itemsize - */ - __pyx_t_8 = 0; - (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":818 - * offset[0] += 1 - * - * offset[0] += child.itemsize # <<<<<<<<<<<<<< - * - * if not PyDataType_HASFIELDS(child): - */ - __pyx_t_8 = 0; - (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":820 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); - if (__pyx_t_6) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":821 - * - * if not PyDataType_HASFIELDS(child): - * t = child.type_num # <<<<<<<<<<<<<< - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); - __pyx_t_4 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":822 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); - if (__pyx_t_6) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":823 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(1, 823, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":822 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":826 - * - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 826, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 98; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":827 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 827, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 827, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 66; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":828 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 828, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 828, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x68; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":829 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 829, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 829, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 72; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":830 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 830, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 830, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x69; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":831 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 831, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 831, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 831, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 73; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":832 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 832, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 832, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x6C; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":833 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 833, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 833, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 833, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 76; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":834 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 834, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 834, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x71; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":835 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 835, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 835, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 81; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":836 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 836, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 836, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x66; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":837 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x64; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":838 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x67; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":839 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x66; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":840 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x64; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":841 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x67; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":842 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 79; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":844 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: - */ - /*else*/ { - __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 844, __pyx_L1_error) - } - __pyx_L15:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":845 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * # Cython ignores struct boundary information ("T{...}"), - */ - __pyx_v_f = (__pyx_v_f + 1); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":820 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - goto __pyx_L13; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":849 - * # Cython ignores struct boundary information ("T{...}"), - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< - * return f - * - */ - /*else*/ { - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) __PYX_ERR(1, 849, __pyx_L1_error) - __pyx_v_f = __pyx_t_9; - } - __pyx_L13:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":794 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":850 - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) - * return f # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_f; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":785 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_child); - __Pyx_XDECREF(__pyx_v_fields); - __Pyx_XDECREF(__pyx_v_childname); - __Pyx_XDECREF(__pyx_v_new_offset); - __Pyx_XDECREF(__pyx_v_t); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":966 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: - */ - -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - PyObject *__pyx_v_baseptr; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("set_array_base", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":968 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_base == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":969 - * cdef PyObject* baseptr - * if base is None: - * baseptr = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(base) # important to do this before decref below! - */ - __pyx_v_baseptr = NULL; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":968 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - goto __pyx_L3; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":971 - * baseptr = NULL - * else: - * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< - * baseptr = base - * Py_XDECREF(arr.base) - */ - /*else*/ { - Py_INCREF(__pyx_v_base); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":972 - * else: - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base # <<<<<<<<<<<<<< - * Py_XDECREF(arr.base) - * arr.base = baseptr - */ - __pyx_v_baseptr = ((PyObject *)__pyx_v_base); - } - __pyx_L3:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":973 - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base - * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< - * arr.base = baseptr - * - */ - Py_XDECREF(__pyx_v_arr->base); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":974 - * baseptr = base - * Py_XDECREF(arr.base) - * arr.base = baseptr # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - __pyx_v_arr->base = __pyx_v_baseptr; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":966 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":976 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":977 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":978 - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: - * return None # <<<<<<<<<<<<<< - * else: - * return arr.base - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":977 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":980 - * return None - * else: - * return arr.base # <<<<<<<<<<<<<< - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); - __pyx_r = ((PyObject *)__pyx_v_arr->base); - goto __pyx_L0; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":976 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.from_py":13 - * - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< - * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - */ - -static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { - Py_ssize_t __pyx_v_length; - char *__pyx_v_data; - std::string __pyx_r; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); - - /* "string.from_py":15 - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: - * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< - * return string(data, length) - * - */ - __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(2, 15, __pyx_L1_error) - __pyx_v_data = __pyx_t_1; - - /* "string.from_py":16 - * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - * return string(data, length) # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = std::string(__pyx_v_data, __pyx_v_length); - goto __pyx_L0; - - /* "string.from_py":13 - * - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< - * cdef Py_ssize_t length - * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":31 - * - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0); - - /* "string.to_py":32 - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyUnicode_FromStringAndSize(char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":31 - * - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":37 - * - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0); - - /* "string.to_py":38 - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyStr_FromStringAndSize(char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":37 - * - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":43 - * - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0); - - /* "string.to_py":44 - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyBytes_FromStringAndSize(char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":43 - * - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":49 - * - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0); - - /* "string.to_py":50 - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyByteArray_FromStringAndSize(char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":49 - * - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":55 - * - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) - * - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0); - - /* "string.to_py":56 - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":55 - * - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_tp_new_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)o); - p->_field_type = Py_None; Py_INCREF(Py_None); - p->_missing_values = Py_None; Py_INCREF(Py_None); - p->_fill_value = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter(PyObject *o) { - struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *p = (struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_5__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->_field_type); - Py_CLEAR(p->_missing_values); - Py_CLEAR(p->_fill_value); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *p = (struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)o; - if (p->_field_type) { - e = (*v)(p->_field_type, a); if (e) return e; - } - if (p->_missing_values) { - e = (*v)(p->_missing_values, a); if (e) return e; - } - if (p->_fill_value) { - e = (*v)(p->_fill_value, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *p = (struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter *)o; - tmp = ((PyObject*)p->_field_type); - p->_field_type = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_missing_values); - p->_missing_values = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_fill_value); - p->_fill_value = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} -static PyObject *__pyx_sq_item_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter(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 PyObject *__pyx_getprop_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_field_type(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_10field_type_1__get__(o); -} - -static PyMethodDef __pyx_methods_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter[] = { - {"close", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_3close, METH_NOARGS, __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_2close}, - {"_check_connection", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_7_check_connection, METH_NOARGS, 0}, - {"get_start_key", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_11get_start_key, METH_NOARGS, __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_10get_start_key}, - {"set_start_key", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_13set_start_key, METH_O, 0}, - {"get_stop_key", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_15get_stop_key, METH_NOARGS, 0}, - {"set_stop_key", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_17set_stop_key, METH_O, 0}, - {"get_start_key_inclusive", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_19get_start_key_inclusive, METH_NOARGS, 0}, - {"set_start_key_inclusive", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_21set_start_key_inclusive, METH_O, 0}, - {"get_stop_key_inclusive", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_23get_stop_key_inclusive, METH_NOARGS, __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_22get_stop_key_inclusive}, - {"set_stop_key_inclusive", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_25set_stop_key_inclusive, METH_O, 0}, - {"set_missing_values", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_27set_missing_values, METH_O, 0}, - {"get_missing_values", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_29get_missing_values, METH_NOARGS, __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_28get_missing_values}, - {"set_fill_value", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_31set_fill_value, METH_O, 0}, - {"get_fill_value", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_33get_fill_value, METH_NOARGS, __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_32get_fill_value}, - {"_to_array", (PyCFunction)__pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_35_to_array, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_34_to_array}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter[] = { - {(char *)"field_type", __pyx_getprop_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_field_type, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_AccumuloAdapter = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, /*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_AccumuloAdapter = { - 0, /*mp_length*/ - __pyx_pw_5iopro_15accumuloadapter_15AccumuloAdapter_15AccumuloAdapter_9__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter = { - PyVarObject_HEAD_INIT(0, 0) - "iopro.accumuloadapter.AccumuloAdapter.AccumuloAdapter", /*tp_name*/ - sizeof(struct __pyx_obj_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_AccumuloAdapter, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_AccumuloAdapter, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "\n Accumulo Adapter for reading data from Accumulo database into NumPy arrays\n or Pandas dataframes.\n \n Constructor Inputs:\n server: Accumulo server address\n port: Accumulo port\n username: Accumulo user name\n password: Accumulo user password\n table: Accumulo table to read data from\n field_type: str, NumPy dtype to interpret table values as\n start_key: str, key of record where scanning will start from\n stop_key: str, key of record where scanning will stop at\n start_key_inclusive: If True, start_key is inclusive (default is True)\n stop_key_inclusive: If True, stop_key is inclusive (default is False)\n missing_values: list, missing value strings. Any values in table equal\n to one of these strings will be replaced with fill_value.\n fill_value: fill value used to replace missing value when scanning\n ", /*tp_doc*/ - __pyx_tp_traverse_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, /*tp_traverse*/ - __pyx_tp_clear_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, /*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_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "AccumuloAdapter", - 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_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, - {&__pyx_kp_s_0_records_successfully_read_but, __pyx_k_0_records_successfully_read_but, sizeof(__pyx_k_0_records_successfully_read_but), 0, 0, 1, 0}, - {&__pyx_kp_s_Connection_already_closed_Please, __pyx_k_Connection_already_closed_Please, sizeof(__pyx_k_Connection_already_closed_Please), 0, 0, 1, 0}, - {&__pyx_n_s_DEFAULT_BUFFER_SIZE, __pyx_k_DEFAULT_BUFFER_SIZE, sizeof(__pyx_k_DEFAULT_BUFFER_SIZE), 0, 0, 1, 1}, - {&__pyx_kp_s_Error_connecting_to_Accumulo_ser, __pyx_k_Error_connecting_to_Accumulo_ser, sizeof(__pyx_k_Error_connecting_to_Accumulo_ser), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_type_must_be_set_before_re, __pyx_k_Field_type_must_be_set_before_re, sizeof(__pyx_k_Field_type_must_be_set_before_re), 0, 0, 1, 0}, - {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, - {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, - {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1}, - {&__pyx_kp_s_Invalid_Accumulo_table_name, __pyx_k_Invalid_Accumulo_table_name, sizeof(__pyx_k_Invalid_Accumulo_table_name), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_Accumulo_username_or_pas, __pyx_k_Invalid_Accumulo_username_or_pas, sizeof(__pyx_k_Invalid_Accumulo_username_or_pas), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_fill_value, __pyx_k_Invalid_fill_value, sizeof(__pyx_k_Invalid_fill_value), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_record_read, __pyx_k_Invalid_record_read, sizeof(__pyx_k_Invalid_record_read), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_start_record, __pyx_k_Invalid_start_record, sizeof(__pyx_k_Invalid_start_record), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_table_name, __pyx_k_Invalid_table_name, sizeof(__pyx_k_Invalid_table_name), 0, 0, 1, 0}, - {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0}, - {&__pyx_n_s_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 1, 1}, - {&__pyx_kp_s_Output_field_type_0_not_supporte, __pyx_k_Output_field_type_0_not_supporte, sizeof(__pyx_k_Output_field_type_0_not_supporte), 0, 0, 1, 0}, - {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 0, 1, 1}, - {&__pyx_kp_s_Table_name_is_required, __pyx_k_Table_name_is_required, sizeof(__pyx_k_Table_name_is_required), 0, 0, 1, 0}, - {&__pyx_kp_s_Unable_to_connect_to_Accumulo_se, __pyx_k_Unable_to_connect_to_Accumulo_se, sizeof(__pyx_k_Unable_to_connect_to_Accumulo_se), 0, 0, 1, 0}, - {&__pyx_kp_s_Unable_to_convert_table_values_t, __pyx_k_Unable_to_convert_table_values_t, sizeof(__pyx_k_Unable_to_convert_table_values_t), 0, 0, 1, 0}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1}, - {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, - {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1}, - {&__pyx_n_s_ceil, __pyx_k_ceil, sizeof(__pyx_k_ceil), 0, 0, 1, 1}, - {&__pyx_n_s_check_connection, __pyx_k_check_connection, sizeof(__pyx_k_check_connection), 0, 0, 1, 1}, - {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1}, - {&__pyx_n_s_f8, __pyx_k_f8, sizeof(__pyx_k_f8), 0, 0, 1, 1}, - {&__pyx_n_s_field_type, __pyx_k_field_type, sizeof(__pyx_k_field_type), 0, 0, 1, 1}, - {&__pyx_n_s_fill_value, __pyx_k_fill_value, sizeof(__pyx_k_fill_value), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_get_fill_value, __pyx_k_get_fill_value, sizeof(__pyx_k_get_fill_value), 0, 0, 1, 1}, - {&__pyx_n_s_get_missing_values, __pyx_k_get_missing_values, sizeof(__pyx_k_get_missing_values), 0, 0, 1, 1}, - {&__pyx_n_s_get_start_key, __pyx_k_get_start_key, sizeof(__pyx_k_get_start_key), 0, 0, 1, 1}, - {&__pyx_n_s_get_start_key_inclusive, __pyx_k_get_start_key_inclusive, sizeof(__pyx_k_get_start_key_inclusive), 0, 0, 1, 1}, - {&__pyx_n_s_get_stop_key, __pyx_k_get_stop_key, sizeof(__pyx_k_get_stop_key), 0, 0, 1, 1}, - {&__pyx_n_s_get_stop_key_inclusive, __pyx_k_get_stop_key_inclusive, sizeof(__pyx_k_get_stop_key_inclusive), 0, 0, 1, 1}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_kp_s_invalid_slice, __pyx_k_invalid_slice, sizeof(__pyx_k_invalid_slice), 0, 0, 1, 0}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_n_s_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 0, 1, 1}, - {&__pyx_n_s_localhost, __pyx_k_localhost, sizeof(__pyx_k_localhost), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1}, - {&__pyx_n_s_missing_values, __pyx_k_missing_values, sizeof(__pyx_k_missing_values), 0, 0, 1, 1}, - {&__pyx_n_s_nan, __pyx_k_nan, sizeof(__pyx_k_nan), 0, 0, 1, 1}, - {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, - {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_n_s_password, __pyx_k_password, sizeof(__pyx_k_password), 0, 0, 1, 1}, - {&__pyx_n_s_port, __pyx_k_port, sizeof(__pyx_k_port), 0, 0, 1, 1}, - {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_kp_s_reading_records_in_reverse_not_s, __pyx_k_reading_records_in_reverse_not_s, sizeof(__pyx_k_reading_records_in_reverse_not_s), 0, 0, 1, 0}, - {&__pyx_n_s_resize, __pyx_k_resize, sizeof(__pyx_k_resize), 0, 0, 1, 1}, - {&__pyx_kp_s_seeking_from_end_of_table_not_su, __pyx_k_seeking_from_end_of_table_not_su, sizeof(__pyx_k_seeking_from_end_of_table_not_su), 0, 0, 1, 0}, - {&__pyx_n_s_server, __pyx_k_server, sizeof(__pyx_k_server), 0, 0, 1, 1}, - {&__pyx_n_s_set_fill_value, __pyx_k_set_fill_value, sizeof(__pyx_k_set_fill_value), 0, 0, 1, 1}, - {&__pyx_n_s_set_missing_values, __pyx_k_set_missing_values, sizeof(__pyx_k_set_missing_values), 0, 0, 1, 1}, - {&__pyx_n_s_set_start_key, __pyx_k_set_start_key, sizeof(__pyx_k_set_start_key), 0, 0, 1, 1}, - {&__pyx_n_s_set_start_key_inclusive, __pyx_k_set_start_key_inclusive, sizeof(__pyx_k_set_start_key_inclusive), 0, 0, 1, 1}, - {&__pyx_n_s_set_stop_key, __pyx_k_set_stop_key, sizeof(__pyx_k_set_stop_key), 0, 0, 1, 1}, - {&__pyx_n_s_set_stop_key_inclusive, __pyx_k_set_stop_key_inclusive, sizeof(__pyx_k_set_stop_key_inclusive), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_kp_s_slice_step_cannot_be_zero, __pyx_k_slice_step_cannot_be_zero, sizeof(__pyx_k_slice_step_cannot_be_zero), 0, 0, 1, 0}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_start_key, __pyx_k_start_key, sizeof(__pyx_k_start_key), 0, 0, 1, 1}, - {&__pyx_n_s_start_key_inclusive, __pyx_k_start_key_inclusive, sizeof(__pyx_k_start_key_inclusive), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_n_s_stop_key, __pyx_k_stop_key, sizeof(__pyx_k_stop_key), 0, 0, 1, 1}, - {&__pyx_n_s_stop_key_inclusive, __pyx_k_stop_key_inclusive, sizeof(__pyx_k_stop_key_inclusive), 0, 0, 1, 1}, - {&__pyx_n_s_table, __pyx_k_table, sizeof(__pyx_k_table), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_to_array, __pyx_k_to_array, sizeof(__pyx_k_to_array), 0, 0, 1, 1}, - {&__pyx_n_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 1}, - {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, - {&__pyx_n_s_username, __pyx_k_username, sizeof(__pyx_k_username), 0, 0, 1, 1}, - {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1}, - {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 212, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 109, __pyx_L1_error) - __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 122, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 177, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 231, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":109 - * """ - * if table is None: - * raise ValueError('Table name is required') # <<<<<<<<<<<<<< - * - * # JNB: force ascii encoding until I figure out whether Accumulo - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Table_name_is_required); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":114 - * # supports unicode, and if so, how to get correct encoding. - * cdef AdapterError error = ADAPTER_SUCCESS - * self._adapter = open_accumulo_adapter(server.encode('ascii'), # <<<<<<<<<<<<<< - * port, - * username.encode('ascii'), - */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":116 - * self._adapter = open_accumulo_adapter(server.encode('ascii'), - * port, - * username.encode('ascii'), # <<<<<<<<<<<<<< - * password.encode('ascii'), - * table.encode('ascii'), - */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":117 - * port, - * username.encode('ascii'), - * password.encode('ascii'), # <<<<<<<<<<<<<< - * table.encode('ascii'), - * &error) - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":118 - * username.encode('ascii'), - * password.encode('ascii'), - * table.encode('ascii'), # <<<<<<<<<<<<<< - * &error) - * if self._adapter == NULL: - */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":122 - * if self._adapter == NULL: - * if error == ADAPTER_ERROR_SOCKET: - * raise IOError('Unable to connect to Accumulo server') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_LOGIN: - * raise IOError('Invalid Accumulo username or password') - */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_connect_to_Accumulo_se); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":124 - * raise IOError('Unable to connect to Accumulo server') - * elif error == ADAPTER_ERROR_LOGIN: - * raise IOError('Invalid Accumulo username or password') # <<<<<<<<<<<<<< - * elif error == ADAPTER_ERROR_TABLE_NAME: - * raise IOError('Invalid Accumulo table name') - */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Invalid_Accumulo_username_or_pas); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":126 - * raise IOError('Invalid Accumulo username or password') - * elif error == ADAPTER_ERROR_TABLE_NAME: - * raise IOError('Invalid Accumulo table name') # <<<<<<<<<<<<<< - * else: - * raise IOError('Error connecting to Accumulo server') - */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Invalid_Accumulo_table_name); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":128 - * raise IOError('Invalid Accumulo table name') - * else: - * raise IOError('Error connecting to Accumulo server') # <<<<<<<<<<<<<< - * - * self._adapter.output_type_size = 0 - */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Error_connecting_to_Accumulo_ser); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":177 - * def _check_connection(self): - * if self._adapter == NULL: - * raise RuntimeError('Connection already closed. ' # <<<<<<<<<<<<<< - * 'Please create a new adapter.') - * - */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Connection_already_closed_Please); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":196 - * return self._to_array(index.start, index.stop, index.step) - * else: - * raise ValueError('invalid slice') # <<<<<<<<<<<<<< - * - * def get_start_key(self): - */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_invalid_slice); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":210 - * if key is None: - * key = '' - * self._adapter.start_key = key.encode('ascii') # <<<<<<<<<<<<<< - * - * start_key = property(get_start_key, set_start_key) - */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":226 - * if key is None: - * key = '' - * self._adapter.stop_key = key.encode('ascii') # <<<<<<<<<<<<<< - * - * stop_key = property(get_stop_key, set_stop_key) - */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":263 - * else: - * for m in missing_values: - * add_missing_value(self._adapter, m.encode('ascii')) # <<<<<<<<<<<<<< - * self._missing_values = missing_values - * - */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":284 - * carray = numpy.array([fill_value], self._field_type) - * if carray.dtype.kind == 'O': - * raise ValueError('Invalid fill value') # <<<<<<<<<<<<<< - * set_fill_value(self._adapter, carray.data, carray.itemsize) - * self._fill_value == fill_value - */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Invalid_fill_value); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":315 - * - * if self._field_type is None: - * raise RuntimeError('Field type must be set before reading records') # <<<<<<<<<<<<<< - * - * if start is None: - */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Field_type_must_be_set_before_re); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 315, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":322 - * step = 1 - * if start < 0: - * raise ValueError('seeking from end of table not supported') # <<<<<<<<<<<<<< - * if step == 0: - * raise ValueError('slice step cannot be zero') - */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_seeking_from_end_of_table_not_su); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 322, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":324 - * raise ValueError('seeking from end of table not supported') - * if step == 0: - * raise ValueError('slice step cannot be zero') # <<<<<<<<<<<<<< - * if step < 0: - * raise ValueError('reading records in reverse not supported') - */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_slice_step_cannot_be_zero); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 324, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":326 - * raise ValueError('slice step cannot be zero') - * if step < 0: - * raise ValueError('reading records in reverse not supported') # <<<<<<<<<<<<<< - * if stop is not None and stop <= start: - * return numpy.array([], dtype=self._field_type) - */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_reading_records_in_reverse_not_s); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":333 - * result = seek_record(self._adapter, start) - * if result == ADAPTER_ERROR_INVALID_SEEK: - * raise ValueError('Invalid start record') # <<<<<<<<<<<<<< - * elif result == ADAPTER_ERROR_INVALID_TABLE_NAME: - * raise ValueError('Invalid table name') - */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Invalid_start_record); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":335 - * raise ValueError('Invalid start record') - * elif result == ADAPTER_ERROR_INVALID_TABLE_NAME: - * raise ValueError('Invalid table name') # <<<<<<<<<<<<<< - * - * total_num_records_found = 0 - */ - __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Invalid_table_name); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":338 - * - * total_num_records_found = 0 - * carray = numpy.ndarray(0, dtype=self.field_type) # <<<<<<<<<<<<<< - * - * if stop is not None: - */ - __pyx_tuple__23 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":369 - * raise RuntimeError("Unable to convert table values to '{0}' dtype".format(self.field_type)) - * elif result != ADAPTER_SUCCESS and result != ADAPTER_ERROR_EOF: - * raise RuntimeError('Invalid record read') # <<<<<<<<<<<<<< - * total_num_records_found += num_records_found - * if ((stop is None and num_records_found < num_records) or - */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_Invalid_record_read); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":218 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":222 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":259 - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":799 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == c'>' and little_endian) or - */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":803 - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 803, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":823 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_42424 = PyInt_FromLong(42424L); if (unlikely(!__pyx_int_42424)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initAccumuloAdapter(void); /*proto*/ -PyMODINIT_FUNC initAccumuloAdapter(void) -#else -PyMODINIT_FUNC PyInit_AccumuloAdapter(void); /*proto*/ -PyMODINIT_FUNC PyInit_AccumuloAdapter(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __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_AccumuloAdapter(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __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("AccumuloAdapter", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_iopro__accumuloadapter__AccumuloAdapter) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "iopro.accumuloadapter.AccumuloAdapter")) { - if (unlikely(PyDict_SetItemString(modules, "iopro.accumuloadapter.AccumuloAdapter", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter) < 0) __PYX_ERR(0, 66, __pyx_L1_error) - __pyx_type_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "AccumuloAdapter", (PyObject *)&__pyx_type_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter) < 0) __PYX_ERR(0, 66, __pyx_L1_error) - __pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter = &__pyx_type_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter; - /*--- Type import code ---*/ - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", - #if CYTHON_COMPILING_IN_PYPY - sizeof(PyTypeObject), - #else - sizeof(PyHeapTypeObject), - #endif - 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(3, 9, __pyx_L1_error) - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 155, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 168, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 172, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 181, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 861, __pyx_L1_error) - /*--- Variable import code ---*/ - /*--- Function import code ---*/ - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":2 - * from __future__ import division - * import numpy # <<<<<<<<<<<<<< - * cimport numpy - * from libcpp cimport bool - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":6 - * from libcpp cimport bool - * from libcpp.string cimport string - * import warnings # <<<<<<<<<<<<<< - * import math - * - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":7 - * from libcpp.string cimport string - * import warnings - * import math # <<<<<<<<<<<<<< - * - * numpy.import_array() - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_math, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":9 - * import math - * - * numpy.import_array() # <<<<<<<<<<<<<< - * - * cdef extern from '_stdint.h': - */ - import_array(); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":64 - * - * # Size of buffer when reading an indeterminate number of records - * DEFAULT_BUFFER_SIZE = 1000 # <<<<<<<<<<<<<< - * - * cdef class AccumuloAdapter: - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_BUFFER_SIZE, __pyx_int_1000) < 0) __PYX_ERR(0, 64, __pyx_L1_error) - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":212 - * self._adapter.start_key = key.encode('ascii') - * - * start_key = property(get_start_key, set_start_key) # <<<<<<<<<<<<<< - * - * def get_stop_key(self): - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_get_start_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_set_start_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter->tp_dict, __pyx_n_s_start_key, __pyx_t_2) < 0) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyType_Modified(__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":228 - * self._adapter.stop_key = key.encode('ascii') - * - * stop_key = property(get_stop_key, set_stop_key) # <<<<<<<<<<<<<< - * - * def get_start_key_inclusive(self): - */ - __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_get_stop_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_set_stop_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter->tp_dict, __pyx_n_s_stop_key, __pyx_t_3) < 0) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - PyType_Modified(__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":241 - * self._adapter.start_key_inclusive = inclusive - * - * start_key_inclusive = property(get_start_key_inclusive, set_start_key_inclusive) # <<<<<<<<<<<<<< - * - * def get_stop_key_inclusive(self): - */ - __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_get_start_key_inclusive); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_set_start_key_inclusive); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter->tp_dict, __pyx_n_s_start_key_inclusive, __pyx_t_1) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":254 - * self._adapter.stop_key_inclusive = inclusive - * - * stop_key_inclusive = property(get_stop_key_inclusive, set_stop_key_inclusive) # <<<<<<<<<<<<<< - * - * def set_missing_values(self, missing_values): - */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_get_stop_key_inclusive); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_set_stop_key_inclusive); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter->tp_dict, __pyx_n_s_stop_key_inclusive, __pyx_t_2) < 0) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyType_Modified(__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":274 - * return self._missing_values - * - * missing_values = property(get_missing_values, set_missing_values) # <<<<<<<<<<<<<< - * - * def set_fill_value(self, fill_value): - */ - __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_get_missing_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_set_missing_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter->tp_dict, __pyx_n_s_missing_values, __pyx_t_3) < 0) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - PyType_Modified(__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":295 - * return self._fill_value - * - * fill_value = property(get_fill_value, set_fill_value) # <<<<<<<<<<<<<< - * - * def _to_array(self, start=0, stop=None, step=1): - */ - __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_get_fill_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter, __pyx_n_s_set_fill_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter->tp_dict, __pyx_n_s_fill_value, __pyx_t_1) < 0) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_ptype_5iopro_15accumuloadapter_15AccumuloAdapter_AccumuloAdapter); - - /* "iopro/accumuloadapter/AccumuloAdapter.pyx":1 - * from __future__ import division # <<<<<<<<<<<<<< - * import numpy - * cimport numpy - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "string.to_py":55 - * - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) - * - */ - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init iopro.accumuloadapter.AccumuloAdapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init iopro.accumuloadapter.AccumuloAdapter"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#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 - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* RaiseDoubleKeywords */ -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_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -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; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* RaiseArgTupleInvalid */ -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, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyErrFetchRestore */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - 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_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - 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; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - 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)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } -#if PY_VERSION_HEX >= 0x03030000 - if (cause) { -#else - if (cause && cause != Py_None) { -#endif - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else 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; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - 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); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -#endif -} - -/* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* GetModuleGlobalName */ - static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* WriteUnraisableException */ - static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; -#endif -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); - } - #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); - } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); -#endif -} - -/* PyIntBinop */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3 - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - } - x = a + b; - return PyLong_FromLong(x); - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); -} -#endif - -/* decode_c_bytes */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( - const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - if (unlikely((start < 0) | (stop < 0))) { - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - } - if (stop > length) - stop = length; - length = stop - start; - if (unlikely(length <= 0)) - return PyUnicode_FromUnicode(NULL, 0); - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); - } -} - -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(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; -} - -/* PyIntBinop */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - if (op1 == op2) { - Py_RETURN_TRUE; - } - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long a = PyInt_AS_LONG(op1); - if (a == b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3 - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a; - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15 - default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ); - #else - default: Py_RETURN_FALSE; - #endif - } - } - if (a == b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - if ((double)a == (double)b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - return PyObject_RichCompare(op1, op2, Py_EQ); -} -#endif - -/* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -/* PyIntBinop */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a - b); - if (likely((x^a) >= 0 || (x^~b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3 - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - } - x = a - b; - return PyLong_FromLong(x); - long_long: - llx = lla - llb; - return PyLong_FromLongLong(llx); - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("subtract", return NULL) - result = ((double)a) - (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); -} -#endif - -/* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - 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_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - #endif - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_VERSION_HEX < 0x03030000 - 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 - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_VERSION_HEX < 0x03030000 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* GetNameInClass */ - static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) { - PyObject *result; - result = __Pyx_PyObject_GetAttrStr(nmspace, name); - if (!result) - result = __Pyx_GetModuleGlobalName(name); - return result; -} - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #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_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __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,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - py_frame->f_lineno = py_line; - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* None */ - #if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return ::std::complex< float >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -/* None */ - #if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrtf(z.real*z.real + z.imag*z.imag); - #else - return hypotf(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - float denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(a, a); - case 3: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(z, a); - case 4: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_absf(a); - theta = atan2f(a.imag, a.real); - } - lnr = logf(r); - z_r = expf(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cosf(z_theta); - z.imag = z_r * sinf(z_theta); - return z; - } - #endif -#endif - -/* None */ - #if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return ::std::complex< double >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -/* None */ - #if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrt(z.real*z.real + z.imag*z.imag); - #else - return hypot(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - double denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(a, a); - case 3: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(z, a); - case 4: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_abs(a); - theta = atan2(a.imag, a.real); - } - lnr = log(r); - z_r = exp(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cos(z_theta); - z.imag = z_r * sin(z_theta); - return z; - } - #endif -#endif - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { - const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(enum NPY_TYPES) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(enum NPY_TYPES) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - 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; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - 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; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CheckBinaryVersion */ - 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); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* ModuleImport */ - #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; - py_name = __Pyx_PyIdentifier_FromString(name); - 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 - -/* TypeImport */ - #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_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - py_name = __Pyx_PyIdentifier_FromString(class_name); - 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, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (!strict && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - else if ((size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return NULL; -} -#endif - -/* InitStrings */ - 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 - 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; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -#endif - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -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_IntOrLong(PyObject* x) { - PyNumberMethods *m; - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return __Pyx_NewRef(x); - m = Py_TYPE(x)->tp_as_number; -#if PY_MAJOR_VERSION < 3 - 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_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (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; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - 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) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/iopro/examples/IOPro PostgreSQL Adapter Tutorial.ipynb b/iopro/examples/IOPro PostgreSQL Adapter Tutorial.ipynb deleted file mode 100644 index a046048..0000000 --- a/iopro/examples/IOPro PostgreSQL Adapter Tutorial.ipynb +++ /dev/null @@ -1,736 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The following is a tutorial on using the new IOPro PostgreSQL/PostGIS/Greenplum adapter. In order to run this notebook, you'll need a running PostgreSQL server with PostGIS extensions installed. Otherwise you can simply follow along with the saved example results. All the examples here were tested with Python 3.5, but they should also work with Python 2.7" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "First we need to generate some test data. Since IOPro only supports pulling data from data sources, we'll use the Python module psycopg2 to create and populate a new table. The connection parameters will need to be changed to run this for your own PostgreSQL server (preferably a non production server!). The following example will create a new database called 'iopro_tutorial'. If a database already exists with that name, it will be destroyed." - ] - }, - { - "cell_type": "code", - "execution_count": 51, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "import psycopg2\n", - "from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT\n", - "\n", - "conn = psycopg2.connect('host=localhost dbname=postgres user=jayvius')\n", - "\n", - "# A new database cannot be created inside a transaction block,\n", - "# so enable autocommit\n", - "conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)\n", - "\n", - "# Use a try/except block to guard against existing database\n", - "# with same name. If database already exists, drop it and\n", - "# create new one.\n", - "cursor = conn.cursor()\n", - "try:\n", - " cursor.execute('CREATE DATABASE iopro_tutorial')\n", - "except psycopg2.ProgrammingError:\n", - " cursor.execute('DROP DATABASE iopro_tutorial')\n", - " cursor.execute('CREATE DATABASE iopro_tutorial')\n", - "cursor.close()\n", - "conn.close()\n", - "\n", - "conn = psycopg2.connect('host=localhost dbname=iopro_tutorial user=jayvius')\n", - " \n", - "cursor = conn.cursor()\n", - "\n", - "# Enable PostGIS extensions for this database\n", - "cursor.execute('CREATE EXTENSION postgis')\n", - "cursor.execute('CREATE EXTENSION postgis_topology')\n", - "cursor.execute('CREATE EXTENSION fuzzystrmatch')\n", - "cursor.execute('CREATE EXTENSION postgis_tiger_geocoder')\n", - "\n", - "cursor.execute('CREATE TABLE data (integer integer, '\n", - " 'real real, '\n", - " 'string varchar(10), '\n", - " 'point2d geometry(POINT), '\n", - " 'multipoint3d geometry(MULTIPOINTZ))')\n", - "cursor.execute(\"INSERT INTO data (integer, real, string, point2d, multipoint3d) VALUES \"\n", - " \"(1, 1.1, 'a', ST_MakePoint(0, 1), ST_Collect(ARRAY[ST_MakePoint(0, 1, 2), ST_MakePoint(3, 4, 5)]))\")\n", - "cursor.execute(\"INSERT INTO data (integer, real, string, point2d, multipoint3d) VALUES \"\n", - " \"(2, 2.2, 'bbb', ST_MakePoint(2, 3), ST_Collect(ARRAY[ST_MakePoint(6, 7, 8), ST_MakePoint(9, 10, 11)]))\")\n", - "cursor.execute(\"INSERT INTO data (integer, real, string, point2d, multipoint3d) VALUES \"\n", - " \"(3, 3.3, 'cccccc', ST_MakePoint(4, 5), ST_Collect(ARRAY[ST_MakePoint(12, 13, 14), ST_MakePoint(15, 16, 17)]))\")\n", - "cursor.execute(\"INSERT INTO data (integer, real, string, point2d, multipoint3d) VALUES \"\n", - " \"(4, 4.4, 'ddddddddd', ST_MakePoint(6, 7), ST_Collect(ARRAY[ST_MakePoint(18, 19, 20), ST_MakePoint(21, 22, 23)]))\")\n", - "cursor.execute(\"INSERT INTO data (integer, real, string, point2d, multipoint3d) VALUES \"\n", - " \"(5, 5.5, 'eeeeeeeeee', ST_MakePoint(8, 9), ST_Collect(ARRAY[ST_MakePoint(24, 25, 26), ST_MakePoint(27, 28, 29)]))\")\n", - "\n", - "conn.commit()\n", - "cursor.close()\n", - "conn.close()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Now we can start using IOPro. First we'll create a new PostgreSQL adapter for the table we created above." - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "import iopro\n", - "adapter = iopro.PostgresAdapter('host=localhost dbname=iopro_tutorial user=jayvius', table='data')" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "IOPro adapters use slicing to retrieve data. To retrieve all records from the 'data' table, the standard NumPy slicing notation can be used:" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([ (1, 1.100000023841858, 'a', [0.0, 1.0], [(0.0, 1.0, 2.0), (3.0, 4.0, 5.0)]),\n", - " (2, 2.200000047683716, 'bbb', [2.0, 3.0], [(6.0, 7.0, 8.0), (9.0, 10.0, 11.0)]),\n", - " (3, 3.299999952316284, 'cccccc', [4.0, 5.0], [(12.0, 13.0, 14.0), (15.0, 16.0, 17.0)]),\n", - " (4, 4.400000095367432, 'ddddddddd', [6.0, 7.0], [(18.0, 19.0, 20.0), (21.0, 22.0, 23.0)]),\n", - " (5, 5.5, 'eeeeeeeeee', [8.0, 9.0], [(24.0, 25.0, 26.0), (27.0, 28.0, 29.0)])], \n", - " dtype=[('integer', '>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "5" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "adapter.num_fields" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "We can also find the names of each field:" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "['integer', 'real', 'string', 'point2d', 'multipoint3d']" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "adapter.field_names" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "These names come from the names of the columns in the database and are used by default for the field names in our NumPy array result. We can change these names by setting the field_names property using a list of field names:" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "dtype([('field1', '\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
    integerrealstringpoint2dmultipoint3d
    011.1a[(0.0, 1.0)][(0.0, 1.0, 2.0), (3.0, 4.0, 5.0)]
    122.2bbb[(2.0, 3.0)][(6.0, 7.0, 8.0), (9.0, 10.0, 11.0)]
    233.3cccccc[(4.0, 5.0)][(12.0, 13.0, 14.0), (15.0, 16.0, 17.0)]
    344.4ddddddddd[(6.0, 7.0)][(18.0, 19.0, 20.0), (21.0, 22.0, 23.0)]
    455.5eeeeeeeeee[(8.0, 9.0)][(24.0, 25.0, 26.0), (27.0, 28.0, 29.0)]
    \n", - "" - ], - "text/plain": [ - " integer real string point2d \\\n", - "0 1 1.1 a [(0.0, 1.0)] \n", - "1 2 2.2 bbb [(2.0, 3.0)] \n", - "2 3 3.3 cccccc [(4.0, 5.0)] \n", - "3 4 4.4 ddddddddd [(6.0, 7.0)] \n", - "4 5 5.5 eeeeeeeeee [(8.0, 9.0)] \n", - "\n", - " multipoint3d \n", - "0 [(0.0, 1.0, 2.0), (3.0, 4.0, 5.0)] \n", - "1 [(6.0, 7.0, 8.0), (9.0, 10.0, 11.0)] \n", - "2 [(12.0, 13.0, 14.0), (15.0, 16.0, 17.0)] \n", - "3 [(18.0, 19.0, 20.0), (21.0, 22.0, 23.0)] \n", - "4 [(24.0, 25.0, 26.0), (27.0, 28.0, 29.0)] " - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "adapter = iopro.PostgresAdapter('host=localhost dbname=iopro_tutorial user=jayvius',\n", - " table='data',\n", - " dataframe=True)\n", - "adapter[:]" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "For one last example, we're use the adapter constructor's query argument to retrieve some PostGIS data that falls within a given bounding box:" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([(1, [0.0, 1.0]), (2, [2.0, 3.0])], \n", - " dtype=[('integer', ' -#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 -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 -#endif -#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 - #define CYTHON_USE_PYLONG_INTERNALS 1 -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#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_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#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 - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - 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_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if PY_VERSION_HEX >= 0x030500B1 -#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods -#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) -#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; -} __Pyx_PyAsyncMethodsStruct; -#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) -#else -#define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#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 - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#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_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#endif - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__iopro__postgresadapter__PostgresAdapter -#define __PYX_HAVE_API__iopro__postgresadapter__PostgresAdapter -#include "string.h" -#include "stdio.h" -#include "stdlib.h" -#include "numpy/arrayobject.h" -#include "numpy/ufuncobject.h" -#include "_stdint.h" -#include "postgres_adapter.h" -#include "postgis_fields.h" -#include "libpq-fe.h" -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -#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) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_COMPILING_IN_CPYTHON -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - -/* None.proto */ -#if !defined(CYTHON_CCOMPLEX) - #if defined(__cplusplus) - #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) - #define CYTHON_CCOMPLEX 1 - #else - #define CYTHON_CCOMPLEX 0 - #endif -#endif -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #include - #else - #include - #endif -#endif -#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) - #undef _Complex_I - #define _Complex_I 1.0fj -#endif - - -static const char *__pyx_f[] = { - "iopro/postgresadapter/PostgresAdapter.pyx", - "__init__.pxd", - "type.pxd", -}; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":725 - * # in Cython to enable them only on the right systems. - * - * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t - */ -typedef npy_int8 __pyx_t_5numpy_int8_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":726 - * - * ctypedef npy_int8 int8_t - * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< - * ctypedef npy_int32 int32_t - * ctypedef npy_int64 int64_t - */ -typedef npy_int16 __pyx_t_5numpy_int16_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":727 - * ctypedef npy_int8 int8_t - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< - * ctypedef npy_int64 int64_t - * #ctypedef npy_int96 int96_t - */ -typedef npy_int32 __pyx_t_5numpy_int32_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":728 - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t - * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< - * #ctypedef npy_int96 int96_t - * #ctypedef npy_int128 int128_t - */ -typedef npy_int64 __pyx_t_5numpy_int64_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":732 - * #ctypedef npy_int128 int128_t - * - * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t - */ -typedef npy_uint8 __pyx_t_5numpy_uint8_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":733 - * - * ctypedef npy_uint8 uint8_t - * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< - * ctypedef npy_uint32 uint32_t - * ctypedef npy_uint64 uint64_t - */ -typedef npy_uint16 __pyx_t_5numpy_uint16_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":734 - * ctypedef npy_uint8 uint8_t - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< - * ctypedef npy_uint64 uint64_t - * #ctypedef npy_uint96 uint96_t - */ -typedef npy_uint32 __pyx_t_5numpy_uint32_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":735 - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t - * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< - * #ctypedef npy_uint96 uint96_t - * #ctypedef npy_uint128 uint128_t - */ -typedef npy_uint64 __pyx_t_5numpy_uint64_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":739 - * #ctypedef npy_uint128 uint128_t - * - * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< - * ctypedef npy_float64 float64_t - * #ctypedef npy_float80 float80_t - */ -typedef npy_float32 __pyx_t_5numpy_float32_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":740 - * - * ctypedef npy_float32 float32_t - * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< - * #ctypedef npy_float80 float80_t - * #ctypedef npy_float128 float128_t - */ -typedef npy_float64 __pyx_t_5numpy_float64_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":749 - * # The int types are mapped a bit surprising -- - * # numpy.int corresponds to 'l' and numpy.long to 'q' - * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t - * ctypedef npy_longlong longlong_t - */ -typedef npy_long __pyx_t_5numpy_int_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":750 - * # numpy.int corresponds to 'l' and numpy.long to 'q' - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":751 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t - * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< - * - * ctypedef npy_ulong uint_t - */ -typedef npy_longlong __pyx_t_5numpy_longlong_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":753 - * ctypedef npy_longlong longlong_t - * - * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t - * ctypedef npy_ulonglong ulonglong_t - */ -typedef npy_ulong __pyx_t_5numpy_uint_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":754 - * - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t - * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":755 - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t - * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< - * - * ctypedef npy_intp intp_t - */ -typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":757 - * ctypedef npy_ulonglong ulonglong_t - * - * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< - * ctypedef npy_uintp uintp_t - * - */ -typedef npy_intp __pyx_t_5numpy_intp_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":758 - * - * ctypedef npy_intp intp_t - * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< - * - * ctypedef npy_double float_t - */ -typedef npy_uintp __pyx_t_5numpy_uintp_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":760 - * ctypedef npy_uintp uintp_t - * - * ctypedef npy_double float_t # <<<<<<<<<<<<<< - * ctypedef npy_double double_t - * ctypedef npy_longdouble longdouble_t - */ -typedef npy_double __pyx_t_5numpy_float_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":761 - * - * ctypedef npy_double float_t - * ctypedef npy_double double_t # <<<<<<<<<<<<<< - * ctypedef npy_longdouble longdouble_t - * - */ -typedef npy_double __pyx_t_5numpy_double_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":762 - * ctypedef npy_double float_t - * ctypedef npy_double double_t - * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< - * - * ctypedef npy_cfloat cfloat_t - */ -typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* None.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< float > __pyx_t_float_complex; - #else - typedef float _Complex __pyx_t_float_complex; - #endif -#else - typedef struct { float real, imag; } __pyx_t_float_complex; -#endif - -/* None.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< double > __pyx_t_double_complex; - #else - typedef double _Complex __pyx_t_double_complex; - #endif -#else - typedef struct { double real, imag; } __pyx_t_double_complex; -#endif - - -/*--- Type declarations ---*/ -struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter; -struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":764 - * ctypedef npy_longdouble longdouble_t - * - * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< - * ctypedef npy_cdouble cdouble_t - * ctypedef npy_clongdouble clongdouble_t - */ -typedef npy_cfloat __pyx_t_5numpy_cfloat_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":765 - * - * ctypedef npy_cfloat cfloat_t - * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< - * ctypedef npy_clongdouble clongdouble_t - * - */ -typedef npy_cdouble __pyx_t_5numpy_cdouble_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":766 - * ctypedef npy_cfloat cfloat_t - * ctypedef npy_cdouble cdouble_t - * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< - * - * ctypedef npy_cdouble complex_t - */ -typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":768 - * ctypedef npy_clongdouble clongdouble_t - * - * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew1(a): - */ -typedef npy_cdouble __pyx_t_5numpy_complex_t; - -/* "iopro/postgresadapter/PostgresAdapter.pyx":281 - * - * - * cdef class PostgresAdapter: # <<<<<<<<<<<<<< - * """ - * PostgreSQL adapter for reading data from PostgreSQL database into - */ -struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter { - PyObject_HEAD - postgres_adapter_t *_adapter; - PyObject *_field_names; - PyObject *_field_types; - PyObject *_field_shapes; - PyObject *_dataframe_result; -}; - - -/* "iopro/postgresadapter/PostgresAdapter.pyx":417 - * return self._field_names - * - * def set_field_names(self, names): # <<<<<<<<<<<<<< - * """ - * Set names to assign to fields in final array or dataframe - */ -struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names { - PyObject_HEAD - struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self; -}; - - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#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); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #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, acquire_gil) - #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 -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* PyThreadStateGet.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - -/* IncludeStringH.proto */ -#include - -/* decode_c_string.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); - -/* ListAppend.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectCallMethod1.proto */ -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); - -/* append.proto */ -static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); - -/* PyIntBinop.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\ - PyObject_RichCompare(op1, op2, Py_EQ) - #endif - -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* SliceObject.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** py_start, PyObject** py_stop, PyObject** py_slice, - int has_cstart, int has_cstop, int wraparound); - -/* SliceObject.proto */ -#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\ - __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) -static CYTHON_INLINE int __Pyx_PyObject_SetSlice( - PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** py_start, PyObject** py_stop, PyObject** py_slice, - int has_cstart, int has_cstop, int wraparound); - -/* GetItemInt.proto */ -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ - __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* RaiseArgTupleInvalid.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); - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* SetItemInt.proto */ -#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) -static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, - int is_list, int wraparound, int boundscheck); - -/* StringJoin.proto */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyString_Join __Pyx_PyBytes_Join -#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v)) -#else -#define __Pyx_PyString_Join PyUnicode_Join -#define __Pyx_PyBaseString_Join PyUnicode_Join -#endif -#if CYTHON_COMPILING_IN_CPYTHON - #if PY_MAJOR_VERSION < 3 - #define __Pyx_PyBytes_Join _PyString_Join - #else - #define __Pyx_PyBytes_Join _PyBytes_Join - #endif -#else -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); -#endif - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); - -/* PySequenceContains.proto */ -static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { - int result = PySequence_Contains(seq, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* PyIntBinop.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif - -/* FetchCommonType.proto */ -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); - -/* CythonFunction.proto */ -#define __Pyx_CyFunction_USED 1 -#include -#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 -#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 -#define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CyFunction_GetClosure(f)\ - (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) -#define __Pyx_CyFunction_Defaults(type, f)\ - ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ - ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) -typedef struct { - PyCFunctionObject func; -#if PY_VERSION_HEX < 0x030500A0 - PyObject *func_weakreflist; -#endif - PyObject *func_dict; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_globals; - PyObject *func_code; - PyObject *func_closure; - PyObject *func_classobj; - void *defaults; - int defaults_pyobjects; - int flags; - PyObject *defaults_tuple; - PyObject *defaults_kwdict; - PyObject *(*defaults_getter)(PyObject *); - PyObject *func_annotations; -} __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ - __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) -static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *self, - PyObject *module, PyObject *globals, - PyObject* code); -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __pyx_CyFunction_init(void); - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* IterFinish.proto */ -static CYTHON_INLINE int __Pyx_IterFinish(void); - -/* UnpackItemEndCheck.proto */ -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); - -/* ListCompAppend.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len)) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) -#endif - -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -/* PyIntBinop.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace)\ - (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) -#endif - -/* PyIntBinop.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_SubtractCObj(op1, op2, intval, inplace)\ - (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) -#endif - -/* DictGetItem.proto */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) - PyErr_SetObject(PyExc_KeyError, args); - Py_XDECREF(args); - } - return NULL; - } - Py_INCREF(value); - return value; -} -#else - #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#endif - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - -/* GetNameInClass.proto */ -static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_AdapterError(AdapterError value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* None.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #define __Pyx_CREAL(z) ((z).real()) - #define __Pyx_CIMAG(z) ((z).imag()) - #else - #define __Pyx_CREAL(z) (__real__(z)) - #define __Pyx_CIMAG(z) (__imag__(z)) - #endif -#else - #define __Pyx_CREAL(z) ((z).real) - #define __Pyx_CIMAG(z) ((z).imag) -#endif -#if defined(__cplusplus) && CYTHON_CCOMPLEX && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) - #define __Pyx_SET_CREAL(z,x) ((z).real(x)) - #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) -#else - #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) - #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) -#endif - -/* None.proto */ -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - -/* None.proto */ -#if CYTHON_CCOMPLEX - #define __Pyx_c_eqf(a, b) ((a)==(b)) - #define __Pyx_c_sumf(a, b) ((a)+(b)) - #define __Pyx_c_difff(a, b) ((a)-(b)) - #define __Pyx_c_prodf(a, b) ((a)*(b)) - #define __Pyx_c_quotf(a, b) ((a)/(b)) - #define __Pyx_c_negf(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zerof(z) ((z)==(float)0) - #define __Pyx_c_conjf(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_absf(z) (::std::abs(z)) - #define __Pyx_c_powf(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zerof(z) ((z)==0) - #define __Pyx_c_conjf(z) (conjf(z)) - #if 1 - #define __Pyx_c_absf(z) (cabsf(z)) - #define __Pyx_c_powf(a, b) (cpowf(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - #if 1 - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); - #endif -#endif - -/* None.proto */ -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - -/* None.proto */ -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq(a, b) ((a)==(b)) - #define __Pyx_c_sum(a, b) ((a)+(b)) - #define __Pyx_c_diff(a, b) ((a)-(b)) - #define __Pyx_c_prod(a, b) ((a)*(b)) - #define __Pyx_c_quot(a, b) ((a)/(b)) - #define __Pyx_c_neg(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero(z) ((z)==(double)0) - #define __Pyx_c_conj(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_abs(z) (::std::abs(z)) - #define __Pyx_c_pow(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zero(z) ((z)==0) - #define __Pyx_c_conj(z) (conj(z)) - #if 1 - #define __Pyx_c_abs(z) (cabs(z)) - #define __Pyx_c_pow(a, b) (cpow(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - #if 1 - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); - #endif -#endif - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* TypeImport.proto */ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - - -/* Module declarations from 'cpython.buffer' */ - -/* Module declarations from 'libc.string' */ - -/* Module declarations from 'libc.stdio' */ - -/* Module declarations from '__builtin__' */ - -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; - -/* Module declarations from 'cpython' */ - -/* Module declarations from 'cpython.object' */ - -/* Module declarations from 'cpython.ref' */ - -/* Module declarations from 'libc.stdlib' */ - -/* Module declarations from 'numpy' */ - -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ - -/* Module declarations from 'iopro.postgresadapter.PostgresAdapter' */ -static PyTypeObject *__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter = 0; -static PyTypeObject *__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names = 0; -__PYX_EXTERN_C DL_EXPORT(PyObject) *create_list(void **); /*proto*/ -__PYX_EXTERN_C DL_EXPORT(void) create_string(void **, char const *); /*proto*/ -__PYX_EXTERN_C DL_EXPORT(void) add_to_list(void *, double *, int); /*proto*/ -__PYX_EXTERN_C DL_EXPORT(void) append_list(void *, void *); /*proto*/ -__PYX_EXTERN_C DL_EXPORT(AdapterError) convert_str2object(char const *, char const *, void **); /*proto*/ -__PYX_EXTERN_C DL_EXPORT(AdapterError) convert_str2str(char const *, char const *, void **, int); /*proto*/ -__PYX_EXTERN_C DL_EXPORT(void) cast_arrays(PyArrayObject *, PyArrayObject *, int, int); /*proto*/ -__PYX_EXTERN_C DL_EXPORT(void) cast_dataframes(PyObject *, PyObject *, int, int, int); /*proto*/ -__PYX_EXTERN_C DL_EXPORT(void) *convert_list_to_array(void *); /*proto*/ -#define __Pyx_MODULE_NAME "iopro.postgresadapter.PostgresAdapter" -int __pyx_module_is_main_iopro__postgresadapter__PostgresAdapter = 0; - -/* Implementation of 'iopro.postgresadapter.PostgresAdapter' */ -static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_builtin_property; -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_IOError; -static PyObject *__pyx_builtin_enumerate; -static PyObject *__pyx_builtin_zip; -static PyObject *__pyx_builtin_IndexError; -static const char __pyx_k_B[] = "B"; -static const char __pyx_k_O[] = "O"; -static const char __pyx_k_S[] = "S"; -static const char __pyx_k_U[] = "U"; -static const char __pyx_k_x[] = "x"; -static const char __pyx_k_S1[] = "S1"; -static const char __pyx_k_U1[] = "U1"; -static const char __pyx_k__6[] = "*"; -static const char __pyx_k__7[] = ","; -static const char __pyx_k__9[] = "."; -static const char __pyx_k_f4[] = "f4"; -static const char __pyx_k_f8[] = "f8"; -static const char __pyx_k_i2[] = "i2"; -static const char __pyx_k_i4[] = "i4"; -static const char __pyx_k_i8[] = "i8"; -static const char __pyx_k_pd[] = "pd"; -static const char __pyx_k_u8[] = "u8"; -static const char __pyx_k_sys[] = "sys"; -static const char __pyx_k_zip[] = "zip"; -static const char __pyx_k_ceil[] = "ceil"; -static const char __pyx_k_data[] = "data"; -static const char __pyx_k_join[] = "join"; -static const char __pyx_k_keys[] = "keys"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_math[] = "math"; -static const char __pyx_k_step[] = "step"; -static const char __pyx_k_stop[] = "stop"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_utf8[] = "utf8"; -static const char __pyx_k_array[] = "array"; -static const char __pyx_k_close[] = "close"; -static const char __pyx_k_dtype[] = "dtype"; -static const char __pyx_k_index[] = "index"; -static const char __pyx_k_items[] = "items"; -static const char __pyx_k_numpy[] = "numpy"; -static const char __pyx_k_query[] = "query"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_start[] = "start"; -static const char __pyx_k_table[] = "table"; -static const char __pyx_k_utf32[] = "utf32"; -static const char __pyx_k_append[] = "append"; -static const char __pyx_k_arange[] = "arange"; -static const char __pyx_k_decode[] = "decode"; -static const char __pyx_k_encode[] = "encode"; -static const char __pyx_k_format[] = "format"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_pandas[] = "pandas"; -static const char __pyx_k_suffix[] = "suffix"; -static const char __pyx_k_values[] = "values"; -static const char __pyx_k_IOError[] = "IOError"; -static const char __pyx_k_asarray[] = "asarray"; -static const char __pyx_k_columns[] = "columns"; -static const char __pyx_k_itemsize[] = "itemsize"; -static const char __pyx_k_property[] = "property"; -static const char __pyx_k_to_array[] = "_to_array"; -static const char __pyx_k_DataFrame[] = "DataFrame"; -static const char __pyx_k_dataframe[] = "dataframe"; -static const char __pyx_k_enumerate[] = "enumerate"; -static const char __pyx_k_IndexError[] = "IndexError"; -static const char __pyx_k_ValueError[] = "ValueError"; -static const char __pyx_k_exceptions[] = "exceptions"; -static const char __pyx_k_field_name[] = "field_name"; -static const char __pyx_k_num_fields[] = "num_fields"; -static const char __pyx_k_OrderedDict[] = "OrderedDict"; -static const char __pyx_k_collections[] = "collections"; -static const char __pyx_k_field_names[] = "field_names"; -static const char __pyx_k_field_types[] = "field_types"; -static const char __pyx_k_num_records[] = "num_records"; -static const char __pyx_k_parse_slice[] = "_parse_slice"; -static const char __pyx_k_PostgreSQL_0[] = " PostgreSQL {0}"; -static const char __pyx_k_RuntimeError[] = "RuntimeError"; -static const char __pyx_k_field_filter[] = "field_filter"; -static const char __pyx_k_field_shapes[] = "field_shapes"; -static const char __pyx_k_to_dataframe[] = "_to_dataframe"; -static const char __pyx_k_connection_uri[] = "connection_uri"; -static const char __pyx_k_with_columns_0[] = " with columns \"{0}\""; -static const char __pyx_k_get_field_names[] = "get_field_names"; -static const char __pyx_k_get_field_types[] = "get_field_types"; -static const char __pyx_k_select_0_from_1[] = "select {0} from {1}"; -static const char __pyx_k_set_field_names[] = "set_field_names"; -static const char __pyx_k_set_field_types[] = "set_field_types"; -static const char __pyx_k_check_connection[] = "_check_connection"; -static const char __pyx_k_get_field_shapes[] = "get_field_shapes"; -static const char __pyx_k_make_unique_name[] = "make_unique_name"; -static const char __pyx_k_numpy_char_width[] = "numpy_char_width"; -static const char __pyx_k_set_field_shapes[] = "set_field_shapes"; -static const char __pyx_k_get_default_types[] = "_get_default_types"; -static const char __pyx_k_pg_to_numpy_mapping[] = "pg_to_numpy_mapping"; -static const char __pyx_k_Invalid_field_name_0[] = "Invalid field name \"{0}\""; -static const char __pyx_k_Invalid_field_number_0[] = "Invalid field number {0}"; -static const char __pyx_k_Invalid_PostgreSQL_query[] = "Invalid PostgreSQL query"; -static const char __pyx_k_index_0_is_out_of_bounds[] = "index {0} is out of bounds"; -static const char __pyx_k_Could_not_perform_query_0[] = "Could not perform query \"{0}\"."; -static const char __pyx_k_PostGIS_type_not_supported[] = "PostGIS type not supported"; -static const char __pyx_k_Unknown_PostGIS_point_size[] = "Unknown PostGIS point size"; -static const char __pyx_k_index_must_be_slice_or_int[] = "index must be slice or int"; -static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; -static const char __pyx_k_PostgreSQL_type_not_supported[] = "PostgreSQL type not supported"; -static const char __pyx_k_Field_shape_for_PostGIS_polygon[] = "Field shape for PostGIS polygon must have 2 dimensions"; -static const char __pyx_k_Field_shape_for_path_or_polygon[] = "Field shape for path or polygon must be int"; -static const char __pyx_k_Field_shape_must_be_int_list_or[] = "Field shape must be int, list, or tuple"; -static const char __pyx_k_Invalid_PostgreSQL_query_result[] = "Invalid PostgreSQL query result"; -static const char __pyx_k_PostGIS_field_data_could_not_be[] = "PostGIS field data could not be parsed"; -static const char __pyx_k_Users_dmertz_Projects_iopro_iop[] = "/Users/dmertz/Projects/iopro/iopro/postgresadapter/PostgresAdapter.pyx"; -static const char __pyx_k_postgresql_type_0_not_supported[] = "postgresql type {0} not supported"; -static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; -static const char __pyx_k_Connection_already_closed_Please[] = "Connection already closed. Please create a new adapter."; -static const char __pyx_k_Could_not_perform_query_on_table[] = "Could not perform query on table \"{0}\""; -static const char __pyx_k_Either_table_or_query_must_be_se[] = "Either table or query must be set"; -static const char __pyx_k_Field_filter_cannot_be_set_for_q[] = "Field filter cannot be set for query"; -static const char __pyx_k_Field_shape_cannot_be_set_when_o[] = "Field shape cannot be set when outputing to dataframe"; -static const char __pyx_k_Field_shape_for_GIS_multipolygon[] = "Field shape for GIS multipolygon must have 3 dimensions"; -static const char __pyx_k_Field_shape_for_PostGIS_line_mus[] = "Field shape for PostGIS line must be int"; -static const char __pyx_k_Field_shape_for_PostGIS_multilin[] = "Field shape for PostGIS multiline must have 2 dimensions"; -static const char __pyx_k_Field_shape_for_PostGIS_multipoi[] = "Field shape for PostGIS multipoint must be int"; -static const char __pyx_k_Field_shape_must_be_greater_than[] = "Field shape must be greater than 0"; -static const char __pyx_k_Field_shape_values_must_be_great[] = "Field shape values must be greater than 0"; -static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; -static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; -static const char __pyx_k_Number_of_field_names_does_not_m[] = "Number of field names does not match number of fields"; -static const char __pyx_k_PostgresAdapter_Unable_to_connec[] = "PostgresAdapter: Unable to connect to %s"; -static const char __pyx_k_Setting_shape_for_field_0_not_al[] = "Setting shape for field \"{0}\" not allowed."; -static const char __pyx_k_Table_and_query_cannot_both_be_s[] = "Table and query cannot both be set"; -static const char __pyx_k_iopro_postgresadapter_PostgresAd[] = "iopro.postgresadapter.PostgresAdapter"; -static const char __pyx_k_length_of_types_list_does_not_ma[] = "length of types list does not match the number of fields"; -static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; -static const char __pyx_k_number_of_shapes_must_equal_numb[] = "number of shapes must equal number of fields"; -static const char __pyx_k_set_field_names_locals_make_uniq[] = "set_field_names..make_unique_name"; -static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; -static PyObject *__pyx_n_s_B; -static PyObject *__pyx_kp_s_Connection_already_closed_Please; -static PyObject *__pyx_kp_s_Could_not_perform_query_0; -static PyObject *__pyx_kp_s_Could_not_perform_query_on_table; -static PyObject *__pyx_n_s_DataFrame; -static PyObject *__pyx_kp_s_Either_table_or_query_must_be_se; -static PyObject *__pyx_kp_s_Field_filter_cannot_be_set_for_q; -static PyObject *__pyx_kp_s_Field_shape_cannot_be_set_when_o; -static PyObject *__pyx_kp_s_Field_shape_for_GIS_multipolygon; -static PyObject *__pyx_kp_s_Field_shape_for_PostGIS_line_mus; -static PyObject *__pyx_kp_s_Field_shape_for_PostGIS_multilin; -static PyObject *__pyx_kp_s_Field_shape_for_PostGIS_multipoi; -static PyObject *__pyx_kp_s_Field_shape_for_PostGIS_polygon; -static PyObject *__pyx_kp_s_Field_shape_for_path_or_polygon; -static PyObject *__pyx_kp_s_Field_shape_must_be_greater_than; -static PyObject *__pyx_kp_s_Field_shape_must_be_int_list_or; -static PyObject *__pyx_kp_s_Field_shape_values_must_be_great; -static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; -static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; -static PyObject *__pyx_n_s_IOError; -static PyObject *__pyx_n_s_IndexError; -static PyObject *__pyx_kp_s_Invalid_PostgreSQL_query; -static PyObject *__pyx_kp_s_Invalid_PostgreSQL_query_result; -static PyObject *__pyx_kp_s_Invalid_field_name_0; -static PyObject *__pyx_kp_s_Invalid_field_number_0; -static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; -static PyObject *__pyx_kp_s_Number_of_field_names_does_not_m; -static PyObject *__pyx_n_s_O; -static PyObject *__pyx_n_s_OrderedDict; -static PyObject *__pyx_kp_s_PostGIS_field_data_could_not_be; -static PyObject *__pyx_kp_s_PostGIS_type_not_supported; -static PyObject *__pyx_kp_s_PostgreSQL_0; -static PyObject *__pyx_kp_s_PostgreSQL_type_not_supported; -static PyObject *__pyx_kp_s_PostgresAdapter_Unable_to_connec; -static PyObject *__pyx_n_s_RuntimeError; -static PyObject *__pyx_n_s_S; -static PyObject *__pyx_n_s_S1; -static PyObject *__pyx_kp_s_Setting_shape_for_field_0_not_al; -static PyObject *__pyx_kp_s_Table_and_query_cannot_both_be_s; -static PyObject *__pyx_n_s_U; -static PyObject *__pyx_n_s_U1; -static PyObject *__pyx_kp_s_Unknown_PostGIS_point_size; -static PyObject *__pyx_kp_s_Users_dmertz_Projects_iopro_iop; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_kp_s__6; -static PyObject *__pyx_kp_s__7; -static PyObject *__pyx_kp_s__9; -static PyObject *__pyx_n_s_append; -static PyObject *__pyx_n_s_arange; -static PyObject *__pyx_n_s_array; -static PyObject *__pyx_n_s_asarray; -static PyObject *__pyx_n_s_ceil; -static PyObject *__pyx_n_s_check_connection; -static PyObject *__pyx_n_s_close; -static PyObject *__pyx_n_s_collections; -static PyObject *__pyx_n_s_columns; -static PyObject *__pyx_n_s_connection_uri; -static PyObject *__pyx_n_s_data; -static PyObject *__pyx_n_s_dataframe; -static PyObject *__pyx_n_s_decode; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_enumerate; -static PyObject *__pyx_n_s_exceptions; -static PyObject *__pyx_n_s_f4; -static PyObject *__pyx_n_s_f8; -static PyObject *__pyx_n_s_field_filter; -static PyObject *__pyx_n_s_field_name; -static PyObject *__pyx_n_s_field_names; -static PyObject *__pyx_n_s_field_shapes; -static PyObject *__pyx_n_s_field_types; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_get_default_types; -static PyObject *__pyx_n_s_get_field_names; -static PyObject *__pyx_n_s_get_field_shapes; -static PyObject *__pyx_n_s_get_field_types; -static PyObject *__pyx_n_s_i2; -static PyObject *__pyx_n_s_i4; -static PyObject *__pyx_n_s_i8; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_index; -static PyObject *__pyx_kp_s_index_0_is_out_of_bounds; -static PyObject *__pyx_kp_s_index_must_be_slice_or_int; -static PyObject *__pyx_n_s_iopro_postgresadapter_PostgresAd; -static PyObject *__pyx_n_s_items; -static PyObject *__pyx_n_s_itemsize; -static PyObject *__pyx_n_s_join; -static PyObject *__pyx_n_s_keys; -static PyObject *__pyx_kp_s_length_of_types_list_does_not_ma; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_make_unique_name; -static PyObject *__pyx_n_s_math; -static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; -static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; -static PyObject *__pyx_n_s_num_fields; -static PyObject *__pyx_n_s_num_records; -static PyObject *__pyx_kp_s_number_of_shapes_must_equal_numb; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_n_s_numpy_char_width; -static PyObject *__pyx_n_s_pandas; -static PyObject *__pyx_n_s_parse_slice; -static PyObject *__pyx_n_s_pd; -static PyObject *__pyx_n_s_pg_to_numpy_mapping; -static PyObject *__pyx_kp_s_postgresql_type_0_not_supported; -static PyObject *__pyx_n_s_property; -static PyObject *__pyx_n_s_query; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_kp_s_select_0_from_1; -static PyObject *__pyx_n_s_set_field_names; -static PyObject *__pyx_n_s_set_field_names_locals_make_uniq; -static PyObject *__pyx_n_s_set_field_shapes; -static PyObject *__pyx_n_s_set_field_types; -static PyObject *__pyx_n_s_start; -static PyObject *__pyx_n_s_step; -static PyObject *__pyx_n_s_stop; -static PyObject *__pyx_n_s_suffix; -static PyObject *__pyx_n_s_sys; -static PyObject *__pyx_n_s_table; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_to_array; -static PyObject *__pyx_n_s_to_dataframe; -static PyObject *__pyx_n_s_u8; -static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; -static PyObject *__pyx_n_s_utf32; -static PyObject *__pyx_n_s_utf8; -static PyObject *__pyx_n_s_values; -static PyObject *__pyx_kp_s_with_columns_0; -static PyObject *__pyx_n_s_x; -static PyObject *__pyx_n_s_zip; -static int __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter___cinit__(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_connection_uri, PyObject *__pyx_v_table, PyObject *__pyx_v_query, PyObject *__pyx_v_field_filter, PyObject *__pyx_v_dataframe, PyObject *__pyx_v_field_names, PyObject *__pyx_v_field_types, PyObject *__pyx_v_field_shapes); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_2close(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self); /* proto */ -static void __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_4__dealloc__(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_6_check_connection(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_11num_records___get__(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_10num_fields___get__(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_8get_field_names(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15set_field_names_make_unique_name(PyObject *__pyx_self, PyObject *__pyx_v_field_name); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_10set_field_names(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_names); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_12_get_default_types(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_14get_field_types(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_16set_field_types(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_types); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_18get_field_shapes(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_20set_field_shapes(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_shapes); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_22_parse_slice(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_step); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_24_to_array(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_step); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_26_to_dataframe(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_step); /* proto */ -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_28__getitem__(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ -static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ -static PyObject *__pyx_tp_new_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_2; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__24; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_tuple__28; -static PyObject *__pyx_tuple__29; -static PyObject *__pyx_tuple__30; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__32; -static PyObject *__pyx_tuple__33; -static PyObject *__pyx_tuple__34; -static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__36; -static PyObject *__pyx_tuple__37; -static PyObject *__pyx_tuple__38; -static PyObject *__pyx_tuple__39; -static PyObject *__pyx_codeobj__13; - -/* "iopro/postgresadapter/PostgresAdapter.pyx":142 - * ADAPTER_ERROR_PARSE_GIS: RuntimeError('PostGIS field data could not be parsed')} - * - * cdef public PyObject* create_list(void **output): # <<<<<<<<<<<<<< - * """ - * Create new list and store in output array or dataframe. Caller is responsible - */ - -PyObject *create_list(void **__pyx_v_output) { - PyObject *__pyx_v_py_list = 0; - PyObject ***__pyx_v_object_ptr; - PyObject *__pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - long __pyx_t_4; - __Pyx_RefNannySetupContext("create_list", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":152 - * pointer to list - * """ - * cdef object py_list = [] # <<<<<<<<<<<<<< - * cdef PyObject ***object_ptr - * # Increment ref count since this object will be referenced by final numpy array - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_py_list = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":155 - * cdef PyObject ***object_ptr - * # Increment ref count since this object will be referenced by final numpy array - * Py_INCREF(py_list) # <<<<<<<<<<<<<< - * if output != NULL: - * object_ptr = (output) - */ - Py_INCREF(__pyx_v_py_list); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":156 - * # Increment ref count since this object will be referenced by final numpy array - * Py_INCREF(py_list) - * if output != NULL: # <<<<<<<<<<<<<< - * object_ptr = (output) - * object_ptr[0][0] = py_list - */ - __pyx_t_3 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_3) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":157 - * Py_INCREF(py_list) - * if output != NULL: - * object_ptr = (output) # <<<<<<<<<<<<<< - * object_ptr[0][0] = py_list - * object_ptr[0] += 1 - */ - __pyx_v_object_ptr = ((PyObject ***)__pyx_v_output); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":158 - * if output != NULL: - * object_ptr = (output) - * object_ptr[0][0] = py_list # <<<<<<<<<<<<<< - * object_ptr[0] += 1 - * return py_list - */ - ((__pyx_v_object_ptr[0])[0]) = ((PyObject *)__pyx_v_py_list); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":159 - * object_ptr = (output) - * object_ptr[0][0] = py_list - * object_ptr[0] += 1 # <<<<<<<<<<<<<< - * return py_list - * - */ - __pyx_t_4 = 0; - (__pyx_v_object_ptr[__pyx_t_4]) = ((__pyx_v_object_ptr[__pyx_t_4]) + 1); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":156 - * # Increment ref count since this object will be referenced by final numpy array - * Py_INCREF(py_list) - * if output != NULL: # <<<<<<<<<<<<<< - * object_ptr = (output) - * object_ptr[0][0] = py_list - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":160 - * object_ptr[0][0] = py_list - * object_ptr[0] += 1 - * return py_list # <<<<<<<<<<<<<< - * - * cdef public void create_string(void **output, const char *value): - */ - __pyx_r = ((PyObject *)__pyx_v_py_list); - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":142 - * ADAPTER_ERROR_PARSE_GIS: RuntimeError('PostGIS field data could not be parsed')} - * - * cdef public PyObject* create_list(void **output): # <<<<<<<<<<<<<< - * """ - * Create new list and store in output array or dataframe. Caller is responsible - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("iopro.postgresadapter.PostgresAdapter.create_list", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_py_list); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":162 - * return py_list - * - * cdef public void create_string(void **output, const char *value): # <<<<<<<<<<<<<< - * cdef object py_string = value.decode('utf8') - * cdef PyObject ***object_ptr - */ - -void create_string(void **__pyx_v_output, char const *__pyx_v_value) { - PyObject *__pyx_v_py_string = 0; - PyObject ***__pyx_v_object_ptr; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - long __pyx_t_3; - __Pyx_RefNannySetupContext("create_string", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":163 - * - * cdef public void create_string(void **output, const char *value): - * cdef object py_string = value.decode('utf8') # <<<<<<<<<<<<<< - * cdef PyObject ***object_ptr - * Py_INCREF(py_string) - */ - __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_value, 0, strlen(__pyx_v_value), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_py_string = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":165 - * cdef object py_string = value.decode('utf8') - * cdef PyObject ***object_ptr - * Py_INCREF(py_string) # <<<<<<<<<<<<<< - * if output != NULL: - * object_ptr = output - */ - Py_INCREF(__pyx_v_py_string); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":166 - * cdef PyObject ***object_ptr - * Py_INCREF(py_string) - * if output != NULL: # <<<<<<<<<<<<<< - * object_ptr = output - * object_ptr[0][0] = py_string - */ - __pyx_t_2 = ((__pyx_v_output != NULL) != 0); - if (__pyx_t_2) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":167 - * Py_INCREF(py_string) - * if output != NULL: - * object_ptr = output # <<<<<<<<<<<<<< - * object_ptr[0][0] = py_string - * object_ptr[0] += 1 - */ - __pyx_v_object_ptr = ((PyObject ***)__pyx_v_output); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":168 - * if output != NULL: - * object_ptr = output - * object_ptr[0][0] = py_string # <<<<<<<<<<<<<< - * object_ptr[0] += 1 - * - */ - ((__pyx_v_object_ptr[0])[0]) = ((PyObject *)__pyx_v_py_string); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":169 - * object_ptr = output - * object_ptr[0][0] = py_string - * object_ptr[0] += 1 # <<<<<<<<<<<<<< - * - * cdef public void add_to_list(void *py_list_ptr, double *items, int num_items): - */ - __pyx_t_3 = 0; - (__pyx_v_object_ptr[__pyx_t_3]) = ((__pyx_v_object_ptr[__pyx_t_3]) + 1); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":166 - * cdef PyObject ***object_ptr - * Py_INCREF(py_string) - * if output != NULL: # <<<<<<<<<<<<<< - * object_ptr = output - * object_ptr[0][0] = py_string - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":162 - * return py_list - * - * cdef public void create_string(void **output, const char *value): # <<<<<<<<<<<<<< - * cdef object py_string = value.decode('utf8') - * cdef PyObject ***object_ptr - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_WriteUnraisable("iopro.postgresadapter.PostgresAdapter.create_string", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_py_string); - __Pyx_RefNannyFinishContext(); -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":171 - * object_ptr[0] += 1 - * - * cdef public void add_to_list(void *py_list_ptr, double *items, int num_items): # <<<<<<<<<<<<<< - * """ - * Append values to list stored in output array or dataframe - */ - -void add_to_list(void *__pyx_v_py_list_ptr, double *__pyx_v_items, int __pyx_v_num_items) { - PyObject *__pyx_v_py_list = 0; - PyObject *__pyx_v_py_sublist = 0; - int __pyx_v_i; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - __Pyx_RefNannySetupContext("add_to_list", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":179 - * num_items: length of items array - * """ - * cdef object py_list = py_list_ptr # <<<<<<<<<<<<<< - * cdef object py_sublist = [] - * if num_items > 1: - */ - __pyx_t_1 = ((PyObject *)__pyx_v_py_list_ptr); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_py_list = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":180 - * """ - * cdef object py_list = py_list_ptr - * cdef object py_sublist = [] # <<<<<<<<<<<<<< - * if num_items > 1: - * for i in range(num_items): - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_py_sublist = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":181 - * cdef object py_list = py_list_ptr - * cdef object py_sublist = [] - * if num_items > 1: # <<<<<<<<<<<<<< - * for i in range(num_items): - * py_sublist.append(items[i]) - */ - __pyx_t_3 = ((__pyx_v_num_items > 1) != 0); - if (__pyx_t_3) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":182 - * cdef object py_sublist = [] - * if num_items > 1: - * for i in range(num_items): # <<<<<<<<<<<<<< - * py_sublist.append(items[i]) - * py_list.append(tuple(py_sublist)) - */ - __pyx_t_4 = __pyx_v_num_items; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":183 - * if num_items > 1: - * for i in range(num_items): - * py_sublist.append(items[i]) # <<<<<<<<<<<<<< - * py_list.append(tuple(py_sublist)) - * else: - */ - __pyx_t_2 = PyFloat_FromDouble((__pyx_v_items[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_py_sublist, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":184 - * for i in range(num_items): - * py_sublist.append(items[i]) - * py_list.append(tuple(py_sublist)) # <<<<<<<<<<<<<< - * else: - * py_list.append(items[0]) - */ - __pyx_t_2 = PySequence_Tuple(__pyx_v_py_sublist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_py_list, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":181 - * cdef object py_list = py_list_ptr - * cdef object py_sublist = [] - * if num_items > 1: # <<<<<<<<<<<<<< - * for i in range(num_items): - * py_sublist.append(items[i]) - */ - goto __pyx_L3; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":186 - * py_list.append(tuple(py_sublist)) - * else: - * py_list.append(items[0]) # <<<<<<<<<<<<<< - * - * cdef public void append_list(void *py_list_ptr, void *py_sublist_ptr): - */ - /*else*/ { - __pyx_t_2 = PyFloat_FromDouble((__pyx_v_items[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_py_list, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L3:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":171 - * object_ptr[0] += 1 - * - * cdef public void add_to_list(void *py_list_ptr, double *items, int num_items): # <<<<<<<<<<<<<< - * """ - * Append values to list stored in output array or dataframe - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("iopro.postgresadapter.PostgresAdapter.add_to_list", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_py_list); - __Pyx_XDECREF(__pyx_v_py_sublist); - __Pyx_RefNannyFinishContext(); -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":188 - * py_list.append(items[0]) - * - * cdef public void append_list(void *py_list_ptr, void *py_sublist_ptr): # <<<<<<<<<<<<<< - * cdef object py_list = py_list_ptr - * cdef object py_sublist = py_sublist_ptr - */ - -void append_list(void *__pyx_v_py_list_ptr, void *__pyx_v_py_sublist_ptr) { - PyObject *__pyx_v_py_list = 0; - PyObject *__pyx_v_py_sublist = 0; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - __Pyx_RefNannySetupContext("append_list", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":189 - * - * cdef public void append_list(void *py_list_ptr, void *py_sublist_ptr): - * cdef object py_list = py_list_ptr # <<<<<<<<<<<<<< - * cdef object py_sublist = py_sublist_ptr - * py_list.append(py_sublist) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_py_list_ptr); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_py_list = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":190 - * cdef public void append_list(void *py_list_ptr, void *py_sublist_ptr): - * cdef object py_list = py_list_ptr - * cdef object py_sublist = py_sublist_ptr # <<<<<<<<<<<<<< - * py_list.append(py_sublist) - * - */ - __pyx_t_1 = ((PyObject *)__pyx_v_py_sublist_ptr); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_py_sublist = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":191 - * cdef object py_list = py_list_ptr - * cdef object py_sublist = py_sublist_ptr - * py_list.append(py_sublist) # <<<<<<<<<<<<<< - * - * cdef public AdapterError convert_str2object(const char *input_str, const char *encoding, void **output): - */ - __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_py_list, __pyx_v_py_sublist); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 191, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":188 - * py_list.append(items[0]) - * - * cdef public void append_list(void *py_list_ptr, void *py_sublist_ptr): # <<<<<<<<<<<<<< - * cdef object py_list = py_list_ptr - * cdef object py_sublist = py_sublist_ptr - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_WriteUnraisable("iopro.postgresadapter.PostgresAdapter.append_list", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_py_list); - __Pyx_XDECREF(__pyx_v_py_sublist); - __Pyx_RefNannyFinishContext(); -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":193 - * py_list.append(py_sublist) - * - * cdef public AdapterError convert_str2object(const char *input_str, const char *encoding, void **output): # <<<<<<<<<<<<<< - * """ - * Convert c string to Python unicode object - */ - -AdapterError convert_str2object(char const *__pyx_v_input_str, char const *__pyx_v_encoding, void **__pyx_v_output) { - PyObject *__pyx_v_unicode_obj = 0; - PyObject ***__pyx_v_object_ptr; - AdapterError __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - long __pyx_t_2; - __Pyx_RefNannySetupContext("convert_str2object", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":202 - * chunk will be incremented by size of Python object pointer. - * """ - * cdef object unicode_obj = input_str.decode(encoding) # <<<<<<<<<<<<<< - * # Increment ref count since this object will be referenced by final numpy array - * Py_INCREF(unicode_obj) - */ - __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_input_str, 0, strlen(__pyx_v_input_str), __pyx_v_encoding, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_unicode_obj = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":204 - * cdef object unicode_obj = input_str.decode(encoding) - * # Increment ref count since this object will be referenced by final numpy array - * Py_INCREF(unicode_obj) # <<<<<<<<<<<<<< - * cdef PyObject ***object_ptr = output - * object_ptr[0][0] = unicode_obj - */ - Py_INCREF(__pyx_v_unicode_obj); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":205 - * # Increment ref count since this object will be referenced by final numpy array - * Py_INCREF(unicode_obj) - * cdef PyObject ***object_ptr = output # <<<<<<<<<<<<<< - * object_ptr[0][0] = unicode_obj - * object_ptr[0] += 1 - */ - __pyx_v_object_ptr = ((PyObject ***)__pyx_v_output); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":206 - * Py_INCREF(unicode_obj) - * cdef PyObject ***object_ptr = output - * object_ptr[0][0] = unicode_obj # <<<<<<<<<<<<<< - * object_ptr[0] += 1 - * return ADAPTER_SUCCESS - */ - ((__pyx_v_object_ptr[0])[0]) = ((PyObject *)__pyx_v_unicode_obj); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":207 - * cdef PyObject ***object_ptr = output - * object_ptr[0][0] = unicode_obj - * object_ptr[0] += 1 # <<<<<<<<<<<<<< - * return ADAPTER_SUCCESS - * - */ - __pyx_t_2 = 0; - (__pyx_v_object_ptr[__pyx_t_2]) = ((__pyx_v_object_ptr[__pyx_t_2]) + 1); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":208 - * object_ptr[0][0] = unicode_obj - * object_ptr[0] += 1 - * return ADAPTER_SUCCESS # <<<<<<<<<<<<<< - * - * cdef public AdapterError convert_str2str(const char *input_str, const char *encoding, - */ - __pyx_r = ADAPTER_SUCCESS; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":193 - * py_list.append(py_sublist) - * - * cdef public AdapterError convert_str2object(const char *input_str, const char *encoding, void **output): # <<<<<<<<<<<<<< - * """ - * Convert c string to Python unicode object - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_WriteUnraisable("iopro.postgresadapter.PostgresAdapter.convert_str2object", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = (AdapterError) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_unicode_obj); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":210 - * return ADAPTER_SUCCESS - * - * cdef public AdapterError convert_str2str(const char *input_str, const char *encoding, # <<<<<<<<<<<<<< - * void **output, int max_chars): - * """ - */ - -AdapterError convert_str2str(char const *__pyx_v_input_str, char const *__pyx_v_encoding, void **__pyx_v_output, int __pyx_v_max_chars) { - PyObject *__pyx_v_unicode_obj = 0; - PyObject *__pyx_v_utf_bytes = NULL; - char *__pyx_v_utf_bytes_ptr; - PyObject *__pyx_v_str_len = NULL; - char **__pyx_v_output_ptr; - AdapterError __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - char *__pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - size_t __pyx_t_7; - int __pyx_t_8; - long __pyx_t_9; - __Pyx_RefNannySetupContext("convert_str2str", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":220 - * chunk will be incremented by size of Python object pointer. - * """ - * cdef object unicode_obj = input_str.decode(encoding) # <<<<<<<<<<<<<< - * - * utf_bytes = unicode_obj.encode('utf32') - */ - __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_input_str, 0, strlen(__pyx_v_input_str), __pyx_v_encoding, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_unicode_obj = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":222 - * cdef object unicode_obj = input_str.decode(encoding) - * - * utf_bytes = unicode_obj.encode('utf32') # <<<<<<<<<<<<<< - * cdef char *utf_bytes_ptr = utf_bytes - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_unicode_obj, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_utf_bytes = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":223 - * - * utf_bytes = unicode_obj.encode('utf32') - * cdef char *utf_bytes_ptr = utf_bytes # <<<<<<<<<<<<<< - * - * str_len = len(unicode_obj) - */ - __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_utf_bytes); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 223, __pyx_L1_error) - __pyx_v_utf_bytes_ptr = __pyx_t_3; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":225 - * cdef char *utf_bytes_ptr = utf_bytes - * - * str_len = len(unicode_obj) # <<<<<<<<<<<<<< - * if str_len > max_chars: - * str_len = max_chars - */ - __pyx_t_4 = PyObject_Length(__pyx_v_unicode_obj); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 225, __pyx_L1_error) - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_str_len = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":226 - * - * str_len = len(unicode_obj) - * if str_len > max_chars: # <<<<<<<<<<<<<< - * str_len = max_chars - * - */ - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_max_chars); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_str_len, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) - __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_ERR(0, 226, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":227 - * str_len = len(unicode_obj) - * if str_len > max_chars: - * str_len = max_chars # <<<<<<<<<<<<<< - * - * cdef char **output_ptr = output - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_max_chars); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_str_len, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":226 - * - * str_len = len(unicode_obj) - * if str_len > max_chars: # <<<<<<<<<<<<<< - * str_len = max_chars - * - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":229 - * str_len = max_chars - * - * cdef char **output_ptr = output # <<<<<<<<<<<<<< - * if str_len == 0: - * memset(output_ptr[0], 0, max_chars * numpy_char_width) - */ - __pyx_v_output_ptr = ((char **)__pyx_v_output); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":230 - * - * cdef char **output_ptr = output - * if str_len == 0: # <<<<<<<<<<<<<< - * memset(output_ptr[0], 0, max_chars * numpy_char_width) - * else: - */ - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_str_len, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 230, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":231 - * cdef char **output_ptr = output - * if str_len == 0: - * memset(output_ptr[0], 0, max_chars * numpy_char_width) # <<<<<<<<<<<<<< - * else: - * memcpy(output_ptr[0], utf_bytes_ptr + numpy_char_width, str_len * numpy_char_width) - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_max_chars); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy_char_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_As_size_t(__pyx_t_6); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - memset((__pyx_v_output_ptr[0]), 0, __pyx_t_7); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":230 - * - * cdef char **output_ptr = output - * if str_len == 0: # <<<<<<<<<<<<<< - * memset(output_ptr[0], 0, max_chars * numpy_char_width) - * else: - */ - goto __pyx_L4; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":233 - * memset(output_ptr[0], 0, max_chars * numpy_char_width) - * else: - * memcpy(output_ptr[0], utf_bytes_ptr + numpy_char_width, str_len * numpy_char_width) # <<<<<<<<<<<<<< - * output_ptr[0] += numpy_char_width * max_chars - * - */ - /*else*/ { - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy_char_width); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy_char_width); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyNumber_Multiply(__pyx_v_str_len, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - memcpy((__pyx_v_output_ptr[0]), (__pyx_v_utf_bytes_ptr + ((int)__pyx_t_8)), __pyx_t_7); - } - __pyx_L4:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":234 - * else: - * memcpy(output_ptr[0], utf_bytes_ptr + numpy_char_width, str_len * numpy_char_width) - * output_ptr[0] += numpy_char_width * max_chars # <<<<<<<<<<<<<< - * - * cdef public void cast_arrays(numpy.ndarray dst, numpy.ndarray src, int offset, int num): - */ - __pyx_t_9 = 0; - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy_char_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - (__pyx_v_output_ptr[__pyx_t_9]) = ((__pyx_v_output_ptr[__pyx_t_9]) + (((int)__pyx_t_8) * ((int)__pyx_v_max_chars))); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":210 - * return ADAPTER_SUCCESS - * - * cdef public AdapterError convert_str2str(const char *input_str, const char *encoding, # <<<<<<<<<<<<<< - * void **output, int max_chars): - * """ - */ - - /* function exit code */ - __pyx_r = (AdapterError) 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("iopro.postgresadapter.PostgresAdapter.convert_str2str", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = (AdapterError) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_unicode_obj); - __Pyx_XDECREF(__pyx_v_utf_bytes); - __Pyx_XDECREF(__pyx_v_str_len); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":236 - * output_ptr[0] += numpy_char_width * max_chars - * - * cdef public void cast_arrays(numpy.ndarray dst, numpy.ndarray src, int offset, int num): # <<<<<<<<<<<<<< - * """ - * Copy values from src array (buffer) to dst array (final array), forcing a - */ - -void cast_arrays(PyArrayObject *__pyx_v_dst, PyArrayObject *__pyx_v_src, int __pyx_v_offset, int __pyx_v_num) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("cast_arrays", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":246 - * num: number of records to copy - * """ - * dst[offset:offset+num] = src[0:num] # <<<<<<<<<<<<<< - * - * cdef public void cast_dataframes(dst, src, int offset, int num, int num_fields): - */ - __pyx_t_1 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_src), 0, __pyx_v_num, NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_dst), __pyx_t_1, __pyx_v_offset, (__pyx_v_offset + __pyx_v_num), NULL, NULL, NULL, 1, 1, 1) < 0) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":236 - * output_ptr[0] += numpy_char_width * max_chars - * - * cdef public void cast_arrays(numpy.ndarray dst, numpy.ndarray src, int offset, int num): # <<<<<<<<<<<<<< - * """ - * Copy values from src array (buffer) to dst array (final array), forcing a - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_WriteUnraisable("iopro.postgresadapter.PostgresAdapter.cast_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":248 - * dst[offset:offset+num] = src[0:num] - * - * cdef public void cast_dataframes(dst, src, int offset, int num, int num_fields): # <<<<<<<<<<<<<< - * """ - * Copy values from src array (buffer) to dst array (final array), forcing a - */ - -void cast_dataframes(PyObject *__pyx_v_dst, PyObject *__pyx_v_src, int __pyx_v_offset, int __pyx_v_num, int __pyx_v_num_fields) { - int __pyx_v_i; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("cast_dataframes", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":258 - * num: number of records to copy - * """ - * for i in range(num_fields): # <<<<<<<<<<<<<< - * dst[dst.columns[i]].values[offset:offset+num] = src[src.columns[i]].values[0:num] - * - */ - __pyx_t_1 = __pyx_v_num_fields; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":259 - * """ - * for i in range(num_fields): - * dst[dst.columns[i]].values[offset:offset+num] = src[src.columns[i]].values[0:num] # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_columns); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(__pyx_v_src, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_4, 0, __pyx_v_num, NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_columns); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetItem(__pyx_v_dst, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetSlice(__pyx_t_5, __pyx_t_3, __pyx_v_offset, (__pyx_v_offset + __pyx_v_num), NULL, NULL, NULL, 1, 1, 1) < 0) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":248 - * dst[offset:offset+num] = src[0:num] - * - * cdef public void cast_dataframes(dst, src, int offset, int num, int num_fields): # <<<<<<<<<<<<<< - * """ - * Copy values from src array (buffer) to dst array (final array), forcing a - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_WriteUnraisable("iopro.postgresadapter.PostgresAdapter.cast_dataframes", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":262 - * - * - * cdef public void* convert_list_to_array(void *py_list_ptr): # <<<<<<<<<<<<<< - * """ - * Convert Python string to NumPy array (infer type) - */ - -void *convert_list_to_array(void *__pyx_v_py_list_ptr) { - PyObject *__pyx_v_py_list = 0; - PyObject *__pyx_v_array = NULL; - PyObject *__pyx_v_py_array = 0; - void *__pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("convert_list_to_array", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":269 - * output: pointer to a NumPy array - * """ - * cdef object py_list = py_list_ptr # <<<<<<<<<<<<<< - * - * # create a temporary reference to the array - */ - __pyx_t_1 = ((PyObject *)__pyx_v_py_list_ptr); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_py_list = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":272 - * - * # create a temporary reference to the array - * array = numpy.array(py_list) # <<<<<<<<<<<<<< - * cdef object py_array = array - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_py_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_py_list); - __Pyx_GIVEREF(__pyx_v_py_list); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_py_list); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_array = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":273 - * # create a temporary reference to the array - * array = numpy.array(py_list) - * cdef object py_array = array # <<<<<<<<<<<<<< - * - * # Increment ref count on the array, decrement ref count on the list - */ - __pyx_t_1 = __pyx_v_array; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_py_array = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":276 - * - * # Increment ref count on the array, decrement ref count on the list - * Py_INCREF(py_array) # <<<<<<<<<<<<<< - * Py_DECREF(py_list) - * return py_array - */ - Py_INCREF(__pyx_v_py_array); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":277 - * # Increment ref count on the array, decrement ref count on the list - * Py_INCREF(py_array) - * Py_DECREF(py_list) # <<<<<<<<<<<<<< - * return py_array - * - */ - Py_DECREF(__pyx_v_py_list); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":278 - * Py_INCREF(py_array) - * Py_DECREF(py_list) - * return py_array # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = ((void *)__pyx_v_py_array); - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":262 - * - * - * cdef public void* convert_list_to_array(void *py_list_ptr): # <<<<<<<<<<<<<< - * """ - * Convert Python string to NumPy array (infer type) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_WriteUnraisable("iopro.postgresadapter.PostgresAdapter.convert_list_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_py_list); - __Pyx_XDECREF(__pyx_v_array); - __Pyx_XDECREF(__pyx_v_py_array); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":318 - * cdef object _dataframe_result - * - * def __cinit__(self, connection_uri, # <<<<<<<<<<<<<< - * table=None, - * query=None, - */ - -/* Python wrapper */ -static int __pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_connection_uri = 0; - PyObject *__pyx_v_table = 0; - PyObject *__pyx_v_query = 0; - PyObject *__pyx_v_field_filter = 0; - PyObject *__pyx_v_dataframe = 0; - PyObject *__pyx_v_field_names = 0; - PyObject *__pyx_v_field_types = 0; - PyObject *__pyx_v_field_shapes = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_connection_uri,&__pyx_n_s_table,&__pyx_n_s_query,&__pyx_n_s_field_filter,&__pyx_n_s_dataframe,&__pyx_n_s_field_names,&__pyx_n_s_field_types,&__pyx_n_s_field_shapes,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":319 - * - * def __cinit__(self, connection_uri, - * table=None, # <<<<<<<<<<<<<< - * query=None, - * field_filter=None, - */ - values[1] = ((PyObject *)Py_None); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":320 - * def __cinit__(self, connection_uri, - * table=None, - * query=None, # <<<<<<<<<<<<<< - * field_filter=None, - * dataframe=False, - */ - values[2] = ((PyObject *)Py_None); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":321 - * table=None, - * query=None, - * field_filter=None, # <<<<<<<<<<<<<< - * dataframe=False, - * field_names=None, - */ - values[3] = ((PyObject *)Py_None); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":322 - * query=None, - * field_filter=None, - * dataframe=False, # <<<<<<<<<<<<<< - * field_names=None, - * field_types=None, - */ - values[4] = ((PyObject *)Py_False); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":323 - * field_filter=None, - * dataframe=False, - * field_names=None, # <<<<<<<<<<<<<< - * field_types=None, - * field_shapes=None): - */ - values[5] = ((PyObject *)Py_None); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":324 - * dataframe=False, - * field_names=None, - * field_types=None, # <<<<<<<<<<<<<< - * field_shapes=None): - * """ - */ - values[6] = ((PyObject *)Py_None); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":325 - * field_names=None, - * field_types=None, - * field_shapes=None): # <<<<<<<<<<<<<< - * """ - * PostgreSQL adapter constructor. - */ - values[7] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_connection_uri)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_table); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_filter); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dataframe); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_names); - if (value) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_types); - if (value) { values[6] = value; kw_args--; } - } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_shapes); - if (value) { values[7] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 318, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - 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_connection_uri = values[0]; - __pyx_v_table = values[1]; - __pyx_v_query = values[2]; - __pyx_v_field_filter = values[3]; - __pyx_v_dataframe = values[4]; - __pyx_v_field_names = values[5]; - __pyx_v_field_types = values[6]; - __pyx_v_field_shapes = values[7]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 318, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter___cinit__(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self), __pyx_v_connection_uri, __pyx_v_table, __pyx_v_query, __pyx_v_field_filter, __pyx_v_dataframe, __pyx_v_field_names, __pyx_v_field_types, __pyx_v_field_shapes); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":318 - * cdef object _dataframe_result - * - * def __cinit__(self, connection_uri, # <<<<<<<<<<<<<< - * table=None, - * query=None, - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter___cinit__(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_connection_uri, PyObject *__pyx_v_table, PyObject *__pyx_v_query, PyObject *__pyx_v_field_filter, PyObject *__pyx_v_dataframe, PyObject *__pyx_v_field_names, PyObject *__pyx_v_field_types, PyObject *__pyx_v_field_shapes) { - PyObject *__pyx_v_columns = NULL; - AdapterError __pyx_v_result; - PyObject *__pyx_v_msg = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - char const *__pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - char const *__pyx_t_10; - char *__pyx_t_11; - PyObject *__pyx_t_12 = NULL; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_query); - __Pyx_INCREF(__pyx_v_field_filter); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":330 - * See above for constructor argument descriptions. - * """ - * if table is None and query is None: # <<<<<<<<<<<<<< - * raise ValueError('Either table or query must be set') - * if table is not None and query is not None: - */ - __pyx_t_2 = (__pyx_v_table == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_3 = (__pyx_v_query == Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":331 - * """ - * if table is None and query is None: - * raise ValueError('Either table or query must be set') # <<<<<<<<<<<<<< - * if table is not None and query is not None: - * raise ValueError('Table and query cannot both be set') - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 331, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":330 - * See above for constructor argument descriptions. - * """ - * if table is None and query is None: # <<<<<<<<<<<<<< - * raise ValueError('Either table or query must be set') - * if table is not None and query is not None: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":332 - * if table is None and query is None: - * raise ValueError('Either table or query must be set') - * if table is not None and query is not None: # <<<<<<<<<<<<<< - * raise ValueError('Table and query cannot both be set') - * - */ - __pyx_t_2 = (__pyx_v_table != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_3 = (__pyx_v_query != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L7_bool_binop_done:; - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":333 - * raise ValueError('Either table or query must be set') - * if table is not None and query is not None: - * raise ValueError('Table and query cannot both be set') # <<<<<<<<<<<<<< - * - * if field_filter is not None and len(field_filter) == 0: - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 333, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":332 - * if table is None and query is None: - * raise ValueError('Either table or query must be set') - * if table is not None and query is not None: # <<<<<<<<<<<<<< - * raise ValueError('Table and query cannot both be set') - * - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":335 - * raise ValueError('Table and query cannot both be set') - * - * if field_filter is not None and len(field_filter) == 0: # <<<<<<<<<<<<<< - * field_filter = None - * if table is None and field_filter is not None: - */ - __pyx_t_2 = (__pyx_v_field_filter != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_5 = PyObject_Length(__pyx_v_field_filter); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 335, __pyx_L1_error) - __pyx_t_3 = ((__pyx_t_5 == 0) != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L10_bool_binop_done:; - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":336 - * - * if field_filter is not None and len(field_filter) == 0: - * field_filter = None # <<<<<<<<<<<<<< - * if table is None and field_filter is not None: - * raise ValueError('Field filter cannot be set for query') - */ - __Pyx_INCREF(Py_None); - __Pyx_DECREF_SET(__pyx_v_field_filter, Py_None); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":335 - * raise ValueError('Table and query cannot both be set') - * - * if field_filter is not None and len(field_filter) == 0: # <<<<<<<<<<<<<< - * field_filter = None - * if table is None and field_filter is not None: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":337 - * if field_filter is not None and len(field_filter) == 0: - * field_filter = None - * if table is None and field_filter is not None: # <<<<<<<<<<<<<< - * raise ValueError('Field filter cannot be set for query') - * - */ - __pyx_t_3 = (__pyx_v_table == Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L13_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_field_filter != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L13_bool_binop_done:; - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":338 - * field_filter = None - * if table is None and field_filter is not None: - * raise ValueError('Field filter cannot be set for query') # <<<<<<<<<<<<<< - * - * self._adapter = open_postgres_adapter(connection_uri.encode('utf8')) - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 338, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":337 - * if field_filter is not None and len(field_filter) == 0: - * field_filter = None - * if table is None and field_filter is not None: # <<<<<<<<<<<<<< - * raise ValueError('Field filter cannot be set for query') - * - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":340 - * raise ValueError('Field filter cannot be set for query') - * - * self._adapter = open_postgres_adapter(connection_uri.encode('utf8')) # <<<<<<<<<<<<<< - * if not self._adapter: - * raise IOError("PostgresAdapter: Unable to connect to %s" % connection_uri) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection_uri, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_6); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 340, __pyx_L1_error) - __pyx_v_self->_adapter = open_postgres_adapter(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":341 - * - * self._adapter = open_postgres_adapter(connection_uri.encode('utf8')) - * if not self._adapter: # <<<<<<<<<<<<<< - * raise IOError("PostgresAdapter: Unable to connect to %s" % connection_uri) - * - */ - __pyx_t_1 = ((!(__pyx_v_self->_adapter != 0)) != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":342 - * self._adapter = open_postgres_adapter(connection_uri.encode('utf8')) - * if not self._adapter: - * raise IOError("PostgresAdapter: Unable to connect to %s" % connection_uri) # <<<<<<<<<<<<<< - * - * pg_to_numpy_mapping[self._adapter.postgis_geometry_oid] = 'f8' - */ - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_PostgresAdapter_Unable_to_connec, __pyx_v_connection_uri); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 342, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":341 - * - * self._adapter = open_postgres_adapter(connection_uri.encode('utf8')) - * if not self._adapter: # <<<<<<<<<<<<<< - * raise IOError("PostgresAdapter: Unable to connect to %s" % connection_uri) - * - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":344 - * raise IOError("PostgresAdapter: Unable to connect to %s" % connection_uri) - * - * pg_to_numpy_mapping[self._adapter.postgis_geometry_oid] = 'f8' # <<<<<<<<<<<<<< - * - * if table is not None: - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_pg_to_numpy_mapping); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 344, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_SetItemInt(__pyx_t_6, __pyx_v_self->_adapter->postgis_geometry_oid, __pyx_n_s_f8, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 344, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":346 - * pg_to_numpy_mapping[self._adapter.postgis_geometry_oid] = 'f8' - * - * if table is not None: # <<<<<<<<<<<<<< - * if field_filter is None: - * columns = '*' - */ - __pyx_t_1 = (__pyx_v_table != Py_None); - __pyx_t_3 = (__pyx_t_1 != 0); - if (__pyx_t_3) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":347 - * - * if table is not None: - * if field_filter is None: # <<<<<<<<<<<<<< - * columns = '*' - * else: - */ - __pyx_t_3 = (__pyx_v_field_filter == Py_None); - __pyx_t_1 = (__pyx_t_3 != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":348 - * if table is not None: - * if field_filter is None: - * columns = '*' # <<<<<<<<<<<<<< - * else: - * columns = ','.join(field_filter) - */ - __Pyx_INCREF(__pyx_kp_s__6); - __pyx_v_columns = __pyx_kp_s__6; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":347 - * - * if table is not None: - * if field_filter is None: # <<<<<<<<<<<<<< - * columns = '*' - * else: - */ - goto __pyx_L17; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":350 - * columns = '*' - * else: - * columns = ','.join(field_filter) # <<<<<<<<<<<<<< - * query = 'select {0} from {1}'.format(columns, table) - * result = exec_query(self._adapter, query.encode('utf8')) - */ - /*else*/ { - __pyx_t_6 = __Pyx_PyString_Join(__pyx_kp_s__7, __pyx_v_field_filter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 350, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_columns = __pyx_t_6; - __pyx_t_6 = 0; - } - __pyx_L17:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":351 - * else: - * columns = ','.join(field_filter) - * query = 'select {0} from {1}'.format(columns, table) # <<<<<<<<<<<<<< - * result = exec_query(self._adapter, query.encode('utf8')) - * if result != ADAPTER_SUCCESS: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_select_0_from_1, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; - __pyx_t_5 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_5 = 1; - } - } - __pyx_t_9 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; - } - __Pyx_INCREF(__pyx_v_columns); - __Pyx_GIVEREF(__pyx_v_columns); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_5, __pyx_v_columns); - __Pyx_INCREF(__pyx_v_table); - __Pyx_GIVEREF(__pyx_v_table); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_5, __pyx_v_table); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_query, __pyx_t_6); - __pyx_t_6 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":352 - * columns = ','.join(field_filter) - * query = 'select {0} from {1}'.format(columns, table) - * result = exec_query(self._adapter, query.encode('utf8')) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * msg = 'Could not perform query on table "{0}"'.format(table) - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error) - __pyx_v_result = exec_query(__pyx_v_self->_adapter, __pyx_t_10); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":353 - * query = 'select {0} from {1}'.format(columns, table) - * result = exec_query(self._adapter, query.encode('utf8')) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * msg = 'Could not perform query on table "{0}"'.format(table) - * if columns != '*': - */ - __pyx_t_1 = ((__pyx_v_result != ADAPTER_SUCCESS) != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":354 - * result = exec_query(self._adapter, query.encode('utf8')) - * if result != ADAPTER_SUCCESS: - * msg = 'Could not perform query on table "{0}"'.format(table) # <<<<<<<<<<<<<< - * if columns != '*': - * msg += ' with columns "{0}"'.format(columns) - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Could_not_perform_query_on_table, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_9) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_table); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_INCREF(__pyx_v_table); - __Pyx_GIVEREF(__pyx_v_table); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_table); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_msg = __pyx_t_4; - __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":355 - * if result != ADAPTER_SUCCESS: - * msg = 'Could not perform query on table "{0}"'.format(table) - * if columns != '*': # <<<<<<<<<<<<<< - * msg += ' with columns "{0}"'.format(columns) - * msg += '.' - */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_columns, __pyx_kp_s__6, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 355, __pyx_L1_error) - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":356 - * msg = 'Could not perform query on table "{0}"'.format(table) - * if columns != '*': - * msg += ' with columns "{0}"'.format(columns) # <<<<<<<<<<<<<< - * msg += '.' - * if self._adapter.result_error_msg != NULL: - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_with_columns_0, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_8) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_columns); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_INCREF(__pyx_v_columns); - __Pyx_GIVEREF(__pyx_v_columns); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_columns); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_6); - __pyx_t_6 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":355 - * if result != ADAPTER_SUCCESS: - * msg = 'Could not perform query on table "{0}"'.format(table) - * if columns != '*': # <<<<<<<<<<<<<< - * msg += ' with columns "{0}"'.format(columns) - * msg += '.' - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":357 - * if columns != '*': - * msg += ' with columns "{0}"'.format(columns) - * msg += '.' # <<<<<<<<<<<<<< - * if self._adapter.result_error_msg != NULL: - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - */ - __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_kp_s__9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_6); - __pyx_t_6 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":358 - * msg += ' with columns "{0}"'.format(columns) - * msg += '.' - * if self._adapter.result_error_msg != NULL: # <<<<<<<<<<<<<< - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - * raise ValueError(msg) - */ - __pyx_t_1 = ((__pyx_v_self->_adapter->result_error_msg != NULL) != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":359 - * msg += '.' - * if self._adapter.result_error_msg != NULL: - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) # <<<<<<<<<<<<<< - * raise ValueError(msg) - * else: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_PostgreSQL_0, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __pyx_v_self->_adapter->result_error_msg; - __pyx_t_9 = __Pyx_decode_c_string(__pyx_t_11, 0, strlen(__pyx_t_11), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_8) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else { - __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_INCREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_4); - __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":358 - * msg += ' with columns "{0}"'.format(columns) - * msg += '.' - * if self._adapter.result_error_msg != NULL: # <<<<<<<<<<<<<< - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - * raise ValueError(msg) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":360 - * if self._adapter.result_error_msg != NULL: - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - * raise ValueError(msg) # <<<<<<<<<<<<<< - * else: - * result = exec_query(self._adapter, query.encode('utf8')) - */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 360, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_msg); - __Pyx_GIVEREF(__pyx_v_msg); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_msg); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 360, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 360, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":353 - * query = 'select {0} from {1}'.format(columns, table) - * result = exec_query(self._adapter, query.encode('utf8')) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * msg = 'Could not perform query on table "{0}"'.format(table) - * if columns != '*': - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":346 - * pg_to_numpy_mapping[self._adapter.postgis_geometry_oid] = 'f8' - * - * if table is not None: # <<<<<<<<<<<<<< - * if field_filter is None: - * columns = '*' - */ - goto __pyx_L16; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":362 - * raise ValueError(msg) - * else: - * result = exec_query(self._adapter, query.encode('utf8')) # <<<<<<<<<<<<<< - * msg = 'Could not perform query "{0}".'.format(query) - * if self._adapter.result_error_msg != NULL: - */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 362, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 362, __pyx_L1_error) - __pyx_v_result = exec_query(__pyx_v_self->_adapter, __pyx_t_10); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":363 - * else: - * result = exec_query(self._adapter, query.encode('utf8')) - * msg = 'Could not perform query "{0}".'.format(query) # <<<<<<<<<<<<<< - * if self._adapter.result_error_msg != NULL: - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Could_not_perform_query_0, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_12 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_12) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_query); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_12); __pyx_t_12 = NULL; - __Pyx_INCREF(__pyx_v_query); - __Pyx_GIVEREF(__pyx_v_query); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_query); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_msg = __pyx_t_4; - __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":364 - * result = exec_query(self._adapter, query.encode('utf8')) - * msg = 'Could not perform query "{0}".'.format(query) - * if self._adapter.result_error_msg != NULL: # <<<<<<<<<<<<<< - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - * if result != ADAPTER_SUCCESS: - */ - __pyx_t_1 = ((__pyx_v_self->_adapter->result_error_msg != NULL) != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":365 - * msg = 'Could not perform query "{0}".'.format(query) - * if self._adapter.result_error_msg != NULL: - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * raise ValueError(msg) - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_PostgreSQL_0, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_11 = __pyx_v_self->_adapter->result_error_msg; - __pyx_t_9 = __Pyx_decode_c_string(__pyx_t_11, 0, strlen(__pyx_t_11), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_12 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_12) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 365, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_12); __pyx_t_12 = NULL; - __Pyx_INCREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 365, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_6); - __pyx_t_6 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":364 - * result = exec_query(self._adapter, query.encode('utf8')) - * msg = 'Could not perform query "{0}".'.format(query) - * if self._adapter.result_error_msg != NULL: # <<<<<<<<<<<<<< - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - * if result != ADAPTER_SUCCESS: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":366 - * if self._adapter.result_error_msg != NULL: - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * raise ValueError(msg) - * - */ - __pyx_t_1 = ((__pyx_v_result != ADAPTER_SUCCESS) != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":367 - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - * if result != ADAPTER_SUCCESS: - * raise ValueError(msg) # <<<<<<<<<<<<<< - * - * self.set_field_names(field_names) - */ - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_msg); - __Pyx_GIVEREF(__pyx_v_msg); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_msg); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 367, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":366 - * if self._adapter.result_error_msg != NULL: - * msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * raise ValueError(msg) - * - */ - } - } - __pyx_L16:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":369 - * raise ValueError(msg) - * - * self.set_field_names(field_names) # <<<<<<<<<<<<<< - * self.set_field_types(field_types) - * self.set_field_shapes(field_shapes) - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_field_names); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_8) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_field_names); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_INCREF(__pyx_v_field_names); - __Pyx_GIVEREF(__pyx_v_field_names); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_field_names); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":370 - * - * self.set_field_names(field_names) - * self.set_field_types(field_types) # <<<<<<<<<<<<<< - * self.set_field_shapes(field_shapes) - * self._dataframe_result = dataframe - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_field_types); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_9) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_field_types); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_INCREF(__pyx_v_field_types); - __Pyx_GIVEREF(__pyx_v_field_types); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_field_types); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":371 - * self.set_field_names(field_names) - * self.set_field_types(field_types) - * self.set_field_shapes(field_shapes) # <<<<<<<<<<<<<< - * self._dataframe_result = dataframe - * - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_field_shapes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_8) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_field_shapes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_INCREF(__pyx_v_field_shapes); - __Pyx_GIVEREF(__pyx_v_field_shapes); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_field_shapes); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":372 - * self.set_field_types(field_types) - * self.set_field_shapes(field_shapes) - * self._dataframe_result = dataframe # <<<<<<<<<<<<<< - * - * def close(self): - */ - __Pyx_INCREF(__pyx_v_dataframe); - __Pyx_GIVEREF(__pyx_v_dataframe); - __Pyx_GOTREF(__pyx_v_self->_dataframe_result); - __Pyx_DECREF(__pyx_v_self->_dataframe_result); - __pyx_v_self->_dataframe_result = __pyx_v_dataframe; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":318 - * cdef object _dataframe_result - * - * def __cinit__(self, connection_uri, # <<<<<<<<<<<<<< - * table=None, - * query=None, - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_columns); - __Pyx_XDECREF(__pyx_v_msg); - __Pyx_XDECREF(__pyx_v_query); - __Pyx_XDECREF(__pyx_v_field_filter); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":374 - * self._dataframe_result = dataframe - * - * def close(self): # <<<<<<<<<<<<<< - * """ - * Close PostgreSQL connection - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_2close[] = "\n Close PostgreSQL connection\n "; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("close (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_2close(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_2close(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("close", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":378 - * Close PostgreSQL connection - * """ - * if self._adapter != NULL: # <<<<<<<<<<<<<< - * close_postgres_adapter(self._adapter) - * self._adapter = NULL - */ - __pyx_t_1 = ((__pyx_v_self->_adapter != NULL) != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":379 - * """ - * if self._adapter != NULL: - * close_postgres_adapter(self._adapter) # <<<<<<<<<<<<<< - * self._adapter = NULL - * - */ - close_postgres_adapter(__pyx_v_self->_adapter); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":380 - * if self._adapter != NULL: - * close_postgres_adapter(self._adapter) - * self._adapter = NULL # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_v_self->_adapter = NULL; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":378 - * Close PostgreSQL connection - * """ - * if self._adapter != NULL: # <<<<<<<<<<<<<< - * close_postgres_adapter(self._adapter) - * self._adapter = NULL - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":374 - * self._dataframe_result = dataframe - * - * def close(self): # <<<<<<<<<<<<<< - * """ - * Close PostgreSQL connection - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":382 - * self._adapter = NULL - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * """ - * PostgreSQL adapter destructor - */ - -/* Python wrapper */ -static void __pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_5__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_5__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_4__dealloc__(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_4__dealloc__(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":386 - * PostgreSQL adapter destructor - * """ - * self.close() # <<<<<<<<<<<<<< - * - * def _check_connection(self): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":382 - * self._adapter = NULL - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * """ - * PostgreSQL adapter destructor - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":388 - * self.close() - * - * def _check_connection(self): # <<<<<<<<<<<<<< - * if self._adapter == NULL: - * raise RuntimeError('Connection already closed. ' - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_7_check_connection(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_7_check_connection(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_check_connection (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_6_check_connection(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_6_check_connection(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("_check_connection", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":389 - * - * def _check_connection(self): - * if self._adapter == NULL: # <<<<<<<<<<<<<< - * raise RuntimeError('Connection already closed. ' - * 'Please create a new adapter.') - */ - __pyx_t_1 = ((__pyx_v_self->_adapter == NULL) != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":390 - * def _check_connection(self): - * if self._adapter == NULL: - * raise RuntimeError('Connection already closed. ' # <<<<<<<<<<<<<< - * 'Please create a new adapter.') - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __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_ERR(0, 390, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":389 - * - * def _check_connection(self): - * if self._adapter == NULL: # <<<<<<<<<<<<<< - * raise RuntimeError('Connection already closed. ' - * 'Please create a new adapter.') - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":388 - * self.close() - * - * def _check_connection(self): # <<<<<<<<<<<<<< - * if self._adapter == NULL: - * raise RuntimeError('Connection already closed. ' - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter._check_connection", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":394 - * - * @property - * def num_records(self): # <<<<<<<<<<<<<< - * """ - * Get number of records that will be returned from table or custom query - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_11num_records_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_11num_records_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_11num_records___get__(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_11num_records___get__(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":398 - * Get number of records that will be returned from table or custom query - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * return get_num_records(self._adapter) - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":399 - * """ - * self._check_connection() - * return get_num_records(self._adapter) # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(get_num_records(__pyx_v_self->_adapter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":394 - * - * @property - * def num_records(self): # <<<<<<<<<<<<<< - * """ - * Get number of records that will be returned from table or custom query - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.num_records.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":402 - * - * @property - * def num_fields(self): # <<<<<<<<<<<<<< - * """ - * Get number of fields in records that will be returned from table - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_10num_fields_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_10num_fields_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_10num_fields___get__(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_10num_fields___get__(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":407 - * or custom query - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * return get_num_fields(self._adapter) - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":408 - * """ - * self._check_connection() - * return get_num_fields(self._adapter) # <<<<<<<<<<<<<< - * - * def get_field_names(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(get_num_fields(__pyx_v_self->_adapter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":402 - * - * @property - * def num_fields(self): # <<<<<<<<<<<<<< - * """ - * Get number of fields in records that will be returned from table - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.num_fields.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":410 - * return get_num_fields(self._adapter) - * - * def get_field_names(self): # <<<<<<<<<<<<<< - * """ - * Get names of fields in final array or dataframe - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_9get_field_names(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_8get_field_names[] = "\n Get names of fields in final array or dataframe\n "; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_9get_field_names(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_field_names (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_8get_field_names(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_8get_field_names(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("get_field_names", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":414 - * Get names of fields in final array or dataframe - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * return self._field_names - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":415 - * """ - * self._check_connection() - * return self._field_names # <<<<<<<<<<<<<< - * - * def set_field_names(self, names): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_field_names); - __pyx_r = __pyx_v_self->_field_names; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":410 - * return get_num_fields(self._adapter) - * - * def get_field_names(self): # <<<<<<<<<<<<<< - * """ - * Get names of fields in final array or dataframe - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.get_field_names", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":417 - * return self._field_names - * - * def set_field_names(self, names): # <<<<<<<<<<<<<< - * """ - * Set names to assign to fields in final array or dataframe - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_11set_field_names(PyObject *__pyx_v_self, PyObject *__pyx_v_names); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_10set_field_names[] = "\n Set names to assign to fields in final array or dataframe\n Inputs:\n names: list of names to assign to fields in result, or dict mapping\n field number to field name. If names is a list, the length\n of list must match the number of fields in data set.\n If names is a dict, the field name from the database will\n be used if no name in dict is specified for that field.\n "; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_11set_field_names(PyObject *__pyx_v_self, PyObject *__pyx_v_names) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_field_names (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_10set_field_names(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_names)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":431 - * names = None - * - * def make_unique_name(field_name): # <<<<<<<<<<<<<< - * suffix = 1 - * while field_name + str(suffix) in self._field_names: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15set_field_names_1make_unique_name(PyObject *__pyx_self, PyObject *__pyx_v_field_name); /*proto*/ -static PyMethodDef __pyx_mdef_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15set_field_names_1make_unique_name = {"make_unique_name", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15set_field_names_1make_unique_name, METH_O, 0}; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15set_field_names_1make_unique_name(PyObject *__pyx_self, PyObject *__pyx_v_field_name) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_unique_name (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15set_field_names_make_unique_name(__pyx_self, ((PyObject *)__pyx_v_field_name)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15set_field_names_make_unique_name(PyObject *__pyx_self, PyObject *__pyx_v_field_name) { - struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *__pyx_cur_scope; - struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *__pyx_outer_scope; - PyObject *__pyx_v_suffix = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("make_unique_name", 0); - __pyx_outer_scope = (struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *) __Pyx_CyFunction_GetClosure(__pyx_self); - __pyx_cur_scope = __pyx_outer_scope; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":432 - * - * def make_unique_name(field_name): - * suffix = 1 # <<<<<<<<<<<<<< - * while field_name + str(suffix) in self._field_names: - * suffix += 1 - */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_suffix = __pyx_int_1; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":433 - * def make_unique_name(field_name): - * suffix = 1 - * while field_name + str(suffix) in self._field_names: # <<<<<<<<<<<<<< - * suffix += 1 - * return field_name + str(suffix) - */ - while (1) { - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_suffix); - __Pyx_GIVEREF(__pyx_v_suffix); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_suffix); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_v_field_name, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 433, __pyx_L1_error) } - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_cur_scope->__pyx_v_self->_field_names, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 433, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = (__pyx_t_3 != 0); - if (!__pyx_t_4) break; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":434 - * suffix = 1 - * while field_name + str(suffix) in self._field_names: - * suffix += 1 # <<<<<<<<<<<<<< - * return field_name + str(suffix) - * - */ - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_suffix, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_suffix, __pyx_t_1); - __pyx_t_1 = 0; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":435 - * while field_name + str(suffix) in self._field_names: - * suffix += 1 - * return field_name + str(suffix) # <<<<<<<<<<<<<< - * - * if names is None: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_suffix); - __Pyx_GIVEREF(__pyx_v_suffix); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_suffix); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 435, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_v_field_name, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":431 - * names = None - * - * def make_unique_name(field_name): # <<<<<<<<<<<<<< - * suffix = 1 - * while field_name + str(suffix) in self._field_names: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.set_field_names.make_unique_name", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_suffix); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":417 - * return self._field_names - * - * def set_field_names(self, names): # <<<<<<<<<<<<<< - * """ - * Set names to assign to fields in final array or dataframe - */ - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_10set_field_names(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_names) { - struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *__pyx_cur_scope; - PyObject *__pyx_v_make_unique_name = 0; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_field_name = NULL; - PyObject *__pyx_v_field_num = NULL; - PyObject *__pyx_r = NULL; - __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; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - char const *__pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; - __Pyx_RefNannySetupContext("set_field_names", 0); - __pyx_cur_scope = (struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *)__pyx_tp_new_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names(__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_INCREF(__pyx_v_names); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":427 - * be used if no name in dict is specified for that field. - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * if names is not None and len(names) == 0: - * names = None - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":428 - * """ - * self._check_connection() - * if names is not None and len(names) == 0: # <<<<<<<<<<<<<< - * names = None - * - */ - __pyx_t_5 = (__pyx_v_names != Py_None); - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - } else { - __pyx_t_4 = __pyx_t_6; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = PyObject_Length(__pyx_v_names); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 428, __pyx_L1_error) - __pyx_t_6 = ((__pyx_t_7 == 0) != 0); - __pyx_t_4 = __pyx_t_6; - __pyx_L4_bool_binop_done:; - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":429 - * self._check_connection() - * if names is not None and len(names) == 0: - * names = None # <<<<<<<<<<<<<< - * - * def make_unique_name(field_name): - */ - __Pyx_INCREF(Py_None); - __Pyx_DECREF_SET(__pyx_v_names, Py_None); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":428 - * """ - * self._check_connection() - * if names is not None and len(names) == 0: # <<<<<<<<<<<<<< - * names = None - * - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":431 - * names = None - * - * def make_unique_name(field_name): # <<<<<<<<<<<<<< - * suffix = 1 - * while field_name + str(suffix) in self._field_names: - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15set_field_names_1make_unique_name, 0, __pyx_n_s_set_field_names_locals_make_uniq, ((PyObject*)__pyx_cur_scope), __pyx_n_s_iopro_postgresadapter_PostgresAd, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_make_unique_name = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":437 - * return field_name + str(suffix) - * - * if names is None: # <<<<<<<<<<<<<< - * self._field_names = [] - * for i in range(self.num_fields): - */ - __pyx_t_4 = (__pyx_v_names == Py_None); - __pyx_t_6 = (__pyx_t_4 != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":438 - * - * if names is None: - * self._field_names = [] # <<<<<<<<<<<<<< - * for i in range(self.num_fields): - * field_name = PQfname(self._adapter.result, i).decode(self._adapter.client_encoding.decode()) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->_field_names); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->_field_names); - __pyx_cur_scope->__pyx_v_self->_field_names = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":439 - * if names is None: - * self._field_names = [] - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * field_name = PQfname(self._adapter.result, i).decode(self._adapter.client_encoding.decode()) - * # Since libpq returns 'st_astext' as the column name for every - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 439, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 439, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 439, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 439, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":440 - * self._field_names = [] - * for i in range(self.num_fields): - * field_name = PQfname(self._adapter.result, i).decode(self._adapter.client_encoding.decode()) # <<<<<<<<<<<<<< - * # Since libpq returns 'st_astext' as the column name for every - * # PostGIS column retrieved as text, we need to number multiple - */ - __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 440, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyBytes_FromString(PQfname(__pyx_cur_scope->__pyx_v_self->_adapter->result, __pyx_t_9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_decode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = __pyx_cur_scope->__pyx_v_self->_adapter->client_encoding; - __pyx_t_3 = __Pyx_decode_c_string(__pyx_t_11, 0, strlen(__pyx_t_11), NULL, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - if (!__pyx_t_12) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL; - __Pyx_INCREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF_SET(__pyx_v_field_name, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":444 - * # PostGIS column retrieved as text, we need to number multiple - * # st_astext columns to make them unique. - * if field_name in self._field_names: # <<<<<<<<<<<<<< - * field_name = make_unique_name(field_name) - * self._field_names.append(field_name) - */ - __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_field_name, __pyx_cur_scope->__pyx_v_self->_field_names, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 444, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_6 != 0); - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":445 - * # st_astext columns to make them unique. - * if field_name in self._field_names: - * field_name = make_unique_name(field_name) # <<<<<<<<<<<<<< - * self._field_names.append(field_name) - * elif isinstance(names, dict): - */ - __pyx_t_1 = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15set_field_names_make_unique_name(__pyx_v_make_unique_name, __pyx_v_field_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_field_name, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":444 - * # PostGIS column retrieved as text, we need to number multiple - * # st_astext columns to make them unique. - * if field_name in self._field_names: # <<<<<<<<<<<<<< - * field_name = make_unique_name(field_name) - * self._field_names.append(field_name) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":446 - * if field_name in self._field_names: - * field_name = make_unique_name(field_name) - * self._field_names.append(field_name) # <<<<<<<<<<<<<< - * elif isinstance(names, dict): - * self._field_names = [] - */ - __pyx_t_14 = __Pyx_PyObject_Append(__pyx_cur_scope->__pyx_v_self->_field_names, __pyx_v_field_name); if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 446, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":439 - * if names is None: - * self._field_names = [] - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * field_name = PQfname(self._adapter.result, i).decode(self._adapter.client_encoding.decode()) - * # Since libpq returns 'st_astext' as the column name for every - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":437 - * return field_name + str(suffix) - * - * if names is None: # <<<<<<<<<<<<<< - * self._field_names = [] - * for i in range(self.num_fields): - */ - goto __pyx_L6; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":447 - * field_name = make_unique_name(field_name) - * self._field_names.append(field_name) - * elif isinstance(names, dict): # <<<<<<<<<<<<<< - * self._field_names = [] - * for field_num in names.keys(): - */ - __pyx_t_4 = PyDict_Check(__pyx_v_names); - __pyx_t_6 = (__pyx_t_4 != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":448 - * self._field_names.append(field_name) - * elif isinstance(names, dict): - * self._field_names = [] # <<<<<<<<<<<<<< - * for field_num in names.keys(): -<<<<<<< HEAD - * if field_num >= self.num_***REMOVED*** -======= - * if field_num >= self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->_field_names); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->_field_names); - __pyx_cur_scope->__pyx_v_self->_field_names = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":449 - * elif isinstance(names, dict): - * self._field_names = [] - * for field_num in names.keys(): # <<<<<<<<<<<<<< -<<<<<<< HEAD - * if field_num >= self.num_***REMOVED*** -======= - * if field_num >= self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Invalid field number {0}'.format(field_num)) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_names, __pyx_n_s_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_10) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 449, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 449, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_8(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 449, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_field_num, __pyx_t_2); - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":450 - * self._field_names = [] - * for field_num in names.keys(): -<<<<<<< HEAD - * if field_num >= self.num_***REMOVED*** # <<<<<<<<<<<<<< -======= - * if field_num >= self.num_fields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Invalid field number {0}'.format(field_num)) - * for i in range(self.num_fields): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_RichCompare(__pyx_v_field_num, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 450, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 450, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":451 - * for field_num in names.keys(): -<<<<<<< HEAD - * if field_num >= self.num_***REMOVED*** -======= - * if field_num >= self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Invalid field number {0}'.format(field_num)) # <<<<<<<<<<<<<< - * for i in range(self.num_fields): - * if i in names.keys(): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Invalid_field_number_0, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_13) { - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_field_num); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - } else { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); __pyx_t_13 = NULL; - __Pyx_INCREF(__pyx_v_field_num); - __Pyx_GIVEREF(__pyx_v_field_num); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_field_num); - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(0, 451, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":450 - * self._field_names = [] - * for field_num in names.keys(): -<<<<<<< HEAD - * if field_num >= self.num_***REMOVED*** # <<<<<<<<<<<<<< -======= - * if field_num >= self.num_fields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Invalid field number {0}'.format(field_num)) - * for i in range(self.num_fields): - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":449 - * elif isinstance(names, dict): - * self._field_names = [] - * for field_num in names.keys(): # <<<<<<<<<<<<<< -<<<<<<< HEAD - * if field_num >= self.num_***REMOVED*** -======= - * if field_num >= self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Invalid field number {0}'.format(field_num)) - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":452 -<<<<<<< HEAD - * if field_num >= self.num_***REMOVED*** -======= - * if field_num >= self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Invalid field number {0}'.format(field_num)) - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * if i in names.keys(): - * self._field_names.append(names[i]) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 452, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_10))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 452, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 452, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_10); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 452, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":453 - * raise ValueError('Invalid field number {0}'.format(field_num)) - * for i in range(self.num_fields): - * if i in names.keys(): # <<<<<<<<<<<<<< - * self._field_names.append(names[i]) - * else: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_names, __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_i, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = (__pyx_t_6 != 0); - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":454 - * for i in range(self.num_fields): - * if i in names.keys(): - * self._field_names.append(names[i]) # <<<<<<<<<<<<<< - * else: - * field_name = PQfname(self._adapter.result, i).decode(self._adapter.client_encoding.decode()) - */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_names, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = __Pyx_PyObject_Append(__pyx_cur_scope->__pyx_v_self->_field_names, __pyx_t_1); if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":453 - * raise ValueError('Invalid field number {0}'.format(field_num)) - * for i in range(self.num_fields): - * if i in names.keys(): # <<<<<<<<<<<<<< - * self._field_names.append(names[i]) - * else: - */ - goto __pyx_L15; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":456 - * self._field_names.append(names[i]) - * else: - * field_name = PQfname(self._adapter.result, i).decode(self._adapter.client_encoding.decode()) # <<<<<<<<<<<<<< - * # Since libpq returns 'st_astext' as the column name for every - * # PostGIS column retrieved as text, we need to number multiple - */ - /*else*/ { - __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 456, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyBytes_FromString(PQfname(__pyx_cur_scope->__pyx_v_self->_adapter->result, __pyx_t_9)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __pyx_cur_scope->__pyx_v_self->_adapter->client_encoding; - __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_11, 0, strlen(__pyx_t_11), NULL, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_13) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __pyx_t_13 = NULL; - __Pyx_INCREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_field_name, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":460 - * # PostGIS column retrieved as text, we need to number multiple - * # st_astext columns to make them unique. - * if field_name in self._field_names: # <<<<<<<<<<<<<< - * field_name = make_unique_name(field_name) - * self._field_names.append(field_name) - */ - __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_field_name, __pyx_cur_scope->__pyx_v_self->_field_names, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 460, __pyx_L1_error) - __pyx_t_6 = (__pyx_t_4 != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":461 - * # st_astext columns to make them unique. - * if field_name in self._field_names: - * field_name = make_unique_name(field_name) # <<<<<<<<<<<<<< - * self._field_names.append(field_name) - * else: - */ - __pyx_t_1 = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15set_field_names_make_unique_name(__pyx_v_make_unique_name, __pyx_v_field_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_field_name, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":460 - * # PostGIS column retrieved as text, we need to number multiple - * # st_astext columns to make them unique. - * if field_name in self._field_names: # <<<<<<<<<<<<<< - * field_name = make_unique_name(field_name) - * self._field_names.append(field_name) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":462 - * if field_name in self._field_names: - * field_name = make_unique_name(field_name) - * self._field_names.append(field_name) # <<<<<<<<<<<<<< - * else: -<<<<<<< HEAD - * if len(names) != self.num_***REMOVED*** -======= - * if len(names) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - */ - __pyx_t_14 = __Pyx_PyObject_Append(__pyx_cur_scope->__pyx_v_self->_field_names, __pyx_v_field_name); if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 462, __pyx_L1_error) - } - __pyx_L15:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":452 -<<<<<<< HEAD - * if field_num >= self.num_***REMOVED*** -======= - * if field_num >= self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Invalid field number {0}'.format(field_num)) - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * if i in names.keys(): - * self._field_names.append(names[i]) - */ - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":447 - * field_name = make_unique_name(field_name) - * self._field_names.append(field_name) - * elif isinstance(names, dict): # <<<<<<<<<<<<<< - * self._field_names = [] - * for field_num in names.keys(): - */ - goto __pyx_L6; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":464 - * self._field_names.append(field_name) - * else: -<<<<<<< HEAD - * if len(names) != self.num_***REMOVED*** # <<<<<<<<<<<<<< -======= - * if len(names) != self.num_fields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Number of field names does not match number of fields') - * self._field_names = names - */ - /*else*/ { - __pyx_t_7 = PyObject_Length(__pyx_v_names); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 464, __pyx_L1_error) - __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_10, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":465 - * else: -<<<<<<< HEAD - * if len(names) != self.num_***REMOVED*** -======= - * if len(names) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Number of field names does not match number of fields') # <<<<<<<<<<<<<< - * self._field_names = names - * - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 465, __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_ERR(0, 465, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":464 - * self._field_names.append(field_name) - * else: -<<<<<<< HEAD - * if len(names) != self.num_***REMOVED*** # <<<<<<<<<<<<<< -======= - * if len(names) != self.num_fields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Number of field names does not match number of fields') - * self._field_names = names - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":466 -<<<<<<< HEAD - * if len(names) != self.num_***REMOVED*** -======= - * if len(names) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Number of field names does not match number of fields') - * self._field_names = names # <<<<<<<<<<<<<< - * - * field_names = property(get_field_names, set_field_names) - */ - __Pyx_INCREF(__pyx_v_names); - __Pyx_GIVEREF(__pyx_v_names); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->_field_names); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->_field_names); - __pyx_cur_scope->__pyx_v_self->_field_names = __pyx_v_names; - } - __pyx_L6:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":417 - * return self._field_names - * - * def set_field_names(self, names): # <<<<<<<<<<<<<< - * """ - * Set names to assign to fields in final array or dataframe - */ - - /* function exit code */ - __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_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.set_field_names", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_make_unique_name); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_field_name); - __Pyx_XDECREF(__pyx_v_field_num); - __Pyx_XDECREF(__pyx_v_names); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":470 - * field_names = property(get_field_names, set_field_names) - * - * def _get_default_types(self): # <<<<<<<<<<<<<< - * """ - * Get list of types based on types in database table/query. These will be - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_13_get_default_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_12_get_default_types[] = "\n Get list of types based on types in database table/query. These will be\n the default types of final array or dataframe if user does not specify\n any types.\n "; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_13_get_default_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_get_default_types (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_12_get_default_types(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_12_get_default_types(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self) { - int __pyx_v_has_srid; - PyObject *__pyx_v_types = NULL; - PyObject *__pyx_v_dtype_len = NULL; - PyObject *__pyx_v_i = NULL; - int __pyx_v_pg_type; - int __pyx_v_field_length; - PyObject *__pyx_v_gis_field_type = NULL; - char *__pyx_v_data; - PyObject *__pyx_v_numpy_type = NULL; - PyObject *__pyx_v_shape = 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_t_6; - int __pyx_t_7; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - int __pyx_t_13; - __Pyx_RefNannySetupContext("_get_default_types", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":477 - * """ - * cdef int has_srid - * self._check_connection() # <<<<<<<<<<<<<< - * types = [] - * dtype_len = [] - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":478 - * cdef int has_srid - * self._check_connection() - * types = [] # <<<<<<<<<<<<<< - * dtype_len = [] - * for i in range(self.num_fields): - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_types = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":479 - * self._check_connection() - * types = [] - * dtype_len = [] # <<<<<<<<<<<<<< - * for i in range(self.num_fields): - * pg_type = get_field_type(self._adapter.result, i) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_dtype_len = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":480 - * types = [] - * dtype_len = [] - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * pg_type = get_field_type(self._adapter.result, i) - * field_length = get_field_length(self._adapter.result, i) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __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_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 480, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 480, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 480, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":481 - * dtype_len = [] - * for i in range(self.num_fields): - * pg_type = get_field_type(self._adapter.result, i) # <<<<<<<<<<<<<< - * field_length = get_field_length(self._adapter.result, i) - * gis_field_type = None - */ - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 481, __pyx_L1_error) - __pyx_v_pg_type = get_field_type(__pyx_v_self->_adapter->result, __pyx_t_6); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":482 - * for i in range(self.num_fields): - * pg_type = get_field_type(self._adapter.result, i) - * field_length = get_field_length(self._adapter.result, i) # <<<<<<<<<<<<<< - * gis_field_type = None - * if pg_type == self._adapter.postgis_geometry_oid: - */ - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 482, __pyx_L1_error) - __pyx_v_field_length = get_field_length(__pyx_v_self->_adapter->result, __pyx_t_6); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":483 - * pg_type = get_field_type(self._adapter.result, i) - * field_length = get_field_length(self._adapter.result, i) - * gis_field_type = None # <<<<<<<<<<<<<< - * if pg_type == self._adapter.postgis_geometry_oid: - * data = get_field_data(self._adapter.result, 0, i) - */ - __Pyx_INCREF(Py_None); - __Pyx_XDECREF_SET(__pyx_v_gis_field_type, Py_None); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":484 - * field_length = get_field_length(self._adapter.result, i) - * gis_field_type = None - * if pg_type == self._adapter.postgis_geometry_oid: # <<<<<<<<<<<<<< - * data = get_field_data(self._adapter.result, 0, i) - * gis_field_type = get_gis_type(data, &has_srid) - */ - __pyx_t_7 = ((__pyx_v_pg_type == __pyx_v_self->_adapter->postgis_geometry_oid) != 0); - if (__pyx_t_7) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":485 - * gis_field_type = None - * if pg_type == self._adapter.postgis_geometry_oid: - * data = get_field_data(self._adapter.result, 0, i) # <<<<<<<<<<<<<< - * gis_field_type = get_gis_type(data, &has_srid) - * - */ - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 485, __pyx_L1_error) - __pyx_v_data = get_field_data(__pyx_v_self->_adapter->result, 0, __pyx_t_6); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":486 - * if pg_type == self._adapter.postgis_geometry_oid: - * data = get_field_data(self._adapter.result, 0, i) - * gis_field_type = get_gis_type(data, &has_srid) # <<<<<<<<<<<<<< - * - * if pg_type not in pg_to_numpy_mapping: - */ - __pyx_t_1 = __Pyx_PyInt_From_uint32_t(get_gis_type(__pyx_v_data, (&__pyx_v_has_srid))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_gis_field_type, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":484 - * field_length = get_field_length(self._adapter.result, i) - * gis_field_type = None - * if pg_type == self._adapter.postgis_geometry_oid: # <<<<<<<<<<<<<< - * data = get_field_data(self._adapter.result, 0, i) - * gis_field_type = get_gis_type(data, &has_srid) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":488 - * gis_field_type = get_gis_type(data, &has_srid) - * - * if pg_type not in pg_to_numpy_mapping: # <<<<<<<<<<<<<< - * raise RuntimeError('postgresql type {0} not supported'.format(pg_type)) - * numpy_type = pg_to_numpy_mapping[pg_type] - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_pg_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pg_to_numpy_mapping); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_t_3, Py_NE)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_8 = (__pyx_t_7 != 0); - if (__pyx_t_8) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":489 - * - * if pg_type not in pg_to_numpy_mapping: - * raise RuntimeError('postgresql type {0} not supported'.format(pg_type)) # <<<<<<<<<<<<<< - * numpy_type = pg_to_numpy_mapping[pg_type] - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_postgresql_type_0_not_supported, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_pg_type); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_10) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 489, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":488 - * gis_field_type = get_gis_type(data, &has_srid) - * - * if pg_type not in pg_to_numpy_mapping: # <<<<<<<<<<<<<< - * raise RuntimeError('postgresql type {0} not supported'.format(pg_type)) - * numpy_type = pg_to_numpy_mapping[pg_type] - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":490 - * if pg_type not in pg_to_numpy_mapping: - * raise RuntimeError('postgresql type {0} not supported'.format(pg_type)) - * numpy_type = pg_to_numpy_mapping[pg_type] # <<<<<<<<<<<<<< - * - * if pg_type in [BPCHAROID, VARCHAROID] and not self._dataframe_result: - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pg_to_numpy_mapping); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_pg_type, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_numpy_type, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":492 - * numpy_type = pg_to_numpy_mapping[pg_type] - * - * if pg_type in [BPCHAROID, VARCHAROID] and not self._dataframe_result: # <<<<<<<<<<<<<< - * numpy_type += str(get_field_length(self._adapter.result, i)) - * types.append(numpy_type) - */ - __pyx_t_6 = __pyx_v_pg_type; - __pyx_t_12 = ((__pyx_t_6 == BPCHAROID) != 0); - if (!__pyx_t_12) { - } else { - __pyx_t_7 = __pyx_t_12; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_12 = ((__pyx_t_6 == VARCHAROID) != 0); - __pyx_t_7 = __pyx_t_12; - __pyx_L10_bool_binop_done:; - __pyx_t_12 = (__pyx_t_7 != 0); - if (__pyx_t_12) { - } else { - __pyx_t_8 = __pyx_t_12; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_self->_dataframe_result); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 492, __pyx_L1_error) - __pyx_t_7 = ((!__pyx_t_12) != 0); - __pyx_t_8 = __pyx_t_7; - __pyx_L8_bool_binop_done:; - if (__pyx_t_8) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":493 - * - * if pg_type in [BPCHAROID, VARCHAROID] and not self._dataframe_result: - * numpy_type += str(get_field_length(self._adapter.result, i)) # <<<<<<<<<<<<<< - * types.append(numpy_type) - * dtype_len.append(1) - */ - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 493, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(get_field_length(__pyx_v_self->_adapter->result, __pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_numpy_type, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_numpy_type, __pyx_t_3); - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":494 - * if pg_type in [BPCHAROID, VARCHAROID] and not self._dataframe_result: - * numpy_type += str(get_field_length(self._adapter.result, i)) - * types.append(numpy_type) # <<<<<<<<<<<<<< - * dtype_len.append(1) - * elif pg_type == TEXTOID or (pg_type in [BPCHAROID, VARCHAROID] and self._dataframe_result): - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_types, __pyx_v_numpy_type); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 494, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":495 - * numpy_type += str(get_field_length(self._adapter.result, i)) - * types.append(numpy_type) - * dtype_len.append(1) # <<<<<<<<<<<<<< - * elif pg_type == TEXTOID or (pg_type in [BPCHAROID, VARCHAROID] and self._dataframe_result): - * types.append('O') - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_dtype_len, __pyx_int_1); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 495, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":492 - * numpy_type = pg_to_numpy_mapping[pg_type] - * - * if pg_type in [BPCHAROID, VARCHAROID] and not self._dataframe_result: # <<<<<<<<<<<<<< - * numpy_type += str(get_field_length(self._adapter.result, i)) - * types.append(numpy_type) - */ - goto __pyx_L7; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":496 - * types.append(numpy_type) - * dtype_len.append(1) - * elif pg_type == TEXTOID or (pg_type in [BPCHAROID, VARCHAROID] and self._dataframe_result): # <<<<<<<<<<<<<< - * types.append('O') - * dtype_len.append(1) - */ - __pyx_t_7 = ((__pyx_v_pg_type == TEXTOID) != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_8 = __pyx_t_7; - goto __pyx_L12_bool_binop_done; - } - __pyx_t_6 = __pyx_v_pg_type; - __pyx_t_12 = ((__pyx_t_6 == BPCHAROID) != 0); - if (!__pyx_t_12) { - } else { - __pyx_t_7 = __pyx_t_12; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_12 = ((__pyx_t_6 == VARCHAROID) != 0); - __pyx_t_7 = __pyx_t_12; - __pyx_L15_bool_binop_done:; - __pyx_t_12 = (__pyx_t_7 != 0); - if (__pyx_t_12) { - } else { - __pyx_t_8 = __pyx_t_12; - goto __pyx_L12_bool_binop_done; - } - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_self->_dataframe_result); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 496, __pyx_L1_error) - __pyx_t_8 = __pyx_t_12; - __pyx_L12_bool_binop_done:; - if (__pyx_t_8) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":497 - * dtype_len.append(1) - * elif pg_type == TEXTOID or (pg_type in [BPCHAROID, VARCHAROID] and self._dataframe_result): - * types.append('O') # <<<<<<<<<<<<<< - * dtype_len.append(1) - * elif (pg_type == self._adapter.postgis_geometry_oid and - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_types, __pyx_n_s_O); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 497, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":498 - * elif pg_type == TEXTOID or (pg_type in [BPCHAROID, VARCHAROID] and self._dataframe_result): - * types.append('O') - * dtype_len.append(1) # <<<<<<<<<<<<<< - * elif (pg_type == self._adapter.postgis_geometry_oid and - * (gis_field_type == GIS_POINT2D or - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_dtype_len, __pyx_int_1); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 498, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":496 - * types.append(numpy_type) - * dtype_len.append(1) - * elif pg_type == TEXTOID or (pg_type in [BPCHAROID, VARCHAROID] and self._dataframe_result): # <<<<<<<<<<<<<< - * types.append('O') - * dtype_len.append(1) - */ - goto __pyx_L7; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":499 - * types.append('O') - * dtype_len.append(1) - * elif (pg_type == self._adapter.postgis_geometry_oid and # <<<<<<<<<<<<<< - * (gis_field_type == GIS_POINT2D or - * gis_field_type == GIS_POINT3D or - */ - __pyx_t_12 = ((__pyx_v_pg_type == __pyx_v_self->_adapter->postgis_geometry_oid) != 0); - if (__pyx_t_12) { - } else { - __pyx_t_8 = __pyx_t_12; - goto __pyx_L17_bool_binop_done; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":500 - * dtype_len.append(1) - * elif (pg_type == self._adapter.postgis_geometry_oid and - * (gis_field_type == GIS_POINT2D or # <<<<<<<<<<<<<< - * gis_field_type == GIS_POINT3D or - * gis_field_type == GIS_POINT4D)): - */ - __pyx_t_3 = __Pyx_PyInt_From_uint32_t(((uint32_t)GIS_POINT2D)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_gis_field_type, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_12) { - } else { - __pyx_t_8 = __pyx_t_12; - goto __pyx_L17_bool_binop_done; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":501 - * elif (pg_type == self._adapter.postgis_geometry_oid and - * (gis_field_type == GIS_POINT2D or - * gis_field_type == GIS_POINT3D or # <<<<<<<<<<<<<< - * gis_field_type == GIS_POINT4D)): - * if self._field_types[i] in [None, 'O']: - */ - __pyx_t_1 = __Pyx_PyInt_From_uint32_t(((uint32_t)GIS_POINT3D)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_gis_field_type, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 501, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_12) { - } else { - __pyx_t_8 = __pyx_t_12; - goto __pyx_L17_bool_binop_done; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":502 - * (gis_field_type == GIS_POINT2D or - * gis_field_type == GIS_POINT3D or - * gis_field_type == GIS_POINT4D)): # <<<<<<<<<<<<<< - * if self._field_types[i] in [None, 'O']: - * types.append('O') - */ - __pyx_t_3 = __Pyx_PyInt_From_uint32_t(((uint32_t)GIS_POINT4D)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_gis_field_type, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 502, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = __pyx_t_12; - __pyx_L17_bool_binop_done:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":499 - * types.append('O') - * dtype_len.append(1) - * elif (pg_type == self._adapter.postgis_geometry_oid and # <<<<<<<<<<<<<< - * (gis_field_type == GIS_POINT2D or - * gis_field_type == GIS_POINT3D or - */ - if (__pyx_t_8) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":503 - * gis_field_type == GIS_POINT3D or - * gis_field_type == GIS_POINT4D)): - * if self._field_types[i] in [None, 'O']: # <<<<<<<<<<<<<< - * types.append('O') - * dtype_len.append(1) - */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_self->_field_types, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error) - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_12) { - } else { - __pyx_t_8 = __pyx_t_12; - goto __pyx_L22_bool_binop_done; - } - __pyx_t_12 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_O, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 503, __pyx_L1_error) - __pyx_t_8 = __pyx_t_12; - __pyx_L22_bool_binop_done:; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_12 = (__pyx_t_8 != 0); - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":504 - * gis_field_type == GIS_POINT4D)): - * if self._field_types[i] in [None, 'O']: - * types.append('O') # <<<<<<<<<<<<<< - * dtype_len.append(1) - * else: - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_types, __pyx_n_s_O); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 504, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":505 - * if self._field_types[i] in [None, 'O']: - * types.append('O') - * dtype_len.append(1) # <<<<<<<<<<<<<< - * else: - * types.append('f8') - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_dtype_len, __pyx_int_1); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 505, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":503 - * gis_field_type == GIS_POINT3D or - * gis_field_type == GIS_POINT4D)): - * if self._field_types[i] in [None, 'O']: # <<<<<<<<<<<<<< - * types.append('O') - * dtype_len.append(1) - */ - goto __pyx_L21; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":507 - * dtype_len.append(1) - * else: - * types.append('f8') # <<<<<<<<<<<<<< - * dtype_len.append(field_length) - * elif field_length < 0 or pg_type == self._adapter.postgis_geometry_oid: - */ - /*else*/ { - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_types, __pyx_n_s_f8); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 507, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":508 - * else: - * types.append('f8') - * dtype_len.append(field_length) # <<<<<<<<<<<<<< - * elif field_length < 0 or pg_type == self._adapter.postgis_geometry_oid: - * if (self.field_shapes is None or self.field_names[i] not in self.field_shapes or self._dataframe_result): - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_field_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_dtype_len, __pyx_t_1); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L21:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":499 - * types.append('O') - * dtype_len.append(1) - * elif (pg_type == self._adapter.postgis_geometry_oid and # <<<<<<<<<<<<<< - * (gis_field_type == GIS_POINT2D or - * gis_field_type == GIS_POINT3D or - */ - goto __pyx_L7; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":509 - * types.append('f8') - * dtype_len.append(field_length) - * elif field_length < 0 or pg_type == self._adapter.postgis_geometry_oid: # <<<<<<<<<<<<<< - * if (self.field_shapes is None or self.field_names[i] not in self.field_shapes or self._dataframe_result): - * types.append('O') - */ - __pyx_t_8 = ((__pyx_v_field_length < 0) != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_12 = __pyx_t_8; - goto __pyx_L24_bool_binop_done; - } - __pyx_t_8 = ((__pyx_v_pg_type == __pyx_v_self->_adapter->postgis_geometry_oid) != 0); - __pyx_t_12 = __pyx_t_8; - __pyx_L24_bool_binop_done:; - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":510 - * dtype_len.append(field_length) - * elif field_length < 0 or pg_type == self._adapter.postgis_geometry_oid: - * if (self.field_shapes is None or self.field_names[i] not in self.field_shapes or self._dataframe_result): # <<<<<<<<<<<<<< - * types.append('O') - * dtype_len.append(1) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_shapes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = (__pyx_t_1 == Py_None); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = (__pyx_t_8 != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_12 = __pyx_t_7; - goto __pyx_L27_bool_binop_done; - } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_shapes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = (__pyx_t_7 != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_12 = __pyx_t_8; - goto __pyx_L27_bool_binop_done; - } - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_self->_dataframe_result); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 510, __pyx_L1_error) - __pyx_t_12 = __pyx_t_8; - __pyx_L27_bool_binop_done:; - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":511 - * elif field_length < 0 or pg_type == self._adapter.postgis_geometry_oid: - * if (self.field_shapes is None or self.field_names[i] not in self.field_shapes or self._dataframe_result): - * types.append('O') # <<<<<<<<<<<<<< - * dtype_len.append(1) - * else: - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_types, __pyx_n_s_O); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 511, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":512 - * if (self.field_shapes is None or self.field_names[i] not in self.field_shapes or self._dataframe_result): - * types.append('O') - * dtype_len.append(1) # <<<<<<<<<<<<<< - * else: - * # For variable length fields that are composed of things - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_dtype_len, __pyx_int_1); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 512, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":510 - * dtype_len.append(field_length) - * elif field_length < 0 or pg_type == self._adapter.postgis_geometry_oid: - * if (self.field_shapes is None or self.field_names[i] not in self.field_shapes or self._dataframe_result): # <<<<<<<<<<<<<< - * types.append('O') - * dtype_len.append(1) - */ - goto __pyx_L26; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":519 - * # for points is two items per point (each point contains an - * # x an y coordinate). - * shape = self.field_shapes[self.field_names[i]] # <<<<<<<<<<<<<< - * types.append(numpy_type) - * dtype_len.append(shape) - */ - /*else*/ { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_shapes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = PyObject_GetItem(__pyx_t_3, __pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF_SET(__pyx_v_shape, __pyx_t_3); - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":520 - * # x an y coordinate). - * shape = self.field_shapes[self.field_names[i]] - * types.append(numpy_type) # <<<<<<<<<<<<<< - * dtype_len.append(shape) - * elif self._dataframe_result and field_length > 1: - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_types, __pyx_v_numpy_type); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 520, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":521 - * shape = self.field_shapes[self.field_names[i]] - * types.append(numpy_type) - * dtype_len.append(shape) # <<<<<<<<<<<<<< - * elif self._dataframe_result and field_length > 1: - * types.append('O') - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_dtype_len, __pyx_v_shape); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 521, __pyx_L1_error) - } - __pyx_L26:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":509 - * types.append('f8') - * dtype_len.append(field_length) - * elif field_length < 0 or pg_type == self._adapter.postgis_geometry_oid: # <<<<<<<<<<<<<< - * if (self.field_shapes is None or self.field_names[i] not in self.field_shapes or self._dataframe_result): - * types.append('O') - */ - goto __pyx_L7; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":522 - * types.append(numpy_type) - * dtype_len.append(shape) - * elif self._dataframe_result and field_length > 1: # <<<<<<<<<<<<<< - * types.append('O') - * dtype_len.append(1) - */ - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_self->_dataframe_result); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 522, __pyx_L1_error) - if (__pyx_t_8) { - } else { - __pyx_t_12 = __pyx_t_8; - goto __pyx_L30_bool_binop_done; - } - __pyx_t_8 = ((__pyx_v_field_length > 1) != 0); - __pyx_t_12 = __pyx_t_8; - __pyx_L30_bool_binop_done:; - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":523 - * dtype_len.append(shape) - * elif self._dataframe_result and field_length > 1: - * types.append('O') # <<<<<<<<<<<<<< - * dtype_len.append(1) - * else: - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_types, __pyx_n_s_O); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 523, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":524 - * elif self._dataframe_result and field_length > 1: - * types.append('O') - * dtype_len.append(1) # <<<<<<<<<<<<<< - * else: - * types.append(numpy_type) - */ - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_dtype_len, __pyx_int_1); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 524, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":522 - * types.append(numpy_type) - * dtype_len.append(shape) - * elif self._dataframe_result and field_length > 1: # <<<<<<<<<<<<<< - * types.append('O') - * dtype_len.append(1) - */ - goto __pyx_L7; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":526 - * dtype_len.append(1) - * else: - * types.append(numpy_type) # <<<<<<<<<<<<<< - * dtype_len.append(field_length) - * return types, dtype_len - */ - /*else*/ { - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_types, __pyx_v_numpy_type); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 526, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":527 - * else: - * types.append(numpy_type) - * dtype_len.append(field_length) # <<<<<<<<<<<<<< - * return types, dtype_len - * - */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_field_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 527, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_dtype_len, __pyx_t_3); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 527, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L7:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":480 - * types = [] - * dtype_len = [] - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * pg_type = get_field_type(self._adapter.result, i) - * field_length = get_field_length(self._adapter.result, i) - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":528 - * types.append(numpy_type) - * dtype_len.append(field_length) - * return types, dtype_len # <<<<<<<<<<<<<< - * - * def get_field_types(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_types); - __Pyx_GIVEREF(__pyx_v_types); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_types); - __Pyx_INCREF(__pyx_v_dtype_len); - __Pyx_GIVEREF(__pyx_v_dtype_len); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_dtype_len); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":470 - * field_names = property(get_field_names, set_field_names) - * - * def _get_default_types(self): # <<<<<<<<<<<<<< - * """ - * Get list of types based on types in database table/query. These will be - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter._get_default_types", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_types); - __Pyx_XDECREF(__pyx_v_dtype_len); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_gis_field_type); - __Pyx_XDECREF(__pyx_v_numpy_type); - __Pyx_XDECREF(__pyx_v_shape); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":530 - * return types, dtype_len - * - * def get_field_types(self): # <<<<<<<<<<<<<< - * """ - * Get field types in final array or dataframe - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15get_field_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_14get_field_types[] = "\n Get field types in final array or dataframe\n "; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15get_field_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_field_types (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_14get_field_types(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_14get_field_types(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self) { - PyObject *__pyx_v_default_types = NULL; - CYTHON_UNUSED PyObject *__pyx_v_dtype_len = NULL; - PyObject *__pyx_v_field_types = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_field_type = NULL; - 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)(PyObject *); - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - __Pyx_RefNannySetupContext("get_field_types", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":539 - * # need to recompute the field types list on the fly in the field types - * # getter, rather than compute once in the field types setter. - * self._check_connection() # <<<<<<<<<<<<<< - * default_types, dtype_len = self._get_default_types() - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":540 - * # getter, rather than compute once in the field types setter. - * self._check_connection() - * default_types, dtype_len = self._get_default_types() # <<<<<<<<<<<<<< - * - * field_types = [] - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_default_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 540, __pyx_L1_error) - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_3 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 540, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 540, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_v_default_types = __pyx_t_2; - __pyx_t_2 = 0; - __pyx_v_dtype_len = __pyx_t_3; - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":542 - * default_types, dtype_len = self._get_default_types() - * - * field_types = [] # <<<<<<<<<<<<<< - * for i, field_type in enumerate(self._field_types): - * if field_type is None: - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_field_types = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":543 - * - * field_types = [] - * for i, field_type in enumerate(self._field_types): # <<<<<<<<<<<<<< - * if field_type is None: - * field_types.append(default_types[i]) - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_1 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_self->_field_types)) || PyTuple_CheckExact(__pyx_v_self->_field_types)) { - __pyx_t_3 = __pyx_v_self->_field_types; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_self->_field_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 543, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 543, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 543, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_7(__pyx_t_3); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 543, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_field_type, __pyx_t_2); - __pyx_t_2 = 0; - __Pyx_INCREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":544 - * field_types = [] - * for i, field_type in enumerate(self._field_types): - * if field_type is None: # <<<<<<<<<<<<<< - * field_types.append(default_types[i]) - * else: - */ - __pyx_t_8 = (__pyx_v_field_type == Py_None); - __pyx_t_9 = (__pyx_t_8 != 0); - if (__pyx_t_9) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":545 - * for i, field_type in enumerate(self._field_types): - * if field_type is None: - * field_types.append(default_types[i]) # <<<<<<<<<<<<<< - * else: - * if field_type in ['U', 'S']: - */ - __pyx_t_2 = PyObject_GetItem(__pyx_v_default_types, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_field_types, __pyx_t_2); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":544 - * field_types = [] - * for i, field_type in enumerate(self._field_types): - * if field_type is None: # <<<<<<<<<<<<<< - * field_types.append(default_types[i]) - * else: - */ - goto __pyx_L7; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":547 - * field_types.append(default_types[i]) - * else: - * if field_type in ['U', 'S']: # <<<<<<<<<<<<<< - * field_types.append(field_type + str(get_field_length(self._adapter.result, i))) - * else: - */ - /*else*/ { - __Pyx_INCREF(__pyx_v_field_type); - __pyx_t_2 = __pyx_v_field_type; - __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_U, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 547, __pyx_L1_error) - if (!__pyx_t_8) { - } else { - __pyx_t_9 = __pyx_t_8; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_S, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 547, __pyx_L1_error) - __pyx_t_9 = __pyx_t_8; - __pyx_L9_bool_binop_done:; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_8 = (__pyx_t_9 != 0); - if (__pyx_t_8) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":548 - * else: - * if field_type in ['U', 'S']: - * field_types.append(field_type + str(get_field_length(self._adapter.result, i))) # <<<<<<<<<<<<<< - * else: - * field_types.append(field_type) - */ - __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 548, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_From_int(get_field_length(__pyx_v_self->_adapter->result, __pyx_t_11)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_v_field_type, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_field_types, __pyx_t_4); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":547 - * field_types.append(default_types[i]) - * else: - * if field_type in ['U', 'S']: # <<<<<<<<<<<<<< - * field_types.append(field_type + str(get_field_length(self._adapter.result, i))) - * else: - */ - goto __pyx_L8; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":550 - * field_types.append(field_type + str(get_field_length(self._adapter.result, i))) - * else: - * field_types.append(field_type) # <<<<<<<<<<<<<< - * return field_types - * - */ - /*else*/ { - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_field_types, __pyx_v_field_type); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 550, __pyx_L1_error) - } - __pyx_L8:; - } - __pyx_L7:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":543 - * - * field_types = [] - * for i, field_type in enumerate(self._field_types): # <<<<<<<<<<<<<< - * if field_type is None: - * field_types.append(default_types[i]) - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":551 - * else: - * field_types.append(field_type) - * return field_types # <<<<<<<<<<<<<< - * - * def set_field_types(self, types): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_field_types); - __pyx_r = __pyx_v_field_types; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":530 - * return types, dtype_len - * - * def get_field_types(self): # <<<<<<<<<<<<<< - * """ - * Get field types in final array or dataframe - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.get_field_types", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_default_types); - __Pyx_XDECREF(__pyx_v_dtype_len); - __Pyx_XDECREF(__pyx_v_field_types); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_field_type); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":553 - * return field_types - * - * def set_field_types(self, types): # <<<<<<<<<<<<<< - * """ - * Set types to assign to fields in final array or dataframe - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_17set_field_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_16set_field_types[] = "\n Set types to assign to fields in final array or dataframe\n Inputs:\n names: list of types to assign to fields in result, or dict mapping\n field number or name to field type. If types is a list, the\n length of list must match the number of fields in data set.\n If types is a dict, the field type from the database will be\n used if type is not specified in dict.\n "; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_17set_field_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_field_types (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_16set_field_types(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_types)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_16set_field_types(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_types) { - PyObject *__pyx_v_key = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_r = NULL; - __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; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *(*__pyx_t_11)(PyObject *); - __Pyx_RefNannySetupContext("set_field_types", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":563 - * used if type is not specified in dict. - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * - * self._field_types = [None] * self.num_fields - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":565 - * self._check_connection() - * - * self._field_types = [None] * self.num_fields # <<<<<<<<<<<<<< - * if types is not None and len(types) == 0: - * return - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyList_SET_ITEM(__pyx_t_2, 0, Py_None); - { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_temp); - __Pyx_DECREF(__pyx_t_2); - __pyx_t_2 = __pyx_temp; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->_field_types); - __Pyx_DECREF(__pyx_v_self->_field_types); - __pyx_v_self->_field_types = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":566 - * - * self._field_types = [None] * self.num_fields - * if types is not None and len(types) == 0: # <<<<<<<<<<<<<< - * return - * if types is None: - */ - __pyx_t_5 = (__pyx_v_types != Py_None); - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - } else { - __pyx_t_4 = __pyx_t_6; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_7 = PyObject_Length(__pyx_v_types); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 566, __pyx_L1_error) - __pyx_t_6 = ((__pyx_t_7 == 0) != 0); - __pyx_t_4 = __pyx_t_6; - __pyx_L4_bool_binop_done:; - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":567 - * self._field_types = [None] * self.num_fields - * if types is not None and len(types) == 0: - * return # <<<<<<<<<<<<<< - * if types is None: - * return - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":566 - * - * self._field_types = [None] * self.num_fields - * if types is not None and len(types) == 0: # <<<<<<<<<<<<<< - * return - * if types is None: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":568 - * if types is not None and len(types) == 0: - * return - * if types is None: # <<<<<<<<<<<<<< - * return - * - */ - __pyx_t_4 = (__pyx_v_types == Py_None); - __pyx_t_6 = (__pyx_t_4 != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":569 - * return - * if types is None: - * return # <<<<<<<<<<<<<< - * - * if isinstance(types, dict): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":568 - * if types is not None and len(types) == 0: - * return - * if types is None: # <<<<<<<<<<<<<< - * return - * - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":571 - * return - * - * if isinstance(types, dict): # <<<<<<<<<<<<<< - * for key, value in types.items(): - * if isinstance(key, (int, long)): - */ - __pyx_t_6 = PyDict_Check(__pyx_v_types); - __pyx_t_4 = (__pyx_t_6 != 0); - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":572 - * - * if isinstance(types, dict): - * for key, value in types.items(): # <<<<<<<<<<<<<< - * if isinstance(key, (int, long)): - * self._field_types[key] = value - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_types, __pyx_n_s_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_3) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 572, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 572, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 572, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 572, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_8(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 572, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { - PyObject* sequence = __pyx_t_2; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 572, __pyx_L1_error) - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); - __pyx_t_9 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_9); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L10_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 572, __pyx_L1_error) - __pyx_t_11 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L11_unpacking_done; - __pyx_L10_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 572, __pyx_L1_error) - __pyx_L11_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3); - __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9); - __pyx_t_9 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":573 - * if isinstance(types, dict): - * for key, value in types.items(): - * if isinstance(key, (int, long)): # <<<<<<<<<<<<<< - * self._field_types[key] = value - * elif key in self.field_names: - */ - __pyx_t_6 = PyInt_Check(__pyx_v_key); - __pyx_t_5 = (__pyx_t_6 != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L13_bool_binop_done; - } - __pyx_t_5 = PyLong_Check(__pyx_v_key); - __pyx_t_6 = (__pyx_t_5 != 0); - __pyx_t_4 = __pyx_t_6; - __pyx_L13_bool_binop_done:; - __pyx_t_6 = (__pyx_t_4 != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":574 - * for key, value in types.items(): - * if isinstance(key, (int, long)): - * self._field_types[key] = value # <<<<<<<<<<<<<< - * elif key in self.field_names: - * self._field_types[self.field_names.index(key)] = value - */ - if (unlikely(PyObject_SetItem(__pyx_v_self->_field_types, __pyx_v_key, __pyx_v_value) < 0)) __PYX_ERR(0, 574, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":573 - * if isinstance(types, dict): - * for key, value in types.items(): - * if isinstance(key, (int, long)): # <<<<<<<<<<<<<< - * self._field_types[key] = value - * elif key in self.field_names: - */ - goto __pyx_L12; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":575 - * if isinstance(key, (int, long)): - * self._field_types[key] = value - * elif key in self.field_names: # <<<<<<<<<<<<<< - * self._field_types[self.field_names.index(key)] = value - * else: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 575, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = (__pyx_t_6 != 0); - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":576 - * self._field_types[key] = value - * elif key in self.field_names: - * self._field_types[self.field_names.index(key)] = value # <<<<<<<<<<<<<< - * else: - * raise ValueError('Invalid field name "{0}"'.format(key)) - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_9) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_INCREF(__pyx_v_key); - __Pyx_GIVEREF(__pyx_v_key); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_key); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_self->_field_types, __pyx_t_2, __pyx_v_value) < 0)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":575 - * if isinstance(key, (int, long)): - * self._field_types[key] = value - * elif key in self.field_names: # <<<<<<<<<<<<<< - * self._field_types[self.field_names.index(key)] = value - * else: - */ - goto __pyx_L12; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":578 - * self._field_types[self.field_names.index(key)] = value - * else: - * raise ValueError('Invalid field name "{0}"'.format(key)) # <<<<<<<<<<<<<< - * else: -<<<<<<< HEAD - * if len(types) != self.num_***REMOVED*** -======= - * if len(types) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Invalid_field_name_0, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_10) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_INCREF(__pyx_v_key); - __Pyx_GIVEREF(__pyx_v_key); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_key); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__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_ERR(0, 578, __pyx_L1_error) - } - __pyx_L12:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":572 - * - * if isinstance(types, dict): - * for key, value in types.items(): # <<<<<<<<<<<<<< - * if isinstance(key, (int, long)): - * self._field_types[key] = value - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":571 - * return - * - * if isinstance(types, dict): # <<<<<<<<<<<<<< - * for key, value in types.items(): - * if isinstance(key, (int, long)): - */ - goto __pyx_L7; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":580 - * raise ValueError('Invalid field name "{0}"'.format(key)) - * else: -<<<<<<< HEAD - * if len(types) != self.num_***REMOVED*** # <<<<<<<<<<<<<< -======= - * if len(types) != self.num_fields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('length of types list does not match the number of fields') - * self._field_types = types - */ - /*else*/ { - __pyx_t_7 = PyObject_Length(__pyx_v_types); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 580, __pyx_L1_error) - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 580, __pyx_L1_error) - __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_ERR(0, 580, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":581 - * else: -<<<<<<< HEAD - * if len(types) != self.num_***REMOVED*** -======= - * if len(types) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('length of types list does not match the number of fields') # <<<<<<<<<<<<<< - * self._field_types = types - * - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __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_ERR(0, 581, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":580 - * raise ValueError('Invalid field name "{0}"'.format(key)) - * else: -<<<<<<< HEAD - * if len(types) != self.num_***REMOVED*** # <<<<<<<<<<<<<< -======= - * if len(types) != self.num_fields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('length of types list does not match the number of fields') - * self._field_types = types - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":582 -<<<<<<< HEAD - * if len(types) != self.num_***REMOVED*** -======= - * if len(types) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('length of types list does not match the number of fields') - * self._field_types = types # <<<<<<<<<<<<<< - * - * field_types = property(get_field_types, set_field_types) - */ - __Pyx_INCREF(__pyx_v_types); - __Pyx_GIVEREF(__pyx_v_types); - __Pyx_GOTREF(__pyx_v_self->_field_types); - __Pyx_DECREF(__pyx_v_self->_field_types); - __pyx_v_self->_field_types = __pyx_v_types; - } - __pyx_L7:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":553 - * return field_types - * - * def set_field_types(self, types): # <<<<<<<<<<<<<< - * """ - * Set types to assign to fields in final array or dataframe - */ - - /* function exit code */ - __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_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.set_field_types", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":586 - * field_types = property(get_field_types, set_field_types) - * - * def get_field_shapes(self): # <<<<<<<<<<<<<< - * """ - * Get field shapes for variable length fields. If a field does not have a - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_19get_field_shapes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_18get_field_shapes[] = "\n Get field shapes for variable length fields. If a field does not have a\n defined shape, then the field values will be stored in a list object.\n "; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_19get_field_shapes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_field_shapes (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_18get_field_shapes(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_18get_field_shapes(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self) { - PyObject *__pyx_v_field_shapes = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_shape = NULL; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_r = NULL; - __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; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("get_field_shapes", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":591 - * defined shape, then the field values will be stored in a list object. - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * if self._field_shapes is None: - * return self._field_shapes - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":592 - * """ - * self._check_connection() - * if self._field_shapes is None: # <<<<<<<<<<<<<< - * return self._field_shapes - * field_shapes = {} - */ - __pyx_t_4 = (__pyx_v_self->_field_shapes == Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":593 - * self._check_connection() - * if self._field_shapes is None: - * return self._field_shapes # <<<<<<<<<<<<<< - * field_shapes = {} - * for i, shape in enumerate(self._field_shapes): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_field_shapes); - __pyx_r = __pyx_v_self->_field_shapes; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":592 - * """ - * self._check_connection() - * if self._field_shapes is None: # <<<<<<<<<<<<<< - * return self._field_shapes - * field_shapes = {} - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":594 - * if self._field_shapes is None: - * return self._field_shapes - * field_shapes = {} # <<<<<<<<<<<<<< - * for i, shape in enumerate(self._field_shapes): - * if shape is not None: - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_field_shapes = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":595 - * return self._field_shapes - * field_shapes = {} - * for i, shape in enumerate(self._field_shapes): # <<<<<<<<<<<<<< - * if shape is not None: - * name = self.field_names[i] - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_1 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_self->_field_shapes)) || PyTuple_CheckExact(__pyx_v_self->_field_shapes)) { - __pyx_t_2 = __pyx_v_self->_field_shapes; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->_field_shapes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 595, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 595, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 595, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_7(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 595, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_shape, __pyx_t_3); - __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":596 - * field_shapes = {} - * for i, shape in enumerate(self._field_shapes): - * if shape is not None: # <<<<<<<<<<<<<< - * name = self.field_names[i] - * field_shapes[name] = shape - */ - __pyx_t_5 = (__pyx_v_shape != Py_None); - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":597 - * for i, shape in enumerate(self._field_shapes): - * if shape is not None: - * name = self.field_names[i] # <<<<<<<<<<<<<< - * field_shapes[name] = shape - * return field_shapes - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyObject_GetItem(__pyx_t_3, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 597, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_8); - __pyx_t_8 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":598 - * if shape is not None: - * name = self.field_names[i] - * field_shapes[name] = shape # <<<<<<<<<<<<<< - * return field_shapes - * - */ - if (unlikely(PyDict_SetItem(__pyx_v_field_shapes, __pyx_v_name, __pyx_v_shape) < 0)) __PYX_ERR(0, 598, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":596 - * field_shapes = {} - * for i, shape in enumerate(self._field_shapes): - * if shape is not None: # <<<<<<<<<<<<<< - * name = self.field_names[i] - * field_shapes[name] = shape - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":595 - * return self._field_shapes - * field_shapes = {} - * for i, shape in enumerate(self._field_shapes): # <<<<<<<<<<<<<< - * if shape is not None: - * name = self.field_names[i] - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":599 - * name = self.field_names[i] - * field_shapes[name] = shape - * return field_shapes # <<<<<<<<<<<<<< - * - * def set_field_shapes(self, shapes): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_field_shapes); - __pyx_r = __pyx_v_field_shapes; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":586 - * field_types = property(get_field_types, set_field_types) - * - * def get_field_shapes(self): # <<<<<<<<<<<<<< - * """ - * Get field shapes for variable length fields. If a field does not have a - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.get_field_shapes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_field_shapes); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_shape); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":601 - * return field_shapes - * - * def set_field_shapes(self, shapes): # <<<<<<<<<<<<<< - * """ - * Set field shapes. A value of None or zero for a field means that - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_21set_field_shapes(PyObject *__pyx_v_self, PyObject *__pyx_v_shapes); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_20set_field_shapes[] = "\n Set field shapes. A value of None or zero for a field means that\n an infinite length value will be allowed for field, and value will be\n stored in Python list object if field is postgresql geometry types, or\n WKT string objects if field is postgis type.\n Inputs:\n shapes: dict, mapping of field name or number to field shape\n "; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_21set_field_shapes(PyObject *__pyx_v_self, PyObject *__pyx_v_shapes) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_field_shapes (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_20set_field_shapes(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_shapes)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_20set_field_shapes(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_shapes) { - int __pyx_v_has_srid; - CYTHON_UNUSED PyObject *__pyx_v_new_shapes = NULL; - PyObject *__pyx_v_key = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_v_index = NULL; - PyObject *__pyx_v_x = NULL; - int __pyx_v_field_type; - char *__pyx_v_data; - uint32_t __pyx_v_gis_field_type; - int __pyx_v_gis_point_size; - 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_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *(*__pyx_t_11)(PyObject *); - Py_ssize_t __pyx_t_12; - PyObject *(*__pyx_t_13)(PyObject *); - int __pyx_t_14; - uint32_t __pyx_t_15; - int __pyx_t_16; - PyObject *__pyx_t_17 = NULL; - __Pyx_RefNannySetupContext("set_field_shapes", 0); - __Pyx_INCREF(__pyx_v_shapes); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":611 - * """ - * cdef int has_srid - * if self._dataframe_result: # <<<<<<<<<<<<<< - * raise RuntimeError('Field shape cannot be set when outputing to dataframe') - * self._check_connection() - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_dataframe_result); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 611, __pyx_L1_error) - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":612 - * cdef int has_srid - * if self._dataframe_result: - * raise RuntimeError('Field shape cannot be set when outputing to dataframe') # <<<<<<<<<<<<<< - * self._check_connection() - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __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_ERR(0, 612, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":611 - * """ - * cdef int has_srid - * if self._dataframe_result: # <<<<<<<<<<<<<< - * raise RuntimeError('Field shape cannot be set when outputing to dataframe') - * self._check_connection() - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":613 - * if self._dataframe_result: - * raise RuntimeError('Field shape cannot be set when outputing to dataframe') - * self._check_connection() # <<<<<<<<<<<<<< - * - * self._field_shapes = [None] * self.num_fields - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":615 - * self._check_connection() - * - * self._field_shapes = [None] * self.num_fields # <<<<<<<<<<<<<< - * if shapes is not None and len(shapes) == 0: - * return - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyList_SET_ITEM(__pyx_t_3, 0, Py_None); - { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_temp); - __Pyx_DECREF(__pyx_t_3); - __pyx_t_3 = __pyx_temp; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->_field_shapes); - __Pyx_DECREF(__pyx_v_self->_field_shapes); - __pyx_v_self->_field_shapes = __pyx_t_3; - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":616 - * - * self._field_shapes = [None] * self.num_fields - * if shapes is not None and len(shapes) == 0: # <<<<<<<<<<<<<< - * return - * if shapes is None: - */ - __pyx_t_5 = (__pyx_v_shapes != Py_None); - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - } else { - __pyx_t_1 = __pyx_t_6; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_7 = PyObject_Length(__pyx_v_shapes); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 616, __pyx_L1_error) - __pyx_t_6 = ((__pyx_t_7 == 0) != 0); - __pyx_t_1 = __pyx_t_6; - __pyx_L5_bool_binop_done:; - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":617 - * self._field_shapes = [None] * self.num_fields - * if shapes is not None and len(shapes) == 0: - * return # <<<<<<<<<<<<<< - * if shapes is None: - * return - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":616 - * - * self._field_shapes = [None] * self.num_fields - * if shapes is not None and len(shapes) == 0: # <<<<<<<<<<<<<< - * return - * if shapes is None: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":618 - * if shapes is not None and len(shapes) == 0: - * return - * if shapes is None: # <<<<<<<<<<<<<< - * return - * - */ - __pyx_t_1 = (__pyx_v_shapes == Py_None); - __pyx_t_6 = (__pyx_t_1 != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":619 - * return - * if shapes is None: - * return # <<<<<<<<<<<<<< - * - * # Convert list of shapes to dict with field number to shape mapping - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":618 - * if shapes is not None and len(shapes) == 0: - * return - * if shapes is None: # <<<<<<<<<<<<<< - * return - * - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":622 - * - * # Convert list of shapes to dict with field number to shape mapping - * new_shapes = {} # <<<<<<<<<<<<<< - * if not isinstance(shapes, dict): -<<<<<<< HEAD - * if len(shapes) != self.num_***REMOVED*** -======= - * if len(shapes) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - */ - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_new_shapes = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":623 - * # Convert list of shapes to dict with field number to shape mapping - * new_shapes = {} - * if not isinstance(shapes, dict): # <<<<<<<<<<<<<< -<<<<<<< HEAD - * if len(shapes) != self.num_***REMOVED*** -======= - * if len(shapes) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('number of shapes must equal number of fields') - */ - __pyx_t_6 = PyDict_Check(__pyx_v_shapes); - __pyx_t_1 = ((!(__pyx_t_6 != 0)) != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":624 - * new_shapes = {} - * if not isinstance(shapes, dict): -<<<<<<< HEAD - * if len(shapes) != self.num_***REMOVED*** # <<<<<<<<<<<<<< -======= - * if len(shapes) != self.num_fields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('number of shapes must equal number of fields') - * shapes = dict(zip(range(len(shapes)), shapes)) - */ - __pyx_t_7 = PyObject_Length(__pyx_v_shapes); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 624, __pyx_L1_error) - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":625 - * if not isinstance(shapes, dict): -<<<<<<< HEAD - * if len(shapes) != self.num_***REMOVED*** -======= - * if len(shapes) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('number of shapes must equal number of fields') # <<<<<<<<<<<<<< - * shapes = dict(zip(range(len(shapes)), shapes)) - * - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 625, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":624 - * new_shapes = {} - * if not isinstance(shapes, dict): -<<<<<<< HEAD - * if len(shapes) != self.num_***REMOVED*** # <<<<<<<<<<<<<< -======= - * if len(shapes) != self.num_fields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('number of shapes must equal number of fields') - * shapes = dict(zip(range(len(shapes)), shapes)) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":626 -<<<<<<< HEAD - * if len(shapes) != self.num_***REMOVED*** -======= - * if len(shapes) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('number of shapes must equal number of fields') - * shapes = dict(zip(range(len(shapes)), shapes)) # <<<<<<<<<<<<<< - * - * for key, value in shapes.items(): - */ - __pyx_t_7 = PyObject_Length(__pyx_v_shapes); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 626, __pyx_L1_error) - __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 626, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 626, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __Pyx_INCREF(__pyx_v_shapes); - __Pyx_GIVEREF(__pyx_v_shapes); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_shapes); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 626, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyDict_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_shapes, __pyx_t_4); - __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":623 - * # Convert list of shapes to dict with field number to shape mapping - * new_shapes = {} - * if not isinstance(shapes, dict): # <<<<<<<<<<<<<< -<<<<<<< HEAD - * if len(shapes) != self.num_***REMOVED*** -======= - * if len(shapes) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('number of shapes must equal number of fields') - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":628 - * shapes = dict(zip(range(len(shapes)), shapes)) - * - * for key, value in shapes.items(): # <<<<<<<<<<<<<< - * if value is not None: - * if isinstance(key, (int, long)): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_shapes, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 628, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 628, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 628, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_8(__pyx_t_2); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 628, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { - PyObject* sequence = __pyx_t_4; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 628, __pyx_L1_error) - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); - __pyx_t_9 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_9); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L12_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L12_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 628, __pyx_L1_error) - __pyx_t_11 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L13_unpacking_done; - __pyx_L12_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 628, __pyx_L1_error) - __pyx_L13_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3); - __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9); - __pyx_t_9 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":629 - * - * for key, value in shapes.items(): - * if value is not None: # <<<<<<<<<<<<<< - * if isinstance(key, (int, long)): - * index = key - */ - __pyx_t_1 = (__pyx_v_value != Py_None); - __pyx_t_6 = (__pyx_t_1 != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":630 - * for key, value in shapes.items(): - * if value is not None: - * if isinstance(key, (int, long)): # <<<<<<<<<<<<<< - * index = key - * elif key in self.field_names: - */ - __pyx_t_1 = PyInt_Check(__pyx_v_key); - __pyx_t_5 = (__pyx_t_1 != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_6 = __pyx_t_5; - goto __pyx_L16_bool_binop_done; - } - __pyx_t_5 = PyLong_Check(__pyx_v_key); - __pyx_t_1 = (__pyx_t_5 != 0); - __pyx_t_6 = __pyx_t_1; - __pyx_L16_bool_binop_done:; - __pyx_t_1 = (__pyx_t_6 != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":631 - * if value is not None: - * if isinstance(key, (int, long)): - * index = key # <<<<<<<<<<<<<< - * elif key in self.field_names: - * index = self.field_names.index(key) - */ - __Pyx_INCREF(__pyx_v_key); - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_v_key); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":630 - * for key, value in shapes.items(): - * if value is not None: - * if isinstance(key, (int, long)): # <<<<<<<<<<<<<< - * index = key - * elif key in self.field_names: - */ - goto __pyx_L15; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":632 - * if isinstance(key, (int, long)): - * index = key - * elif key in self.field_names: # <<<<<<<<<<<<<< - * index = self.field_names.index(key) - * else: - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_t_4, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 632, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = (__pyx_t_1 != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":633 - * index = key - * elif key in self.field_names: - * index = self.field_names.index(key) # <<<<<<<<<<<<<< - * else: - * raise ValueError('Invalid field name "{0}"'.format(key)) - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_9) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_INCREF(__pyx_v_key); - __Pyx_GIVEREF(__pyx_v_key); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_key); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_4); - __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":632 - * if isinstance(key, (int, long)): - * index = key - * elif key in self.field_names: # <<<<<<<<<<<<<< - * index = self.field_names.index(key) - * else: - */ - goto __pyx_L15; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":635 - * index = self.field_names.index(key) - * else: - * raise ValueError('Invalid field name "{0}"'.format(key)) # <<<<<<<<<<<<<< - * - * if isinstance(value, (int, long)): - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Invalid_field_name_0, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_10) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_INCREF(__pyx_v_key); - __Pyx_GIVEREF(__pyx_v_key); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_key); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 635, __pyx_L1_error) - } - __pyx_L15:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":637 - * raise ValueError('Invalid field name "{0}"'.format(key)) - * - * if isinstance(value, (int, long)): # <<<<<<<<<<<<<< - * if value < 1: - * raise ValueError('Field shape must be greater than 0') - */ - __pyx_t_1 = PyInt_Check(__pyx_v_value); - __pyx_t_5 = (__pyx_t_1 != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_6 = __pyx_t_5; - goto __pyx_L19_bool_binop_done; - } - __pyx_t_5 = PyLong_Check(__pyx_v_value); - __pyx_t_1 = (__pyx_t_5 != 0); - __pyx_t_6 = __pyx_t_1; - __pyx_L19_bool_binop_done:; - __pyx_t_1 = (__pyx_t_6 != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":638 - * - * if isinstance(value, (int, long)): - * if value < 1: # <<<<<<<<<<<<<< - * raise ValueError('Field shape must be greater than 0') - * elif isinstance(value, (list, tuple)): - */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 638, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":639 - * if isinstance(value, (int, long)): - * if value < 1: - * raise ValueError('Field shape must be greater than 0') # <<<<<<<<<<<<<< - * elif isinstance(value, (list, tuple)): - * for x in value: - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 639, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":638 - * - * if isinstance(value, (int, long)): - * if value < 1: # <<<<<<<<<<<<<< - * raise ValueError('Field shape must be greater than 0') - * elif isinstance(value, (list, tuple)): - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":637 - * raise ValueError('Invalid field name "{0}"'.format(key)) - * - * if isinstance(value, (int, long)): # <<<<<<<<<<<<<< - * if value < 1: - * raise ValueError('Field shape must be greater than 0') - */ - goto __pyx_L18; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":640 - * if value < 1: - * raise ValueError('Field shape must be greater than 0') - * elif isinstance(value, (list, tuple)): # <<<<<<<<<<<<<< - * for x in value: - * if x < 1: - */ - __pyx_t_6 = PyList_Check(__pyx_v_value); - __pyx_t_5 = (__pyx_t_6 != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L22_bool_binop_done; - } - __pyx_t_5 = PyTuple_Check(__pyx_v_value); - __pyx_t_6 = (__pyx_t_5 != 0); - __pyx_t_1 = __pyx_t_6; - __pyx_L22_bool_binop_done:; - __pyx_t_6 = (__pyx_t_1 != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":641 - * raise ValueError('Field shape must be greater than 0') - * elif isinstance(value, (list, tuple)): - * for x in value: # <<<<<<<<<<<<<< - * if x < 1: - * raise ValueError('Field shape values must be greater than 0') - */ - if (likely(PyList_CheckExact(__pyx_v_value)) || PyTuple_CheckExact(__pyx_v_value)) { - __pyx_t_4 = __pyx_v_value; __Pyx_INCREF(__pyx_t_4); __pyx_t_12 = 0; - __pyx_t_13 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 641, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_13 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 641, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_13)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 641, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 641, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_13(__pyx_t_4); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 641, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_3); - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":642 - * elif isinstance(value, (list, tuple)): - * for x in value: - * if x < 1: # <<<<<<<<<<<<<< - * raise ValueError('Field shape values must be greater than 0') - * else: - */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_x, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 642, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":643 - * for x in value: - * if x < 1: - * raise ValueError('Field shape values must be greater than 0') # <<<<<<<<<<<<<< - * else: - * raise ValueError('Field shape must be int, list, or tuple') - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __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_ERR(0, 643, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":642 - * elif isinstance(value, (list, tuple)): - * for x in value: - * if x < 1: # <<<<<<<<<<<<<< - * raise ValueError('Field shape values must be greater than 0') - * else: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":641 - * raise ValueError('Field shape must be greater than 0') - * elif isinstance(value, (list, tuple)): - * for x in value: # <<<<<<<<<<<<<< - * if x < 1: - * raise ValueError('Field shape values must be greater than 0') - */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":640 - * if value < 1: - * raise ValueError('Field shape must be greater than 0') - * elif isinstance(value, (list, tuple)): # <<<<<<<<<<<<<< - * for x in value: - * if x < 1: - */ - goto __pyx_L18; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":645 - * raise ValueError('Field shape values must be greater than 0') - * else: - * raise ValueError('Field shape must be int, list, or tuple') # <<<<<<<<<<<<<< - * - * # field shape for geometric types that contain points will always - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 645, __pyx_L1_error) - } - __pyx_L18:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":650 - * # have a fixed point size, so user only has to specify number of - * # points, lines, etc - * field_type = get_field_type(self._adapter.result, index) # <<<<<<<<<<<<<< - * if field_type in [PATHOID, POLYGONOID]: - * if not isinstance(value, int): - */ - __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_v_index); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 650, __pyx_L1_error) - __pyx_v_field_type = get_field_type(__pyx_v_self->_adapter->result, __pyx_t_14); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":651 - * # points, lines, etc - * field_type = get_field_type(self._adapter.result, index) - * if field_type in [PATHOID, POLYGONOID]: # <<<<<<<<<<<<<< - * if not isinstance(value, int): - * raise ValueError('Field shape for path or polygon must be int') - */ - __pyx_t_14 = __pyx_v_field_type; - __pyx_t_1 = ((__pyx_t_14 == PATHOID) != 0); - if (!__pyx_t_1) { - } else { - __pyx_t_6 = __pyx_t_1; - goto __pyx_L28_bool_binop_done; - } - __pyx_t_1 = ((__pyx_t_14 == POLYGONOID) != 0); - __pyx_t_6 = __pyx_t_1; - __pyx_L28_bool_binop_done:; - __pyx_t_1 = (__pyx_t_6 != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":652 - * field_type = get_field_type(self._adapter.result, index) - * if field_type in [PATHOID, POLYGONOID]: - * if not isinstance(value, int): # <<<<<<<<<<<<<< - * raise ValueError('Field shape for path or polygon must be int') - * self._field_shapes[index] = (value, 2) - */ - __pyx_t_1 = PyInt_Check(__pyx_v_value); - __pyx_t_6 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":653 - * if field_type in [PATHOID, POLYGONOID]: - * if not isinstance(value, int): - * raise ValueError('Field shape for path or polygon must be int') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value, 2) - * elif field_type == self._adapter.postgis_geometry_oid: - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 653, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 653, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":652 - * field_type = get_field_type(self._adapter.result, index) - * if field_type in [PATHOID, POLYGONOID]: - * if not isinstance(value, int): # <<<<<<<<<<<<<< - * raise ValueError('Field shape for path or polygon must be int') - * self._field_shapes[index] = (value, 2) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":654 - * if not isinstance(value, int): - * raise ValueError('Field shape for path or polygon must be int') - * self._field_shapes[index] = (value, 2) # <<<<<<<<<<<<<< - * elif field_type == self._adapter.postgis_geometry_oid: - * data = get_field_data(self._adapter.result, 0, index) - */ - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_value); - __Pyx_INCREF(__pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_2); - if (unlikely(PyObject_SetItem(__pyx_v_self->_field_shapes, __pyx_v_index, __pyx_t_4) < 0)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":651 - * # points, lines, etc - * field_type = get_field_type(self._adapter.result, index) - * if field_type in [PATHOID, POLYGONOID]: # <<<<<<<<<<<<<< - * if not isinstance(value, int): - * raise ValueError('Field shape for path or polygon must be int') - */ - goto __pyx_L27; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":655 - * raise ValueError('Field shape for path or polygon must be int') - * self._field_shapes[index] = (value, 2) - * elif field_type == self._adapter.postgis_geometry_oid: # <<<<<<<<<<<<<< - * data = get_field_data(self._adapter.result, 0, index) - * gis_field_type = get_gis_type(data, &has_srid) - */ - __pyx_t_6 = ((__pyx_v_field_type == __pyx_v_self->_adapter->postgis_geometry_oid) != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":656 - * self._field_shapes[index] = (value, 2) - * elif field_type == self._adapter.postgis_geometry_oid: - * data = get_field_data(self._adapter.result, 0, index) # <<<<<<<<<<<<<< - * gis_field_type = get_gis_type(data, &has_srid) - * gis_point_size = get_gis_point_size(gis_field_type) - */ - __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_v_index); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 656, __pyx_L1_error) - __pyx_v_data = get_field_data(__pyx_v_self->_adapter->result, 0, __pyx_t_14); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":657 - * elif field_type == self._adapter.postgis_geometry_oid: - * data = get_field_data(self._adapter.result, 0, index) - * gis_field_type = get_gis_type(data, &has_srid) # <<<<<<<<<<<<<< - * gis_point_size = get_gis_point_size(gis_field_type) - * if gis_point_size == -1: - */ - __pyx_v_gis_field_type = get_gis_type(__pyx_v_data, (&__pyx_v_has_srid)); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":658 - * data = get_field_data(self._adapter.result, 0, index) - * gis_field_type = get_gis_type(data, &has_srid) - * gis_point_size = get_gis_point_size(gis_field_type) # <<<<<<<<<<<<<< - * if gis_point_size == -1: - * raise ValueError('Unknown PostGIS point size') - */ - __pyx_v_gis_point_size = get_gis_point_size(__pyx_v_gis_field_type); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":659 - * gis_field_type = get_gis_type(data, &has_srid) - * gis_point_size = get_gis_point_size(gis_field_type) - * if gis_point_size == -1: # <<<<<<<<<<<<<< - * raise ValueError('Unknown PostGIS point size') - * if gis_field_type in [GIS_LINE2D, GIS_LINE3D, GIS_LINE4D]: - */ - __pyx_t_6 = ((__pyx_v_gis_point_size == -1L) != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":660 - * gis_point_size = get_gis_point_size(gis_field_type) - * if gis_point_size == -1: - * raise ValueError('Unknown PostGIS point size') # <<<<<<<<<<<<<< - * if gis_field_type in [GIS_LINE2D, GIS_LINE3D, GIS_LINE4D]: - * if not isinstance(value, int): - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 660, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":659 - * gis_field_type = get_gis_type(data, &has_srid) - * gis_point_size = get_gis_point_size(gis_field_type) - * if gis_point_size == -1: # <<<<<<<<<<<<<< - * raise ValueError('Unknown PostGIS point size') - * if gis_field_type in [GIS_LINE2D, GIS_LINE3D, GIS_LINE4D]: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":661 - * if gis_point_size == -1: - * raise ValueError('Unknown PostGIS point size') - * if gis_field_type in [GIS_LINE2D, GIS_LINE3D, GIS_LINE4D]: # <<<<<<<<<<<<<< - * if not isinstance(value, int): - * raise ValueError('Field shape for PostGIS line must be int') - */ - __pyx_t_15 = __pyx_v_gis_field_type; - __pyx_t_1 = ((__pyx_t_15 == GIS_LINE2D) != 0); - if (!__pyx_t_1) { - } else { - __pyx_t_6 = __pyx_t_1; - goto __pyx_L33_bool_binop_done; - } - __pyx_t_1 = ((__pyx_t_15 == GIS_LINE3D) != 0); - if (!__pyx_t_1) { - } else { - __pyx_t_6 = __pyx_t_1; - goto __pyx_L33_bool_binop_done; - } - __pyx_t_1 = ((__pyx_t_15 == GIS_LINE4D) != 0); - __pyx_t_6 = __pyx_t_1; - __pyx_L33_bool_binop_done:; - __pyx_t_1 = (__pyx_t_6 != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":662 - * raise ValueError('Unknown PostGIS point size') - * if gis_field_type in [GIS_LINE2D, GIS_LINE3D, GIS_LINE4D]: - * if not isinstance(value, int): # <<<<<<<<<<<<<< - * raise ValueError('Field shape for PostGIS line must be int') - * self._field_shapes[index] = (value, gis_point_size) - */ - __pyx_t_1 = PyInt_Check(__pyx_v_value); - __pyx_t_6 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":663 - * if gis_field_type in [GIS_LINE2D, GIS_LINE3D, GIS_LINE4D]: - * if not isinstance(value, int): - * raise ValueError('Field shape for PostGIS line must be int') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_POLYGON2D, GIS_POLYGON3D, GIS_POLYGON4D]: - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 663, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":662 - * raise ValueError('Unknown PostGIS point size') - * if gis_field_type in [GIS_LINE2D, GIS_LINE3D, GIS_LINE4D]: - * if not isinstance(value, int): # <<<<<<<<<<<<<< - * raise ValueError('Field shape for PostGIS line must be int') - * self._field_shapes[index] = (value, gis_point_size) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":664 - * if not isinstance(value, int): - * raise ValueError('Field shape for PostGIS line must be int') - * self._field_shapes[index] = (value, gis_point_size) # <<<<<<<<<<<<<< - * elif gis_field_type in [GIS_POLYGON2D, GIS_POLYGON3D, GIS_POLYGON4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 2: - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gis_point_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 664, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_value); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); - __pyx_t_4 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_self->_field_shapes, __pyx_v_index, __pyx_t_3) < 0)) __PYX_ERR(0, 664, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":661 - * if gis_point_size == -1: - * raise ValueError('Unknown PostGIS point size') - * if gis_field_type in [GIS_LINE2D, GIS_LINE3D, GIS_LINE4D]: # <<<<<<<<<<<<<< - * if not isinstance(value, int): - * raise ValueError('Field shape for PostGIS line must be int') - */ - goto __pyx_L32; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":665 - * raise ValueError('Field shape for PostGIS line must be int') - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_POLYGON2D, GIS_POLYGON3D, GIS_POLYGON4D]: # <<<<<<<<<<<<<< - * if not isinstance(value, (list, tuple)) or len(value) != 2: - * raise ValueError('Field shape for PostGIS polygon must have 2 dimensions') - */ - __pyx_t_15 = __pyx_v_gis_field_type; - __pyx_t_1 = ((__pyx_t_15 == GIS_POLYGON2D) != 0); - if (!__pyx_t_1) { - } else { - __pyx_t_6 = __pyx_t_1; - goto __pyx_L37_bool_binop_done; - } - __pyx_t_1 = ((__pyx_t_15 == GIS_POLYGON3D) != 0); - if (!__pyx_t_1) { - } else { - __pyx_t_6 = __pyx_t_1; - goto __pyx_L37_bool_binop_done; - } - __pyx_t_1 = ((__pyx_t_15 == GIS_POLYGON4D) != 0); - __pyx_t_6 = __pyx_t_1; - __pyx_L37_bool_binop_done:; - __pyx_t_1 = (__pyx_t_6 != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":666 - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_POLYGON2D, GIS_POLYGON3D, GIS_POLYGON4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 2: # <<<<<<<<<<<<<< - * raise ValueError('Field shape for PostGIS polygon must have 2 dimensions') - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - */ - __pyx_t_5 = PyList_Check(__pyx_v_value); - __pyx_t_16 = (__pyx_t_5 != 0); - if (!__pyx_t_16) { - } else { - __pyx_t_6 = __pyx_t_16; - goto __pyx_L43_bool_binop_done; - } - __pyx_t_16 = PyTuple_Check(__pyx_v_value); - __pyx_t_5 = (__pyx_t_16 != 0); - __pyx_t_6 = __pyx_t_5; - __pyx_L43_bool_binop_done:; - __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L41_bool_binop_done; - } - __pyx_t_12 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 666, __pyx_L1_error) - __pyx_t_5 = ((__pyx_t_12 != 2) != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L41_bool_binop_done:; - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":667 - * elif gis_field_type in [GIS_POLYGON2D, GIS_POLYGON3D, GIS_POLYGON4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 2: - * raise ValueError('Field shape for PostGIS polygon must have 2 dimensions') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOINT2D, GIS_MULTIPOINT3D, GIS_MULTIPOINT4D]: - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __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_ERR(0, 667, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":666 - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_POLYGON2D, GIS_POLYGON3D, GIS_POLYGON4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 2: # <<<<<<<<<<<<<< - * raise ValueError('Field shape for PostGIS polygon must have 2 dimensions') - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":668 - * if not isinstance(value, (list, tuple)) or len(value) != 2: - * raise ValueError('Field shape for PostGIS polygon must have 2 dimensions') - * self._field_shapes[index] = (value[0], value[1], gis_point_size) # <<<<<<<<<<<<<< - * elif gis_field_type in [GIS_MULTIPOINT2D, GIS_MULTIPOINT3D, GIS_MULTIPOINT4D]: - * if not isinstance(value, int): - */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_gis_point_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_9); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_9 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_self->_field_shapes, __pyx_v_index, __pyx_t_10) < 0)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":665 - * raise ValueError('Field shape for PostGIS line must be int') - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_POLYGON2D, GIS_POLYGON3D, GIS_POLYGON4D]: # <<<<<<<<<<<<<< - * if not isinstance(value, (list, tuple)) or len(value) != 2: - * raise ValueError('Field shape for PostGIS polygon must have 2 dimensions') - */ - goto __pyx_L32; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":669 - * raise ValueError('Field shape for PostGIS polygon must have 2 dimensions') - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOINT2D, GIS_MULTIPOINT3D, GIS_MULTIPOINT4D]: # <<<<<<<<<<<<<< - * if not isinstance(value, int): - * raise ValueError('Field shape for PostGIS multipoint must be int') - */ - __pyx_t_15 = __pyx_v_gis_field_type; - __pyx_t_5 = ((__pyx_t_15 == GIS_MULTIPOINT2D) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L45_bool_binop_done; - } - __pyx_t_5 = ((__pyx_t_15 == GIS_MULTIPOINT3D) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L45_bool_binop_done; - } - __pyx_t_5 = ((__pyx_t_15 == GIS_MULTIPOINT4D) != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L45_bool_binop_done:; - __pyx_t_5 = (__pyx_t_1 != 0); - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":670 - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOINT2D, GIS_MULTIPOINT3D, GIS_MULTIPOINT4D]: - * if not isinstance(value, int): # <<<<<<<<<<<<<< - * raise ValueError('Field shape for PostGIS multipoint must be int') - * self._field_shapes[index] = (value, gis_point_size) - */ - __pyx_t_5 = PyInt_Check(__pyx_v_value); - __pyx_t_1 = ((!(__pyx_t_5 != 0)) != 0); - if (__pyx_t_1) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":671 - * elif gis_field_type in [GIS_MULTIPOINT2D, GIS_MULTIPOINT3D, GIS_MULTIPOINT4D]: - * if not isinstance(value, int): - * raise ValueError('Field shape for PostGIS multipoint must be int') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_MULTILINE2D, GIS_MULTILINE3D, GIS_MULTILINE4D]: - */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 671, __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_ERR(0, 671, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":670 - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOINT2D, GIS_MULTIPOINT3D, GIS_MULTIPOINT4D]: - * if not isinstance(value, int): # <<<<<<<<<<<<<< - * raise ValueError('Field shape for PostGIS multipoint must be int') - * self._field_shapes[index] = (value, gis_point_size) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":672 - * if not isinstance(value, int): - * raise ValueError('Field shape for PostGIS multipoint must be int') - * self._field_shapes[index] = (value, gis_point_size) # <<<<<<<<<<<<<< - * elif gis_field_type in [GIS_MULTILINE2D, GIS_MULTILINE3D, GIS_MULTILINE4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 2: - */ - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_gis_point_size); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_value); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10); - __pyx_t_10 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_self->_field_shapes, __pyx_v_index, __pyx_t_9) < 0)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":669 - * raise ValueError('Field shape for PostGIS polygon must have 2 dimensions') - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOINT2D, GIS_MULTIPOINT3D, GIS_MULTIPOINT4D]: # <<<<<<<<<<<<<< - * if not isinstance(value, int): - * raise ValueError('Field shape for PostGIS multipoint must be int') - */ - goto __pyx_L32; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":673 - * raise ValueError('Field shape for PostGIS multipoint must be int') - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_MULTILINE2D, GIS_MULTILINE3D, GIS_MULTILINE4D]: # <<<<<<<<<<<<<< - * if not isinstance(value, (list, tuple)) or len(value) != 2: - * raise ValueError('Field shape for PostGIS multiline must have 2 dimensions') - */ - __pyx_t_15 = __pyx_v_gis_field_type; - __pyx_t_5 = ((__pyx_t_15 == GIS_MULTILINE2D) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L49_bool_binop_done; - } - __pyx_t_5 = ((__pyx_t_15 == GIS_MULTILINE3D) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L49_bool_binop_done; - } - __pyx_t_5 = ((__pyx_t_15 == GIS_MULTILINE4D) != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L49_bool_binop_done:; - __pyx_t_5 = (__pyx_t_1 != 0); - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":674 - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_MULTILINE2D, GIS_MULTILINE3D, GIS_MULTILINE4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 2: # <<<<<<<<<<<<<< - * raise ValueError('Field shape for PostGIS multiline must have 2 dimensions') - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - */ - __pyx_t_6 = PyList_Check(__pyx_v_value); - __pyx_t_16 = (__pyx_t_6 != 0); - if (!__pyx_t_16) { - } else { - __pyx_t_1 = __pyx_t_16; - goto __pyx_L55_bool_binop_done; - } - __pyx_t_16 = PyTuple_Check(__pyx_v_value); - __pyx_t_6 = (__pyx_t_16 != 0); - __pyx_t_1 = __pyx_t_6; - __pyx_L55_bool_binop_done:; - __pyx_t_6 = ((!(__pyx_t_1 != 0)) != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L53_bool_binop_done; - } - __pyx_t_12 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 674, __pyx_L1_error) - __pyx_t_6 = ((__pyx_t_12 != 2) != 0); - __pyx_t_5 = __pyx_t_6; - __pyx_L53_bool_binop_done:; - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":675 - * elif gis_field_type in [GIS_MULTILINE2D, GIS_MULTILINE3D, GIS_MULTILINE4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 2: - * raise ValueError('Field shape for PostGIS multiline must have 2 dimensions') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOLYGON2D, GIS_MULTIPOLYGON3D, GIS_MULTIPOLYGON4D]: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 675, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":674 - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_MULTILINE2D, GIS_MULTILINE3D, GIS_MULTILINE4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 2: # <<<<<<<<<<<<<< - * raise ValueError('Field shape for PostGIS multiline must have 2 dimensions') - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":676 - * if not isinstance(value, (list, tuple)) or len(value) != 2: - * raise ValueError('Field shape for PostGIS multiline must have 2 dimensions') - * self._field_shapes[index] = (value[0], value[1], gis_point_size) # <<<<<<<<<<<<<< - * elif gis_field_type in [GIS_MULTIPOLYGON2D, GIS_MULTIPOLYGON3D, GIS_MULTIPOLYGON4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 3: - */ - __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gis_point_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4); - __pyx_t_9 = 0; - __pyx_t_10 = 0; - __pyx_t_4 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_self->_field_shapes, __pyx_v_index, __pyx_t_3) < 0)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":673 - * raise ValueError('Field shape for PostGIS multipoint must be int') - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_MULTILINE2D, GIS_MULTILINE3D, GIS_MULTILINE4D]: # <<<<<<<<<<<<<< - * if not isinstance(value, (list, tuple)) or len(value) != 2: - * raise ValueError('Field shape for PostGIS multiline must have 2 dimensions') - */ - goto __pyx_L32; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":677 - * raise ValueError('Field shape for PostGIS multiline must have 2 dimensions') - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOLYGON2D, GIS_MULTIPOLYGON3D, GIS_MULTIPOLYGON4D]: # <<<<<<<<<<<<<< - * if not isinstance(value, (list, tuple)) or len(value) != 3: - * raise ValueError('Field shape for GIS multipolygon must have 3 dimensions') - */ - __pyx_t_15 = __pyx_v_gis_field_type; - __pyx_t_6 = ((__pyx_t_15 == GIS_MULTIPOLYGON2D) != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L57_bool_binop_done; - } - __pyx_t_6 = ((__pyx_t_15 == GIS_MULTIPOLYGON3D) != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_5 = __pyx_t_6; - goto __pyx_L57_bool_binop_done; - } - __pyx_t_6 = ((__pyx_t_15 == GIS_MULTIPOLYGON4D) != 0); - __pyx_t_5 = __pyx_t_6; - __pyx_L57_bool_binop_done:; - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":678 - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOLYGON2D, GIS_MULTIPOLYGON3D, GIS_MULTIPOLYGON4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 3: # <<<<<<<<<<<<<< - * raise ValueError('Field shape for GIS multipolygon must have 3 dimensions') - * self._field_shapes[index] = (value[0], value[1], value[2], gis_point_size) - */ - __pyx_t_1 = PyList_Check(__pyx_v_value); - __pyx_t_16 = (__pyx_t_1 != 0); - if (!__pyx_t_16) { - } else { - __pyx_t_5 = __pyx_t_16; - goto __pyx_L63_bool_binop_done; - } - __pyx_t_16 = PyTuple_Check(__pyx_v_value); - __pyx_t_1 = (__pyx_t_16 != 0); - __pyx_t_5 = __pyx_t_1; - __pyx_L63_bool_binop_done:; - __pyx_t_1 = ((!(__pyx_t_5 != 0)) != 0); - if (!__pyx_t_1) { - } else { - __pyx_t_6 = __pyx_t_1; - goto __pyx_L61_bool_binop_done; - } - __pyx_t_12 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 678, __pyx_L1_error) - __pyx_t_1 = ((__pyx_t_12 != 3) != 0); - __pyx_t_6 = __pyx_t_1; - __pyx_L61_bool_binop_done:; - if (__pyx_t_6) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":679 - * elif gis_field_type in [GIS_MULTIPOLYGON2D, GIS_MULTIPOLYGON3D, GIS_MULTIPOLYGON4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 3: - * raise ValueError('Field shape for GIS multipolygon must have 3 dimensions') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value[0], value[1], value[2], gis_point_size) - * else: - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 679, __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_ERR(0, 679, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":678 - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOLYGON2D, GIS_MULTIPOLYGON3D, GIS_MULTIPOLYGON4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 3: # <<<<<<<<<<<<<< - * raise ValueError('Field shape for GIS multipolygon must have 3 dimensions') - * self._field_shapes[index] = (value[0], value[1], value[2], gis_point_size) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":680 - * if not isinstance(value, (list, tuple)) or len(value) != 3: - * raise ValueError('Field shape for GIS multipolygon must have 3 dimensions') - * self._field_shapes[index] = (value[0], value[1], value[2], gis_point_size) # <<<<<<<<<<<<<< - * else: - * raise ValueError('Setting shape for field "{0}" not allowed.'.format(index)) - */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 680, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 680, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 680, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_gis_point_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 680, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_17 = PyTuple_New(4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 680, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_9); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_10 = 0; - __pyx_t_9 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_self->_field_shapes, __pyx_v_index, __pyx_t_17) < 0)) __PYX_ERR(0, 680, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":677 - * raise ValueError('Field shape for PostGIS multiline must have 2 dimensions') - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOLYGON2D, GIS_MULTIPOLYGON3D, GIS_MULTIPOLYGON4D]: # <<<<<<<<<<<<<< - * if not isinstance(value, (list, tuple)) or len(value) != 3: - * raise ValueError('Field shape for GIS multipolygon must have 3 dimensions') - */ - goto __pyx_L32; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":682 - * self._field_shapes[index] = (value[0], value[1], value[2], gis_point_size) - * else: - * raise ValueError('Setting shape for field "{0}" not allowed.'.format(index)) # <<<<<<<<<<<<<< - * else: - * raise ValueError('Setting shape for field "{0}" not allowed.'.format(index)) - */ - /*else*/ { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Setting_shape_for_field_0_not_al, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - if (!__pyx_t_10) { - __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_index); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); __pyx_t_10 = NULL; - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_index); - __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_17); - __pyx_t_17 = 0; - __pyx_t_17 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_Raise(__pyx_t_17, 0, 0, 0); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __PYX_ERR(0, 682, __pyx_L1_error) - } - __pyx_L32:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":655 - * raise ValueError('Field shape for path or polygon must be int') - * self._field_shapes[index] = (value, 2) - * elif field_type == self._adapter.postgis_geometry_oid: # <<<<<<<<<<<<<< - * data = get_field_data(self._adapter.result, 0, index) - * gis_field_type = get_gis_type(data, &has_srid) - */ - goto __pyx_L27; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":684 - * raise ValueError('Setting shape for field "{0}" not allowed.'.format(index)) - * else: - * raise ValueError('Setting shape for field "{0}" not allowed.'.format(index)) # <<<<<<<<<<<<<< - * - * field_shapes = property(get_field_shapes, set_field_shapes) - */ - /*else*/ { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Setting_shape_for_field_0_not_al, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - if (!__pyx_t_4) { - __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_index); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - } else { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_index); - __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_17); - __pyx_t_17 = 0; - __pyx_t_17 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_Raise(__pyx_t_17, 0, 0, 0); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __PYX_ERR(0, 684, __pyx_L1_error) - } - __pyx_L27:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":629 - * - * for key, value in shapes.items(): - * if value is not None: # <<<<<<<<<<<<<< - * if isinstance(key, (int, long)): - * index = key - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":628 - * shapes = dict(zip(range(len(shapes)), shapes)) - * - * for key, value in shapes.items(): # <<<<<<<<<<<<<< - * if value is not None: - * if isinstance(key, (int, long)): - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":601 - * return field_shapes - * - * def set_field_shapes(self, shapes): # <<<<<<<<<<<<<< - * """ - * Set field shapes. A value of None or zero for a field means that - */ - - /* function exit code */ - __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_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.set_field_shapes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_new_shapes); - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XDECREF(__pyx_v_x); - __Pyx_XDECREF(__pyx_v_shapes); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":688 - * field_shapes = property(get_field_shapes, set_field_shapes) - * - * def _parse_slice(self, start, stop, step): # <<<<<<<<<<<<<< - * """ - * Adjust stop slice parameter if needed, get number of records to read. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_23_parse_slice(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_22_parse_slice[] = "\n Adjust stop slice parameter if needed, get number of records to read.\n Stop is set to total number of records if None.\n Inputs:\n start: int, start record\n stop: int, stop record\n step: int, step value\n Outputs:\n Adjusted stop and number of records\n "; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_23_parse_slice(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_start = 0; - PyObject *__pyx_v_stop = 0; - PyObject *__pyx_v_step = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_parse_slice (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_step,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_parse_slice", 1, 3, 3, 1); __PYX_ERR(0, 688, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_parse_slice", 1, 3, 3, 2); __PYX_ERR(0, 688, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_parse_slice") < 0)) __PYX_ERR(0, 688, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_start = values[0]; - __pyx_v_stop = values[1]; - __pyx_v_step = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_parse_slice", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 688, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter._parse_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_22_parse_slice(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self), __pyx_v_start, __pyx_v_stop, __pyx_v_step); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_22_parse_slice(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_step) { - PyObject *__pyx_v_num_records = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - 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; - __Pyx_RefNannySetupContext("_parse_slice", 0); - __Pyx_INCREF(__pyx_v_stop); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":699 - * Adjusted stop and number of records - * """ - * if stop is None: # <<<<<<<<<<<<<< - * stop = self.num_records - * if step > 0: - */ - __pyx_t_1 = (__pyx_v_stop == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":700 - * """ - * if stop is None: - * stop = self.num_records # <<<<<<<<<<<<<< - * if step > 0: - * num_records = stop - start - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_3); - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":699 - * Adjusted stop and number of records - * """ - * if stop is None: # <<<<<<<<<<<<<< - * stop = self.num_records - * if step > 0: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":701 - * if stop is None: - * stop = self.num_records - * if step > 0: # <<<<<<<<<<<<<< - * num_records = stop - start - * else: - */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_step, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 701, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 701, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_2) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":702 - * stop = self.num_records - * if step > 0: - * num_records = stop - start # <<<<<<<<<<<<<< - * else: - * num_records = start - stop - */ - __pyx_t_3 = PyNumber_Subtract(__pyx_v_stop, __pyx_v_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 702, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_num_records = __pyx_t_3; - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":701 - * if stop is None: - * stop = self.num_records - * if step > 0: # <<<<<<<<<<<<<< - * num_records = stop - start - * else: - */ - goto __pyx_L4; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":704 - * num_records = stop - start - * else: - * num_records = start - stop # <<<<<<<<<<<<<< - * num_records = math.ceil(abs(num_records / step)) - * return stop, num_records - */ - /*else*/ { - __pyx_t_3 = PyNumber_Subtract(__pyx_v_start, __pyx_v_stop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 704, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_num_records = __pyx_t_3; - __pyx_t_3 = 0; - } - __pyx_L4:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":705 - * else: - * num_records = start - stop - * num_records = math.ceil(abs(num_records / step)) # <<<<<<<<<<<<<< - * return stop, num_records - * - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ceil); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_v_num_records, __pyx_v_step); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Absolute(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_num_records, __pyx_t_3); - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":706 - * num_records = start - stop - * num_records = math.ceil(abs(num_records / step)) - * return stop, num_records # <<<<<<<<<<<<<< - * - * def _to_array(self, start=0, stop=None, step=1): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 706, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_stop); - __Pyx_GIVEREF(__pyx_v_stop); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stop); - __Pyx_INCREF(__pyx_v_num_records); - __Pyx_GIVEREF(__pyx_v_num_records); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_num_records); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":688 - * field_shapes = property(get_field_shapes, set_field_shapes) - * - * def _parse_slice(self, start, stop, step): # <<<<<<<<<<<<<< - * """ - * Adjust stop slice parameter if needed, get number of records to read. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter._parse_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_num_records); - __Pyx_XDECREF(__pyx_v_stop); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":708 - * return stop, num_records - * - * def _to_array(self, start=0, stop=None, step=1): # <<<<<<<<<<<<<< - * """ - * Read records from table or custom query into NumPy record array, - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_25_to_array(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_24_to_array[] = "\n Read records from table or custom query into NumPy record array,\n and return array. Custom query takes precedent over table.\n Inputs:\n start: first record to read\n stop: last record to read. If None, read all records.\n step: number of records to skip between each read\n "; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_25_to_array(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_start = 0; - PyObject *__pyx_v_stop = 0; - PyObject *__pyx_v_step = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_to_array (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_step,0}; - PyObject* values[3] = {0,0,0}; - values[0] = ((PyObject *)__pyx_int_0); - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)__pyx_int_1); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_to_array") < 0)) __PYX_ERR(0, 708, __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); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_start = values[0]; - __pyx_v_stop = values[1]; - __pyx_v_step = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_to_array", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 708, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter._to_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_24_to_array(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self), __pyx_v_start, __pyx_v_stop, __pyx_v_step); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_24_to_array(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_step) { - PyArrayObject *__pyx_v_carray = 0; - PyArrayObject *__pyx_v_final_carray = 0; - char **__pyx_v_data_arrays; - int __pyx_v_num_records_found; - int __pyx_v_has_srid; - PyObject *__pyx_v_num_records = NULL; - PyObject *__pyx_v_default_types = NULL; - PyObject *__pyx_v_dtype_len = NULL; - int __pyx_v_cast_types; - PyObject *__pyx_v_dtype = NULL; - PyObject *__pyx_v_cast_dtype = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_dim = NULL; - PyObject *__pyx_v_size = NULL; - char *__pyx_v_data; - uint32_t __pyx_v_gis_field_type; - int __pyx_v_field_length; - AdapterError __pyx_v_result; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_type_ = 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 = NULL; - PyObject *(*__pyx_t_6)(PyObject *); - int __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - Py_ssize_t __pyx_t_13; - PyObject *(*__pyx_t_14)(PyObject *); - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - uint32_t __pyx_t_18; - int __pyx_t_19; - char *__pyx_t_20; - __Pyx_RefNannySetupContext("_to_array", 0); - __Pyx_INCREF(__pyx_v_stop); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":722 - * cdef int num_records_found - * cdef int has_srid - * self._check_connection() # <<<<<<<<<<<<<< - * - * stop, num_records = self._parse_slice(start, stop, step) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 722, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 722, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 722, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":724 - * self._check_connection() - * - * stop, num_records = self._parse_slice(start, stop, step) # <<<<<<<<<<<<<< - * - * # Check to see if we need to cast database values to user specified dtype. - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_parse_slice); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; - } - } - __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_start); - __Pyx_GIVEREF(__pyx_v_start); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_start); - __Pyx_INCREF(__pyx_v_stop); - __Pyx_GIVEREF(__pyx_v_stop); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_stop); - __Pyx_INCREF(__pyx_v_step); - __Pyx_GIVEREF(__pyx_v_step); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_step); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 724, __pyx_L1_error) - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_5 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 724, __pyx_L1_error) - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 724, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_v_num_records = __pyx_t_5; - __pyx_t_5 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":728 - * # Check to see if we need to cast database values to user specified dtype. - * # Default types are based on database table/query column types. - * default_types, dtype_len = self._get_default_types() # <<<<<<<<<<<<<< - * if default_types == self.field_types: - * cast_types = False - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_default_types); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 728, __pyx_L1_error) - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_2 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 728, __pyx_L1_error) - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 728, __pyx_L1_error) - __pyx_L6_unpacking_done:; - } - __pyx_v_default_types = __pyx_t_5; - __pyx_t_5 = 0; - __pyx_v_dtype_len = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":729 - * # Default types are based on database table/query column types. - * default_types, dtype_len = self._get_default_types() - * if default_types == self.field_types: # <<<<<<<<<<<<<< - * cast_types = False - * else: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_default_types, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_7) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":730 - * default_types, dtype_len = self._get_default_types() - * if default_types == self.field_types: - * cast_types = False # <<<<<<<<<<<<<< - * else: - * cast_types = True - */ - __pyx_v_cast_types = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":729 - * # Default types are based on database table/query column types. - * default_types, dtype_len = self._get_default_types() - * if default_types == self.field_types: # <<<<<<<<<<<<<< - * cast_types = False - * else: - */ - goto __pyx_L7; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":732 - * cast_types = False - * else: - * cast_types = True # <<<<<<<<<<<<<< - * - * dtype = numpy.dtype([(str(name), type_, size) for name, type_, size - */ - /*else*/ { - __pyx_v_cast_types = 1; - } - __pyx_L7:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":734 - * cast_types = True - * - * dtype = numpy.dtype([(str(name), type_, size) for name, type_, size # <<<<<<<<<<<<<< - * in zip(self.field_names, default_types, dtype_len)]) - * if cast_types: - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":735 - * - * dtype = numpy.dtype([(str(name), type_, size) for name, type_, size - * in zip(self.field_names, default_types, dtype_len)]) # <<<<<<<<<<<<<< - * if cast_types: - * cast_dtype = numpy.dtype([(str(name), type_, size) for name, type_, size - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_v_default_types); - __Pyx_GIVEREF(__pyx_v_default_types); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_default_types); - __Pyx_INCREF(__pyx_v_dtype_len); - __Pyx_GIVEREF(__pyx_v_dtype_len); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_dtype_len); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_4 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 735, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 735, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 735, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_5); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 735, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 734, __pyx_L1_error) - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); - __pyx_t_9 = PyList_GET_ITEM(sequence, 1); - __pyx_t_10 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_11)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_11); if (unlikely(!__pyx_t_3)) goto __pyx_L10_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_9 = __pyx_t_6(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 2; __pyx_t_10 = __pyx_t_6(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L10_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_11), 3) < 0) __PYX_ERR(0, 734, __pyx_L1_error) - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L11_unpacking_done; - __pyx_L10_unpacking_failed:; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 734, __pyx_L1_error) - __pyx_L11_unpacking_done:; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":734 - * cast_types = True - * - * dtype = numpy.dtype([(str(name), type_, size) for name, type_, size # <<<<<<<<<<<<<< - * in zip(self.field_names, default_types, dtype_len)]) - * if cast_types: - */ - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_3); - __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_type_, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_XDECREF_SET(__pyx_v_size, __pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name); - __pyx_t_10 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); - __Pyx_INCREF(__pyx_v_type_); - __Pyx_GIVEREF(__pyx_v_type_); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_type_); - __Pyx_INCREF(__pyx_v_size); - __Pyx_GIVEREF(__pyx_v_size); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_size); - __pyx_t_10 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_dtype = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":736 - * dtype = numpy.dtype([(str(name), type_, size) for name, type_, size - * in zip(self.field_names, default_types, dtype_len)]) - * if cast_types: # <<<<<<<<<<<<<< - * cast_dtype = numpy.dtype([(str(name), type_, size) for name, type_, size - * in zip(self.field_names, self.field_types, dtype_len)]) - */ - __pyx_t_7 = (__pyx_v_cast_types != 0); - if (__pyx_t_7) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":737 - * in zip(self.field_names, default_types, dtype_len)]) - * if cast_types: - * cast_dtype = numpy.dtype([(str(name), type_, size) for name, type_, size # <<<<<<<<<<<<<< - * in zip(self.field_names, self.field_types, dtype_len)]) - * - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":738 - * if cast_types: - * cast_dtype = numpy.dtype([(str(name), type_, size) for name, type_, size - * in zip(self.field_names, self.field_types, dtype_len)]) # <<<<<<<<<<<<<< - * - * for i in range(self.num_fields): - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); - __Pyx_INCREF(__pyx_v_dtype_len); - __Pyx_GIVEREF(__pyx_v_dtype_len); - PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_dtype_len); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10); __pyx_t_4 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 738, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_10))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 738, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 738, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_10); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 738, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 737, __pyx_L1_error) - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_9 = PyList_GET_ITEM(sequence, 1); - __pyx_t_3 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_11)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_6(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L15_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_9 = __pyx_t_6(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L15_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 2; __pyx_t_3 = __pyx_t_6(__pyx_t_11); if (unlikely(!__pyx_t_3)) goto __pyx_L15_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_11), 3) < 0) __PYX_ERR(0, 737, __pyx_L1_error) - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L16_unpacking_done; - __pyx_L15_unpacking_failed:; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 737, __pyx_L1_error) - __pyx_L16_unpacking_done:; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":737 - * in zip(self.field_names, default_types, dtype_len)]) - * if cast_types: - * cast_dtype = numpy.dtype([(str(name), type_, size) for name, type_, size # <<<<<<<<<<<<<< - * in zip(self.field_names, self.field_types, dtype_len)]) - * - */ - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_type_, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_XDECREF_SET(__pyx_v_size, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_v_type_); - __Pyx_GIVEREF(__pyx_v_type_); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_type_); - __Pyx_INCREF(__pyx_v_size); - __Pyx_GIVEREF(__pyx_v_size); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_size); - __pyx_t_3 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 737, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_cast_dtype = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":736 - * dtype = numpy.dtype([(str(name), type_, size) for name, type_, size - * in zip(self.field_names, default_types, dtype_len)]) - * if cast_types: # <<<<<<<<<<<<<< - * cast_dtype = numpy.dtype([(str(name), type_, size) for name, type_, size - * in zip(self.field_names, self.field_types, dtype_len)]) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":740 - * in zip(self.field_names, self.field_types, dtype_len)]) - * - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * if self._field_shapes[i] is not None: - * for dim, size in enumerate(self._field_shapes[i]): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 740, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_10 = __pyx_t_2; __Pyx_INCREF(__pyx_t_10); __pyx_t_4 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 740, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 740, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_10))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 740, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 740, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_8(__pyx_t_10); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 740, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":741 - * - * for i in range(self.num_fields): - * if self._field_shapes[i] is not None: # <<<<<<<<<<<<<< - * for dim, size in enumerate(self._field_shapes[i]): - * set_field_dim_size(self._adapter, i, dim, size) - */ - __pyx_t_2 = PyObject_GetItem(__pyx_v_self->_field_shapes, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = (__pyx_t_2 != Py_None); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_12 = (__pyx_t_7 != 0); - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":742 - * for i in range(self.num_fields): - * if self._field_shapes[i] is not None: - * for dim, size in enumerate(self._field_shapes[i]): # <<<<<<<<<<<<<< - * set_field_dim_size(self._adapter, i, dim, size) - * elif get_field_type(self._adapter.result, i) == self._adapter.postgis_geometry_oid: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_2 = __pyx_int_0; - __pyx_t_1 = PyObject_GetItem(__pyx_v_self->_field_shapes, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_13 = 0; - __pyx_t_14 = NULL; - } else { - __pyx_t_13 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_14 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 742, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 742, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 742, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_14(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 742, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_size, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_2); - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); - __pyx_t_2 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":743 - * if self._field_shapes[i] is not None: - * for dim, size in enumerate(self._field_shapes[i]): - * set_field_dim_size(self._adapter, i, dim, size) # <<<<<<<<<<<<<< - * elif get_field_type(self._adapter.result, i) == self._adapter.postgis_geometry_oid: - * data = get_field_data(self._adapter.result, 0, i) - */ - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L1_error) - __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_dim); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L1_error) - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L1_error) - set_field_dim_size(__pyx_v_self->_adapter, __pyx_t_15, __pyx_t_16, __pyx_t_17); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":742 - * for i in range(self.num_fields): - * if self._field_shapes[i] is not None: - * for dim, size in enumerate(self._field_shapes[i]): # <<<<<<<<<<<<<< - * set_field_dim_size(self._adapter, i, dim, size) - * elif get_field_type(self._adapter.result, i) == self._adapter.postgis_geometry_oid: - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":741 - * - * for i in range(self.num_fields): - * if self._field_shapes[i] is not None: # <<<<<<<<<<<<<< - * for dim, size in enumerate(self._field_shapes[i]): - * set_field_dim_size(self._adapter, i, dim, size) - */ - goto __pyx_L19; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":744 - * for dim, size in enumerate(self._field_shapes[i]): - * set_field_dim_size(self._adapter, i, dim, size) - * elif get_field_type(self._adapter.result, i) == self._adapter.postgis_geometry_oid: # <<<<<<<<<<<<<< - * data = get_field_data(self._adapter.result, 0, i) - * gis_field_type = get_gis_type(data, &has_srid) - */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 744, __pyx_L1_error) - __pyx_t_12 = ((get_field_type(__pyx_v_self->_adapter->result, __pyx_t_17) == __pyx_v_self->_adapter->postgis_geometry_oid) != 0); - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":745 - * set_field_dim_size(self._adapter, i, dim, size) - * elif get_field_type(self._adapter.result, i) == self._adapter.postgis_geometry_oid: - * data = get_field_data(self._adapter.result, 0, i) # <<<<<<<<<<<<<< - * gis_field_type = get_gis_type(data, &has_srid) - * if gis_field_type in [GIS_POINT2D, GIS_POINT3D, GIS_POINT4D] and default_types[i] == 'f8': - */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 745, __pyx_L1_error) - __pyx_v_data = get_field_data(__pyx_v_self->_adapter->result, 0, __pyx_t_17); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":746 - * elif get_field_type(self._adapter.result, i) == self._adapter.postgis_geometry_oid: - * data = get_field_data(self._adapter.result, 0, i) - * gis_field_type = get_gis_type(data, &has_srid) # <<<<<<<<<<<<<< - * if gis_field_type in [GIS_POINT2D, GIS_POINT3D, GIS_POINT4D] and default_types[i] == 'f8': - * field_length = get_field_length(self._adapter.result, i) - */ - __pyx_v_gis_field_type = get_gis_type(__pyx_v_data, (&__pyx_v_has_srid)); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":747 - * data = get_field_data(self._adapter.result, 0, i) - * gis_field_type = get_gis_type(data, &has_srid) - * if gis_field_type in [GIS_POINT2D, GIS_POINT3D, GIS_POINT4D] and default_types[i] == 'f8': # <<<<<<<<<<<<<< - * field_length = get_field_length(self._adapter.result, i) - * set_field_dim_size(self._adapter, i, 0, field_length) - */ - __pyx_t_18 = __pyx_v_gis_field_type; - __pyx_t_19 = ((__pyx_t_18 == GIS_POINT2D) != 0); - if (!__pyx_t_19) { - } else { - __pyx_t_7 = __pyx_t_19; - goto __pyx_L25_bool_binop_done; - } - __pyx_t_19 = ((__pyx_t_18 == GIS_POINT3D) != 0); - if (!__pyx_t_19) { - } else { - __pyx_t_7 = __pyx_t_19; - goto __pyx_L25_bool_binop_done; - } - __pyx_t_19 = ((__pyx_t_18 == GIS_POINT4D) != 0); - __pyx_t_7 = __pyx_t_19; - __pyx_L25_bool_binop_done:; - __pyx_t_19 = (__pyx_t_7 != 0); - if (__pyx_t_19) { - } else { - __pyx_t_12 = __pyx_t_19; - goto __pyx_L23_bool_binop_done; - } - __pyx_t_2 = PyObject_GetItem(__pyx_v_default_types, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_19 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_f8, Py_EQ)); if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 747, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_12 = __pyx_t_19; - __pyx_L23_bool_binop_done:; - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":748 - * gis_field_type = get_gis_type(data, &has_srid) - * if gis_field_type in [GIS_POINT2D, GIS_POINT3D, GIS_POINT4D] and default_types[i] == 'f8': - * field_length = get_field_length(self._adapter.result, i) # <<<<<<<<<<<<<< - * set_field_dim_size(self._adapter, i, 0, field_length) - * else: - */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 748, __pyx_L1_error) - __pyx_v_field_length = get_field_length(__pyx_v_self->_adapter->result, __pyx_t_17); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":749 - * if gis_field_type in [GIS_POINT2D, GIS_POINT3D, GIS_POINT4D] and default_types[i] == 'f8': - * field_length = get_field_length(self._adapter.result, i) - * set_field_dim_size(self._adapter, i, 0, field_length) # <<<<<<<<<<<<<< - * else: - * clear_field_size(self._adapter, i) - */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 749, __pyx_L1_error) - set_field_dim_size(__pyx_v_self->_adapter, __pyx_t_17, 0, __pyx_v_field_length); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":747 - * data = get_field_data(self._adapter.result, 0, i) - * gis_field_type = get_gis_type(data, &has_srid) - * if gis_field_type in [GIS_POINT2D, GIS_POINT3D, GIS_POINT4D] and default_types[i] == 'f8': # <<<<<<<<<<<<<< - * field_length = get_field_length(self._adapter.result, i) - * set_field_dim_size(self._adapter, i, 0, field_length) - */ - goto __pyx_L22; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":751 - * set_field_dim_size(self._adapter, i, 0, field_length) - * else: - * clear_field_size(self._adapter, i) # <<<<<<<<<<<<<< - * else: - * clear_field_size(self._adapter, i) - */ - /*else*/ { - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 751, __pyx_L1_error) - clear_field_size(__pyx_v_self->_adapter, __pyx_t_17); - } - __pyx_L22:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":744 - * for dim, size in enumerate(self._field_shapes[i]): - * set_field_dim_size(self._adapter, i, dim, size) - * elif get_field_type(self._adapter.result, i) == self._adapter.postgis_geometry_oid: # <<<<<<<<<<<<<< - * data = get_field_data(self._adapter.result, 0, i) - * gis_field_type = get_gis_type(data, &has_srid) - */ - goto __pyx_L19; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":753 - * clear_field_size(self._adapter, i) - * else: - * clear_field_size(self._adapter, i) # <<<<<<<<<<<<<< - * - * if ((step > 0 and start >= stop) - */ - /*else*/ { - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 753, __pyx_L1_error) - clear_field_size(__pyx_v_self->_adapter, __pyx_t_17); - } - __pyx_L19:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":740 - * in zip(self.field_names, self.field_types, dtype_len)]) - * - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * if self._field_shapes[i] is not None: - * for dim, size in enumerate(self._field_shapes[i]): - */ - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":755 - * clear_field_size(self._adapter, i) - * - * if ((step > 0 and start >= stop) # <<<<<<<<<<<<<< - * or (step < 0 and start <= stop)): - * if cast_types: - */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_step, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 755, __pyx_L1_error) - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (!__pyx_t_19) { - goto __pyx_L30_next_or; - } else { - } - __pyx_t_10 = PyObject_RichCompare(__pyx_v_start, __pyx_v_stop, Py_GE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 755, __pyx_L1_error) - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (!__pyx_t_19) { - } else { - __pyx_t_12 = __pyx_t_19; - goto __pyx_L29_bool_binop_done; - } - __pyx_L30_next_or:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":756 - * - * if ((step > 0 and start >= stop) - * or (step < 0 and start <= stop)): # <<<<<<<<<<<<<< - * if cast_types: - * return numpy.array([], dtype=cast_dtype) - */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_step, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 756, __pyx_L1_error) - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_19) { - } else { - __pyx_t_12 = __pyx_t_19; - goto __pyx_L29_bool_binop_done; - } - __pyx_t_10 = PyObject_RichCompare(__pyx_v_start, __pyx_v_stop, Py_LE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 756, __pyx_L1_error) - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_12 = __pyx_t_19; - __pyx_L29_bool_binop_done:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":755 - * clear_field_size(self._adapter, i) - * - * if ((step > 0 and start >= stop) # <<<<<<<<<<<<<< - * or (step < 0 and start <= stop)): - * if cast_types: - */ - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":757 - * if ((step > 0 and start >= stop) - * or (step < 0 and start <= stop)): - * if cast_types: # <<<<<<<<<<<<<< - * return numpy.array([], dtype=cast_dtype) - * else: - */ - __pyx_t_12 = (__pyx_v_cast_types != 0); - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":758 - * or (step < 0 and start <= stop)): - * if cast_types: - * return numpy.array([], dtype=cast_dtype) # <<<<<<<<<<<<<< - * else: - * return numpy.array([], dtype=dtype) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (unlikely(!__pyx_v_cast_dtype)) { __Pyx_RaiseUnboundLocalError("cast_dtype"); __PYX_ERR(0, 758, __pyx_L1_error) } - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_v_cast_dtype) < 0) __PYX_ERR(0, 758, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":757 - * if ((step > 0 and start >= stop) - * or (step < 0 and start <= stop)): - * if cast_types: # <<<<<<<<<<<<<< - * return numpy.array([], dtype=cast_dtype) - * else: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":760 - * return numpy.array([], dtype=cast_dtype) - * else: - * return numpy.array([], dtype=dtype) # <<<<<<<<<<<<<< - * - * # Allocate and prepare result array. An array of data pointers needs to - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 760, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 760, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_dtype) < 0) __PYX_ERR(0, 760, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 760, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":755 - * clear_field_size(self._adapter, i) - * - * if ((step > 0 and start >= stop) # <<<<<<<<<<<<<< - * or (step < 0 and start <= stop)): - * if cast_types: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":772 - * # correct cast under the hood. This isn't super fast, but it's easy - * # and will ensure casting follows numpy casting - * data_arrays = calloc(1, sizeof(char*)) # <<<<<<<<<<<<<< - * if cast_types: - * carray = numpy.ndarray(CAST_BUFFER_SIZE, numpy.dtype(dtype)) - */ - __pyx_v_data_arrays = ((char **)calloc(1, (sizeof(char *)))); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":773 - * # and will ensure casting follows numpy casting - * data_arrays = calloc(1, sizeof(char*)) - * if cast_types: # <<<<<<<<<<<<<< - * carray = numpy.ndarray(CAST_BUFFER_SIZE, numpy.dtype(dtype)) - * final_carray = numpy.ndarray(num_records, numpy.dtype(cast_dtype)) - */ - __pyx_t_12 = (__pyx_v_cast_types != 0); - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":774 - * data_arrays = calloc(1, sizeof(char*)) - * if cast_types: - * carray = numpy.ndarray(CAST_BUFFER_SIZE, numpy.dtype(dtype)) # <<<<<<<<<<<<<< - * final_carray = numpy.ndarray(num_records, numpy.dtype(cast_dtype)) - * data_arrays[0] = carray.data - */ - __pyx_t_2 = __Pyx_PyInt_From_int(CAST_BUFFER_SIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dtype); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_carray = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":775 - * if cast_types: - * carray = numpy.ndarray(CAST_BUFFER_SIZE, numpy.dtype(dtype)) - * final_carray = numpy.ndarray(num_records, numpy.dtype(cast_dtype)) # <<<<<<<<<<<<<< - * data_arrays[0] = carray.data - * result = read_records(self._adapter, start, stop, step, data_arrays, - */ - if (unlikely(!__pyx_v_cast_dtype)) { __Pyx_RaiseUnboundLocalError("cast_dtype"); __PYX_ERR(0, 775, __pyx_L1_error) } - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_cast_dtype); - __Pyx_GIVEREF(__pyx_v_cast_dtype); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_cast_dtype); - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_num_records); - __Pyx_GIVEREF(__pyx_v_num_records); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_num_records); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_final_carray = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":776 - * carray = numpy.ndarray(CAST_BUFFER_SIZE, numpy.dtype(dtype)) - * final_carray = numpy.ndarray(num_records, numpy.dtype(cast_dtype)) - * data_arrays[0] = carray.data # <<<<<<<<<<<<<< - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 1, carray, final_carray, 0) - */ - __pyx_t_20 = __pyx_v_carray->data; - (__pyx_v_data_arrays[0]) = __pyx_t_20; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":777 - * final_carray = numpy.ndarray(num_records, numpy.dtype(cast_dtype)) - * data_arrays[0] = carray.data - * result = read_records(self._adapter, start, stop, step, data_arrays, # <<<<<<<<<<<<<< - * &num_records_found, 1, carray, final_carray, 0) - * free(data_arrays) - */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L1_error) - __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_stop); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L1_error) - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_step); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":778 - * data_arrays[0] = carray.data - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 1, carray, final_carray, 0) # <<<<<<<<<<<<<< - * free(data_arrays) - * if result != ADAPTER_SUCCESS: - */ - __pyx_v_result = read_records(__pyx_v_self->_adapter, __pyx_t_17, __pyx_t_16, __pyx_t_15, __pyx_v_data_arrays, (&__pyx_v_num_records_found), 1, ((void *)__pyx_v_carray), ((void *)__pyx_v_final_carray), 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":779 - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 1, carray, final_carray, 0) - * free(data_arrays) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] - */ - free(__pyx_v_data_arrays); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":780 - * &num_records_found, 1, carray, final_carray, 0) - * free(data_arrays) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * raise exceptions[result] - * return numpy.asarray(final_carray) - */ - __pyx_t_12 = ((__pyx_v_result != ADAPTER_SUCCESS) != 0); - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":781 - * free(data_arrays) - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] # <<<<<<<<<<<<<< - * return numpy.asarray(final_carray) - * else: - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__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_ERR(0, 781, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":780 - * &num_records_found, 1, carray, final_carray, 0) - * free(data_arrays) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * raise exceptions[result] - * return numpy.asarray(final_carray) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":782 - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] - * return numpy.asarray(final_carray) # <<<<<<<<<<<<<< - * else: - * carray = numpy.ndarray(num_records, dtype) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 782, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_3) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)__pyx_v_final_carray)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 782, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_final_carray)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_final_carray)); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, ((PyObject *)__pyx_v_final_carray)); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":773 - * # and will ensure casting follows numpy casting - * data_arrays = calloc(1, sizeof(char*)) - * if cast_types: # <<<<<<<<<<<<<< - * carray = numpy.ndarray(CAST_BUFFER_SIZE, numpy.dtype(dtype)) - * final_carray = numpy.ndarray(num_records, numpy.dtype(cast_dtype)) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":784 - * return numpy.asarray(final_carray) - * else: - * carray = numpy.ndarray(num_records, dtype) # <<<<<<<<<<<<<< - * data_arrays[0] = carray.data - * result = read_records(self._adapter, start, stop, step, data_arrays, - */ - /*else*/ { - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_num_records); - __Pyx_GIVEREF(__pyx_v_num_records); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_num_records); - __Pyx_INCREF(__pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_dtype); - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_carray = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":785 - * else: - * carray = numpy.ndarray(num_records, dtype) - * data_arrays[0] = carray.data # <<<<<<<<<<<<<< - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 0, NULL, NULL, 0) - */ - __pyx_t_20 = __pyx_v_carray->data; - (__pyx_v_data_arrays[0]) = __pyx_t_20; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":786 - * carray = numpy.ndarray(num_records, dtype) - * data_arrays[0] = carray.data - * result = read_records(self._adapter, start, stop, step, data_arrays, # <<<<<<<<<<<<<< - * &num_records_found, 0, NULL, NULL, 0) - * free(data_arrays) - */ - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 786, __pyx_L1_error) - __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_stop); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 786, __pyx_L1_error) - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_step); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 786, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":787 - * data_arrays[0] = carray.data - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 0, NULL, NULL, 0) # <<<<<<<<<<<<<< - * free(data_arrays) - * if result != ADAPTER_SUCCESS: - */ - __pyx_v_result = read_records(__pyx_v_self->_adapter, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_v_data_arrays, (&__pyx_v_num_records_found), 0, NULL, NULL, 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":788 - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 0, NULL, NULL, 0) - * free(data_arrays) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] - */ - free(__pyx_v_data_arrays); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":789 - * &num_records_found, 0, NULL, NULL, 0) - * free(data_arrays) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * raise exceptions[result] - * return numpy.asarray(carray) - */ - __pyx_t_12 = ((__pyx_v_result != ADAPTER_SUCCESS) != 0); - if (__pyx_t_12) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":790 - * free(data_arrays) - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] # <<<<<<<<<<<<<< - * return numpy.asarray(carray) - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 790, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 790, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 790, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(0, 790, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":789 - * &num_records_found, 0, NULL, NULL, 0) - * free(data_arrays) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * raise exceptions[result] - * return numpy.asarray(carray) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":791 - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] - * return numpy.asarray(carray) # <<<<<<<<<<<<<< - * - * def _to_dataframe(self, start=0, stop=None, step=1): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 791, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_2) { - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)__pyx_v_carray)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 791, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - } else { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_carray)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_carray)); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_carray)); - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 791, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_10; - __pyx_t_10 = 0; - goto __pyx_L0; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":708 - * return stop, num_records - * - * def _to_array(self, start=0, stop=None, step=1): # <<<<<<<<<<<<<< - * """ - * Read records from table or custom query into NumPy record array, - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter._to_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_carray); - __Pyx_XDECREF((PyObject *)__pyx_v_final_carray); - __Pyx_XDECREF(__pyx_v_num_records); - __Pyx_XDECREF(__pyx_v_default_types); - __Pyx_XDECREF(__pyx_v_dtype_len); - __Pyx_XDECREF(__pyx_v_dtype); - __Pyx_XDECREF(__pyx_v_cast_dtype); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_dim); - __Pyx_XDECREF(__pyx_v_size); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_type_); - __Pyx_XDECREF(__pyx_v_stop); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":793 - * return numpy.asarray(carray) - * - * def _to_dataframe(self, start=0, stop=None, step=1): # <<<<<<<<<<<<<< - * """ - * Read records from table or custom query into Pandas dataframe. - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_27_to_dataframe(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_26_to_dataframe[] = "\n Read records from table or custom query into Pandas dataframe.\n and return dataframe. Custom query takes precedent over table.\n Inputs:\n start: first record to read\n stop: last record to read. If None, read all records.\n step: number of records to skip between each read\n "; -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_27_to_dataframe(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_start = 0; - PyObject *__pyx_v_stop = 0; - PyObject *__pyx_v_step = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_to_dataframe (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_step,0}; - PyObject* values[3] = {0,0,0}; - values[0] = ((PyObject *)__pyx_int_0); - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)__pyx_int_1); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_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 (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_to_dataframe") < 0)) __PYX_ERR(0, 793, __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); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_start = values[0]; - __pyx_v_stop = values[1]; - __pyx_v_step = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_to_dataframe", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 793, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter._to_dataframe", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_26_to_dataframe(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self), __pyx_v_start, __pyx_v_stop, __pyx_v_step); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_26_to_dataframe(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_step) { - char **__pyx_v_data_arrays; - PyArrayObject *__pyx_v_temp_array = 0; - int __pyx_v_num_records_found; - PyObject *__pyx_v_num_records = NULL; - PyObject *__pyx_v_default_types = NULL; - CYTHON_UNUSED PyObject *__pyx_v_dtype_len = NULL; - int __pyx_v_cast_types; - PyObject *__pyx_v_data = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_dtype = NULL; - PyObject *__pyx_v_final_data = NULL; - PyObject *__pyx_v_df_result = NULL; - PyObject *__pyx_v_final_df_result = NULL; - AdapterError __pyx_v_result; - 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 = NULL; - PyObject *(*__pyx_t_6)(PyObject *); - int __pyx_t_7; - int __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); - PyObject *__pyx_t_10 = NULL; - size_t __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - char *__pyx_t_13; - Py_ssize_t __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - __Pyx_RefNannySetupContext("_to_dataframe", 0); - __Pyx_INCREF(__pyx_v_stop); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":805 - * cdef numpy.ndarray temp_array - * cdef int num_records_found - * self._check_connection() # <<<<<<<<<<<<<< - * - * stop, num_records = self._parse_slice(start, stop, step) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":807 - * self._check_connection() - * - * stop, num_records = self._parse_slice(start, stop, step) # <<<<<<<<<<<<<< - * - * # Check to see if we need to cast database values to user specified dtype. - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_parse_slice); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; - } - } - __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 807, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_start); - __Pyx_GIVEREF(__pyx_v_start); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_start); - __Pyx_INCREF(__pyx_v_stop); - __Pyx_GIVEREF(__pyx_v_stop); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_stop); - __Pyx_INCREF(__pyx_v_step); - __Pyx_GIVEREF(__pyx_v_step); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_step); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 807, __pyx_L1_error) - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_5 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 807, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 807, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 807, __pyx_L1_error) - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 807, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_v_num_records = __pyx_t_5; - __pyx_t_5 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":811 - * # Check to see if we need to cast database values to user specified dtype. - * # Default types are based on database table/query column types. - * default_types, dtype_len = self._get_default_types() # <<<<<<<<<<<<<< - * if default_types == self.field_types: - * cast_types = False - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_default_types); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 811, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 811, __pyx_L1_error) - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_2 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 811, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 811, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 811, __pyx_L1_error) - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 811, __pyx_L1_error) - __pyx_L6_unpacking_done:; - } - __pyx_v_default_types = __pyx_t_5; - __pyx_t_5 = 0; - __pyx_v_dtype_len = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":812 - * # Default types are based on database table/query column types. - * default_types, dtype_len = self._get_default_types() - * if default_types == self.field_types: # <<<<<<<<<<<<<< - * cast_types = False - * else: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_default_types, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 812, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 812, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_7) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":813 - * default_types, dtype_len = self._get_default_types() - * if default_types == self.field_types: - * cast_types = False # <<<<<<<<<<<<<< - * else: - * cast_types = True - */ - __pyx_v_cast_types = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":812 - * # Default types are based on database table/query column types. - * default_types, dtype_len = self._get_default_types() - * if default_types == self.field_types: # <<<<<<<<<<<<<< - * cast_types = False - * else: - */ - goto __pyx_L7; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":815 - * cast_types = False - * else: - * cast_types = True # <<<<<<<<<<<<<< - * - * if ((step > 0 and start >= stop) - */ - /*else*/ { - __pyx_v_cast_types = 1; - } - __pyx_L7:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":817 - * cast_types = True - * - * if ((step > 0 and start >= stop) # <<<<<<<<<<<<<< - * or (step < 0 and start <= stop)): - * data = OrderedDict() - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_step, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 817, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 817, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!__pyx_t_8) { - goto __pyx_L10_next_or; - } else { - } - __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_v_stop, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 817, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 817, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L9_bool_binop_done; - } - __pyx_L10_next_or:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":818 - * - * if ((step > 0 and start >= stop) - * or (step < 0 and start <= stop)): # <<<<<<<<<<<<<< - * data = OrderedDict() - * if cast_types: - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_step, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_v_stop, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __pyx_t_8; - __pyx_L9_bool_binop_done:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":817 - * cast_types = True - * - * if ((step > 0 and start >= stop) # <<<<<<<<<<<<<< - * or (step < 0 and start <= stop)): - * data = OrderedDict() - */ - if (__pyx_t_7) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":819 - * if ((step > 0 and start >= stop) - * or (step < 0 and start <= stop)): - * data = OrderedDict() # <<<<<<<<<<<<<< - * if cast_types: - * for i in range(self.num_fields): - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 819, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 819, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 819, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_data = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":820 - * or (step < 0 and start <= stop)): - * data = OrderedDict() - * if cast_types: # <<<<<<<<<<<<<< - * for i in range(self.num_fields): - * dtype = self.field_types[i] - */ - __pyx_t_7 = (__pyx_v_cast_types != 0); - if (__pyx_t_7) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":821 - * data = OrderedDict() - * if cast_types: - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * dtype = self.field_types[i] - * data[self.field_names[i]] = numpy.array([], dtype=dtype) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 821, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 821, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 821, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_9(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 821, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":822 - * if cast_types: - * for i in range(self.num_fields): - * dtype = self.field_types[i] # <<<<<<<<<<<<<< - * data[self.field_names[i]] = numpy.array([], dtype=dtype) - * else: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_GetItem(__pyx_t_2, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_5); - __pyx_t_5 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":823 - * for i in range(self.num_fields): - * dtype = self.field_types[i] - * data[self.field_names[i]] = numpy.array([], dtype=dtype) # <<<<<<<<<<<<<< - * else: - * for i in range(self.num_fields): - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_v_dtype) < 0) __PYX_ERR(0, 823, __pyx_L1_error) - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetItem(__pyx_t_5, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_data, __pyx_t_3, __pyx_t_10) < 0)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":821 - * data = OrderedDict() - * if cast_types: - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * dtype = self.field_types[i] - * data[self.field_names[i]] = numpy.array([], dtype=dtype) - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":820 - * or (step < 0 and start <= stop)): - * data = OrderedDict() - * if cast_types: # <<<<<<<<<<<<<< - * for i in range(self.num_fields): - * dtype = self.field_types[i] - */ - goto __pyx_L13; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":825 - * data[self.field_names[i]] = numpy.array([], dtype=dtype) - * else: - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * dtype = self.field_types[i] - * data[self.field_names[i]] = numpy.array([], dtype=dtype) - */ - /*else*/ { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10); __pyx_t_4 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 825, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_10))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 825, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 825, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_9(__pyx_t_10); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 825, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":826 - * else: - * for i in range(self.num_fields): - * dtype = self.field_types[i] # <<<<<<<<<<<<<< - * data[self.field_names[i]] = numpy.array([], dtype=dtype) - * return pd.DataFrame(data=data) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 826, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_3); - __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":827 - * for i in range(self.num_fields): - * dtype = self.field_types[i] - * data[self.field_names[i]] = numpy.array([], dtype=dtype) # <<<<<<<<<<<<<< - * return pd.DataFrame(data=data) - * - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_v_dtype) < 0) __PYX_ERR(0, 827, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_data, __pyx_t_5, __pyx_t_2) < 0)) __PYX_ERR(0, 827, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":825 - * data[self.field_names[i]] = numpy.array([], dtype=dtype) - * else: - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * dtype = self.field_types[i] - * data[self.field_names[i]] = numpy.array([], dtype=dtype) - */ - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __pyx_L13:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":828 - * dtype = self.field_types[i] - * data[self.field_names[i]] = numpy.array([], dtype=dtype) - * return pd.DataFrame(data=data) # <<<<<<<<<<<<<< - * - * # Allocate and prepare result dataframe. An array of data pointers needs to - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_data, __pyx_v_data) < 0) __PYX_ERR(0, 828, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":817 - * cast_types = True - * - * if ((step > 0 and start >= stop) # <<<<<<<<<<<<<< - * or (step < 0 and start <= stop)): - * data = OrderedDict() - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":833 - * # be passed to read_records, one for each dataframe field. Each source - * # field's data will be stored in corresponding data pointer's memory chunk. - * data_arrays = calloc(self.num_fields, sizeof(char*)) # <<<<<<<<<<<<<< - * data = OrderedDict() - * final_data = OrderedDict() - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 833, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_11 = __Pyx_PyInt_As_size_t(__pyx_t_5); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 833, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_data_arrays = ((char **)calloc(__pyx_t_11, (sizeof(char *)))); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":834 - * # field's data will be stored in corresponding data pointer's memory chunk. - * data_arrays = calloc(self.num_fields, sizeof(char*)) - * data = OrderedDict() # <<<<<<<<<<<<<< - * final_data = OrderedDict() - * for i in range(self.num_fields): - */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - if (__pyx_t_2) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 834, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_data = __pyx_t_5; - __pyx_t_5 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":835 - * data_arrays = calloc(self.num_fields, sizeof(char*)) - * data = OrderedDict() - * final_data = OrderedDict() # <<<<<<<<<<<<<< - * for i in range(self.num_fields): - * dtype = default_types[i] - */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - if (__pyx_t_2) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 835, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_final_data = __pyx_t_5; - __pyx_t_5 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":836 - * data = OrderedDict() - * final_data = OrderedDict() - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * dtype = default_types[i] - * data[self.field_names[i]] = numpy.array([0], dtype=default_types[i]) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { - __pyx_t_10 = __pyx_t_5; __Pyx_INCREF(__pyx_t_10); __pyx_t_4 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 836, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_10))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 836, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 836, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_9(__pyx_t_10); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 836, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5); - __pyx_t_5 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":837 - * final_data = OrderedDict() - * for i in range(self.num_fields): - * dtype = default_types[i] # <<<<<<<<<<<<<< - * data[self.field_names[i]] = numpy.array([0], dtype=default_types[i]) - * final_data[self.field_names[i]] = numpy.array([0], dtype=self.field_types[i]) - */ - __pyx_t_5 = PyObject_GetItem(__pyx_v_default_types, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_5); - __pyx_t_5 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":838 - * for i in range(self.num_fields): - * dtype = default_types[i] - * data[self.field_names[i]] = numpy.array([0], dtype=default_types[i]) # <<<<<<<<<<<<<< - * final_data[self.field_names[i]] = numpy.array([0], dtype=self.field_types[i]) - * - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyList_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetItem(__pyx_v_default_types, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetItem(__pyx_t_5, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_data, __pyx_t_3, __pyx_t_1) < 0)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":839 - * dtype = default_types[i] - * data[self.field_names[i]] = numpy.array([0], dtype=default_types[i]) - * final_data[self.field_names[i]] = numpy.array([0], dtype=self.field_types[i]) # <<<<<<<<<<<<<< - * - * # If we need to cast values from database to user specified dtype, - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = PyObject_GetItem(__pyx_t_2, __pyx_v_i); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_12) < 0) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_final_data, __pyx_t_5, __pyx_t_12) < 0)) __PYX_ERR(0, 839, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":836 - * data = OrderedDict() - * final_data = OrderedDict() - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * dtype = default_types[i] - * data[self.field_names[i]] = numpy.array([0], dtype=default_types[i]) - */ - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":847 - * # perform the correct cast under the hood. This isn't super fast, - * # but it's easy and will ensure casting follows pandas casting. - * if cast_types: # <<<<<<<<<<<<<< - * df_result = pd.DataFrame(index=numpy.arange(CAST_BUFFER_SIZE, dtype='u8'), data=data) - * final_df_result = pd.DataFrame(index=numpy.arange(num_records, dtype='u8'), data=final_data) - */ - __pyx_t_7 = (__pyx_v_cast_types != 0); - if (__pyx_t_7) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":848 - * # but it's easy and will ensure casting follows pandas casting. - * if cast_types: - * df_result = pd.DataFrame(index=numpy.arange(CAST_BUFFER_SIZE, dtype='u8'), data=data) # <<<<<<<<<<<<<< - * final_df_result = pd.DataFrame(index=numpy.arange(num_records, dtype='u8'), data=final_data) - * else: - */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_arange); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_int(CAST_BUFFER_SIZE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(0, 848, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_index, __pyx_t_2) < 0) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_data, __pyx_v_data) < 0) __PYX_ERR(0, 848, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_df_result = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":849 - * if cast_types: - * df_result = pd.DataFrame(index=numpy.arange(CAST_BUFFER_SIZE, dtype='u8'), data=data) - * final_df_result = pd.DataFrame(index=numpy.arange(num_records, dtype='u8'), data=final_data) # <<<<<<<<<<<<<< - * else: - * df_result = pd.DataFrame(index=numpy.arange(num_records, dtype='u8'), data=data) - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_arange); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_v_num_records); - __Pyx_GIVEREF(__pyx_v_num_records); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_num_records); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(0, 849, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_index, __pyx_t_1) < 0) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_data, __pyx_v_final_data) < 0) __PYX_ERR(0, 849, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 849, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_final_df_result = __pyx_t_1; - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":847 - * # perform the correct cast under the hood. This isn't super fast, - * # but it's easy and will ensure casting follows pandas casting. - * if cast_types: # <<<<<<<<<<<<<< - * df_result = pd.DataFrame(index=numpy.arange(CAST_BUFFER_SIZE, dtype='u8'), data=data) - * final_df_result = pd.DataFrame(index=numpy.arange(num_records, dtype='u8'), data=final_data) - */ - goto __pyx_L20; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":851 - * final_df_result = pd.DataFrame(index=numpy.arange(num_records, dtype='u8'), data=final_data) - * else: - * df_result = pd.DataFrame(index=numpy.arange(num_records, dtype='u8'), data=data) # <<<<<<<<<<<<<< - * - * # Get data pointers from dataframe columns - */ - /*else*/ { - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_arange); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_INCREF(__pyx_v_num_records); - __Pyx_GIVEREF(__pyx_v_num_records); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_num_records); - __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_dtype, __pyx_n_s_u8) < 0) __PYX_ERR(0, 851, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_index, __pyx_t_5) < 0) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_data, __pyx_v_data) < 0) __PYX_ERR(0, 851, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_df_result = __pyx_t_5; - __pyx_t_5 = 0; - } - __pyx_L20:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":854 - * - * # Get data pointers from dataframe columns - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * temp_array = df_result[self.field_names[i]].values - * data_arrays[i] = temp_array.data - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_fields); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { - __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 854, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 854, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 854, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_9(__pyx_t_1); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 854, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5); - __pyx_t_5 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":855 - * # Get data pointers from dataframe columns - * for i in range(self.num_fields): - * temp_array = df_result[self.field_names[i]].values # <<<<<<<<<<<<<< - * data_arrays[i] = temp_array.data - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_field_names); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 855, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyObject_GetItem(__pyx_t_5, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 855, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetItem(__pyx_v_df_result, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 855, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 855, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 855, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_temp_array, ((PyArrayObject *)__pyx_t_2)); - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":856 - * for i in range(self.num_fields): - * temp_array = df_result[self.field_names[i]].values - * data_arrays[i] = temp_array.data # <<<<<<<<<<<<<< - * - * if cast_types: - */ - __pyx_t_13 = __pyx_v_temp_array->data; - __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 856, __pyx_L1_error) - (__pyx_v_data_arrays[__pyx_t_14]) = __pyx_t_13; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":854 - * - * # Get data pointers from dataframe columns - * for i in range(self.num_fields): # <<<<<<<<<<<<<< - * temp_array = df_result[self.field_names[i]].values - * data_arrays[i] = temp_array.data - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":858 - * data_arrays[i] = temp_array.data - * - * if cast_types: # <<<<<<<<<<<<<< - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 1, df_result, final_df_result, 1) - */ - __pyx_t_7 = (__pyx_v_cast_types != 0); - if (__pyx_t_7) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":859 - * - * if cast_types: - * result = read_records(self._adapter, start, stop, step, data_arrays, # <<<<<<<<<<<<<< - * &num_records_found, 1, df_result, final_df_result, 1) - * free(data_arrays) - */ - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L1_error) - __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_stop); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L1_error) - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_step); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":860 - * if cast_types: - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 1, df_result, final_df_result, 1) # <<<<<<<<<<<<<< - * free(data_arrays) - * if result != ADAPTER_SUCCESS: - */ - if (unlikely(!__pyx_v_final_df_result)) { __Pyx_RaiseUnboundLocalError("final_df_result"); __PYX_ERR(0, 860, __pyx_L1_error) } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":859 - * - * if cast_types: - * result = read_records(self._adapter, start, stop, step, data_arrays, # <<<<<<<<<<<<<< - * &num_records_found, 1, df_result, final_df_result, 1) - * free(data_arrays) - */ - __pyx_v_result = read_records(__pyx_v_self->_adapter, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_v_data_arrays, (&__pyx_v_num_records_found), 1, ((void *)__pyx_v_df_result), ((void *)__pyx_v_final_df_result), 1); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":861 - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 1, df_result, final_df_result, 1) - * free(data_arrays) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] - */ - free(__pyx_v_data_arrays); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":862 - * &num_records_found, 1, df_result, final_df_result, 1) - * free(data_arrays) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * raise exceptions[result] - * return final_df_result - */ - __pyx_t_7 = ((__pyx_v_result != ADAPTER_SUCCESS) != 0); - if (__pyx_t_7) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":863 - * free(data_arrays) - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] # <<<<<<<<<<<<<< - * return final_df_result - * else: - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 863, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 863, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":862 - * &num_records_found, 1, df_result, final_df_result, 1) - * free(data_arrays) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * raise exceptions[result] - * return final_df_result - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":864 - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] - * return final_df_result # <<<<<<<<<<<<<< - * else: - * result = read_records(self._adapter, start, stop, step, data_arrays, - */ - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_final_df_result)) { __Pyx_RaiseUnboundLocalError("final_df_result"); __PYX_ERR(0, 864, __pyx_L1_error) } - __Pyx_INCREF(__pyx_v_final_df_result); - __pyx_r = __pyx_v_final_df_result; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":858 - * data_arrays[i] = temp_array.data - * - * if cast_types: # <<<<<<<<<<<<<< - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 1, df_result, final_df_result, 1) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":866 - * return final_df_result - * else: - * result = read_records(self._adapter, start, stop, step, data_arrays, # <<<<<<<<<<<<<< - * &num_records_found, 0, NULL, NULL, 1) - * free(data_arrays) - */ - /*else*/ { - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L1_error) - __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_stop); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L1_error) - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_step); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":867 - * else: - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 0, NULL, NULL, 1) # <<<<<<<<<<<<<< - * free(data_arrays) - * if result != ADAPTER_SUCCESS: - */ - __pyx_v_result = read_records(__pyx_v_self->_adapter, __pyx_t_17, __pyx_t_16, __pyx_t_15, __pyx_v_data_arrays, (&__pyx_v_num_records_found), 0, NULL, NULL, 1); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":868 - * result = read_records(self._adapter, start, stop, step, data_arrays, - * &num_records_found, 0, NULL, NULL, 1) - * free(data_arrays) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] - */ - free(__pyx_v_data_arrays); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":869 - * &num_records_found, 0, NULL, NULL, 1) - * free(data_arrays) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * raise exceptions[result] - * return df_result - */ - __pyx_t_7 = ((__pyx_v_result != ADAPTER_SUCCESS) != 0); - if (__pyx_t_7) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":870 - * free(data_arrays) - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] # <<<<<<<<<<<<<< - * return df_result - * - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_exceptions); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 870, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyInt_From_AdapterError(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 870, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetItem(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 870, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 870, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":869 - * &num_records_found, 0, NULL, NULL, 1) - * free(data_arrays) - * if result != ADAPTER_SUCCESS: # <<<<<<<<<<<<<< - * raise exceptions[result] - * return df_result - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":871 - * if result != ADAPTER_SUCCESS: - * raise exceptions[result] - * return df_result # <<<<<<<<<<<<<< - * - * def __getitem__(self, index): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_df_result); - __pyx_r = __pyx_v_df_result; - goto __pyx_L0; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":793 - * return numpy.asarray(carray) - * - * def _to_dataframe(self, start=0, stop=None, step=1): # <<<<<<<<<<<<<< - * """ - * Read records from table or custom query into Pandas dataframe. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter._to_dataframe", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_temp_array); - __Pyx_XDECREF(__pyx_v_num_records); - __Pyx_XDECREF(__pyx_v_default_types); - __Pyx_XDECREF(__pyx_v_dtype_len); - __Pyx_XDECREF(__pyx_v_data); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_dtype); - __Pyx_XDECREF(__pyx_v_final_data); - __Pyx_XDECREF(__pyx_v_df_result); - __Pyx_XDECREF(__pyx_v_final_df_result); - __Pyx_XDECREF(__pyx_v_stop); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "iopro/postgresadapter/PostgresAdapter.pyx":873 - * return df_result - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * """ - * Read records by slice - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_29__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static char __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_28__getitem__[] = "\n Read records by slice\n Inputs:\n index: slice object or int index\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_28__getitem__; -#endif -static PyObject *__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_29__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_28__getitem__(((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_28__getitem__(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_start = NULL; - PyObject *__pyx_v_stop = NULL; - PyObject *__pyx_v_step = NULL; - PyObject *__pyx_r = NULL; - __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; - PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - __Pyx_RefNannySetupContext("__getitem__", 0); - __Pyx_INCREF(__pyx_v_index); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":879 - * index: slice object or int index - * """ - * self._check_connection() # <<<<<<<<<<<<<< - * - * if isinstance(index, (int, long)): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 879, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":881 - * self._check_connection() - * - * if isinstance(index, (int, long)): # <<<<<<<<<<<<<< - * if index > self.num_records - 1: - * raise ValueError('index {0} is out of bounds'.format(index)) - */ - __pyx_t_5 = PyInt_Check(__pyx_v_index); - __pyx_t_6 = (__pyx_t_5 != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_4 = __pyx_t_6; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_6 = PyLong_Check(__pyx_v_index); - __pyx_t_5 = (__pyx_t_6 != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":882 - * - * if isinstance(index, (int, long)): - * if index > self.num_records - 1: # <<<<<<<<<<<<<< - * raise ValueError('index {0} is out of bounds'.format(index)) - * elif index < 0: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_index, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error) - __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_ERR(0, 882, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":883 - * if isinstance(index, (int, long)): - * if index > self.num_records - 1: - * raise ValueError('index {0} is out of bounds'.format(index)) # <<<<<<<<<<<<<< - * elif index < 0: - * if self.num_records + index < 0: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_index_0_is_out_of_bounds, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 883, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 883, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_index); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 883, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 883, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":882 - * - * if isinstance(index, (int, long)): - * if index > self.num_records - 1: # <<<<<<<<<<<<<< - * raise ValueError('index {0} is out of bounds'.format(index)) - * elif index < 0: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":884 - * if index > self.num_records - 1: - * raise ValueError('index {0} is out of bounds'.format(index)) - * elif index < 0: # <<<<<<<<<<<<<< - * if self.num_records + index < 0: - * raise ValueError('index {0} is out of bounds'.format(index)) - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_index, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 884, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":885 - * raise ValueError('index {0} is out of bounds'.format(index)) - * elif index < 0: - * if self.num_records + index < 0: # <<<<<<<<<<<<<< - * raise ValueError('index {0} is out of bounds'.format(index)) - * index = self.num_records + index - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 885, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error) - __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_ERR(0, 885, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":886 - * elif index < 0: - * if self.num_records + index < 0: - * raise ValueError('index {0} is out of bounds'.format(index)) # <<<<<<<<<<<<<< - * index = self.num_records + index - * if self._dataframe_result: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_index_0_is_out_of_bounds, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_index); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 886, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":885 - * raise ValueError('index {0} is out of bounds'.format(index)) - * elif index < 0: - * if self.num_records + index < 0: # <<<<<<<<<<<<<< - * raise ValueError('index {0} is out of bounds'.format(index)) - * index = self.num_records + index - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":887 - * if self.num_records + index < 0: - * raise ValueError('index {0} is out of bounds'.format(index)) - * index = self.num_records + index # <<<<<<<<<<<<<< - * if self._dataframe_result: - * return self._to_dataframe(index, index + 1) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_2); - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":884 - * if index > self.num_records - 1: - * raise ValueError('index {0} is out of bounds'.format(index)) - * elif index < 0: # <<<<<<<<<<<<<< - * if self.num_records + index < 0: - * raise ValueError('index {0} is out of bounds'.format(index)) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":888 - * raise ValueError('index {0} is out of bounds'.format(index)) - * index = self.num_records + index - * if self._dataframe_result: # <<<<<<<<<<<<<< - * return self._to_dataframe(index, index + 1) - * else: - */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->_dataframe_result); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 888, __pyx_L1_error) - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":889 - * index = self.num_records + index - * if self._dataframe_result: - * return self._to_dataframe(index, index + 1) # <<<<<<<<<<<<<< - * else: - * return self._to_array(index, index + 1) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_dataframe); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_8 = 1; - } - } - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_index); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":888 - * raise ValueError('index {0} is out of bounds'.format(index)) - * index = self.num_records + index - * if self._dataframe_result: # <<<<<<<<<<<<<< - * return self._to_dataframe(index, index + 1) - * else: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":891 - * return self._to_dataframe(index, index + 1) - * else: - * return self._to_array(index, index + 1) # <<<<<<<<<<<<<< - * elif isinstance(index, slice): - * start = index.start - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 891, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 891, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = NULL; - __pyx_t_8 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_8 = 1; - } - } - __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 891, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_v_index); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 891, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":881 - * self._check_connection() - * - * if isinstance(index, (int, long)): # <<<<<<<<<<<<<< - * if index > self.num_records - 1: - * raise ValueError('index {0} is out of bounds'.format(index)) - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":892 - * else: - * return self._to_array(index, index + 1) - * elif isinstance(index, slice): # <<<<<<<<<<<<<< - * start = index.start - * stop = index.stop - */ - __pyx_t_5 = PySlice_Check(__pyx_v_index); - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":893 - * return self._to_array(index, index + 1) - * elif isinstance(index, slice): - * start = index.start # <<<<<<<<<<<<<< - * stop = index.stop - * step = index.step - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 893, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_start = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":894 - * elif isinstance(index, slice): - * start = index.start - * stop = index.stop # <<<<<<<<<<<<<< - * step = index.step - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 894, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_stop = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":895 - * start = index.start - * stop = index.stop - * step = index.step # <<<<<<<<<<<<<< - * - * if step is None: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 895, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_step = __pyx_t_2; - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":897 - * step = index.step - * - * if step is None: # <<<<<<<<<<<<<< - * step = 1 - * - */ - __pyx_t_4 = (__pyx_v_step == Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":898 - * - * if step is None: - * step = 1 # <<<<<<<<<<<<<< - * - * if start is None: - */ - __Pyx_INCREF(__pyx_int_1); - __Pyx_DECREF_SET(__pyx_v_step, __pyx_int_1); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":897 - * step = index.step - * - * if step is None: # <<<<<<<<<<<<<< - * step = 1 - * - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":900 - * step = 1 - * - * if start is None: # <<<<<<<<<<<<<< - * if step > 0: - * start = 0 - */ - __pyx_t_5 = (__pyx_v_start == Py_None); - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":901 - * - * if start is None: - * if step > 0: # <<<<<<<<<<<<<< - * start = 0 - * else: - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_step, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 901, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":902 - * if start is None: - * if step > 0: - * start = 0 # <<<<<<<<<<<<<< - * else: - * start = self.num_records - 1 - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_DECREF_SET(__pyx_v_start, __pyx_int_0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":901 - * - * if start is None: - * if step > 0: # <<<<<<<<<<<<<< - * start = 0 - * else: - */ - goto __pyx_L11; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":904 - * start = 0 - * else: - * start = self.num_records - 1 # <<<<<<<<<<<<<< - * elif start > self.num_records: - * start = self.num_records - */ - /*else*/ { - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 904, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_1); - __pyx_t_1 = 0; - } - __pyx_L11:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":900 - * step = 1 - * - * if start is None: # <<<<<<<<<<<<<< - * if step > 0: - * start = 0 - */ - goto __pyx_L10; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":905 - * else: - * start = self.num_records - 1 - * elif start > self.num_records: # <<<<<<<<<<<<<< - * start = self.num_records - * elif start < 0: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 905, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 905, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":906 - * start = self.num_records - 1 - * elif start > self.num_records: - * start = self.num_records # <<<<<<<<<<<<<< - * elif start < 0: - * if self.num_records + start < 0: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 906, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_2); - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":905 - * else: - * start = self.num_records - 1 - * elif start > self.num_records: # <<<<<<<<<<<<<< - * start = self.num_records - * elif start < 0: - */ - goto __pyx_L10; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":907 - * elif start > self.num_records: - * start = self.num_records - * elif start < 0: # <<<<<<<<<<<<<< - * if self.num_records + start < 0: - * start = 0 - self.num_records - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 907, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 907, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":908 - * start = self.num_records - * elif start < 0: - * if self.num_records + start < 0: # <<<<<<<<<<<<<< - * start = 0 - self.num_records - * start = self.num_records + start - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 908, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 908, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 908, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 908, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_4) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":909 - * elif start < 0: - * if self.num_records + start < 0: - * start = 0 - self.num_records # <<<<<<<<<<<<<< - * start = self.num_records + start - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 909, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyInt_SubtractCObj(__pyx_int_0, __pyx_t_2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 909, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":908 - * start = self.num_records - * elif start < 0: - * if self.num_records + start < 0: # <<<<<<<<<<<<<< - * start = 0 - self.num_records - * start = self.num_records + start - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":910 - * if self.num_records + start < 0: - * start = 0 - self.num_records - * start = self.num_records + start # <<<<<<<<<<<<<< - * - * if stop is None: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 910, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 910, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_2); - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":907 - * elif start > self.num_records: - * start = self.num_records - * elif start < 0: # <<<<<<<<<<<<<< - * if self.num_records + start < 0: - * start = 0 - self.num_records - */ - } - __pyx_L10:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":912 - * start = self.num_records + start - * - * if stop is None: # <<<<<<<<<<<<<< - * if step > 0: - * stop = self.num_records - */ - __pyx_t_4 = (__pyx_v_stop == Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":913 - * - * if stop is None: - * if step > 0: # <<<<<<<<<<<<<< - * stop = self.num_records - * else: - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_step, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 913, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":914 - * if stop is None: - * if step > 0: - * stop = self.num_records # <<<<<<<<<<<<<< - * else: - * stop = -1 - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 914, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_2); - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":913 - * - * if stop is None: - * if step > 0: # <<<<<<<<<<<<<< - * stop = self.num_records - * else: - */ - goto __pyx_L14; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":916 - * stop = self.num_records - * else: - * stop = -1 # <<<<<<<<<<<<<< - * elif stop > self.num_records: - * stop = self.num_records - */ - /*else*/ { - __Pyx_INCREF(__pyx_int_neg_1); - __Pyx_DECREF_SET(__pyx_v_stop, __pyx_int_neg_1); - } - __pyx_L14:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":912 - * start = self.num_records + start - * - * if stop is None: # <<<<<<<<<<<<<< - * if step > 0: - * stop = self.num_records - */ - goto __pyx_L13; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":917 - * else: - * stop = -1 - * elif stop > self.num_records: # <<<<<<<<<<<<<< - * stop = self.num_records - * elif stop < 0: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 917, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_stop, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error) - __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_ERR(0, 917, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":918 - * stop = -1 - * elif stop > self.num_records: - * stop = self.num_records # <<<<<<<<<<<<<< - * elif stop < 0: - * if self.num_records + stop < 0: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":917 - * else: - * stop = -1 - * elif stop > self.num_records: # <<<<<<<<<<<<<< - * stop = self.num_records - * elif stop < 0: - */ - goto __pyx_L13; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":919 - * elif stop > self.num_records: - * stop = self.num_records - * elif stop < 0: # <<<<<<<<<<<<<< - * if self.num_records + stop < 0: - * stop = 0 - self.num_records - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_stop, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 919, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":920 - * stop = self.num_records - * elif stop < 0: - * if self.num_records + stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - self.num_records - * stop = self.num_records + stop - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_stop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error) - __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_ERR(0, 920, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":921 - * elif stop < 0: - * if self.num_records + stop < 0: - * stop = 0 - self.num_records # <<<<<<<<<<<<<< - * stop = self.num_records + stop - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_SubtractCObj(__pyx_int_0, __pyx_t_1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 921, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_2); - __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":920 - * stop = self.num_records - * elif stop < 0: - * if self.num_records + stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - self.num_records - * stop = self.num_records + stop - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":922 - * if self.num_records + stop < 0: - * stop = 0 - self.num_records - * stop = self.num_records + stop # <<<<<<<<<<<<<< - * - * if self._dataframe_result: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_num_records); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 922, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_stop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 922, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_1); - __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":919 - * elif stop > self.num_records: - * stop = self.num_records - * elif stop < 0: # <<<<<<<<<<<<<< - * if self.num_records + stop < 0: - * stop = 0 - self.num_records - */ - } - __pyx_L13:; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":924 - * stop = self.num_records + stop - * - * if self._dataframe_result: # <<<<<<<<<<<<<< - * return self._to_dataframe(start, stop, step) - * else: - */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->_dataframe_result); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 924, __pyx_L1_error) - if (__pyx_t_5) { - - /* "iopro/postgresadapter/PostgresAdapter.pyx":925 - * - * if self._dataframe_result: - * return self._to_dataframe(start, stop, step) # <<<<<<<<<<<<<< - * else: - * return self._to_array(start, stop, step) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_dataframe); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 925, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_8 = 1; - } - } - __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 925, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_INCREF(__pyx_v_start); - __Pyx_GIVEREF(__pyx_v_start); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_start); - __Pyx_INCREF(__pyx_v_stop); - __Pyx_GIVEREF(__pyx_v_stop); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_stop); - __Pyx_INCREF(__pyx_v_step); - __Pyx_GIVEREF(__pyx_v_step); - PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_step); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":924 - * stop = self.num_records + stop - * - * if self._dataframe_result: # <<<<<<<<<<<<<< - * return self._to_dataframe(start, stop, step) - * else: - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":927 - * return self._to_dataframe(start, stop, step) - * else: - * return self._to_array(start, stop, step) # <<<<<<<<<<<<<< - * - * else: - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 927, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = NULL; - __pyx_t_8 = 0; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_8 = 1; - } - } - __pyx_t_7 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 927, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_INCREF(__pyx_v_start); - __Pyx_GIVEREF(__pyx_v_start); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_v_start); - __Pyx_INCREF(__pyx_v_stop); - __Pyx_GIVEREF(__pyx_v_stop); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_v_stop); - __Pyx_INCREF(__pyx_v_step); - __Pyx_GIVEREF(__pyx_v_step); - PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_step); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 927, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":892 - * else: - * return self._to_array(index, index + 1) - * elif isinstance(index, slice): # <<<<<<<<<<<<<< - * start = index.start - * stop = index.stop - */ - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":930 - * - * else: - * raise IndexError('index must be slice or int') # <<<<<<<<<<<<<< - */ - /*else*/ { - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 930, __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_ERR(0, 930, __pyx_L1_error) - } - - /* "iopro/postgresadapter/PostgresAdapter.pyx":873 - * return df_result - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * """ - * Read records by slice - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("iopro.postgresadapter.PostgresAdapter.PostgresAdapter.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_start); - __Pyx_XDECREF(__pyx_v_stop); - __Pyx_XDECREF(__pyx_v_step); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":197 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_copy_shape; - int __pyx_v_i; - int __pyx_v_ndim; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - int __pyx_v_t; - char *__pyx_v_f; - PyArray_Descr *__pyx_v_descr = 0; - int __pyx_v_offset; - int __pyx_v_hasfields; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - __Pyx_RefNannySetupContext("__getbuffer__", 0); - if (__pyx_v_info != NULL) { - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":203 - * # of flags - * - * if info == NULL: return # <<<<<<<<<<<<<< - * - * cdef int copy_shape, i, ndim - */ - __pyx_t_1 = ((__pyx_v_info == NULL) != 0); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":206 - * - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - */ - __pyx_v_endian_detector = 1; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":207 - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * - * ndim = PyArray_NDIM(self) - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":209 - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":211 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":212 - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * copy_shape = 1 # <<<<<<<<<<<<<< - * else: - * copy_shape = 0 - */ - __pyx_v_copy_shape = 1; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":211 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - goto __pyx_L4; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":214 - * copy_shape = 1 - * else: - * copy_shape = 0 # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - */ - /*else*/ { - __pyx_v_copy_shape = 0; - } - __pyx_L4:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L6_bool_binop_done; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":217 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not C contiguous") - * - */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L6_bool_binop_done:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":218 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __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_ERR(1, 218, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":216 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":220 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L9_bool_binop_done; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":221 - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not Fortran contiguous") - * - */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L9_bool_binop_done:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":220 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":222 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 222, __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_ERR(1, 222, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":220 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":224 - * raise ValueError(u"ndarray is not Fortran contiguous") - * - * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< - * info.ndim = ndim - * if copy_shape: - */ - __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":225 - * - * info.buf = PyArray_DATA(self) - * info.ndim = ndim # <<<<<<<<<<<<<< - * if copy_shape: - * # Allocate new buffer for strides and shape info. - */ - __pyx_v_info->ndim = __pyx_v_ndim; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":226 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - */ - __pyx_t_1 = (__pyx_v_copy_shape != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":229 - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< - * info.shape = info.strides + ndim - * for i in range(ndim): - */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":230 - * # This is allocated as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim # <<<<<<<<<<<<<< - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - */ - __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":231 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim - * for i in range(ndim): # <<<<<<<<<<<<<< - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] - */ - __pyx_t_4 = __pyx_v_ndim; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":232 - * info.shape = info.strides + ndim - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":233 - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< - * else: - * info.strides = PyArray_STRIDES(self) - */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":226 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - */ - goto __pyx_L11; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":235 - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - */ - /*else*/ { - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":236 - * else: - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); - } - __pyx_L11:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":237 - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) - */ - __pyx_v_info->suboffsets = NULL; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":238 - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< - * info.readonly = not PyArray_ISWRITEABLE(self) - * - */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":239 - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< - * - * cdef int t - */ - __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":242 - * - * cdef int t - * cdef char* f = NULL # <<<<<<<<<<<<<< - * cdef dtype descr = self.descr - * cdef int offset - */ - __pyx_v_f = NULL; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":243 - * cdef int t - * cdef char* f = NULL - * cdef dtype descr = self.descr # <<<<<<<<<<<<<< - * cdef int offset - * - */ - __pyx_t_3 = ((PyObject *)__pyx_v_self->descr); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":246 - * cdef int offset - * - * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * - * if not hasfields and not copy_shape: - */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":248 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L15_bool_binop_done:; - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":250 - * if not hasfields and not copy_shape: - * # do not call releasebuffer - * info.obj = None # <<<<<<<<<<<<<< - * else: - * # need to call releasebuffer - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = Py_None; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":248 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - goto __pyx_L14; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":253 - * else: - * # need to call releasebuffer - * info.obj = self # <<<<<<<<<<<<<< - * -<<<<<<< HEAD - * if not has***REMOVED*** -======= - * if not hasfields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - */ - /*else*/ { - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - } - __pyx_L14:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":255 - * info.obj = self - * -<<<<<<< HEAD - * if not has***REMOVED*** # <<<<<<<<<<<<<< -======= - * if not hasfields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - */ - __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":256 - * -<<<<<<< HEAD - * if not has***REMOVED*** -======= - * if not hasfields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - */ - __pyx_t_4 = __pyx_v_descr->type_num; - __pyx_v_t = __pyx_t_4; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":257 -<<<<<<< HEAD - * if not has***REMOVED*** -======= - * if not hasfields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0); - if (!__pyx_t_2) { - goto __pyx_L20_next_or; - } else { - } - __pyx_t_2 = (__pyx_v_little_endian != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L19_bool_binop_done; - } - __pyx_L20_next_or:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":258 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - */ - __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L19_bool_binop_done; - } - __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L19_bool_binop_done:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":257 -<<<<<<< HEAD - * if not has***REMOVED*** -======= - * if not hasfields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":259 - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 259, __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_ERR(1, 259, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":257 -<<<<<<< HEAD - * if not has***REMOVED*** -======= - * if not hasfields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":260 - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - */ - switch (__pyx_v_t) { - case NPY_BYTE: - __pyx_v_f = ((char *)"b"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":261 - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - */ - case NPY_UBYTE: - __pyx_v_f = ((char *)"B"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":262 - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - */ - case NPY_SHORT: - __pyx_v_f = ((char *)"h"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":263 - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - */ - case NPY_USHORT: - __pyx_v_f = ((char *)"H"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":264 - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - */ - case NPY_INT: - __pyx_v_f = ((char *)"i"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":265 - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - */ - case NPY_UINT: - __pyx_v_f = ((char *)"I"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":266 - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - */ - case NPY_LONG: - __pyx_v_f = ((char *)"l"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":267 - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - */ - case NPY_ULONG: - __pyx_v_f = ((char *)"L"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":268 - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - */ - case NPY_LONGLONG: - __pyx_v_f = ((char *)"q"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":269 - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - */ - case NPY_ULONGLONG: - __pyx_v_f = ((char *)"Q"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":270 - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - */ - case NPY_FLOAT: - __pyx_v_f = ((char *)"f"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":271 - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - */ - case NPY_DOUBLE: - __pyx_v_f = ((char *)"d"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":272 - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - */ - case NPY_LONGDOUBLE: - __pyx_v_f = ((char *)"g"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":273 - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - */ - case NPY_CFLOAT: - __pyx_v_f = ((char *)"Zf"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":274 - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" - */ - case NPY_CDOUBLE: - __pyx_v_f = ((char *)"Zd"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":275 - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f = "O" - * else: - */ - case NPY_CLONGDOUBLE: - __pyx_v_f = ((char *)"Zg"); - break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":276 - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - case NPY_OBJECT: - __pyx_v_f = ((char *)"O"); - break; - default: - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":278 - * elif t == NPY_OBJECT: f = "O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * info.format = f - * return - */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(1, 278, __pyx_L1_error) - break; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":279 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f # <<<<<<<<<<<<<< - * return - * else: - */ - __pyx_v_info->format = __pyx_v_f; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":280 - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f - * return # <<<<<<<<<<<<<< - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":255 - * info.obj = self - * -<<<<<<< HEAD - * if not has***REMOVED*** # <<<<<<<<<<<<<< -======= - * if not hasfields: # <<<<<<<<<<<<<< ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":282 - * return - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 - */ - /*else*/ { - __pyx_v_info->format = ((char *)malloc(0xFF)); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":283 - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, - */ - (__pyx_v_info->format[0]) = '^'; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":284 - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 # <<<<<<<<<<<<<< - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - */ - __pyx_v_offset = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":285 - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< - * info.format + _buffer_format_string_len, - * &offset) - */ - __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) __PYX_ERR(1, 285, __pyx_L1_error) - __pyx_v_f = __pyx_t_7; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":288 - * info.format + _buffer_format_string_len, - * &offset) - * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - */ - (__pyx_v_f[0]) = '\x00'; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":197 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(Py_None); - __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; - } - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":290 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - -/* Python wrapper */ -static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); - __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":291 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":292 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) - */ - free(__pyx_v_info->format); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":291 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":293 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block - */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":294 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block - * - */ - free(__pyx_v_info->strides); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":293 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":290 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":770 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":771 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew2(a, b): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 771, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":770 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":773 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":774 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":773 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":776 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":777 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":776 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":779 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":780 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":779 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":782 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":783 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":782 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":785 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child = 0; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - PyObject *__pyx_v_fields = 0; - PyObject *__pyx_v_childname = NULL; - PyObject *__pyx_v_new_offset = NULL; - PyObject *__pyx_v_t = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - long __pyx_t_8; - char *__pyx_t_9; - __Pyx_RefNannySetupContext("_util_dtypestring", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":790 - * - * cdef dtype child - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * cdef tuple fields - */ - __pyx_v_endian_detector = 1; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":791 - * cdef dtype child - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * cdef tuple fields - * - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":794 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - if (unlikely(__pyx_v_descr->names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(1, 794, __pyx_L1_error) - } - __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - for (;;) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 794, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 794, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); - __pyx_t_3 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":795 - * - * for childname in descr.names: - * fields = descr.fields[childname] # <<<<<<<<<<<<<< - * child, new_offset = fields - * - */ - if (unlikely(__pyx_v_descr->fields == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 795, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 795, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 795, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":796 - * for childname in descr.names: - * fields = descr.fields[childname] - * child, new_offset = fields # <<<<<<<<<<<<<< - * - * if (end - f) - (new_offset - offset[0]) < 15: - */ - if (likely(__pyx_v_fields != Py_None)) { - PyObject* sequence = __pyx_v_fields; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 796, __pyx_L1_error) - } - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 796, __pyx_L1_error) - } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 796, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); - __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); - __pyx_t_4 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":798 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 798, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); - if (__pyx_t_6) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":799 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == c'>' and little_endian) or - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 799, __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_ERR(1, 799, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":798 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":801 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); - if (!__pyx_t_7) { - goto __pyx_L8_next_or; - } else { - } - __pyx_t_7 = (__pyx_v_little_endian != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L7_bool_binop_done; - } - __pyx_L8_next_or:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":802 - * - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * # One could encode it in the format string and have Cython - */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); - if (__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_6 = __pyx_t_7; - __pyx_L7_bool_binop_done:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":801 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - if (__pyx_t_6) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":803 - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 803, __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_ERR(1, 803, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":801 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":813 - * - * # Output padding bytes - * while offset[0] < new_offset: # <<<<<<<<<<<<<< - * f[0] = 120 # "x"; pad byte - * f += 1 - */ - while (1) { - __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 813, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 813, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 813, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_6) break; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":814 - * # Output padding bytes - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< - * f += 1 - * offset[0] += 1 - */ - (__pyx_v_f[0]) = 0x78; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":815 - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte - * f += 1 # <<<<<<<<<<<<<< - * offset[0] += 1 - * - */ - __pyx_v_f = (__pyx_v_f + 1); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":816 - * f[0] = 120 # "x"; pad byte - * f += 1 - * offset[0] += 1 # <<<<<<<<<<<<<< - * - * offset[0] += child.itemsize - */ - __pyx_t_8 = 0; - (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":818 - * offset[0] += 1 - * - * offset[0] += child.itemsize # <<<<<<<<<<<<<< - * - * if not PyDataType_HASFIELDS(child): - */ - __pyx_t_8 = 0; - (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":820 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); - if (__pyx_t_6) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":821 - * - * if not PyDataType_HASFIELDS(child): - * t = child.type_num # <<<<<<<<<<<<<< - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); - __pyx_t_4 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":822 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); - if (__pyx_t_6) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":823 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(1, 823, __pyx_L1_error) - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":822 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":826 - * - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 826, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 98; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":827 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 827, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 827, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 827, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 66; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":828 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 828, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 828, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x68; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":829 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 829, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 829, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 72; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":830 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 830, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 830, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x69; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":831 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 831, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 831, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 831, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 73; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":832 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 832, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 832, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x6C; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":833 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 833, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 833, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 833, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 76; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":834 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 834, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 834, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x71; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":835 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 835, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 835, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 81; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":836 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 836, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 836, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x66; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":837 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x64; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":838 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x67; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":839 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x66; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":840 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x64; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":841 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x67; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":842 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 79; - goto __pyx_L15; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":844 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: - */ - /*else*/ { - __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 844, __pyx_L1_error) - } - __pyx_L15:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":845 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * # Cython ignores struct boundary information ("T{...}"), - */ - __pyx_v_f = (__pyx_v_f + 1); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":820 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - goto __pyx_L13; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":849 - * # Cython ignores struct boundary information ("T{...}"), - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< - * return f - * - */ - /*else*/ { - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) __PYX_ERR(1, 849, __pyx_L1_error) - __pyx_v_f = __pyx_t_9; - } - __pyx_L13:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":794 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":850 - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) - * return f # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_f; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":785 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_child); - __Pyx_XDECREF(__pyx_v_fields); - __Pyx_XDECREF(__pyx_v_childname); - __Pyx_XDECREF(__pyx_v_new_offset); - __Pyx_XDECREF(__pyx_v_t); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":966 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: - */ - -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - PyObject *__pyx_v_baseptr; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("set_array_base", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":968 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_base == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":969 - * cdef PyObject* baseptr - * if base is None: - * baseptr = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(base) # important to do this before decref below! - */ - __pyx_v_baseptr = NULL; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":968 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - goto __pyx_L3; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":971 - * baseptr = NULL - * else: - * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< - * baseptr = base - * Py_XDECREF(arr.base) - */ - /*else*/ { - Py_INCREF(__pyx_v_base); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":972 - * else: - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base # <<<<<<<<<<<<<< - * Py_XDECREF(arr.base) - * arr.base = baseptr - */ - __pyx_v_baseptr = ((PyObject *)__pyx_v_base); - } - __pyx_L3:; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":973 - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base - * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< - * arr.base = baseptr - * - */ - Py_XDECREF(__pyx_v_arr->base); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":974 - * baseptr = base - * Py_XDECREF(arr.base) - * arr.base = baseptr # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - __pyx_v_arr->base = __pyx_v_baseptr; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":966 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":976 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":977 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); - if (__pyx_t_1) { - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":978 - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: - * return None # <<<<<<<<<<<<<< - * else: - * return arr.base - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":977 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":980 - * return None - * else: - * return arr.base # <<<<<<<<<<<<<< - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); - __pyx_r = ((PyObject *)__pyx_v_arr->base); - goto __pyx_L0; - } - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":976 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_tp_new_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)o); - p->_field_names = Py_None; Py_INCREF(Py_None); - p->_field_types = Py_None; Py_INCREF(Py_None); - p->_field_shapes = Py_None; Py_INCREF(Py_None); - p->_dataframe_result = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter(PyObject *o) { - struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *p = (struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_5__dealloc__(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->_field_names); - Py_CLEAR(p->_field_types); - Py_CLEAR(p->_field_shapes); - Py_CLEAR(p->_dataframe_result); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *p = (struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)o; - if (p->_field_names) { - e = (*v)(p->_field_names, a); if (e) return e; - } - if (p->_field_types) { - e = (*v)(p->_field_types, a); if (e) return e; - } - if (p->_field_shapes) { - e = (*v)(p->_field_shapes, a); if (e) return e; - } - if (p->_dataframe_result) { - e = (*v)(p->_dataframe_result, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *p = (struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)o; - tmp = ((PyObject*)p->_field_names); - p->_field_names = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_field_types); - p->_field_types = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_field_shapes); - p->_field_shapes = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_dataframe_result); - p->_dataframe_result = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} -static PyObject *__pyx_sq_item_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter(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 PyObject *__pyx_getprop_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_num_records(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_11num_records_1__get__(o); -} - -static PyObject *__pyx_getprop_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_num_fields(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_10num_fields_1__get__(o); -} - -static PyMethodDef __pyx_methods_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter[] = { - {"close", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_3close, METH_NOARGS, __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_2close}, - {"_check_connection", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_7_check_connection, METH_NOARGS, 0}, - {"get_field_names", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_9get_field_names, METH_NOARGS, __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_8get_field_names}, - {"set_field_names", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_11set_field_names, METH_O, __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_10set_field_names}, - {"_get_default_types", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_13_get_default_types, METH_NOARGS, __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_12_get_default_types}, - {"get_field_types", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_15get_field_types, METH_NOARGS, __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_14get_field_types}, - {"set_field_types", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_17set_field_types, METH_O, __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_16set_field_types}, - {"get_field_shapes", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_19get_field_shapes, METH_NOARGS, __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_18get_field_shapes}, - {"set_field_shapes", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_21set_field_shapes, METH_O, __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_20set_field_shapes}, - {"_parse_slice", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_23_parse_slice, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_22_parse_slice}, - {"_to_array", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_25_to_array, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_24_to_array}, - {"_to_dataframe", (PyCFunction)__pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_27_to_dataframe, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_26_to_dataframe}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter[] = { - {(char *)"num_records", __pyx_getprop_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_num_records, 0, (char *)"\n Get number of records that will be returned from table or custom query\n ", 0}, - {(char *)"num_fields", __pyx_getprop_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_num_fields, 0, (char *)"\n Get number of fields in records that will be returned from table\n or custom query\n ", 0}, - {0, 0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_PostgresAdapter = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, /*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_PostgresAdapter = { - 0, /*mp_length*/ - __pyx_pw_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_29__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter = { - PyVarObject_HEAD_INIT(0, 0) - "iopro.postgresadapter.PostgresAdapter.PostgresAdapter", /*tp_name*/ - sizeof(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_PostgresAdapter, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_PostgresAdapter, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "\n PostgreSQL adapter for reading data from PostgreSQL database into\n NumPy array or Pandas dataframe.\n\n Constructor Inputs:\n connection_uri: string URI describing how to connect to database\n table: string, name of table to read records from. Only table\n parameter or query parameter can be set, but not both.\n query: string, custom query to use for reading records. Only query\n parameter or table parameter can be set, but not both.\n field_filter parameter cannot be set when query parameter is\n set (since it is trivial to specify fields in query string).\n field_filter: names of fields include in query (only valid when table\n parameter is specified)\n dataframe: bool, return results as dataframe instead of array\n field_names: list, names of fields in output array or dataframe.\n Defaults to database table column names.\n field_types: list, NumPy dtype for each field in output array\n or dataframe. Defaults to database table column types.\n field_shapes: list, shape of each field value for geometry field\n types with variable length data. For example, for a\n 'path' database column with 2d points, the points of\n the path will be stored in a list object by default.\n If a field shape of '10' is specified, the points will\n be stored in a 2x10 float subarray (2 floats per point\n * 10 points max). A field shape of the form (x,y) should\n be specifed for types like multipolygon where x is the\n max number of polygons and y is the max length of each\n polygon (the size of the point is inferred).\n ", /*tp_doc*/ - __pyx_tp_traverse_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, /*tp_traverse*/ - __pyx_tp_clear_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, /*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_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *__pyx_freelist_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names[8]; -static int __pyx_freecount_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names = 0; - -static PyObject *__pyx_tp_new_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names)))) { - o = (PyObject*)__pyx_freelist_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names[--__pyx_freecount_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names]; - memset(o, 0, sizeof(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names(PyObject *o) { - struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *p = (struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names)))) { - __pyx_freelist_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names[__pyx_freecount_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names++] = ((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *p = (struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *p = (struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names *)o; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names = { - PyVarObject_HEAD_INIT(0, 0) - "iopro.postgresadapter.PostgresAdapter.__pyx_scope_struct__set_field_names", /*tp_name*/ - sizeof(struct __pyx_obj_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names, /*tp_traverse*/ - __pyx_tp_clear_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*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_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names, /*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*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "PostgresAdapter", - 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_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1}, - {&__pyx_kp_s_Connection_already_closed_Please, __pyx_k_Connection_already_closed_Please, sizeof(__pyx_k_Connection_already_closed_Please), 0, 0, 1, 0}, - {&__pyx_kp_s_Could_not_perform_query_0, __pyx_k_Could_not_perform_query_0, sizeof(__pyx_k_Could_not_perform_query_0), 0, 0, 1, 0}, - {&__pyx_kp_s_Could_not_perform_query_on_table, __pyx_k_Could_not_perform_query_on_table, sizeof(__pyx_k_Could_not_perform_query_on_table), 0, 0, 1, 0}, - {&__pyx_n_s_DataFrame, __pyx_k_DataFrame, sizeof(__pyx_k_DataFrame), 0, 0, 1, 1}, - {&__pyx_kp_s_Either_table_or_query_must_be_se, __pyx_k_Either_table_or_query_must_be_se, sizeof(__pyx_k_Either_table_or_query_must_be_se), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_filter_cannot_be_set_for_q, __pyx_k_Field_filter_cannot_be_set_for_q, sizeof(__pyx_k_Field_filter_cannot_be_set_for_q), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_shape_cannot_be_set_when_o, __pyx_k_Field_shape_cannot_be_set_when_o, sizeof(__pyx_k_Field_shape_cannot_be_set_when_o), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_shape_for_GIS_multipolygon, __pyx_k_Field_shape_for_GIS_multipolygon, sizeof(__pyx_k_Field_shape_for_GIS_multipolygon), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_shape_for_PostGIS_line_mus, __pyx_k_Field_shape_for_PostGIS_line_mus, sizeof(__pyx_k_Field_shape_for_PostGIS_line_mus), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_shape_for_PostGIS_multilin, __pyx_k_Field_shape_for_PostGIS_multilin, sizeof(__pyx_k_Field_shape_for_PostGIS_multilin), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_shape_for_PostGIS_multipoi, __pyx_k_Field_shape_for_PostGIS_multipoi, sizeof(__pyx_k_Field_shape_for_PostGIS_multipoi), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_shape_for_PostGIS_polygon, __pyx_k_Field_shape_for_PostGIS_polygon, sizeof(__pyx_k_Field_shape_for_PostGIS_polygon), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_shape_for_path_or_polygon, __pyx_k_Field_shape_for_path_or_polygon, sizeof(__pyx_k_Field_shape_for_path_or_polygon), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_shape_must_be_greater_than, __pyx_k_Field_shape_must_be_greater_than, sizeof(__pyx_k_Field_shape_must_be_greater_than), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_shape_must_be_int_list_or, __pyx_k_Field_shape_must_be_int_list_or, sizeof(__pyx_k_Field_shape_must_be_int_list_or), 0, 0, 1, 0}, - {&__pyx_kp_s_Field_shape_values_must_be_great, __pyx_k_Field_shape_values_must_be_great, sizeof(__pyx_k_Field_shape_values_must_be_great), 0, 0, 1, 0}, - {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, - {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, - {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Invalid_PostgreSQL_query, __pyx_k_Invalid_PostgreSQL_query, sizeof(__pyx_k_Invalid_PostgreSQL_query), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_PostgreSQL_query_result, __pyx_k_Invalid_PostgreSQL_query_result, sizeof(__pyx_k_Invalid_PostgreSQL_query_result), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_field_name_0, __pyx_k_Invalid_field_name_0, sizeof(__pyx_k_Invalid_field_name_0), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_field_number_0, __pyx_k_Invalid_field_number_0, sizeof(__pyx_k_Invalid_field_number_0), 0, 0, 1, 0}, - {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0}, - {&__pyx_kp_s_Number_of_field_names_does_not_m, __pyx_k_Number_of_field_names_does_not_m, sizeof(__pyx_k_Number_of_field_names_does_not_m), 0, 0, 1, 0}, - {&__pyx_n_s_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 1, 1}, - {&__pyx_n_s_OrderedDict, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1}, - {&__pyx_kp_s_PostGIS_field_data_could_not_be, __pyx_k_PostGIS_field_data_could_not_be, sizeof(__pyx_k_PostGIS_field_data_could_not_be), 0, 0, 1, 0}, - {&__pyx_kp_s_PostGIS_type_not_supported, __pyx_k_PostGIS_type_not_supported, sizeof(__pyx_k_PostGIS_type_not_supported), 0, 0, 1, 0}, - {&__pyx_kp_s_PostgreSQL_0, __pyx_k_PostgreSQL_0, sizeof(__pyx_k_PostgreSQL_0), 0, 0, 1, 0}, - {&__pyx_kp_s_PostgreSQL_type_not_supported, __pyx_k_PostgreSQL_type_not_supported, sizeof(__pyx_k_PostgreSQL_type_not_supported), 0, 0, 1, 0}, - {&__pyx_kp_s_PostgresAdapter_Unable_to_connec, __pyx_k_PostgresAdapter_Unable_to_connec, sizeof(__pyx_k_PostgresAdapter_Unable_to_connec), 0, 0, 1, 0}, - {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 0, 1, 1}, - {&__pyx_n_s_S1, __pyx_k_S1, sizeof(__pyx_k_S1), 0, 0, 1, 1}, - {&__pyx_kp_s_Setting_shape_for_field_0_not_al, __pyx_k_Setting_shape_for_field_0_not_al, sizeof(__pyx_k_Setting_shape_for_field_0_not_al), 0, 0, 1, 0}, - {&__pyx_kp_s_Table_and_query_cannot_both_be_s, __pyx_k_Table_and_query_cannot_both_be_s, sizeof(__pyx_k_Table_and_query_cannot_both_be_s), 0, 0, 1, 0}, - {&__pyx_n_s_U, __pyx_k_U, sizeof(__pyx_k_U), 0, 0, 1, 1}, - {&__pyx_n_s_U1, __pyx_k_U1, sizeof(__pyx_k_U1), 0, 0, 1, 1}, - {&__pyx_kp_s_Unknown_PostGIS_point_size, __pyx_k_Unknown_PostGIS_point_size, sizeof(__pyx_k_Unknown_PostGIS_point_size), 0, 0, 1, 0}, - {&__pyx_kp_s_Users_dmertz_Projects_iopro_iop, __pyx_k_Users_dmertz_Projects_iopro_iop, sizeof(__pyx_k_Users_dmertz_Projects_iopro_iop), 0, 0, 1, 0}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0}, - {&__pyx_kp_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 0}, - {&__pyx_kp_s__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 0, 1, 0}, - {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, - {&__pyx_n_s_arange, __pyx_k_arange, sizeof(__pyx_k_arange), 0, 0, 1, 1}, - {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1}, - {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, - {&__pyx_n_s_ceil, __pyx_k_ceil, sizeof(__pyx_k_ceil), 0, 0, 1, 1}, - {&__pyx_n_s_check_connection, __pyx_k_check_connection, sizeof(__pyx_k_check_connection), 0, 0, 1, 1}, - {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, - {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, - {&__pyx_n_s_columns, __pyx_k_columns, sizeof(__pyx_k_columns), 0, 0, 1, 1}, - {&__pyx_n_s_connection_uri, __pyx_k_connection_uri, sizeof(__pyx_k_connection_uri), 0, 0, 1, 1}, - {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, - {&__pyx_n_s_dataframe, __pyx_k_dataframe, sizeof(__pyx_k_dataframe), 0, 0, 1, 1}, - {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_exceptions, __pyx_k_exceptions, sizeof(__pyx_k_exceptions), 0, 0, 1, 1}, - {&__pyx_n_s_f4, __pyx_k_f4, sizeof(__pyx_k_f4), 0, 0, 1, 1}, - {&__pyx_n_s_f8, __pyx_k_f8, sizeof(__pyx_k_f8), 0, 0, 1, 1}, - {&__pyx_n_s_field_filter, __pyx_k_field_filter, sizeof(__pyx_k_field_filter), 0, 0, 1, 1}, - {&__pyx_n_s_field_name, __pyx_k_field_name, sizeof(__pyx_k_field_name), 0, 0, 1, 1}, - {&__pyx_n_s_field_names, __pyx_k_field_names, sizeof(__pyx_k_field_names), 0, 0, 1, 1}, - {&__pyx_n_s_field_shapes, __pyx_k_field_shapes, sizeof(__pyx_k_field_shapes), 0, 0, 1, 1}, - {&__pyx_n_s_field_types, __pyx_k_field_types, sizeof(__pyx_k_field_types), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_get_default_types, __pyx_k_get_default_types, sizeof(__pyx_k_get_default_types), 0, 0, 1, 1}, - {&__pyx_n_s_get_field_names, __pyx_k_get_field_names, sizeof(__pyx_k_get_field_names), 0, 0, 1, 1}, - {&__pyx_n_s_get_field_shapes, __pyx_k_get_field_shapes, sizeof(__pyx_k_get_field_shapes), 0, 0, 1, 1}, - {&__pyx_n_s_get_field_types, __pyx_k_get_field_types, sizeof(__pyx_k_get_field_types), 0, 0, 1, 1}, - {&__pyx_n_s_i2, __pyx_k_i2, sizeof(__pyx_k_i2), 0, 0, 1, 1}, - {&__pyx_n_s_i4, __pyx_k_i4, sizeof(__pyx_k_i4), 0, 0, 1, 1}, - {&__pyx_n_s_i8, __pyx_k_i8, sizeof(__pyx_k_i8), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, - {&__pyx_kp_s_index_0_is_out_of_bounds, __pyx_k_index_0_is_out_of_bounds, sizeof(__pyx_k_index_0_is_out_of_bounds), 0, 0, 1, 0}, - {&__pyx_kp_s_index_must_be_slice_or_int, __pyx_k_index_must_be_slice_or_int, sizeof(__pyx_k_index_must_be_slice_or_int), 0, 0, 1, 0}, - {&__pyx_n_s_iopro_postgresadapter_PostgresAd, __pyx_k_iopro_postgresadapter_PostgresAd, sizeof(__pyx_k_iopro_postgresadapter_PostgresAd), 0, 0, 1, 1}, - {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, - {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1}, - {&__pyx_kp_s_length_of_types_list_does_not_ma, __pyx_k_length_of_types_list_does_not_ma, sizeof(__pyx_k_length_of_types_list_does_not_ma), 0, 0, 1, 0}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_make_unique_name, __pyx_k_make_unique_name, sizeof(__pyx_k_make_unique_name), 0, 0, 1, 1}, - {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1}, - {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, - {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, - {&__pyx_n_s_num_fields, __pyx_k_num_fields, sizeof(__pyx_k_num_fields), 0, 0, 1, 1}, - {&__pyx_n_s_num_records, __pyx_k_num_records, sizeof(__pyx_k_num_records), 0, 0, 1, 1}, - {&__pyx_kp_s_number_of_shapes_must_equal_numb, __pyx_k_number_of_shapes_must_equal_numb, sizeof(__pyx_k_number_of_shapes_must_equal_numb), 0, 0, 1, 0}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_n_s_numpy_char_width, __pyx_k_numpy_char_width, sizeof(__pyx_k_numpy_char_width), 0, 0, 1, 1}, - {&__pyx_n_s_pandas, __pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 0, 1, 1}, - {&__pyx_n_s_parse_slice, __pyx_k_parse_slice, sizeof(__pyx_k_parse_slice), 0, 0, 1, 1}, - {&__pyx_n_s_pd, __pyx_k_pd, sizeof(__pyx_k_pd), 0, 0, 1, 1}, - {&__pyx_n_s_pg_to_numpy_mapping, __pyx_k_pg_to_numpy_mapping, sizeof(__pyx_k_pg_to_numpy_mapping), 0, 0, 1, 1}, - {&__pyx_kp_s_postgresql_type_0_not_supported, __pyx_k_postgresql_type_0_not_supported, sizeof(__pyx_k_postgresql_type_0_not_supported), 0, 0, 1, 0}, - {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1}, - {&__pyx_n_s_query, __pyx_k_query, sizeof(__pyx_k_query), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_kp_s_select_0_from_1, __pyx_k_select_0_from_1, sizeof(__pyx_k_select_0_from_1), 0, 0, 1, 0}, - {&__pyx_n_s_set_field_names, __pyx_k_set_field_names, sizeof(__pyx_k_set_field_names), 0, 0, 1, 1}, - {&__pyx_n_s_set_field_names_locals_make_uniq, __pyx_k_set_field_names_locals_make_uniq, sizeof(__pyx_k_set_field_names_locals_make_uniq), 0, 0, 1, 1}, - {&__pyx_n_s_set_field_shapes, __pyx_k_set_field_shapes, sizeof(__pyx_k_set_field_shapes), 0, 0, 1, 1}, - {&__pyx_n_s_set_field_types, __pyx_k_set_field_types, sizeof(__pyx_k_set_field_types), 0, 0, 1, 1}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_n_s_suffix, __pyx_k_suffix, sizeof(__pyx_k_suffix), 0, 0, 1, 1}, - {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, - {&__pyx_n_s_table, __pyx_k_table, sizeof(__pyx_k_table), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_to_array, __pyx_k_to_array, sizeof(__pyx_k_to_array), 0, 0, 1, 1}, - {&__pyx_n_s_to_dataframe, __pyx_k_to_dataframe, sizeof(__pyx_k_to_dataframe), 0, 0, 1, 1}, - {&__pyx_n_s_u8, __pyx_k_u8, sizeof(__pyx_k_u8), 0, 0, 1, 1}, - {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, - {&__pyx_n_s_utf32, __pyx_k_utf32, sizeof(__pyx_k_utf32), 0, 0, 1, 1}, - {&__pyx_n_s_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 0, 1, 1}, - {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, - {&__pyx_kp_s_with_columns_0, __pyx_k_with_columns_0, sizeof(__pyx_k_with_columns_0), 0, 0, 1, 0}, - {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, - {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 136, __pyx_L1_error) - __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 468, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 182, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 331, __pyx_L1_error) - __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 342, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 543, __pyx_L1_error) - __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 626, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 930, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":222 - * cdef object unicode_obj = input_str.decode(encoding) - * - * utf_bytes = unicode_obj.encode('utf32') # <<<<<<<<<<<<<< - * cdef char *utf_bytes_ptr = utf_bytes - * - */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_utf32); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":331 - * """ - * if table is None and query is None: - * raise ValueError('Either table or query must be set') # <<<<<<<<<<<<<< - * if table is not None and query is not None: - * raise ValueError('Table and query cannot both be set') - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Either_table_or_query_must_be_se); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":333 - * raise ValueError('Either table or query must be set') - * if table is not None and query is not None: - * raise ValueError('Table and query cannot both be set') # <<<<<<<<<<<<<< - * - * if field_filter is not None and len(field_filter) == 0: - */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Table_and_query_cannot_both_be_s); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":338 - * field_filter = None - * if table is None and field_filter is not None: - * raise ValueError('Field filter cannot be set for query') # <<<<<<<<<<<<<< - * - * self._adapter = open_postgres_adapter(connection_uri.encode('utf8')) - */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Field_filter_cannot_be_set_for_q); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":340 - * raise ValueError('Field filter cannot be set for query') - * - * self._adapter = open_postgres_adapter(connection_uri.encode('utf8')) # <<<<<<<<<<<<<< - * if not self._adapter: - * raise IOError("PostgresAdapter: Unable to connect to %s" % connection_uri) - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":352 - * columns = ','.join(field_filter) - * query = 'select {0} from {1}'.format(columns, table) - * result = exec_query(self._adapter, query.encode('utf8')) # <<<<<<<<<<<<<< - * if result != ADAPTER_SUCCESS: - * msg = 'Could not perform query on table "{0}"'.format(table) - */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":362 - * raise ValueError(msg) - * else: - * result = exec_query(self._adapter, query.encode('utf8')) # <<<<<<<<<<<<<< - * msg = 'Could not perform query "{0}".'.format(query) - * if self._adapter.result_error_msg != NULL: - */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 362, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":390 - * def _check_connection(self): - * if self._adapter == NULL: - * raise RuntimeError('Connection already closed. ' # <<<<<<<<<<<<<< - * 'Please create a new adapter.') - * - */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Connection_already_closed_Please); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 390, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":431 - * names = None - * - * def make_unique_name(field_name): # <<<<<<<<<<<<<< - * suffix = 1 - * while field_name + str(suffix) in self._field_names: - */ - __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_field_name, __pyx_n_s_suffix); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dmertz_Projects_iopro_iop, __pyx_n_s_make_unique_name, 431, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 431, __pyx_L1_error) - - /* "iopro/postgresadapter/PostgresAdapter.pyx":465 - * else: -<<<<<<< HEAD - * if len(names) != self.num_***REMOVED*** -======= - * if len(names) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('Number of field names does not match number of fields') # <<<<<<<<<<<<<< - * self._field_names = names - * - */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Number_of_field_names_does_not_m); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":581 - * else: -<<<<<<< HEAD - * if len(types) != self.num_***REMOVED*** -======= - * if len(types) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('length of types list does not match the number of fields') # <<<<<<<<<<<<<< - * self._field_types = types - * - */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_length_of_types_list_does_not_ma); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":612 - * cdef int has_srid - * if self._dataframe_result: - * raise RuntimeError('Field shape cannot be set when outputing to dataframe') # <<<<<<<<<<<<<< - * self._check_connection() - * - */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Field_shape_cannot_be_set_when_o); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 612, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":625 - * if not isinstance(shapes, dict): -<<<<<<< HEAD - * if len(shapes) != self.num_***REMOVED*** -======= - * if len(shapes) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - * raise ValueError('number of shapes must equal number of fields') # <<<<<<<<<<<<<< - * shapes = dict(zip(range(len(shapes)), shapes)) - * - */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_number_of_shapes_must_equal_numb); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":639 - * if isinstance(value, (int, long)): - * if value < 1: - * raise ValueError('Field shape must be greater than 0') # <<<<<<<<<<<<<< - * elif isinstance(value, (list, tuple)): - * for x in value: - */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Field_shape_must_be_greater_than); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":643 - * for x in value: - * if x < 1: - * raise ValueError('Field shape values must be greater than 0') # <<<<<<<<<<<<<< - * else: - * raise ValueError('Field shape must be int, list, or tuple') - */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Field_shape_values_must_be_great); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":645 - * raise ValueError('Field shape values must be greater than 0') - * else: - * raise ValueError('Field shape must be int, list, or tuple') # <<<<<<<<<<<<<< - * - * # field shape for geometric types that contain points will always - */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Field_shape_must_be_int_list_or); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":653 - * if field_type in [PATHOID, POLYGONOID]: - * if not isinstance(value, int): - * raise ValueError('Field shape for path or polygon must be int') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value, 2) - * elif field_type == self._adapter.postgis_geometry_oid: - */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Field_shape_for_path_or_polygon); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 653, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":660 - * gis_point_size = get_gis_point_size(gis_field_type) - * if gis_point_size == -1: - * raise ValueError('Unknown PostGIS point size') # <<<<<<<<<<<<<< - * if gis_field_type in [GIS_LINE2D, GIS_LINE3D, GIS_LINE4D]: - * if not isinstance(value, int): - */ - __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Unknown_PostGIS_point_size); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":663 - * if gis_field_type in [GIS_LINE2D, GIS_LINE3D, GIS_LINE4D]: - * if not isinstance(value, int): - * raise ValueError('Field shape for PostGIS line must be int') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_POLYGON2D, GIS_POLYGON3D, GIS_POLYGON4D]: - */ - __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Field_shape_for_PostGIS_line_mus); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":667 - * elif gis_field_type in [GIS_POLYGON2D, GIS_POLYGON3D, GIS_POLYGON4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 2: - * raise ValueError('Field shape for PostGIS polygon must have 2 dimensions') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOINT2D, GIS_MULTIPOINT3D, GIS_MULTIPOINT4D]: - */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_Field_shape_for_PostGIS_polygon); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":671 - * elif gis_field_type in [GIS_MULTIPOINT2D, GIS_MULTIPOINT3D, GIS_MULTIPOINT4D]: - * if not isinstance(value, int): - * raise ValueError('Field shape for PostGIS multipoint must be int') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value, gis_point_size) - * elif gis_field_type in [GIS_MULTILINE2D, GIS_MULTILINE3D, GIS_MULTILINE4D]: - */ - __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_Field_shape_for_PostGIS_multipoi); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":675 - * elif gis_field_type in [GIS_MULTILINE2D, GIS_MULTILINE3D, GIS_MULTILINE4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 2: - * raise ValueError('Field shape for PostGIS multiline must have 2 dimensions') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value[0], value[1], gis_point_size) - * elif gis_field_type in [GIS_MULTIPOLYGON2D, GIS_MULTIPOLYGON3D, GIS_MULTIPOLYGON4D]: - */ - __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_Field_shape_for_PostGIS_multilin); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":679 - * elif gis_field_type in [GIS_MULTIPOLYGON2D, GIS_MULTIPOLYGON3D, GIS_MULTIPOLYGON4D]: - * if not isinstance(value, (list, tuple)) or len(value) != 3: - * raise ValueError('Field shape for GIS multipolygon must have 3 dimensions') # <<<<<<<<<<<<<< - * self._field_shapes[index] = (value[0], value[1], value[2], gis_point_size) - * else: - */ - __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_Field_shape_for_GIS_multipolygon); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 679, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":930 - * - * else: - * raise IndexError('index must be slice or int') # <<<<<<<<<<<<<< - */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_index_must_be_slice_or_int); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":218 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":222 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":259 - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":799 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == c'>' and little_endian) or - */ - __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(1, 799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":803 - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 803, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":823 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__34); - __Pyx_GIVEREF(__pyx_tuple__34); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":136 - * CIRCLEOID: 'f8'} - * - * exceptions = {ADAPTER_ERROR_INVALID_QUERY: RuntimeError('Invalid PostgreSQL query'), # <<<<<<<<<<<<<< - * ADAPTER_ERROR_INVALID_QUERY_VALUE: RuntimeError('Invalid PostgreSQL query result'), - * ADAPTER_ERROR_INVALID_TYPE: RuntimeError('PostgreSQL type not supported'), - */ - __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_Invalid_PostgreSQL_query); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":137 - * - * exceptions = {ADAPTER_ERROR_INVALID_QUERY: RuntimeError('Invalid PostgreSQL query'), - * ADAPTER_ERROR_INVALID_QUERY_VALUE: RuntimeError('Invalid PostgreSQL query result'), # <<<<<<<<<<<<<< - * ADAPTER_ERROR_INVALID_TYPE: RuntimeError('PostgreSQL type not supported'), - * ADAPTER_ERROR_INVALID_GIS_TYPE: RuntimeError('PostGIS type not supported'), - */ - __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_Invalid_PostgreSQL_query_result); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__36); - __Pyx_GIVEREF(__pyx_tuple__36); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":138 - * exceptions = {ADAPTER_ERROR_INVALID_QUERY: RuntimeError('Invalid PostgreSQL query'), - * ADAPTER_ERROR_INVALID_QUERY_VALUE: RuntimeError('Invalid PostgreSQL query result'), - * ADAPTER_ERROR_INVALID_TYPE: RuntimeError('PostgreSQL type not supported'), # <<<<<<<<<<<<<< - * ADAPTER_ERROR_INVALID_GIS_TYPE: RuntimeError('PostGIS type not supported'), - * ADAPTER_ERROR_PARSE_GIS: RuntimeError('PostGIS field data could not be parsed')} - */ - __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_PostgreSQL_type_not_supported); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":139 - * ADAPTER_ERROR_INVALID_QUERY_VALUE: RuntimeError('Invalid PostgreSQL query result'), - * ADAPTER_ERROR_INVALID_TYPE: RuntimeError('PostgreSQL type not supported'), - * ADAPTER_ERROR_INVALID_GIS_TYPE: RuntimeError('PostGIS type not supported'), # <<<<<<<<<<<<<< - * ADAPTER_ERROR_PARSE_GIS: RuntimeError('PostGIS field data could not be parsed')} - * - */ - __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_PostGIS_type_not_supported); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__38); - __Pyx_GIVEREF(__pyx_tuple__38); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":140 - * ADAPTER_ERROR_INVALID_TYPE: RuntimeError('PostgreSQL type not supported'), - * ADAPTER_ERROR_INVALID_GIS_TYPE: RuntimeError('PostGIS type not supported'), - * ADAPTER_ERROR_PARSE_GIS: RuntimeError('PostGIS field data could not be parsed')} # <<<<<<<<<<<<<< - * - * cdef public PyObject* create_list(void **output): - */ - __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_PostGIS_field_data_could_not_be); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initPostgresAdapter(void); /*proto*/ -PyMODINIT_FUNC initPostgresAdapter(void) -#else -PyMODINIT_FUNC PyInit_PostgresAdapter(void); /*proto*/ -PyMODINIT_FUNC PyInit_PostgresAdapter(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __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_PostgresAdapter(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __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("PostgresAdapter", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_iopro__postgresadapter__PostgresAdapter) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "iopro.postgresadapter.PostgresAdapter")) { - if (unlikely(PyDict_SetItemString(modules, "iopro.postgresadapter.PostgresAdapter", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter) < 0) __PYX_ERR(0, 281, __pyx_L1_error) - __pyx_type_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 281, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_28__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_28__getitem__.doc = __pyx_doc_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_28__getitem__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5iopro_15postgresadapter_15PostgresAdapter_15PostgresAdapter_28__getitem__; - } - } - #endif - if (PyObject_SetAttrString(__pyx_m, "PostgresAdapter", (PyObject *)&__pyx_type_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter) < 0) __PYX_ERR(0, 281, __pyx_L1_error) - __pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter = &__pyx_type_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter; - if (PyType_Ready(&__pyx_type_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names) < 0) __PYX_ERR(0, 417, __pyx_L1_error) - __pyx_type_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names.tp_print = 0; - __pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names = &__pyx_type_5iopro_15postgresadapter_15PostgresAdapter___pyx_scope_struct__set_field_names; - /*--- Type import code ---*/ - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", - #if CYTHON_COMPILING_IN_PYPY - sizeof(PyTypeObject), - #else - sizeof(PyHeapTypeObject), - #endif - 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 155, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 168, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 172, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 181, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 861, __pyx_L1_error) - /*--- Variable import code ---*/ - /*--- Function import code ---*/ - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "iopro/postgresadapter/PostgresAdapter.pyx":2 - * from __future__ import division - * import numpy # <<<<<<<<<<<<<< - * cimport numpy - * from cpython.ref cimport Py_INCREF, Py_DECREF, PyObject - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":5 - * cimport numpy - * from cpython.ref cimport Py_INCREF, Py_DECREF, PyObject - * import sys # <<<<<<<<<<<<<< - * from libc.string cimport memcpy, memset - * from libc.stdlib cimport calloc, free - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":9 - * from libc.stdlib cimport calloc, free - * from libc.stdio cimport printf - * import math # <<<<<<<<<<<<<< - * import pandas as pd - * from collections import OrderedDict - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_math, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":10 - * from libc.stdio cimport printf - * import math - * import pandas as pd # <<<<<<<<<<<<<< - * from collections import OrderedDict - * - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_pandas, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pd, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":11 - * import math - * import pandas as pd - * from collections import OrderedDict # <<<<<<<<<<<<<< - * - * numpy.import_array() - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_OrderedDict); - __Pyx_GIVEREF(__pyx_n_s_OrderedDict); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_OrderedDict); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_OrderedDict, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":13 - * from collections import OrderedDict - * - * numpy.import_array() # <<<<<<<<<<<<<< - * - * # Numpy unicode strings should always be 4 bytes per character, - */ - import_array(); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":17 - * # Numpy unicode strings should always be 4 bytes per character, - * # but check just in case - * numpy_char_width = numpy.array(['x'], dtype='U1').itemsize # <<<<<<<<<<<<<< - * - * cdef extern from '_stdint.h': - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_x); - __Pyx_GIVEREF(__pyx_n_s_x); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_x); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_n_s_U1) < 0) __PYX_ERR(0, 17, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy_char_width, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":117 - * # Mapping that specifies which numpy dtype to - * # convert each postgres column type to - * pg_to_numpy_mapping = {BOOLOID: 'B', # <<<<<<<<<<<<<< - * CHAROID: 'S1', - * INT8OID: 'i8', - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_From_int(BOOLOID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_B) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":118 - * # convert each postgres column type to - * pg_to_numpy_mapping = {BOOLOID: 'B', - * CHAROID: 'S1', # <<<<<<<<<<<<<< - * INT8OID: 'i8', - * INT2OID: 'i2', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(CHAROID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_S1) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":119 - * pg_to_numpy_mapping = {BOOLOID: 'B', - * CHAROID: 'S1', - * INT8OID: 'i8', # <<<<<<<<<<<<<< - * INT2OID: 'i2', - * INT4OID: 'i4', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(INT8OID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_i8) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":120 - * CHAROID: 'S1', - * INT8OID: 'i8', - * INT2OID: 'i2', # <<<<<<<<<<<<<< - * INT4OID: 'i4', - * FLOAT4OID: 'f4', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(INT2OID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_i2) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":121 - * INT8OID: 'i8', - * INT2OID: 'i2', - * INT4OID: 'i4', # <<<<<<<<<<<<<< - * FLOAT4OID: 'f4', - * FLOAT8OID: 'f8', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(INT4OID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_i4) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":122 - * INT2OID: 'i2', - * INT4OID: 'i4', - * FLOAT4OID: 'f4', # <<<<<<<<<<<<<< - * FLOAT8OID: 'f8', - * BPCHAROID: 'U', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(FLOAT4OID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_f4) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":123 - * INT4OID: 'i4', - * FLOAT4OID: 'f4', - * FLOAT8OID: 'f8', # <<<<<<<<<<<<<< - * BPCHAROID: 'U', - * VARCHAROID: 'U', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(FLOAT8OID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_f8) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":124 - * FLOAT4OID: 'f4', - * FLOAT8OID: 'f8', - * BPCHAROID: 'U', # <<<<<<<<<<<<<< - * VARCHAROID: 'U', - * TEXTOID: 'O', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(BPCHAROID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_U) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":125 - * FLOAT8OID: 'f8', - * BPCHAROID: 'U', - * VARCHAROID: 'U', # <<<<<<<<<<<<<< - * TEXTOID: 'O', - * #NUMERICOID: 'O', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(VARCHAROID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_U) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":126 - * BPCHAROID: 'U', - * VARCHAROID: 'U', - * TEXTOID: 'O', # <<<<<<<<<<<<<< - * #NUMERICOID: 'O', - * POINTOID: 'f8', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(TEXTOID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_O) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":128 - * TEXTOID: 'O', - * #NUMERICOID: 'O', - * POINTOID: 'f8', # <<<<<<<<<<<<<< - * LINEOID: 'f8', - * LSEGOID: 'f8', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(POINTOID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_f8) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":129 - * #NUMERICOID: 'O', - * POINTOID: 'f8', - * LINEOID: 'f8', # <<<<<<<<<<<<<< - * LSEGOID: 'f8', - * BOXOID: 'f8', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(LINEOID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_f8) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":130 - * POINTOID: 'f8', - * LINEOID: 'f8', - * LSEGOID: 'f8', # <<<<<<<<<<<<<< - * BOXOID: 'f8', - * PATHOID: 'f8', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(LSEGOID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_f8) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":131 - * LINEOID: 'f8', - * LSEGOID: 'f8', - * BOXOID: 'f8', # <<<<<<<<<<<<<< - * PATHOID: 'f8', - * POLYGONOID: 'f8', - */ - __pyx_t_4 = __Pyx_PyInt_From_int(BOXOID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_f8) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":132 - * LSEGOID: 'f8', - * BOXOID: 'f8', - * PATHOID: 'f8', # <<<<<<<<<<<<<< - * POLYGONOID: 'f8', - * CIRCLEOID: 'f8'} - */ - __pyx_t_4 = __Pyx_PyInt_From_int(PATHOID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_f8) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":133 - * BOXOID: 'f8', - * PATHOID: 'f8', - * POLYGONOID: 'f8', # <<<<<<<<<<<<<< - * CIRCLEOID: 'f8'} - * - */ - __pyx_t_4 = __Pyx_PyInt_From_int(POLYGONOID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_f8) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":134 - * PATHOID: 'f8', - * POLYGONOID: 'f8', - * CIRCLEOID: 'f8'} # <<<<<<<<<<<<<< - * - * exceptions = {ADAPTER_ERROR_INVALID_QUERY: RuntimeError('Invalid PostgreSQL query'), - */ - __pyx_t_4 = __Pyx_PyInt_From_int(CIRCLEOID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_n_s_f8) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pg_to_numpy_mapping, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":136 - * CIRCLEOID: 'f8'} - * - * exceptions = {ADAPTER_ERROR_INVALID_QUERY: RuntimeError('Invalid PostgreSQL query'), # <<<<<<<<<<<<<< - * ADAPTER_ERROR_INVALID_QUERY_VALUE: RuntimeError('Invalid PostgreSQL query result'), - * ADAPTER_ERROR_INVALID_TYPE: RuntimeError('PostgreSQL type not supported'), - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_INVALID_QUERY); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_t_3) < 0) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":137 - * - * exceptions = {ADAPTER_ERROR_INVALID_QUERY: RuntimeError('Invalid PostgreSQL query'), - * ADAPTER_ERROR_INVALID_QUERY_VALUE: RuntimeError('Invalid PostgreSQL query result'), # <<<<<<<<<<<<<< - * ADAPTER_ERROR_INVALID_TYPE: RuntimeError('PostgreSQL type not supported'), - * ADAPTER_ERROR_INVALID_GIS_TYPE: RuntimeError('PostGIS type not supported'), - */ - __pyx_t_3 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_INVALID_QUERY_VALUE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_4) < 0) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":138 - * exceptions = {ADAPTER_ERROR_INVALID_QUERY: RuntimeError('Invalid PostgreSQL query'), - * ADAPTER_ERROR_INVALID_QUERY_VALUE: RuntimeError('Invalid PostgreSQL query result'), - * ADAPTER_ERROR_INVALID_TYPE: RuntimeError('PostgreSQL type not supported'), # <<<<<<<<<<<<<< - * ADAPTER_ERROR_INVALID_GIS_TYPE: RuntimeError('PostGIS type not supported'), - * ADAPTER_ERROR_PARSE_GIS: RuntimeError('PostGIS field data could not be parsed')} - */ - __pyx_t_4 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_INVALID_TYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_t_3) < 0) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":139 - * ADAPTER_ERROR_INVALID_QUERY_VALUE: RuntimeError('Invalid PostgreSQL query result'), - * ADAPTER_ERROR_INVALID_TYPE: RuntimeError('PostgreSQL type not supported'), - * ADAPTER_ERROR_INVALID_GIS_TYPE: RuntimeError('PostGIS type not supported'), # <<<<<<<<<<<<<< - * ADAPTER_ERROR_PARSE_GIS: RuntimeError('PostGIS field data could not be parsed')} - * - */ - __pyx_t_3 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_INVALID_GIS_TYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_4) < 0) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":140 - * ADAPTER_ERROR_INVALID_TYPE: RuntimeError('PostgreSQL type not supported'), - * ADAPTER_ERROR_INVALID_GIS_TYPE: RuntimeError('PostGIS type not supported'), - * ADAPTER_ERROR_PARSE_GIS: RuntimeError('PostGIS field data could not be parsed')} # <<<<<<<<<<<<<< - * - * cdef public PyObject* create_list(void **output): - */ - __pyx_t_4 = __Pyx_PyInt_From_AdapterError(ADAPTER_ERROR_PARSE_GIS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_t_3) < 0) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_exceptions, __pyx_t_2) < 0) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "iopro/postgresadapter/PostgresAdapter.pyx":468 - * self._field_names = names - * - * field_names = property(get_field_names, set_field_names) # <<<<<<<<<<<<<< - * - * def _get_default_types(self): - */ - __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, __pyx_n_s_get_field_names); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, __pyx_n_s_set_field_names); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 468, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 468, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 468, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter->tp_dict, __pyx_n_s_field_names, __pyx_t_3) < 0) __PYX_ERR(0, 468, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - PyType_Modified(__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":584 - * self._field_types = types - * - * field_types = property(get_field_types, set_field_types) # <<<<<<<<<<<<<< - * - * def get_field_shapes(self): - */ - __pyx_t_3 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, __pyx_n_s_get_field_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, __pyx_n_s_set_field_types); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter->tp_dict, __pyx_n_s_field_types, __pyx_t_4) < 0) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - PyType_Modified(__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":686 - * raise ValueError('Setting shape for field "{0}" not allowed.'.format(index)) - * - * field_shapes = property(get_field_shapes, set_field_shapes) # <<<<<<<<<<<<<< - * - * def _parse_slice(self, start, stop, step): - */ - __pyx_t_4 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, __pyx_n_s_get_field_shapes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 686, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter, __pyx_n_s_set_field_shapes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 686, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_4 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter->tp_dict, __pyx_n_s_field_shapes, __pyx_t_2) < 0) __PYX_ERR(0, 686, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyType_Modified(__pyx_ptype_5iopro_15postgresadapter_15PostgresAdapter_PostgresAdapter); - - /* "iopro/postgresadapter/PostgresAdapter.pyx":1 - * from __future__ import division # <<<<<<<<<<<<<< - * import numpy - * cimport numpy - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "../../anaconda/envs/iopro/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":976 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - - /*--- Wrapped vars code ---*/ - - 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_4); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init iopro.postgresadapter.PostgresAdapter", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init iopro.postgresadapter.PostgresAdapter"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#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 - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* PyErrFetchRestore */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - 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_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* WriteUnraisableException */ -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; -#endif -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); - } - #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); - } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); -#endif -} - -/* decode_c_string */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; - } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - } - length = stop - start; - if (unlikely(length <= 0)) - return PyUnicode_FromUnicode(NULL, 0); - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); - } -} - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyObjectCallMethod1 */ - static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { - PyObject *method, *result = NULL; - method = __Pyx_PyObject_GetAttrStr(obj, method_name); - if (unlikely(!method)) goto bad; -#if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyMethod_Check(method))) { - PyObject *self = PyMethod_GET_SELF(method); - if (likely(self)) { - PyObject *args; - PyObject *function = PyMethod_GET_FUNCTION(method); - args = PyTuple_New(2); - if (unlikely(!args)) goto bad; - Py_INCREF(self); - PyTuple_SET_ITEM(args, 0, self); - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 1, arg); - Py_INCREF(function); - Py_DECREF(method); method = NULL; - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); - return result; - } - } -#endif - result = __Pyx_PyObject_CallOneArg(method, arg); -bad: - Py_XDECREF(method); - return result; -} - -/* append */ - static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; - } else { - PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); - if (unlikely(!retval)) - return -1; - Py_DECREF(retval); - } - return 0; -} - -/* PyIntBinop */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - if (op1 == op2) { - Py_RETURN_TRUE; - } - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long a = PyInt_AS_LONG(op1); - if (a == b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3 - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a; - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15 - default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ); - #else - default: Py_RETURN_FALSE; - #endif - } - } - if (a == b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - if ((double)a == (double)b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - return PyObject_RichCompare(op1, op2, Py_EQ); -} -#endif - -/* GetModuleGlobalName */ - static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* SliceObject */ - static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, - Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { -#if CYTHON_COMPILING_IN_CPYTHON - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; - } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; - } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; - } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - goto bad; - PyErr_Clear(); - } - } - return ms->sq_slice(obj, cstart, cstop); - } -#endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_subscript)) -#endif - { - PyObject* result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; - } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; - } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; - } -#if CYTHON_COMPILING_IN_CPYTHON - result = mp->mp_subscript(obj, py_slice); -#else - result = PyObject_GetItem(obj, py_slice); -#endif - if (!_py_slice) { - Py_DECREF(py_slice); - } - return result; - } - PyErr_Format(PyExc_TypeError, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); -bad: - return NULL; -} - -/* SliceObject */ - static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value, - Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { -#if CYTHON_COMPILING_IN_CPYTHON - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_ass_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; - } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; - } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; - } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - goto bad; - PyErr_Clear(); - } - } - return ms->sq_ass_slice(obj, cstart, cstop, value); - } -#endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_ass_subscript)) -#endif - { - int result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; - } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; - } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; - } -#if CYTHON_COMPILING_IN_CPYTHON - result = mp->mp_ass_subscript(obj, py_slice, value); -#else - result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice); -#endif - if (!_py_slice) { - Py_DECREF(py_slice); - } - return result; - } - PyErr_Format(PyExc_TypeError, - "'%.200s' object does not support slice %.10s", - Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion"); -bad: - return -1; -} - -/* GetItemInt */ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_COMPILING_IN_CPYTHON - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_COMPILING_IN_CPYTHON - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_COMPILING_IN_CPYTHON - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* RaiseDoubleKeywords */ - 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_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ - 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; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* RaiseArgTupleInvalid */ - 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, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - 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; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - 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)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } -#if PY_VERSION_HEX >= 0x03030000 - if (cause) { -#else - if (cause && cause != Py_None) { -#endif - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else 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; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - 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); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* SetItemInt */ - static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, - CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_COMPILING_IN_CPYTHON - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); - if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { - PyObject* old = PyList_GET_ITEM(o, n); - Py_INCREF(v); - PyList_SET_ITEM(o, n, v); - Py_DECREF(old); - return 1; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_ass_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return -1; - PyErr_Clear(); - } - } - return m->sq_ass_item(o, i, v); - } - } -#else -#if CYTHON_COMPILING_IN_PYPY - if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) { -#else - if (is_list || PySequence_Check(o)) { -#endif - return PySequence_SetItem(o, i, v); - } -#endif - return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); -} - -/* StringJoin */ - #if !CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { - return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); -} -#endif - -/* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -#endif -} - -/* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* None */ - static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { - PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); -} - -/* PyIntBinop */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3 - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - } - x = a + b; - return PyLong_FromLong(x); - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); -} -#endif - -/* FetchCommonType */ - static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); - if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); - goto bad; - } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); - goto bad; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; - } -done: - Py_DECREF(fake_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} - -/* CythonFunction */ - static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) -{ - if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); -#endif - if (unlikely(op->func_doc == NULL)) - return NULL; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - Py_INCREF(op->func_doc); - return op->func_doc; -} -static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp = op->func_doc; - if (value == NULL) { - value = Py_None; - } - Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); -#else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); -#endif - if (unlikely(op->func_name == NULL)) - return NULL; - } - Py_INCREF(op->func_name); - return op->func_name; -} -static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - tmp = op->func_name; - Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) -{ - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - tmp = op->func_qualname; - Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_dict == NULL)) { - op->func_dict = PyDict_New(); - if (unlikely(op->func_dict == NULL)) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - tmp = op->func_dict; - Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) -{ - Py_INCREF(op->func_globals); - return op->func_globals; -} -static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) -{ - Py_INCREF(Py_None); - return Py_None; -} -static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) -{ - PyObject* result = (op->func_code) ? op->func_code : Py_None; - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { - int result = 0; - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - #if CYTHON_COMPILING_IN_CPYTHON - op->defaults_tuple = PyTuple_GET_ITEM(res, 0); - Py_INCREF(op->defaults_tuple); - op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); - Py_INCREF(op->defaults_kwdict); - #else - op->defaults_tuple = PySequence_ITEM(res, 0); - if (unlikely(!op->defaults_tuple)) result = -1; - else { - op->defaults_kwdict = PySequence_ITEM(res, 1); - if (unlikely(!op->defaults_kwdict)) result = -1; - } - #endif - Py_DECREF(res); - return result; -} -static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_tuple; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_tuple; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__kwdefaults__ must be set to a dict object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_kwdict; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_kwdict; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value || value == Py_None) { - value = NULL; - } else if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__annotations__ must be set to a dict object"); - return -1; - } - Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { - PyObject* result = op->func_annotations; - if (unlikely(!result)) { - result = PyDict_New(); - if (unlikely(!result)) return NULL; - op->func_annotations = result; - } - Py_INCREF(result); - return result; -} -static PyGetSetDef __pyx_CyFunction_getsets[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, - {0, 0, 0, 0, 0} -}; -static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, - {0, 0, 0, 0, 0} -}; -static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(m->func.m_ml->ml_name); -#else - return PyString_FromString(m->func.m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -#if PY_VERSION_HEX < 0x030500A0 -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) -#else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) -#endif -static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); - if (op == NULL) - return NULL; - op->flags = flags; - __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; - Py_XINCREF(closure); - op->func_closure = closure; - Py_XINCREF(module); - op->func.m_module = module; - op->func_dict = NULL; - op->func_name = NULL; - Py_INCREF(qualname); - op->func_qualname = qualname; - op->func_doc = NULL; - op->func_classobj = NULL; - op->func_globals = globals; - Py_INCREF(op->func_globals); - Py_XINCREF(code); - op->func_code = code; - op->defaults_pyobjects = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - PyObject_GC_Track(op); - return (PyObject *) op; -} -static int -__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) -{ - Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_globals); - Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); - Py_CLEAR(m->defaults_tuple); - Py_CLEAR(m->defaults_kwdict); - Py_CLEAR(m->func_annotations); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyObject_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); -} -static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_globals); - Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); - Py_VISIT(m->defaults_tuple); - Py_VISIT(m->defaults_kwdict); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; - return __Pyx_PyMethod_New(func, obj, type); -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -#if CYTHON_COMPILING_IN_PYPY -static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = f->m_ml->ml_meth; - PyObject *self = f->m_self; - Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { - case METH_VARARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 0)) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 1)) { - PyObject *result, *arg0 = PySequence_ITEM(arg, 0); - if (unlikely(!arg0)) return NULL; - result = (*meth)(self, arg0); - Py_DECREF(arg0); - return result; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); - return NULL; - } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; -} -#else -static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return PyCFunction_Call(func, arg, kw); -} -#endif -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, - 0, - 0, - 0, -#if PY_MAJOR_VERSION < 3 - 0, -#else - 0, -#endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_Call, - 0, - 0, - 0, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), -#endif - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_CyFunction_descr_get, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -}; -static int __pyx_CyFunction_init(void) { -#if !CYTHON_COMPILING_IN_PYPY - __pyx_CyFunctionType_type.tp_call = PyCFunction_Call; -#endif - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); - if (__pyx_CyFunctionType == NULL) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (!m->defaults) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -/* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* IterFinish */ - static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); - PyObject* exc_type = tstate->curexc_type; - if (unlikely(exc_type)) { - if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { - return -1; - } - } - return 0; -#endif -} - -/* UnpackItemEndCheck */ - static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else { - return __Pyx_IterFinish(); - } - return 0; -} - -/* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(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; -} - -/* PyIntBinop */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a - b); - if (likely((x^a) >= 0 || (x^~b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3 - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - } - x = a - b; - return PyLong_FromLong(x); - long_long: - llx = lla - llb; - return PyLong_FromLongLong(llx); - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("subtract", return NULL) - result = ((double)a) - (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); -} -#endif - -/* PyIntBinop */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op2))) { - const long a = intval; - long x; - long b = PyInt_AS_LONG(op2); - x = (long)((unsigned long)a - b); - if (likely((x^a) >= 0 || (x^~b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3 - if (likely(PyLong_CheckExact(op2))) { - const long a = intval; - long b, x; - const PY_LONG_LONG lla = intval; - PY_LONG_LONG llb, llx; - const digit* digits = ((PyLongObject*)op2)->ob_digit; - const Py_ssize_t size = Py_SIZE(op2); - if (likely(__Pyx_sst_abs(size) <= 1)) { - b = likely(size) ? digits[0] : 0; - if (size == -1) b = -b; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - } - default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - } - x = a - b; - return PyLong_FromLong(x); - long_long: - llx = lla - llb; - return PyLong_FromLongLong(llx); - } - #endif - if (PyFloat_CheckExact(op2)) { - const long a = intval; - double b = PyFloat_AS_DOUBLE(op2); - double result; - PyFPE_START_PROTECT("subtract", return NULL) - result = ((double)a) - (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); -} -#endif - -/* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - 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_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - #endif - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_VERSION_HEX < 0x03030000 - 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 - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_VERSION_HEX < 0x03030000 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -/* GetNameInClass */ - static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) { - PyObject *result; - result = __Pyx_PyObject_GetAttrStr(nmspace, name); - if (!result) - result = __Pyx_GetModuleGlobalName(name); - return result; -} - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #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_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __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,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - py_frame->f_lineno = py_line; - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_AdapterError(AdapterError value) { - const AdapterError neg_one = (AdapterError) -1, const_zero = (AdapterError) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(AdapterError) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(AdapterError) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(AdapterError) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(AdapterError) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(AdapterError) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(AdapterError), - little, !is_unsigned); - } -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) { - const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(uint32_t) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(uint32_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(uint32_t) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(uint32_t), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* None */ - #if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return ::std::complex< float >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -/* None */ - #if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrtf(z.real*z.real + z.imag*z.imag); - #else - return hypotf(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - float denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(a, a); - case 3: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(z, a); - case 4: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_absf(a); - theta = atan2f(a.imag, a.real); - } - lnr = logf(r); - z_r = expf(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cosf(z_theta); - z.imag = z_r * sinf(z_theta); - return z; - } - #endif -#endif - -/* None */ - #if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return ::std::complex< double >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -/* None */ - #if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrt(z.real*z.real + z.imag*z.imag); - #else - return hypot(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - double denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(a, a); - case 3: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(z, a); - case 4: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_abs(a); - theta = atan2(a.imag, a.real); - } - lnr = log(r); - z_r = exp(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cos(z_theta); - z.imag = z_r * sin(z_theta); - return z; - } - #endif -#endif - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { - const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(enum NPY_TYPES) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); - } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); - } - } else { - if (sizeof(enum NPY_TYPES) <= sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - 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; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { - const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(size_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (size_t) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) - case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { - return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { - return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { - return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (size_t) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(size_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) - case -2: - if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { - return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); - } - } - break; - } -#endif - if (sizeof(size_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) - } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - size_t val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - 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; - } -#endif - return (size_t) -1; - } - } else { - size_t val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (size_t) -1; - val = __Pyx_PyInt_As_size_t(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to size_t"); - return (size_t) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - 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; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CheckBinaryVersion */ - 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); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* ModuleImport */ - #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; - py_name = __Pyx_PyIdentifier_FromString(name); - 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 - -/* TypeImport */ - #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_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - py_name = __Pyx_PyIdentifier_FromString(class_name); - 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, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (!strict && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - else if ((size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return NULL; -} -#endif - -/* InitStrings */ - 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 - 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; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -#endif - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -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_IntOrLong(PyObject* x) { - PyNumberMethods *m; - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return __Pyx_NewRef(x); - m = Py_TYPE(x)->tp_as_number; -#if PY_MAJOR_VERSION < 3 - 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_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (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; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - 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) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/iopro/postgresadapter/PostgresAdapter.pyx b/iopro/postgresadapter/PostgresAdapter.pyx deleted file mode 100644 index a18d773..0000000 --- a/iopro/postgresadapter/PostgresAdapter.pyx +++ /dev/null @@ -1,946 +0,0 @@ -from __future__ import division -import numpy -cimport numpy -from cpython.ref cimport Py_INCREF, Py_DECREF, PyObject -import sys -from libc.string cimport memcpy, memset -from libc.stdlib cimport calloc, free -from libc.stdio cimport printf -import math -import pandas as pd -from collections import OrderedDict - -numpy.import_array() - -# Numpy unicode strings should always be 4 bytes per character, -# but check just in case -numpy_char_width = numpy.array(['x'], dtype='U1').itemsize - -cdef extern from '_stdint.h': - # Actual type lengths are defined in _stdint.h - # Sizes here are just place holders - ctypedef unsigned long long uint64_t - ctypedef unsigned int uint32_t - ctypedef unsigned short uint16_t - ctypedef unsigned char uint8_t - ctypedef long long int64_t - ctypedef int int32_t - ctypedef short int16_t - ctypedef char int8_t - -cdef extern from 'postgres_adapter.h': - ctypedef struct postgres_adapter_t: - const char *client_encoding - PGresult *result - char *result_error_msg - int postgis_geometry_oid - ctypedef enum AdapterError: - ADAPTER_SUCCESS - ADAPTER_ERROR_INVALID_QUERY - ADAPTER_ERROR_INVALID_QUERY_VALUE - ADAPTER_ERROR_INVALID_TYPE - ADAPTER_ERROR_INVALID_GIS_TYPE - ADAPTER_ERROR_PARSE_GIS - cdef int BOOLOID - cdef int CHAROID - cdef int INT8OID - cdef int INT2OID - cdef int INT4OID - cdef int TEXTOID - cdef int FLOAT4OID - cdef int FLOAT8OID - cdef int BPCHAROID - cdef int VARCHAROID - cdef int TEXTOID - #cdef int NUMERICOID - cdef int POINTOID - cdef int LINEOID - cdef int LSEGOID - cdef int BOXOID - cdef int PATHOID - cdef int POLYGONOID - cdef int CIRCLEOID - - postgres_adapter_t* open_postgres_adapter(const char *connection_uri) - void close_postgres_adapter(postgres_adapter_t *adapter) - AdapterError exec_query(postgres_adapter_t *adapter, const char *query) - void clear_query(postgres_adapter_t *adapter) - int get_num_records(postgres_adapter_t *adapter) - int get_num_fields(postgres_adapter_t *adapter) - void set_field_dim_size(postgres_adapter_t *adapter, int field, int dim, int size) - void clear_field_size(postgres_adapter_t *adapter, int field) - AdapterError read_records(postgres_adapter_t *adapter, - int start, - int stop, - int step, - char **output, - int *num_records_found, - int cast_types, - void *src, - void *dst, - int dataframe) - - cdef int CAST_BUFFER_SIZE - int get_field_type(PGresult *result, int field) - int get_field_length(PGresult *result, int field) - char * get_field_data(PGresult *result, int row, int field) - int get_postgis_geometry_oid(postgres_adapter_t *adapter) - -cdef extern from 'postgis_fields.h': - uint32_t get_gis_type(char *data, int *has_srid) - int get_gis_point_size(uint32_t gis_type) - cdef int GIS_POINT2D - cdef int GIS_POINT3D - cdef int GIS_POINT4D - cdef int GIS_LINE2D - cdef int GIS_LINE3D - cdef int GIS_LINE4D - cdef int GIS_POLYGON2D - cdef int GIS_POLYGON3D - cdef int GIS_POLYGON4D - cdef int GIS_MULTIPOINT2D - cdef int GIS_MULTIPOINT3D - cdef int GIS_MULTIPOINT4D - cdef int GIS_MULTILINE2D - cdef int GIS_MULTILINE3D - cdef int GIS_MULTILINE4D - cdef int GIS_MULTIPOLYGON2D - cdef int GIS_MULTIPOLYGON3D - cdef int GIS_MULTIPOLYGON4D - -cdef extern from 'libpq-fe.h': - ctypedef struct PGresult - char *PQfname(PGresult *res, int field_num) - -# Mapping that specifies which numpy dtype to -# convert each postgres column type to -pg_to_numpy_mapping = {BOOLOID: 'B', - CHAROID: 'S1', - INT8OID: 'i8', - INT2OID: 'i2', - INT4OID: 'i4', - FLOAT4OID: 'f4', - FLOAT8OID: 'f8', - BPCHAROID: 'U', - VARCHAROID: 'U', - TEXTOID: 'O', - #NUMERICOID: 'O', - POINTOID: 'f8', - LINEOID: 'f8', - LSEGOID: 'f8', - BOXOID: 'f8', - PATHOID: 'f8', - POLYGONOID: 'f8', - CIRCLEOID: 'f8'} - -exceptions = {ADAPTER_ERROR_INVALID_QUERY: RuntimeError('Invalid PostgreSQL query'), - ADAPTER_ERROR_INVALID_QUERY_VALUE: RuntimeError('Invalid PostgreSQL query result'), - ADAPTER_ERROR_INVALID_TYPE: RuntimeError('PostgreSQL type not supported'), - ADAPTER_ERROR_INVALID_GIS_TYPE: RuntimeError('PostGIS type not supported'), - ADAPTER_ERROR_PARSE_GIS: RuntimeError('PostGIS field data could not be parsed')} - -cdef public PyObject* create_list(void **output): - """ - Create new list and store in output array or dataframe. Caller is responsible - for appending values to list. - Inputs: - output: pointer to output pointer (output pointer will be incremented - after list pointer is stored in it) - Outputs: - pointer to list - """ - cdef object py_list = [] - cdef PyObject ***object_ptr - # Increment ref count since this object will be referenced by final numpy array - Py_INCREF(py_list) - if output != NULL: - object_ptr = (output) - object_ptr[0][0] = py_list - object_ptr[0] += 1 - return py_list - -cdef public void create_string(void **output, const char *value): - cdef object py_string = value.decode('utf8') - cdef PyObject ***object_ptr - Py_INCREF(py_string) - if output != NULL: - object_ptr = output - object_ptr[0][0] = py_string - object_ptr[0] += 1 - -cdef public void add_to_list(void *py_list_ptr, double *items, int num_items): - """ - Append values to list stored in output array or dataframe - Inputs: - py_list_ptr: pointer to python list object - items: array of double values - num_items: length of items array - """ - cdef object py_list = py_list_ptr - cdef object py_sublist = [] - if num_items > 1: - for i in range(num_items): - py_sublist.append(items[i]) - py_list.append(tuple(py_sublist)) - else: - py_list.append(items[0]) - -cdef public void append_list(void *py_list_ptr, void *py_sublist_ptr): - cdef object py_list = py_list_ptr - cdef object py_sublist = py_sublist_ptr - py_list.append(py_sublist) - -cdef public AdapterError convert_str2object(const char *input_str, const char *encoding, void **output): - """ - Convert c string to Python unicode object - Inputs: - input_str: pointer to input c string - encoding: encoding of input c string - output: pointer to pointer of numpy array memory chunk. Pointer to memory - chunk will be incremented by size of Python object pointer. - """ - cdef object unicode_obj = input_str.decode(encoding) - # Increment ref count since this object will be referenced by final numpy array - Py_INCREF(unicode_obj) - cdef PyObject ***object_ptr = output - object_ptr[0][0] = unicode_obj - object_ptr[0] += 1 - return ADAPTER_SUCCESS - -cdef public AdapterError convert_str2str(const char *input_str, const char *encoding, - void **output, int max_chars): - """ - Convert c string to numpy UCS2 or UCS4 unicode value - Inputs: - input_str: pointer to input c string - encoding: encoding of input c string - output: pointer to pointer of numpy array memory chunk. Pointer to memory - chunk will be incremented by size of Python object pointer. - """ - cdef object unicode_obj = input_str.decode(encoding) - - utf_bytes = unicode_obj.encode('utf32') - cdef char *utf_bytes_ptr = utf_bytes - - str_len = len(unicode_obj) - if str_len > max_chars: - str_len = max_chars - - cdef char **output_ptr = output - if str_len == 0: - memset(output_ptr[0], 0, max_chars * numpy_char_width) - else: - memcpy(output_ptr[0], utf_bytes_ptr + numpy_char_width, str_len * numpy_char_width) - output_ptr[0] += numpy_char_width * max_chars - -cdef public void cast_arrays(numpy.ndarray dst, numpy.ndarray src, int offset, int num): - """ - Copy values from src array (buffer) to dst array (final array), forcing a - cast. - Inputs: - dst: final array set to user specified dtypes - src: buffer array set to database table/query dtypes - offset: first record in final array to copy to - num: number of records to copy - """ - dst[offset:offset+num] = src[0:num] - -cdef public void cast_dataframes(dst, src, int offset, int num, int num_fields): - """ - Copy values from src array (buffer) to dst array (final array), forcing a - cast. - Inputs: - dst: final array set to user specified dtypes - src: buffer array set to database table/query dtypes - offset: first record in final array to copy to - num: number of records to copy - """ - for i in range(num_fields): - dst[dst.columns[i]].values[offset:offset+num] = src[src.columns[i]].values[0:num] - - -cdef public void* convert_list_to_array(void *py_list_ptr): - """ - Convert Python string to NumPy array (infer type) - Inputs: - py_list_ptr: pointer to Python list - output: pointer to a NumPy array - """ - cdef object py_list = py_list_ptr - - # create a temporary reference to the array - array = numpy.array(py_list) - cdef object py_array = array - - # Increment ref count on the array, decrement ref count on the list - Py_INCREF(py_array) - Py_DECREF(py_list) - return py_array - - -cdef class PostgresAdapter: - """ - PostgreSQL adapter for reading data from PostgreSQL database into - NumPy array or Pandas dataframe. - - Constructor Inputs: - connection_uri: string URI describing how to connect to database - table: string, name of table to read records from. Only table - parameter or query parameter can be set, but not both. - query: string, custom query to use for reading records. Only query - parameter or table parameter can be set, but not both. - field_filter parameter cannot be set when query parameter is - set (since it is trivial to specify fields in query string). - field_filter: names of fields include in query (only valid when table - parameter is specified) - dataframe: bool, return results as dataframe instead of array - field_names: list, names of fields in output array or dataframe. - Defaults to database table column names. - field_types: list, NumPy dtype for each field in output array - or dataframe. Defaults to database table column types. - field_shapes: list, shape of each field value for geometry field - types with variable length data. For example, for a - 'path' database column with 2d points, the points of - the path will be stored in a list object by default. - If a field shape of '10' is specified, the points will - be stored in a 2x10 float subarray (2 floats per point - * 10 points max). A field shape of the form (x,y) should - be specifed for types like multipolygon where x is the - max number of polygons and y is the max length of each - polygon (the size of the point is inferred). - """ - cdef postgres_adapter_t *_adapter - cdef object _field_names - cdef object _field_types - cdef object _field_shapes - cdef object _dataframe_result - - def __cinit__(self, connection_uri, - table=None, - query=None, - field_filter=None, - dataframe=False, - field_names=None, - field_types=None, - field_shapes=None): - """ - PostgreSQL adapter constructor. - See above for constructor argument descriptions. - """ - if table is None and query is None: - raise ValueError('Either table or query must be set') - if table is not None and query is not None: - raise ValueError('Table and query cannot both be set') - - if field_filter is not None and len(field_filter) == 0: - field_filter = None - if table is None and field_filter is not None: - raise ValueError('Field filter cannot be set for query') - - self._adapter = open_postgres_adapter(connection_uri.encode('utf8')) - if not self._adapter: - raise IOError("PostgresAdapter: Unable to connect to %s" % connection_uri) - - pg_to_numpy_mapping[self._adapter.postgis_geometry_oid] = 'f8' - - if table is not None: - if field_filter is None: - columns = '*' - else: - columns = ','.join(field_filter) - query = 'select {0} from {1}'.format(columns, table) - result = exec_query(self._adapter, query.encode('utf8')) - if result != ADAPTER_SUCCESS: - msg = 'Could not perform query on table "{0}"'.format(table) - if columns != '*': - msg += ' with columns "{0}"'.format(columns) - msg += '.' - if self._adapter.result_error_msg != NULL: - msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - raise ValueError(msg) - else: - result = exec_query(self._adapter, query.encode('utf8')) - msg = 'Could not perform query "{0}".'.format(query) - if self._adapter.result_error_msg != NULL: - msg += ' PostgreSQL {0}'.format(self._adapter.result_error_msg.decode('utf8')) - if result != ADAPTER_SUCCESS: - raise ValueError(msg) - - self.set_field_names(field_names) - self.set_field_types(field_types) - self.set_field_shapes(field_shapes) - self._dataframe_result = dataframe - - def close(self): - """ - Close PostgreSQL connection - """ - if self._adapter != NULL: - close_postgres_adapter(self._adapter) - self._adapter = NULL - - def __dealloc__(self): - """ - PostgreSQL adapter destructor - """ - self.close() - - def _check_connection(self): - if self._adapter == NULL: - raise RuntimeError('Connection already closed. ' - 'Please create a new adapter.') - - @property - def num_records(self): - """ - Get number of records that will be returned from table or custom query - """ - self._check_connection() - return get_num_records(self._adapter) - - @property - def num_fields(self): - """ - Get number of fields in records that will be returned from table - or custom query - """ - self._check_connection() - return get_num_fields(self._adapter) - - def get_field_names(self): - """ - Get names of fields in final array or dataframe - """ - self._check_connection() - return self._field_names - - def set_field_names(self, names): - """ - Set names to assign to fields in final array or dataframe - Inputs: - names: list of names to assign to fields in result, or dict mapping - field number to field name. If names is a list, the length - of list must match the number of fields in data set. - If names is a dict, the field name from the database will - be used if no name in dict is specified for that field. - """ - self._check_connection() - if names is not None and len(names) == 0: - names = None - - def make_unique_name(field_name): - suffix = 1 - while field_name + str(suffix) in self._field_names: - suffix += 1 - return field_name + str(suffix) - - if names is None: - self._field_names = [] - for i in range(self.num_fields): - field_name = PQfname(self._adapter.result, i).decode(self._adapter.client_encoding.decode()) - # Since libpq returns 'st_astext' as the column name for every - # PostGIS column retrieved as text, we need to number multiple - # st_astext columns to make them unique. - if field_name in self._field_names: - field_name = make_unique_name(field_name) - self._field_names.append(field_name) - elif isinstance(names, dict): - self._field_names = [] - for field_num in names.keys(): -<<<<<<< HEAD - if field_num >= self.num_***REMOVED*** -======= - if field_num >= self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - raise ValueError('Invalid field number {0}'.format(field_num)) - for i in range(self.num_fields): - if i in names.keys(): - self._field_names.append(names[i]) - else: - field_name = PQfname(self._adapter.result, i).decode(self._adapter.client_encoding.decode()) - # Since libpq returns 'st_astext' as the column name for every - # PostGIS column retrieved as text, we need to number multiple - # st_astext columns to make them unique. - if field_name in self._field_names: - field_name = make_unique_name(field_name) - self._field_names.append(field_name) - else: -<<<<<<< HEAD - if len(names) != self.num_***REMOVED*** -======= - if len(names) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - raise ValueError('Number of field names does not match number of fields') - self._field_names = names - - field_names = property(get_field_names, set_field_names) - - def _get_default_types(self): - """ - Get list of types based on types in database table/query. These will be - the default types of final array or dataframe if user does not specify - any types. - """ - cdef int has_srid - self._check_connection() - types = [] - dtype_len = [] - for i in range(self.num_fields): - pg_type = get_field_type(self._adapter.result, i) - field_length = get_field_length(self._adapter.result, i) - gis_field_type = None - if pg_type == self._adapter.postgis_geometry_oid: - data = get_field_data(self._adapter.result, 0, i) - gis_field_type = get_gis_type(data, &has_srid) - - if pg_type not in pg_to_numpy_mapping: - raise RuntimeError('postgresql type {0} not supported'.format(pg_type)) - numpy_type = pg_to_numpy_mapping[pg_type] - - if pg_type in [BPCHAROID, VARCHAROID] and not self._dataframe_result: - numpy_type += str(get_field_length(self._adapter.result, i)) - types.append(numpy_type) - dtype_len.append(1) - elif pg_type == TEXTOID or (pg_type in [BPCHAROID, VARCHAROID] and self._dataframe_result): - types.append('O') - dtype_len.append(1) - elif (pg_type == self._adapter.postgis_geometry_oid and - (gis_field_type == GIS_POINT2D or - gis_field_type == GIS_POINT3D or - gis_field_type == GIS_POINT4D)): - if self._field_types[i] in [None, 'O']: - types.append('O') - dtype_len.append(1) - else: - types.append('f8') - dtype_len.append(field_length) - elif field_length < 0 or pg_type == self._adapter.postgis_geometry_oid: - if (self.field_shapes is None or self.field_names[i] not in self.field_shapes or self._dataframe_result): - types.append('O') - dtype_len.append(1) - else: - # For variable length fields that are composed of things - # like points, the user specified max field size is in terms - # of points. We need to get the max number of items, which - # for points is two items per point (each point contains an - # x an y coordinate). - shape = self.field_shapes[self.field_names[i]] - types.append(numpy_type) - dtype_len.append(shape) - elif self._dataframe_result and field_length > 1: - types.append('O') - dtype_len.append(1) - else: - types.append(numpy_type) - dtype_len.append(field_length) - return types, dtype_len - - def get_field_types(self): - """ - Get field types in final array or dataframe - """ - - # Reporting the field types may depend on whether the user has specified - # any field shapes using the field_shapes property. Because of this, we - # need to recompute the field types list on the fly in the field types - # getter, rather than compute once in the field types setter. - self._check_connection() - default_types, dtype_len = self._get_default_types() - - field_types = [] - for i, field_type in enumerate(self._field_types): - if field_type is None: - field_types.append(default_types[i]) - else: - if field_type in ['U', 'S']: - field_types.append(field_type + str(get_field_length(self._adapter.result, i))) - else: - field_types.append(field_type) - return field_types - - def set_field_types(self, types): - """ - Set types to assign to fields in final array or dataframe - Inputs: - names: list of types to assign to fields in result, or dict mapping - field number or name to field type. If types is a list, the - length of list must match the number of fields in data set. - If types is a dict, the field type from the database will be - used if type is not specified in dict. - """ - self._check_connection() - - self._field_types = [None] * self.num_fields - if types is not None and len(types) == 0: - return - if types is None: - return - - if isinstance(types, dict): - for key, value in types.items(): - if isinstance(key, (int, long)): - self._field_types[key] = value - elif key in self.field_names: - self._field_types[self.field_names.index(key)] = value - else: - raise ValueError('Invalid field name "{0}"'.format(key)) - else: -<<<<<<< HEAD - if len(types) != self.num_***REMOVED*** -======= - if len(types) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - raise ValueError('length of types list does not match the number of fields') - self._field_types = types - - field_types = property(get_field_types, set_field_types) - - def get_field_shapes(self): - """ - Get field shapes for variable length fields. If a field does not have a - defined shape, then the field values will be stored in a list object. - """ - self._check_connection() - if self._field_shapes is None: - return self._field_shapes - field_shapes = {} - for i, shape in enumerate(self._field_shapes): - if shape is not None: - name = self.field_names[i] - field_shapes[name] = shape - return field_shapes - - def set_field_shapes(self, shapes): - """ - Set field shapes. A value of None or zero for a field means that - an infinite length value will be allowed for field, and value will be - stored in Python list object if field is postgresql geometry types, or - WKT string objects if field is postgis type. - Inputs: - shapes: dict, mapping of field name or number to field shape - """ - cdef int has_srid - if self._dataframe_result: - raise RuntimeError('Field shape cannot be set when outputing to dataframe') - self._check_connection() - - self._field_shapes = [None] * self.num_fields - if shapes is not None and len(shapes) == 0: - return - if shapes is None: - return - - # Convert list of shapes to dict with field number to shape mapping - new_shapes = {} - if not isinstance(shapes, dict): -<<<<<<< HEAD - if len(shapes) != self.num_***REMOVED*** -======= - if len(shapes) != self.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - raise ValueError('number of shapes must equal number of fields') - shapes = dict(zip(range(len(shapes)), shapes)) - - for key, value in shapes.items(): - if value is not None: - if isinstance(key, (int, long)): - index = key - elif key in self.field_names: - index = self.field_names.index(key) - else: - raise ValueError('Invalid field name "{0}"'.format(key)) - - if isinstance(value, (int, long)): - if value < 1: - raise ValueError('Field shape must be greater than 0') - elif isinstance(value, (list, tuple)): - for x in value: - if x < 1: - raise ValueError('Field shape values must be greater than 0') - else: - raise ValueError('Field shape must be int, list, or tuple') - - # field shape for geometric types that contain points will always - # have a fixed point size, so user only has to specify number of - # points, lines, etc - field_type = get_field_type(self._adapter.result, index) - if field_type in [PATHOID, POLYGONOID]: - if not isinstance(value, int): - raise ValueError('Field shape for path or polygon must be int') - self._field_shapes[index] = (value, 2) - elif field_type == self._adapter.postgis_geometry_oid: - data = get_field_data(self._adapter.result, 0, index) - gis_field_type = get_gis_type(data, &has_srid) - gis_point_size = get_gis_point_size(gis_field_type) - if gis_point_size == -1: - raise ValueError('Unknown PostGIS point size') - if gis_field_type in [GIS_LINE2D, GIS_LINE3D, GIS_LINE4D]: - if not isinstance(value, int): - raise ValueError('Field shape for PostGIS line must be int') - self._field_shapes[index] = (value, gis_point_size) - elif gis_field_type in [GIS_POLYGON2D, GIS_POLYGON3D, GIS_POLYGON4D]: - if not isinstance(value, (list, tuple)) or len(value) != 2: - raise ValueError('Field shape for PostGIS polygon must have 2 dimensions') - self._field_shapes[index] = (value[0], value[1], gis_point_size) - elif gis_field_type in [GIS_MULTIPOINT2D, GIS_MULTIPOINT3D, GIS_MULTIPOINT4D]: - if not isinstance(value, int): - raise ValueError('Field shape for PostGIS multipoint must be int') - self._field_shapes[index] = (value, gis_point_size) - elif gis_field_type in [GIS_MULTILINE2D, GIS_MULTILINE3D, GIS_MULTILINE4D]: - if not isinstance(value, (list, tuple)) or len(value) != 2: - raise ValueError('Field shape for PostGIS multiline must have 2 dimensions') - self._field_shapes[index] = (value[0], value[1], gis_point_size) - elif gis_field_type in [GIS_MULTIPOLYGON2D, GIS_MULTIPOLYGON3D, GIS_MULTIPOLYGON4D]: - if not isinstance(value, (list, tuple)) or len(value) != 3: - raise ValueError('Field shape for GIS multipolygon must have 3 dimensions') - self._field_shapes[index] = (value[0], value[1], value[2], gis_point_size) - else: - raise ValueError('Setting shape for field "{0}" not allowed.'.format(index)) - else: - raise ValueError('Setting shape for field "{0}" not allowed.'.format(index)) - - field_shapes = property(get_field_shapes, set_field_shapes) - - def _parse_slice(self, start, stop, step): - """ - Adjust stop slice parameter if needed, get number of records to read. - Stop is set to total number of records if None. - Inputs: - start: int, start record - stop: int, stop record - step: int, step value - Outputs: - Adjusted stop and number of records - """ - if stop is None: - stop = self.num_records - if step > 0: - num_records = stop - start - else: - num_records = start - stop - num_records = math.ceil(abs(num_records / step)) - return stop, num_records - - def _to_array(self, start=0, stop=None, step=1): - """ - Read records from table or custom query into NumPy record array, - and return array. Custom query takes precedent over table. - Inputs: - start: first record to read - stop: last record to read. If None, read all records. - step: number of records to skip between each read - """ - cdef numpy.ndarray carray - cdef numpy.ndarray final_carray - cdef char **data_arrays - cdef int num_records_found - cdef int has_srid - self._check_connection() - - stop, num_records = self._parse_slice(start, stop, step) - - # Check to see if we need to cast database values to user specified dtype. - # Default types are based on database table/query column types. - default_types, dtype_len = self._get_default_types() - if default_types == self.field_types: - cast_types = False - else: - cast_types = True - - dtype = numpy.dtype([(str(name), type_, size) for name, type_, size - in zip(self.field_names, default_types, dtype_len)]) - if cast_types: - cast_dtype = numpy.dtype([(str(name), type_, size) for name, type_, size - in zip(self.field_names, self.field_types, dtype_len)]) - - for i in range(self.num_fields): - if self._field_shapes[i] is not None: - for dim, size in enumerate(self._field_shapes[i]): - set_field_dim_size(self._adapter, i, dim, size) - elif get_field_type(self._adapter.result, i) == self._adapter.postgis_geometry_oid: - data = get_field_data(self._adapter.result, 0, i) - gis_field_type = get_gis_type(data, &has_srid) - if gis_field_type in [GIS_POINT2D, GIS_POINT3D, GIS_POINT4D] and default_types[i] == 'f8': - field_length = get_field_length(self._adapter.result, i) - set_field_dim_size(self._adapter, i, 0, field_length) - else: - clear_field_size(self._adapter, i) - else: - clear_field_size(self._adapter, i) - - if ((step > 0 and start >= stop) - or (step < 0 and start <= stop)): - if cast_types: - return numpy.array([], dtype=cast_dtype) - else: - return numpy.array([], dtype=dtype) - - # Allocate and prepare result array. An array of data pointers needs to - # be passed to read_records. Since the output is going to be a record - # array, pass a single data pointer to read_records so that data from - # all source fields will be stored in array sequentially. - # If we need to cast values from database to user specified dtype, - # temporarily store values from db in a buffer array. As buffer array - # is filled, call Cython function to copy values to final array set - # to user specified dtype. During the copy, numpy will perform the - # correct cast under the hood. This isn't super fast, but it's easy - # and will ensure casting follows numpy casting - data_arrays = calloc(1, sizeof(char*)) - if cast_types: - carray = numpy.ndarray(CAST_BUFFER_SIZE, numpy.dtype(dtype)) - final_carray = numpy.ndarray(num_records, numpy.dtype(cast_dtype)) - data_arrays[0] = carray.data - result = read_records(self._adapter, start, stop, step, data_arrays, - &num_records_found, 1, carray, final_carray, 0) - free(data_arrays) - if result != ADAPTER_SUCCESS: - raise exceptions[result] - return numpy.asarray(final_carray) - else: - carray = numpy.ndarray(num_records, dtype) - data_arrays[0] = carray.data - result = read_records(self._adapter, start, stop, step, data_arrays, - &num_records_found, 0, NULL, NULL, 0) - free(data_arrays) - if result != ADAPTER_SUCCESS: - raise exceptions[result] - return numpy.asarray(carray) - - def _to_dataframe(self, start=0, stop=None, step=1): - """ - Read records from table or custom query into Pandas dataframe. - and return dataframe. Custom query takes precedent over table. - Inputs: - start: first record to read - stop: last record to read. If None, read all records. - step: number of records to skip between each read - """ - cdef char **data_arrays - cdef numpy.ndarray temp_array - cdef int num_records_found - self._check_connection() - - stop, num_records = self._parse_slice(start, stop, step) - - # Check to see if we need to cast database values to user specified dtype. - # Default types are based on database table/query column types. - default_types, dtype_len = self._get_default_types() - if default_types == self.field_types: - cast_types = False - else: - cast_types = True - - if ((step > 0 and start >= stop) - or (step < 0 and start <= stop)): - data = OrderedDict() - if cast_types: - for i in range(self.num_fields): - dtype = self.field_types[i] - data[self.field_names[i]] = numpy.array([], dtype=dtype) - else: - for i in range(self.num_fields): - dtype = self.field_types[i] - data[self.field_names[i]] = numpy.array([], dtype=dtype) - return pd.DataFrame(data=data) - - # Allocate and prepare result dataframe. An array of data pointers needs to - # be passed to read_records, one for each dataframe field. Each source - # field's data will be stored in corresponding data pointer's memory chunk. - data_arrays = calloc(self.num_fields, sizeof(char*)) - data = OrderedDict() - final_data = OrderedDict() - for i in range(self.num_fields): - dtype = default_types[i] - data[self.field_names[i]] = numpy.array([0], dtype=default_types[i]) - final_data[self.field_names[i]] = numpy.array([0], dtype=self.field_types[i]) - - # If we need to cast values from database to user specified dtype, - # temporarily store values from db in a buffer dataframe. As buffer - # dataframe is filled, call Cython function to copy values to final - # dataframe set to user specified dtype. During the copy, pandas will - # perform the correct cast under the hood. This isn't super fast, - # but it's easy and will ensure casting follows pandas casting. - if cast_types: - df_result = pd.DataFrame(index=numpy.arange(CAST_BUFFER_SIZE, dtype='u8'), data=data) - final_df_result = pd.DataFrame(index=numpy.arange(num_records, dtype='u8'), data=final_data) - else: - df_result = pd.DataFrame(index=numpy.arange(num_records, dtype='u8'), data=data) - - # Get data pointers from dataframe columns - for i in range(self.num_fields): - temp_array = df_result[self.field_names[i]].values - data_arrays[i] = temp_array.data - - if cast_types: - result = read_records(self._adapter, start, stop, step, data_arrays, - &num_records_found, 1, df_result, final_df_result, 1) - free(data_arrays) - if result != ADAPTER_SUCCESS: - raise exceptions[result] - return final_df_result - else: - result = read_records(self._adapter, start, stop, step, data_arrays, - &num_records_found, 0, NULL, NULL, 1) - free(data_arrays) - if result != ADAPTER_SUCCESS: - raise exceptions[result] - return df_result - - def __getitem__(self, index): - """ - Read records by slice - Inputs: - index: slice object or int index - """ - self._check_connection() - - if isinstance(index, (int, long)): - if index > self.num_records - 1: - raise ValueError('index {0} is out of bounds'.format(index)) - elif index < 0: - if self.num_records + index < 0: - raise ValueError('index {0} is out of bounds'.format(index)) - index = self.num_records + index - if self._dataframe_result: - return self._to_dataframe(index, index + 1) - else: - return self._to_array(index, index + 1) - elif isinstance(index, slice): - start = index.start - stop = index.stop - step = index.step - - if step is None: - step = 1 - - if start is None: - if step > 0: - start = 0 - else: - start = self.num_records - 1 - elif start > self.num_records: - start = self.num_records - elif start < 0: - if self.num_records + start < 0: - start = 0 - self.num_records - start = self.num_records + start - - if stop is None: - if step > 0: - stop = self.num_records - else: - stop = -1 - elif stop > self.num_records: - stop = self.num_records - elif stop < 0: - if self.num_records + stop < 0: - stop = 0 - self.num_records - stop = self.num_records + stop - - if self._dataframe_result: - return self._to_dataframe(start, stop, step) - else: - return self._to_array(start, stop, step) - - else: - raise IndexError('index must be slice or int') diff --git a/iopro/postgresadapter/test2.c b/iopro/postgresadapter/test2.c deleted file mode 100644 index dec3517..0000000 --- a/iopro/postgresadapter/test2.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "postgres_adapter.h" -#include -#include - -int main(int argc, char *argv[]) -{ - const char *uri = "postgresql://localhost:5432/foo"; - const char *query = "select value1, value2 from foo1"; - PostgresAdapter *adapter = open_postgres_adapter(uri); - if (adapter == NULL) { - fprintf(stderr, "ERROR: could not open postgresql adapter\n"); - exit(1); - } - exec_query(adapter, query); - - int num_fields = get_num_fields(adapter); -<<<<<<< HEAD - printf("num_***REMOVED*** %d\n", num_fields); -======= - printf("num_fields: %d\n", num_fields); ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - - char *output = calloc(get_num_records(adapter), get_record_size(adapter)); - int num_records_found = 0; - read_records(adapter, output, &num_records_found); - printf("num_records_found: %d\n", num_records_found); - - char **field_names = calloc(num_fields, sizeof(char*)); - get_field_names(adapter, field_names); - printf("field names: %s %s\n", field_names[0], field_names[1]); - - Oid *field_types = calloc(num_fields, sizeof(Oid)); - get_field_types(adapter, field_types); - printf("field types: %d %d\n", field_types[0], field_types[1]); - - char *output_ptr = output; - for (int i = 0; i < num_records_found; i++) { - uint32_t value1; - double value2; - memcpy((char *)&value1, output_ptr, sizeof(value1)); - memcpy((char *)&value2, output_ptr + sizeof(value1), sizeof(value2)); - printf("field values: %u %f\n", value1, value2); - output_ptr += get_record_size(adapter); - } - - free(field_names); - free(field_types); - free(output); - clear_query(adapter); - close_postgres_adapter(adapter); - - return 0; -} diff --git a/iopro/tests/test_PostgresAdapter.py b/iopro/tests/test_PostgresAdapter.py deleted file mode 100644 index f05f4f5..0000000 --- a/iopro/tests/test_PostgresAdapter.py +++ /dev/null @@ -1,626 +0,0 @@ -from iopro import PostgresAdapter -import pandas as pd -import numpy as np -import string -import pytest -import sys -from pandas.util.testing import assert_frame_equal -from collections import OrderedDict - -# PostgreSQL test data was generated from iopro/tests/setup_postgresql_data.py - -# create large random number of records for cast test data, for stress testing -CASTS_TEST_NUM_RECORDS = 23456 - -@pytest.fixture(scope='module') -def postgres(request): - - class Dummy(object): - - def __init__(self, host, dbname, user): - self.host = host - self.dbname = dbname - self.user = user - - def url(self): - return 'host={0} dbname={1} user={2}'.format(self.host, self.dbname, self.user) - - postgresql = Dummy(request.config.option.pg_host, - request.config.option.pg_dbname, - request.config.option.pg_user) - return postgresql - -def test_connection(postgres): - with pytest.raises(IOError) as excinfo: - adapter = PostgresAdapter("bad URI", table='ints_test') - -def test_ints(postgres): - adapter = PostgresAdapter(postgres.url(), table='ints_test') - expected = np.array([(np.iinfo(np.int16).min, - np.iinfo(np.int32).min, - np.iinfo(np.int64).min), - (0, 0, 0), - (np.iinfo(np.int16).max, - np.iinfo(np.int32).max, - np.iinfo(np.int64).max)], - dtype=[(str('int2'), str('i2')),(str('int4'), str('i4')),(str('int8'), str('i8'))]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - -def test_serial(postgres): - adapter = PostgresAdapter(postgres.url(), table='serial_test') - expected = np.array([(np.iinfo(np.int16).min, - np.iinfo(np.int32).min, - np.iinfo(np.int64).min), - (0, 0, 0), - (np.iinfo(np.int16).max, - np.iinfo(np.int32).max, - np.iinfo(np.int64).max)], - dtype=[(str('int2'), str('i2')),(str('int4'), str('i4')),(str('int8'), str('i8'))]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - -@pytest.mark.xfail(sys.version_info <= (3,), - reason='Possible bug in libpq under Python 2') -def test_floats(postgres): - adapter = PostgresAdapter(postgres.url(), 'floats_test') - expected = np.array([(np.finfo(np.float32).min, - np.finfo(np.float64).min), - (0.0, 0.0), - (-1.1, 1.1)], - dtype=[(str('float4'), str('f4')),(str('float8'), str('f8'))]) - result = adapter[:] - - # JNB: There is currently a bug in NumPy that prevents two record arrays - # containing float types from being compared with assert_array_almost_equal, - # so just compare each column and dtype for now. - np.testing.assert_array_almost_equal(expected[str('float4')], result[str('float4')]) - np.testing.assert_array_almost_equal(expected['float8'], result['float8']) - assert(expected.dtype == result.dtype) - -@pytest.mark.xfail(reason='Not sure about best way to convert infinite precision ' - 'postgres decimal data to Python decimal objects. ' - 'Also not quite sure about the format of the postgres ' - 'decimal data.') -def test_numeric(postgres): - adapter = PostgresAdapter(postgres.url(), 'numeric_test') - expected = np.array([(1234567890.01789, 1234567890.0123456789)], - dtype=[(str('numeric1'), 'O'),(str('numeric2'), 'O')]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - -def test_fixed_strings(postgres): - adapter = PostgresAdapter(postgres.url(), 'fixed_strings_test') - expected = np.array([('aaa ',), - ('bbb ',), - ('ccc ',)], - dtype=[(str('fixed'), 'U10')]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - - adapter.field_types = ['U2'] - result = adapter[:] - expected = np.array([('aa',), - ('bb',), - ('cc',)], - dtype=[(str('fixed'), 'U2')]) - np.testing.assert_array_equal(expected, result) - - adapter.field_types = ['U'] - result = adapter[:] - expected = np.array([('aaa ',), - ('bbb ',), - ('ccc ',)], - dtype=[(str('fixed'), 'U10')]) - np.testing.assert_array_equal(expected, result) - -def test_var_strings(postgres): - adapter = PostgresAdapter(postgres.url(), 'var_strings_test') - expected = np.array([('aaa', string.ascii_lowercase), - ('bbb', string.ascii_uppercase), - ('ccc', string.ascii_letters)], - dtype=[(str('varchar'), 'U10'), (str('text'), 'O')]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - - adapter.field_types = ['U1', 'O'] - expected = np.array([('a', string.ascii_lowercase), - ('b', string.ascii_uppercase), - ('c', string.ascii_letters)], - dtype=[(str('varchar'), 'U1'), (str('text'), 'O')]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - - adapter.field_types = ['U', 'O'] - expected = np.array([('aaa', string.ascii_lowercase), - ('bbb', string.ascii_uppercase), - ('ccc', string.ascii_letters)], - dtype=[(str('varchar'), 'U10'), (str('text'), 'O')]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - -def test_unicode_strings(postgres): - adapter = PostgresAdapter(postgres.url(), 'unicode_strings_test') - expected = np.array([(u'\u4242xxx ', u'xxx\u4242')], - dtype=[(str('fixed'), 'U10'), (str('text'), 'O')]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - -@pytest.mark.skipif(sys.version_info <= (3,), - reason="No support for Unicode dtype field names in NumPy for Python 2") -def test_unicode_table_name(postgres): - adapter = PostgresAdapter(postgres.url(), 'unicode_table_name_test') - expected = np.array([('foo',)], dtype=[('name\u4242', 'O')]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - -def test_geometric_types(postgres): - adapter = PostgresAdapter(postgres.url(), 'geometric_test') - adapter.field_shapes = {'path': 5} - adapter.field_names = {4: 'path2'} - expected = np.array([((1.1, 2.2), - [1, 2, 3], - [1, 2, 3, 4], - [3, 4, 1, 2], - [(1, 2), (3, 4), (5, 6), (0, 0), (0, 0)], - [(1.0, 2.0), (3.0, 4.0), (5.0, 6.0)], - [1, 2, 3])], - dtype=[(str('point'), 'f8', 2), - (str('line'), 'f8', 3), - (str('lseg'), 'f8', 4), - (str('box'), 'f8', 4), - (str('path2'), 'f8', (5, 2)), - (str('polygon'), 'O'), - (str('circle'), 'f8', 3)]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - - adapter.field_shapes = {'path2': 5} - result = adapter[:] - np.testing.assert_array_equal(expected, result) - - adapter.field_shapes = {4: 5} - result = adapter[:] - np.testing.assert_array_equal(expected, result) - -def test_slicing(postgres): - adapter = PostgresAdapter(postgres.url(), table='ints_test') - - expected = np.array([(np.iinfo(np.int16).min, - np.iinfo(np.int32).min, - np.iinfo(np.int64).min)], - dtype=[(str('int2'), 'i2'),(str('int4'), 'i4'),(str('int8'), 'i8')]) - result = adapter[0] - np.testing.assert_array_equal(expected, result) - - expected = np.array([(0, 0, 0)], - dtype=[(str('int2'), 'i2'),(str('int4'), 'i4'),(str('int8'), 'i8')]) - result = adapter[1] - np.testing.assert_array_equal(expected, result) - - expected = np.array([(np.iinfo(np.int16).max, - np.iinfo(np.int32).max, - np.iinfo(np.int64).max)], - dtype=[(str('int2'), 'i2'),(str('int4'), 'i4'),(str('int8'), 'i8')]) - result = adapter[-1] - np.testing.assert_array_equal(expected, result) - - expected = np.array([(0, 0, 0), - (np.iinfo(np.int16).max, - np.iinfo(np.int32).max, - np.iinfo(np.int64).max)], - dtype=[(str('int2'), 'i2'),(str('int4'), 'i4'),(str('int8'), 'i8')]) - result = adapter[1:] - np.testing.assert_array_equal(expected, result) - - expected = np.array([(np.iinfo(np.int16).min, - np.iinfo(np.int32).min, - np.iinfo(np.int64).min), - (0, 0, 0)], - dtype=[(str('int2'), 'i2'),(str('int4'), 'i4'),(str('int8'), 'i8')]) - result = adapter[:-1] - np.testing.assert_array_equal(expected, result) - - expected = np.array([(0, 0, 0)], - dtype=[(str('int2'), 'i2'),(str('int4'), 'i4'),(str('int8'), 'i8')]) - result = adapter[1:2] - np.testing.assert_array_equal(expected, result) - - expected = np.array([(np.iinfo(np.int16).min, - np.iinfo(np.int32).min, - np.iinfo(np.int64).min), - (0, 0, 0), - (np.iinfo(np.int16).max, - np.iinfo(np.int32).max, - np.iinfo(np.int64).max)], - dtype=[(str('int2'), 'i2'),(str('int4'), 'i4'),(str('int8'), 'i8')]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - - result = adapter[0:10] - np.testing.assert_array_equal(expected, result) - - expected = np.array([(np.iinfo(np.int16).min, - np.iinfo(np.int32).min, - np.iinfo(np.int64).min), - (np.iinfo(np.int16).max, - np.iinfo(np.int32).max, - np.iinfo(np.int64).max)], - dtype=[(str('int2'), 'i2'),(str('int4'), 'i4'),(str('int8'), 'i8')]) - result = adapter[::2] - np.testing.assert_array_equal(expected, result) - - expected = np.array([(np.iinfo(np.int16).max, - np.iinfo(np.int32).max, - np.iinfo(np.int64).max), - (np.iinfo(np.int16).min, - np.iinfo(np.int32).min, - np.iinfo(np.int64).min)], - dtype=[(str('int2'), 'i2'),(str('int4'), 'i4'),(str('int8'), 'i8')]) - result = adapter[::-2] - np.testing.assert_array_equal(expected, result) - - expected = np.array([(np.iinfo(np.int16).max, - np.iinfo(np.int32).max, - np.iinfo(np.int64).max)], - dtype=[(str('int2'), 'i2'),(str('int4'), 'i4'),(str('int8'), 'i8')]) - result = adapter[2:1:-2] - np.testing.assert_array_equal(expected, result) - - expected = np.array([], - dtype=[(str('int2'), 'i2'),(str('int4'), 'i4'),(str('int8'), 'i8')]) - result = adapter[0:2:-1] - np.testing.assert_array_equal(expected, result) - - result = adapter[2:0:1] - np.testing.assert_array_equal(expected, result) - - result = adapter[1:1] - np.testing.assert_array_equal(expected, result) - - result = adapter[1:1:-1] - np.testing.assert_array_equal(expected, result) - -def test_field_filter(postgres): - adapter = PostgresAdapter(postgres.url(), 'ints_test', field_filter=['int2', 'int8']) - expected = np.array([(np.iinfo(np.int16).min, - np.iinfo(np.int64).min), - (0, 0), - (np.iinfo(np.int16).max, - np.iinfo(np.int64).max)], - dtype=[(str('int2'), str('i2')), (str('int8'), str('i8'))]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - - adapter = PostgresAdapter(postgres.url(), 'ints_test', field_filter=[]) - expected = np.array([(np.iinfo(np.int16).min, - np.iinfo(np.int32).min, - np.iinfo(np.int64).min), - (0, 0, 0), - (np.iinfo(np.int16).max, - np.iinfo(np.int32).max, - np.iinfo(np.int64).max)], - dtype=[(str('int2'), str('i2')), (str('int4'), str('i4')), (str('int8'), str('i8'))]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - -def test_field_names(postgres): - adapter = PostgresAdapter(postgres.url(), 'ints_test') - - adapter.field_names = ['a', 'b', 'c'] - assert(adapter.field_names == ['a', 'b', 'c']) - - adapter.field_names = {1: 'b'} - assert(adapter.field_names == ['int2', 'b', 'int8']) - - adapter.field_names = ['a', 'b', 'c'] - expected = np.array([(np.iinfo(np.int16).min, - np.iinfo(np.int32).min, - np.iinfo(np.int64).min), - (0, 0, 0), - (np.iinfo(np.int16).max, - np.iinfo(np.int32).max, - np.iinfo(np.int64).max)], - dtype=[(str('a'), str('i2')), (str('b'), str('i4')), (str('c'), str('i8'))]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - - adapter = PostgresAdapter(postgres.url(), 'ints_test', field_filter=['int2', 'int4']) - adapter.field_names = ['a', 'b'] - expected = np.array([(np.iinfo(np.int16).min, - np.iinfo(np.int32).min), - (0, 0), - (np.iinfo(np.int16).max, - np.iinfo(np.int32).max)], - dtype=[(str('a'), str('i2')), (str('b'), str('i4'))]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - - adapter = PostgresAdapter(postgres.url(), 'ints_test', field_filter=['int2']) - with pytest.raises(ValueError): - adapter.field_names = ['a', 'b'] - - adapter = PostgresAdapter(postgres.url(), 'ints_test') - adapter.field_names = {0: 'a'} - expected = np.array([(np.iinfo(np.int16).min, - np.iinfo(np.int32).min, - np.iinfo(np.int64).min), - (0, 0, 0), - (np.iinfo(np.int16).max, - np.iinfo(np.int32).max, - np.iinfo(np.int64).max)], - dtype=[(str('a'), str('i2')), (str('int4'), str('i4')), (str('int8'), str('i8'))]) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - -def test_field_types(postgres): - adapter = PostgresAdapter(postgres.url(), 'casts_test') - adapter.field_names = ['a', 'b', 'c'] - - assert(adapter.field_types == ['U10', 'i4', 'f8']) - - adapter.field_types = ['i4', 'f4', 'U10'] - assert(adapter.field_types == ['i4', 'f4', 'U10']) - - adapter.field_types = {'a': 'i4'} - assert(adapter.field_types == ['i4', 'i4', 'f8']) - - adapter.field_types = {1: 'f8'} - assert(adapter.field_types == ['U10', 'f8', 'f8']) - - adapter.field_types = ['i4', 'f4', 'U10'] - expected = np.zeros((CASTS_TEST_NUM_RECORDS,), dtype=[(str('a'), str('i4')), (str('b'), str('f4')), (str('c'), str('U10'))]) - for i in range(CASTS_TEST_NUM_RECORDS): - expected[i] = (i, i, float('{0}.{0}'.format(i))) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - - adapter.field_types = {'a': 'f4'} - expected = np.zeros((CASTS_TEST_NUM_RECORDS,), dtype=[(str('a'), str('f4')), (str('b'), str('i4')), (str('c'), str('f8'))]) - for i in range(CASTS_TEST_NUM_RECORDS): - expected[i] = (i, i, float('{0}.{0}'.format(i))) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - -def test_dataframe(postgres): - adapter = PostgresAdapter(postgres.url(), table='ints_test', dataframe=True) - expected = pd.DataFrame({'int2': np.array([np.iinfo(np.int16).min, 0, np.iinfo(np.int16).max], dtype='i2'), - 'int4': np.array([np.iinfo(np.int32).min, 0, np.iinfo(np.int32).max], dtype='i4'), - 'int8': np.array([np.iinfo(np.int64).min, 0, np.iinfo(np.int64).max], dtype='i8')}) - result = adapter[:] - np.testing.assert_array_equal(expected, result) - - adapter = PostgresAdapter(postgres.url(), 'casts_test', dataframe=True) - expected = np.zeros((CASTS_TEST_NUM_RECORDS,), dtype=[(str('char'), str('O')), - (str('int4'), str('i4')), - (str('float8'), str('f8'))]) - for i in range(CASTS_TEST_NUM_RECORDS): - expected[i] = (str(i).ljust(10), i, float('{0}.{0}'.format(i))) - expected = pd.DataFrame.from_records(expected, index=np.arange(CASTS_TEST_NUM_RECORDS, dtype='u8')) - result = adapter[:] - assert_frame_equal(expected, result) - - adapter = PostgresAdapter(postgres.url(), 'casts_test', dataframe=True, field_filter=['int4', 'float8']) - adapter.field_types = ['i2', 'f4'] - adapter.field_names = ['a', 'b'] - expected = np.zeros((CASTS_TEST_NUM_RECORDS,), dtype=[(str('a'), str('i2')), (str('b'), str('f4'))]) - for i in range(CASTS_TEST_NUM_RECORDS): - expected[i] = (i, float('{0}.{0}'.format(i))) - expected = pd.DataFrame.from_records(expected, index=np.arange(CASTS_TEST_NUM_RECORDS, dtype='u8')) - result = adapter[:] - assert_frame_equal(expected, result) - - adapter.field_types = {'a': 'f4'} - expected = np.zeros((CASTS_TEST_NUM_RECORDS,), dtype=[(str('a'), str('f4')), (str('b'), str('f8'))]) - for i in range(CASTS_TEST_NUM_RECORDS): - expected[i] = (i, float('{0}.{0}'.format(i))) - expected = pd.DataFrame.from_records(expected, index=np.arange(CASTS_TEST_NUM_RECORDS, dtype='u8')) - result = adapter[:] - assert_frame_equal(expected, result) - - adapter = PostgresAdapter(postgres.url(), - 'geometric_test', - dataframe=True, - field_filter=['point', 'line', 'polygon']) - result = adapter[:] - point_data = np.empty(1, dtype='O') - point_data[0] = [1.1, 2.2] - line_data = np.empty(1, dtype='O') - line_data[0] = [1.0, 2.0, 3.0] - polygon_data = np.empty(1, dtype='O') - polygon_data[0] = [(1.0, 2.0), (3.0, 4.0), (5.0, 6.0)] - expected = pd.DataFrame(OrderedDict([('point', point_data), - ('line', line_data), - ('polygon', polygon_data)]), - index=np.array([0], dtype='u8')) - assert_frame_equal(expected, result) - - adapter = PostgresAdapter(postgres.url(), 'fixed_strings_test', dataframe=True) - result = adapter[:] - expected = pd.DataFrame(['aaa ', 'bbb ', 'ccc '], - columns=['fixed'], - index=np.array([0, 1, 2], dtype='u8')) - assert_frame_equal(expected, result) - - with pytest.raises(RuntimeError): - adapter.field_shapes = {'fixed': 2} - -def test_missing_values(postgres): - # Don't test missing values for PostGIS types for now. Since PostGIS type metadata - # is stored by postgresql as actual data in the record, an empty or missing - # value in a PostGIS column contains no metadata about what type it - # actually is (and postgresql doesn't know about GIS types so doesn't - # store that column metadata anywhere). In order to handle missing data - # for PostGIS types, we'll probably need to come up with some sort of -<<<<<<< HEAD - # generic PostGIS object or dtype which can be set to NULL for ***REMOVED*** -======= - # generic PostGIS object or dtype which can be set to NULL for missing data. ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - adapter = PostgresAdapter(postgres.url(), table='missing_values_test') - adapter.field_shapes = {'path': 2} - result = adapter[:] - expected = np.array([('', 0, np.nan, [np.nan, np.nan], [(np.nan, np.nan), (np.nan, np.nan)], [])], - dtype=[(str('char'), str('U5')), - (str('int4'), str('i4')), - (str('float4'), str('f4')), - (str('point'), str('f8'), 2), - (str('path'), str('f8'), (2, 2)), - (str('polygon'), str('O'))]) - assert expected.dtype == result.dtype - assert result[0][0] == '' - assert result[0][1] == 0 - assert np.isnan(result[0][2]) - assert np.isnan(result[0][3][0]) - assert np.isnan(result[0][3][1]) - assert np.isnan(result[0][4][0][0]) - assert np.isnan(result[0][4][0][1]) - assert np.isnan(result[0][4][1][0]) - assert np.isnan(result[0][4][1][1]) - assert len(result[0][5]) == 0 - -def test_empty_table(postgres): - adapter = PostgresAdapter(postgres.url(), table='empty_test') - result = adapter[:] - expected = np.array([], dtype=[(str('dummy'), str('i4'))]) - np.testing.assert_array_equal(expected, result) - -def test_points(postgres): - adapter = PostgresAdapter(postgres.url(), - query='select point2d, point3d, point4d from points') - result = adapter[:] - expected = np.array([('POINT (0.000000 1.000000)', - 'POINT (0.000000 1.000000 2.000000)', - 'POINT (0.000000 1.000000 2.000000 3.000000)')], - dtype=[('point2d', 'O'), - ('point3d', 'O'), - ('point4d', 'O')]) - np.testing.assert_array_equal(expected, result) - - adapter.field_types = ['f8', 'O', 'f8'] - result = adapter[:] - expected = np.array([([0.0, 1.0], - 'POINT (0.000000 1.000000 2.000000)', - [0.0, 1.0, 2.0, 3.0])], - dtype=[('point2d', 'f8', (2,)), - ('point3d', 'O'), - ('point4d', 'f8', (4,))]) - np.testing.assert_array_equal(expected, result) - -def test_multipoints(postgres): - adapter = PostgresAdapter(postgres.url(), - query='select point2d, point3d, point4d from multipoints') - adapter.field_shapes = {'point2d': 1, 'point3d': 4} - result = adapter[:] - expected = np.array([([[0, 1]], - [[0, 1, 2], [3, 4, 5], [0, 0, 0], [0, 0, 0]], - 'MULTIPOINT ((0.000000 1.000000 2.000000 3.000000), ' - '(4.000000 5.000000 6.000000 7.000000))')], - dtype=[('point2d', 'f8', (1, 2)), - ('point3d', 'f8', (4, 3)), - ('point4d', 'O')]) - np.testing.assert_array_equal(expected, result) - -def test_lines(postgres): - adapter = PostgresAdapter(postgres.url(), - query='select line2d, line3d, line4d from lines') - adapter.field_shapes = {'line2d': 1, 'line3d': 3} - result = adapter[:] - expected = np.array([([[0.0, 1.0]], - [[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [0.0, 0.0, 0.0]], - 'LINESTRING (0.000000 1.000000 2.000000 3.000000, ' - '4.000000 5.000000 6.000000 7.000000)'), - ([[0.0, 1.0]], - [[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0]], - 'LINESTRING (0.000000 1.000000 2.000000 3.000000, ' - '4.000000 5.000000 6.000000 7.000000)')], - dtype=[('line2d', 'f8', (1,2)), - ('line3d', 'f8', (3,3)), - ('line4d', 'O')]) - np.testing.assert_array_equal(expected, result) - -def test_multilines(postgres): - adapter = PostgresAdapter(postgres.url(), - query='select line2d, line3d, line4d from multilines') - adapter.field_shapes = {'line3d': (2, 3), 'line4d': (2, 2)} - result = adapter[:] - expected = np.array([('MULTILINESTRING ((0.000000 1.000000, 2.000000 3.000000), ' - '(4.000000 5.000000, 6.000000 7.000000))', - [[[0, 1, 2], [3, 4, 5], [0, 0, 0]], [[6, 7, 8], [9, 10, 11], [12, 13, 14]]], - [[(0, 1, 2, 3), (4, 5, 6, 7)], [(8, 9, 10, 11), (12, 13, 14, 15)]])], - dtype=[('line2d', 'O'), - ('line3d', 'f8', (2, 3, 3)), - ('line4d', 'f8', (2, 2, 4))]) - np.testing.assert_array_equal(expected, result) - -def test_polygons(postgres): - adapter = PostgresAdapter(postgres.url(), - query='select polygon2d, polygon3d, polygon4d from polygons') - adapter.field_shapes = {'polygon3d': (4, 5), 'polygon4d': (3, 4)} - result = adapter[:] - expected = np.array([('POLYGON ((0.000000 1.000000, 2.000000 3.000000, 4.000000 5.000000, 0.000000 1.000000), ' - '(0.000000 1.000000, 2.000000 3.000000, 4.000000 5.000000, 0.000000 1.000000), ' - '(0.000000 1.000000, 2.000000 3.000000, 4.000000 5.000000, 0.000000 1.000000))', - [[[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 1, 2], [0, 0, 0]], - [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 1, 2], [0, 0, 0]], - [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 1, 2], [0, 0, 0]], - [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]], - [[[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [0, 1, 2, 3]], - [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [0, 1, 2, 3]], - [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [0, 1, 2, 3]]])], - dtype=[('polygon2d', 'O'), - ('polygon3d', 'f8', (4, 5, 3)), - ('polygon4d', 'f8', (3, 4, 4))]) - np.testing.assert_array_equal(expected, result) - -def test_multipolygons(postgres): - adapter = PostgresAdapter(postgres.url(), - query='select polygon2d, polygon3d, polygon4d from multipolygons') - adapter.field_shapes = {'polygon3d': (2, 4, 5), 'polygon4d': (2, 3, 4)} - result = adapter[:] - expected = np.array([('MULTIPOLYGON (((0.000000 1.000000, 2.000000 3.000000, 4.000000 5.000000, 0.000000 1.000000), ' - '(0.000000 1.000000, 2.000000 3.000000, 4.000000 5.000000, 0.000000 1.000000), ' - '(0.000000 1.000000, 2.000000 3.000000, 4.000000 5.000000, 0.000000 1.000000)), ' - '((0.000000 1.000000, 2.000000 3.000000, 4.000000 5.000000, 0.000000 1.000000), ' - '(0.000000 1.000000, 2.000000 3.000000, 4.000000 5.000000, 0.000000 1.000000), ' - '(0.000000 1.000000, 2.000000 3.000000, 4.000000 5.000000, 0.000000 1.000000)))', - [[[[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 1, 2], [0, 0, 0]], - [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 1, 2], [0, 0, 0]], - [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 1, 2], [0, 0, 0]], - [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]], - [[[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 1, 2], [0, 0, 0]], - [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 1, 2], [0, 0, 0]], - [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 1, 2], [0, 0, 0]], - [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]]], - [[[(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11), (0, 1, 2, 3)], - [(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11), (0, 1, 2, 3)], - [(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11), (0, 1, 2, 3)]], - [[(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11), (0, 1, 2, 3)], - [(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11), (0, 1, 2, 3)], - [(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11), (0, 1, 2, 3)]]])], - dtype=[('polygon2d', 'O'), - ('polygon3d', 'f8', (2, 4, 5, 3)), - ('polygon4d', 'f8', (2, 3, 4, 4))]) - np.testing.assert_array_equal(expected, result) - -def test_dataframe_gis(postgres): - adapter = PostgresAdapter(postgres.url(), dataframe=True, table='points') - result = adapter[:] - expected = pd.DataFrame(np.array([('POINT (0.000000 1.000000)', - 'POINT (0.000000 1.000000 2.000000)', - 'POINT (0.000000 1.000000 2.000000 3.000000)')], - dtype=[('point2d', 'O'), - ('point3d', 'O'), - ('point4d', 'O')])) - np.testing.assert_array_equal(expected, result) - - adapter = PostgresAdapter(postgres.url(), dataframe=True, table='multipoints') - result = adapter[:] - expected = pd.DataFrame(np.array([('MULTIPOINT ((0.000000 1.000000), (2.000000 3.000000))', - 'MULTIPOINT ((0.000000 1.000000 2.000000), (3.000000 4.000000 5.000000))', - 'MULTIPOINT ((0.000000 1.000000 2.000000 3.000000), ' - '(4.000000 5.000000 6.000000 7.000000))')], - dtype=[('point2d', 'O'), - ('point3d', 'O'), - ('point4d', 'O')])) - np.testing.assert_array_equal(expected, result) diff --git a/pyodbc/INSTALL.rst b/pyodbc/INSTALL.rst deleted file mode 100644 index a1d887c..0000000 --- a/pyodbc/INSTALL.rst +++ /dev/null @@ -1,78 +0,0 @@ -Installing NumPy-aware pyodbc -============================= - -Compiling ---------- - -For compiling this library, just use the standard Python procedure:: - - $ python setup.py build_ext -i - -You will need a C++ compiler installed. - - -Running the test suite -<<<<<<< HEAD -***REMOVED******REMOVED*** -======= ----------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -For testing the library, look into the original documentation in: - -:homepage: http://code.google.com/p/pyodbc - -For testing the NumPy-aware methods specifically, please configure -your ODBC system by installing the next packages:: - - - ODBC system: unixODBC >= 2.2.14 - - SQLite backend: SQLite ODBC >= 0.96 - - MySQL backend: mysql-connector-odbc >= 5.1.10 - - Postgres backend: psqlODBC >= 09.01.0100 - -Then make sure that you have proper 'odcbinst.ini' and 'odbc.ini' -files configured in '/etc'. Also, edit the 'tests_numpy/odbc.cfg' -file and configure it to your needs. Here it is an example:: - - [sqlite] - connection-string=DSN=odbcsqlite;Database=test-sqlite.db - [mysql] - connection-string=DSN=myodbc;Database=test - [postgresql] - connection-string=DSN=odbcpostgresql;Database=test - -On Windows, try: - - [sqlite] - connection-string=DSN=SQLite3 Datasource;Database=test-sqlite.db - [mysql] - connection-string=DSN=MySQL55;Database=test - -You may want to have a look at the examples included in the 'samples/' -directory. These offer configurations for SQLite, MySQL and -PostgreSQL ODBC drivers, but you can add a new ODBC driver for any -other database you want. The only restriction is that they must -support the ODBC standard 3.0 or higher. - -To run the test suite for the different backends configured in -'tests_numpy/odbc.cfg', just do:: - - $ PYTHONPATH=. python tests_numpy/generic.py [your-backend] - -This will run the NumPy-aware test suite for the selected backend. In -case you don't provide a backend, it defaults to `sqlite`. - -In case some test fails, please report this back. - -Installing -<<<<<<< HEAD -***REMOVED*** -======= ----------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -After you run the test suite, you are ready to install. Just do it with:: - - $ [sudo] python setup.py install - -That's all folks! diff --git a/pyodbc/README.rst b/pyodbc/README.rst deleted file mode 100644 index 9aae081..0000000 --- a/pyodbc/README.rst +++ /dev/null @@ -1,172 +0,0 @@ - -Overview -======== - -This project is an enhancement of the Python database module for ODBC -that implements the Python DB API 2.0 specification. You can see the -original project here: - -:homepage: http://code.google.com/p/pyodbc -:source: http://github.com/mkleehammer/pyodbc -:source: http://code.google.com/p/pyodbc/source/list - -The enhancements are documented in this file. For general info about -the pyodbc package, please refer to the original project -documentation. - -This module enhancement requires: - -* Python 2.4 or greater -* ODBC 3.0 or greater -* NumPy 1.5 or greater (1.7 is required for datetime64 support) - -The enhancements in this module consist mainly in the addition of some -new methods for fetching the data after a query and put it in a -variety of NumPy containers. - -Using NumPy as data containers instead of the classical list of tuples -has a couple of advantages: - -1) The NumPy container is much more compact, and hence, it -requires much less memory, than the original approach. - -2) As a NumPy container can hold arbitrarily large arrays, it requires -much less object creation than the original approach (one Python -object per datum retrieved). - -This means that this enhancements will allow to fetch data out of -relational databases in a much faster way, while consuming -significantly less resources. - - -Installing -========== - -Please follow the instructions in 'INSTALL.rst'. - - -API additions -============= - -Variables -~~~~~~~~~ - -* `pyodbc.npversion` The version for the NumPy additions - -Methods -~~~~~~~ - -Cursor.fetchdictarray(size=cursor.arraysize) -<<<<<<< HEAD -***REMOVED******REMOVED******REMOVED*** -======= --------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -This is similar to the original `Cursor.fetchmany(size)`, but the data -is returned in a dictionary where the keys are the names of the -columns and the values are NumPy containers. - -For example, it a SELECT is returning 3 columns with names 'a', 'b' -and 'c' and types `varchar(10)`, `integer` and `timestamp`, the -returned object will be something similar to:: - - {'a': array([...], dtype='S11'), - 'b': array([...], dtype=int32), - 'c': array([...], dtype=datetime64[us])} - -Note that the `varchar(10)` type is translated automatically to a -string type of 11 elements ('S11'). This is because the ODBC driver -needs one additional space to put the trailing '\0' in strings, and -NumPy needs to provide the room for this. - -Also, it is important to stress that all the `timestamp` types are -translated into a NumPy `datetime64` type with a resolution of -microseconds by default. - -Cursor.fetchsarray(size=cursor.arraysize) -<<<<<<< HEAD -***REMOVED******REMOVED***------- -======= ------------------------------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -This is similar to the original `Cursor.fetchmany(size)`, but the data -is returned in a NumPy structured array, where the name and type of -the fields matches to those resulting from the SELECT. - -Here it is an example of the output for the SELECT above:: - - array([(...), - (...)], - dtype=[('a', '|S11'), ('b', ' -#include - -inline bool StatementIsValid(Cursor* cursor) -{ - return cursor->cnxn != 0 && ((Connection*)cursor->cnxn)->hdbc != SQL_NULL_HANDLE && cursor->hstmt != SQL_NULL_HANDLE; -} - -extern PyTypeObject CursorType; - -inline bool Cursor_Check(PyObject* o) -{ - return o != 0 && Py_TYPE(o) == &CursorType; -} - -Cursor* Cursor_Validate(PyObject* obj, DWORD flags) -{ - // Validates that a PyObject is a Cursor (like Cursor_Check) and optionally some other requirements controlled by - // `flags`. If valid and all requirements (from the flags) are met, the cursor is returned, cast to Cursor*. - // Otherwise zero is returned. - // - // Designed to be used at the top of methods to convert the PyObject pointer and perform necessary checks. - // - // Valid flags are from the CURSOR_ enum above. Note that unless CURSOR_RAISE_ERROR is supplied, an exception - // will not be set. (When deallocating, we really don't want an exception.) - - Connection* cnxn = 0; - Cursor* cursor = 0; - - if (!Cursor_Check(obj)) - { - if (flags & CURSOR_RAISE_ERROR) - PyErr_SetString(ProgrammingError, "Invalid cursor object."); - return 0; - } - - cursor = (Cursor*)obj; - cnxn = (Connection*)cursor->cnxn; - - if (cnxn == 0) - { - if (flags & CURSOR_RAISE_ERROR) - PyErr_SetString(ProgrammingError, "Attempt to use a closed cursor."); - return 0; - } - - if (IsSet(flags, CURSOR_REQUIRE_OPEN)) - { - if (cursor->hstmt == SQL_NULL_HANDLE) - { - if (flags & CURSOR_RAISE_ERROR) - PyErr_SetString(ProgrammingError, "Attempt to use a closed cursor."); - return 0; - } - - if (cnxn->hdbc == SQL_NULL_HANDLE) - { - if (flags & CURSOR_RAISE_ERROR) - PyErr_SetString(ProgrammingError, "The cursor's connection has been closed."); - return 0; - } - } - - if (IsSet(flags, CURSOR_REQUIRE_RESULTS) && cursor->colinfos == 0) - { - if (flags & CURSOR_RAISE_ERROR) - PyErr_SetString(ProgrammingError, "No results. Previous SQL was not a query."); - return 0; - } - - return cursor; -} - - -inline bool IsNumericType(SQLSMALLINT sqltype) -{ - switch (sqltype) - { - case SQL_DECIMAL: - case SQL_NUMERIC: - case SQL_REAL: - case SQL_FLOAT: - case SQL_DOUBLE: - case SQL_SMALLINT: - case SQL_INTEGER: - case SQL_TINYINT: - case SQL_BIGINT: - return true; - } - - return false; -} - - -static PyObject* PythonTypeFromSqlType(Cursor* cur, const SQLCHAR* name, SQLSMALLINT type, bool unicode_results) -{ - // Returns a type object ('int', 'str', etc.) for the given ODBC C type. This is used to populate - // Cursor.description with the type of Python object that will be returned for each column. - // - // name - // The name of the column, only used to create error messages. - // - // type - // The ODBC C type (SQL_C_CHAR, etc.) of the column. - // - // The returned object does not have its reference count incremented! - - int conv_index = GetUserConvIndex(cur, type); - if (conv_index != -1) - return (PyObject*)&PyString_Type; - - PyObject* pytype = 0; - - switch (type) - { - case SQL_CHAR: - case SQL_VARCHAR: - case SQL_LONGVARCHAR: - case SQL_GUID: - case SQL_SS_XML: - if (unicode_results) - pytype = (PyObject*)&PyUnicode_Type; - else - pytype = (PyObject*)&PyString_Type; - break; - - case SQL_DECIMAL: - case SQL_NUMERIC: - pytype = (PyObject*)decimal_type; - break; - - case SQL_REAL: - case SQL_FLOAT: - case SQL_DOUBLE: - pytype = (PyObject*)&PyFloat_Type; - break; - - case SQL_SMALLINT: - case SQL_INTEGER: - case SQL_TINYINT: - pytype = (PyObject*)&PyInt_Type; - break; - - case SQL_TYPE_DATE: - pytype = (PyObject*)PyDateTimeAPI->DateType; - break; - - case SQL_TYPE_TIME: - case SQL_SS_TIME2: // SQL Server 2008+ - pytype = (PyObject*)PyDateTimeAPI->TimeType; - break; - - case SQL_TYPE_TIMESTAMP: - pytype = (PyObject*)PyDateTimeAPI->DateTimeType; - break; - - case SQL_BIGINT: - pytype = (PyObject*)&PyLong_Type; - break; - - case SQL_BIT: - pytype = (PyObject*)&PyBool_Type; - break; - - case SQL_BINARY: - case SQL_VARBINARY: - case SQL_LONGVARBINARY: -#if PY_MAJOR_VERSION >= 3 - pytype = (PyObject*)&PyBytes_Type; -#else - pytype = (PyObject*)&PyBuffer_Type; -#endif - break; - - - case SQL_WCHAR: - case SQL_WVARCHAR: - case SQL_WLONGVARCHAR: - pytype = (PyObject*)&PyUnicode_Type; - break; - - default: - return RaiseErrorV(0, 0, "ODBC data type %d is not supported. Cannot read column '%s'.", type, (const char*)name); - } - - Py_INCREF(pytype); - return pytype; -} - - -static bool create_name_map(Cursor* cur, SQLSMALLINT field_count, bool lower) -{ - // Called after an execute to construct the map shared by rows. - - bool success = false; - PyObject *desc = 0, *colmap = 0, *colinfo = 0, *type = 0, *index = 0, *nullable_obj=0; - SQLRETURN ret; - - I(cur->hstmt != SQL_NULL_HANDLE && cur->colinfos != 0); - - // These are the values we expect after free_results. If this function fails, we do not modify any members, so - // they should be set to something Cursor_close can deal with. - I(cur->description == Py_None); - I(cur->map_name_to_index == 0); - - if (cur->cnxn->hdbc == SQL_NULL_HANDLE) - { - RaiseErrorV(0, ProgrammingError, "The cursor's connection was closed."); - return false; - } - - desc = PyTuple_New((Py_ssize_t)field_count); - colmap = PyDict_New(); - if (!desc || !colmap) - goto done; - - for (int i = 0; i < field_count; i++) - { - SQLCHAR name[300]; - SQLSMALLINT nDataType; - SQLULEN nColSize; // precision - SQLSMALLINT cDecimalDigits; // scale - SQLSMALLINT nullable; - - Py_BEGIN_ALLOW_THREADS - ret = SQLDescribeCol(cur->hstmt, (SQLUSMALLINT)(i + 1), name, _countof(name), 0, &nDataType, &nColSize, &cDecimalDigits, &nullable); - Py_END_ALLOW_THREADS - - if (cur->cnxn->hdbc == SQL_NULL_HANDLE) - { - // The connection was closed by another thread in the ALLOW_THREADS block above. - RaiseErrorV(0, ProgrammingError, "The cursor's connection was closed."); - goto done; - } - - if (!SQL_SUCCEEDED(ret)) - { - RaiseErrorFromHandle("SQLDescribeCol", cur->cnxn->hdbc, cur->hstmt); - goto done; - } - - TRACE("Col %d: type=%d colsize=%d\n", (i+1), (int)nDataType, (int)nColSize); - - if (lower) - _strlwr((char*)name); - - type = PythonTypeFromSqlType(cur, name, nDataType, cur->cnxn->unicode_results); - if (!type) - goto done; - - switch (nullable) - { - case SQL_NO_NULLS: - nullable_obj = Py_False; - break; - case SQL_NULLABLE: - nullable_obj = Py_True; - break; - case SQL_NULLABLE_UNKNOWN: - default: - nullable_obj = Py_None; - break; - } - - // The Oracle ODBC driver has a bug (I call it) that it returns a data size of 0 when a numeric value is - // retrieved from a UNION: http://support.microsoft.com/?scid=kb%3Ben-us%3B236786&x=13&y=6 - // - // Unfortunately, I don't have a test system for this yet, so I'm *trying* something. (Not a good sign.) If - // the size is zero and it appears to be a numeric type, we'll try to come up with our own length using any - // other data we can get. - - if (nColSize == 0 && IsNumericType(nDataType)) - { - // I'm not sure how - if (cDecimalDigits != 0) - { - nColSize = (SQLUINTEGER)(cDecimalDigits + 3); - } - else - { - // I'm not sure if this is a good idea, but ... - nColSize = 42; - } - } - - colinfo = Py_BuildValue("(sOOiiiO)", - (char*)name, - type, // type_code - Py_None, // display size - (int)nColSize, // internal_size - (int)nColSize, // precision - (int)cDecimalDigits, // scale - nullable_obj); // null_ok - if (!colinfo) - goto done; - - - nullable_obj = 0; - - index = PyInt_FromLong(i); - if (!index) - goto done; - - PyDict_SetItemString(colmap, (const char*)name, index); - Py_DECREF(index); // SetItemString increments - index = 0; - - PyTuple_SET_ITEM(desc, i, colinfo); - colinfo = 0; // reference stolen by SET_ITEM - } - - Py_XDECREF(cur->description); - cur->description = desc; - desc = 0; - cur->map_name_to_index = colmap; - colmap = 0; - - success = true; - - done: - Py_XDECREF(nullable_obj); - Py_XDECREF(desc); - Py_XDECREF(colmap); - Py_XDECREF(index); - Py_XDECREF(colinfo); - - return success; -} - - -enum free_results_flags -{ - FREE_STATEMENT = 0x01, - KEEP_STATEMENT = 0x02, - FREE_PREPARED = 0x04, - KEEP_PREPARED = 0x08, - - STATEMENT_MASK = 0x03, - PREPARED_MASK = 0x0C -}; - -static bool free_results(Cursor* self, int flags) -{ - // Internal function called any time we need to free the memory associated with query results. It is safe to call - // this even when a query has not been executed. - - // If we ran out of memory, it is possible that we have a cursor but colinfos is zero. However, we should be - // deleting this object, so the cursor will be freed when the HSTMT is destroyed. */ - - I((flags & STATEMENT_MASK) != 0); - I((flags & PREPARED_MASK) != 0); - - if ((flags & PREPARED_MASK) == FREE_PREPARED) - { - Py_XDECREF(self->pPreparedSQL); - self->pPreparedSQL = 0; - } - - if (self->colinfos) - { - pyodbc_free(self->colinfos); - self->colinfos = 0; - } - - if (StatementIsValid(self)) - { - if ((flags & STATEMENT_MASK) == FREE_STATEMENT) - { - Py_BEGIN_ALLOW_THREADS - SQLFreeStmt(self->hstmt, SQL_CLOSE); - Py_END_ALLOW_THREADS; - } - else - { - Py_BEGIN_ALLOW_THREADS - SQLFreeStmt(self->hstmt, SQL_UNBIND); - SQLFreeStmt(self->hstmt, SQL_RESET_PARAMS); - Py_END_ALLOW_THREADS; - } - - if (self->cnxn->hdbc == SQL_NULL_HANDLE) - { - // The connection was closed by another thread in the ALLOW_THREADS block above. - RaiseErrorV(0, ProgrammingError, "The cursor's connection was closed."); - return false; - } - } - - if (self->description != Py_None) - { - Py_DECREF(self->description); - self->description = Py_None; - Py_INCREF(Py_None); - } - - if (self->map_name_to_index) - { - Py_DECREF(self->map_name_to_index); - self->map_name_to_index = 0; - } - - self->rowcount = -1; - - return true; -} - -static void cancelimpl(Cursor* cur) -{ - UNUSED(cur); - - Py_BEGIN_ALLOW_THREADS - SQLCancel(cur->hstmt); - Py_END_ALLOW_THREADS -} - -static void closeimpl(Cursor* cur) -{ - // An internal function for the shared 'closing' code used by Cursor_close and Cursor_dealloc. - // - // This method releases the GIL lock while closing, so verify the HDBC still exists if you use it. - - free_results(cur, FREE_STATEMENT | FREE_PREPARED); - - FreeParameterInfo(cur); - FreeParameterData(cur); - - if (StatementIsValid(cur)) - { - HSTMT hstmt = cur->hstmt; - cur->hstmt = SQL_NULL_HANDLE; - Py_BEGIN_ALLOW_THREADS - SQLFreeHandle(SQL_HANDLE_STMT, hstmt); - Py_END_ALLOW_THREADS - } - - - Py_XDECREF(cur->pPreparedSQL); - Py_XDECREF(cur->description); - Py_XDECREF(cur->map_name_to_index); - Py_XDECREF(cur->cnxn); - - cur->pPreparedSQL = 0; - cur->description = 0; - cur->map_name_to_index = 0; - cur->cnxn = 0; -} - -static char close_doc[] = - "Close the cursor now (rather than whenever __del__ is called). The cursor will\n" - "be unusable from this point forward; a ProgrammingError exception will be\n" - "raised if any operation is attempted with the cursor."; - -static PyObject* Cursor_close(PyObject* self, PyObject* args) -{ - UNUSED(args); - - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_OPEN | CURSOR_RAISE_ERROR); - if (!cursor) - return 0; - - closeimpl(cursor); - - Py_INCREF(Py_None); - return Py_None; -} - -static void Cursor_dealloc(Cursor* cursor) -{ - if (Cursor_Validate((PyObject*)cursor, CURSOR_REQUIRE_CNXN)) - { - closeimpl(cursor); - } - - PyObject_Del(cursor); -} - - -static const char cancel_doc[] = "cancel() \n"\ - "cancel the active statement associated with the cursor. \n\n" \ - "This method wraps SQLCancel. As such, it is possible to cancel \n" \ - "statements that are running on other threads. In Python this means \n" \ - "that it is possible to call cancel on a cursor that is blocking \n" \ - "another Python thread.\n\n" \ - "When a cursor is cancelled, the thread that was blocked on a call to\n" \ - "that cursor will be unblocked by having the blocking function raise\n" \ - "an error exception.\n" \ - "\n"; - -static PyObject* Cursor_cancel(PyObject* self, PyObject* args) -{ - UNUSED(args); - Cursor* cursor = Cursor_Validate(self, - CURSOR_REQUIRE_OPEN | CURSOR_RAISE_ERROR); - - if (!cursor) - return 0; - - cancelimpl(cursor); - - Py_INCREF(Py_None); - return Py_None; -} - - -bool InitColumnInfo(Cursor* cursor, SQLUSMALLINT iCol, ColumnInfo* pinfo) -{ - // Initializes ColumnInfo from result set metadata. - - SQLRETURN ret; - - // REVIEW: This line fails on OS/X with the FileMaker driver : http://www.filemaker.com/support/updaters/xdbc_odbc_mac.html - // - // I suspect the problem is that it doesn't allow NULLs in some of the parameters, so I'm going to supply them all - // to see what happens. - - SQLCHAR ColumnName[200]; - SQLSMALLINT BufferLength = _countof(ColumnName); - SQLSMALLINT NameLength = 0; - SQLSMALLINT DataType = 0; - SQLULEN ColumnSize = 0; - SQLSMALLINT DecimalDigits = 0; - SQLSMALLINT Nullable = 0; - - Py_BEGIN_ALLOW_THREADS - ret = SQLDescribeCol(cursor->hstmt, iCol, - ColumnName, - BufferLength, - &NameLength, - &DataType, - &ColumnSize, - &DecimalDigits, - &Nullable); - Py_END_ALLOW_THREADS - - pinfo->sql_type = DataType; - pinfo->column_size = ColumnSize; - - if (cursor->cnxn->hdbc == SQL_NULL_HANDLE) - { - // The connection was closed by another thread in the ALLOW_THREADS block above. - RaiseErrorV(0, ProgrammingError, "The cursor's connection was closed."); - return false; - } - - if (!SQL_SUCCEEDED(ret)) - { - RaiseErrorFromHandle("SQLDescribeCol", cursor->cnxn->hdbc, cursor->hstmt); - return false; - } - - // If it is an integer type, determine if it is signed or unsigned. The buffer size is the same but we'll need to - // know when we convert to a Python integer. - - switch (pinfo->sql_type) - { - case SQL_TINYINT: - case SQL_SMALLINT: - case SQL_INTEGER: - case SQL_BIGINT: - { - SQLLEN f; - Py_BEGIN_ALLOW_THREADS - ret = SQLColAttribute(cursor->hstmt, iCol, SQL_DESC_UNSIGNED, 0, 0, 0, &f); - Py_END_ALLOW_THREADS - - if (cursor->cnxn->hdbc == SQL_NULL_HANDLE) - { - // The connection was closed by another thread in the ALLOW_THREADS block above. - RaiseErrorV(0, ProgrammingError, "The cursor's connection was closed."); - return false; - } - - if (!SQL_SUCCEEDED(ret)) - { - RaiseErrorFromHandle("SQLColAttribute", cursor->cnxn->hdbc, cursor->hstmt); - return false; - } - pinfo->is_unsigned = (f == SQL_TRUE); - break; - } - - default: - pinfo->is_unsigned = false; - } - - return true; -} - - -static bool PrepareResults(Cursor* cur, int cCols) -{ - // Called after a SELECT has been executed to perform pre-fetch work. - // - // Allocates the ColumnInfo structures describing the returned data. - - int i; - I(cur->colinfos == 0); - - cur->colinfos = (ColumnInfo*)pyodbc_malloc(sizeof(ColumnInfo) * cCols); - if (cur->colinfos == 0) - { - PyErr_NoMemory(); - return false; - } - - for (i = 0; i < cCols; i++) - { - if (!InitColumnInfo(cur, (SQLUSMALLINT)(i + 1), &cur->colinfos[i])) - { - pyodbc_free(cur->colinfos); - cur->colinfos = 0; - return false; - } - } - - return true; -} - - -static PyObject* execute(Cursor* cur, PyObject* pSql, PyObject* params, bool skip_first) -{ - // Internal function to execute SQL, called by .execute and .executemany. - // - // pSql - // A PyString, PyUnicode, or derived object containing the SQL. - // - // params - // Pointer to an optional sequence of parameters, and possibly the SQL statement (see skip_first): - // (SQL, param1, param2) or (param1, param2). - // - // skip_first - // If true, the first element in `params` is ignored. (It will be the SQL statement and `params` will be the - // entire tuple passed to Cursor.execute.) Otherwise all of the params are used. (This case occurs when called - // from Cursor.executemany, in which case the sequences do not contain the SQL statement.) Ignored if params is - // zero. - - if (params) - { - if (!PyTuple_Check(params) && !PyList_Check(params) && !Row_Check(params)) - return RaiseErrorV(0, PyExc_TypeError, "Params must be in a list, tuple, or Row"); - } - - // Normalize the parameter variables. - - int params_offset = skip_first ? 1 : 0; - Py_ssize_t cParams = params == 0 ? 0 : PySequence_Length(params) - params_offset; - - SQLRETURN ret = 0; - - free_results(cur, FREE_STATEMENT | KEEP_PREPARED); - - const char* szLastFunction = ""; - - if (cParams > 0) - { - // There are parameters, so we'll need to prepare the SQL statement and bind the parameters. (We need to - // prepare the statement because we can't bind a NULL (None) object without knowing the target datatype. There - // is no one data type that always maps to the others (no, not even varchar)). - - if (!PrepareAndBind(cur, pSql, params, skip_first)) - return 0; - - szLastFunction = "SQLExecute"; - Py_BEGIN_ALLOW_THREADS - ret = SQLExecute(cur->hstmt); - Py_END_ALLOW_THREADS - } - else - { - // REVIEW: Why don't we always prepare? It is highly unlikely that a user would need to execute the same SQL - // repeatedly if it did not have parameters, so we are not losing performance, but it would simplify the code. - - Py_XDECREF(cur->pPreparedSQL); - cur->pPreparedSQL = 0; - - szLastFunction = "SQLExecDirect"; -#if PY_MAJOR_VERSION < 3 - if (PyString_Check(pSql)) - { - Py_BEGIN_ALLOW_THREADS - ret = SQLExecDirect(cur->hstmt, (SQLCHAR*)PyString_AS_STRING(pSql), SQL_NTS); - Py_END_ALLOW_THREADS - } - else -#endif - { - SQLWChar query(pSql); - if (!query) - return 0; - Py_BEGIN_ALLOW_THREADS - ret = SQLExecDirectW(cur->hstmt, query, SQL_NTS); - Py_END_ALLOW_THREADS - } - } - - if (cur->cnxn->hdbc == SQL_NULL_HANDLE) - { - // The connection was closed by another thread in the ALLOW_THREADS block above. - - FreeParameterData(cur); - - return RaiseErrorV(0, ProgrammingError, "The cursor's connection was closed."); - } - - if (!SQL_SUCCEEDED(ret) && ret != SQL_NEED_DATA && ret != SQL_NO_DATA) - { - // We could try dropping through the while and if below, but if there is an error, we need to raise it before - // FreeParameterData calls more ODBC functions. - RaiseErrorFromHandle("SQLExecDirectW", cur->cnxn->hdbc, cur->hstmt); - FreeParameterData(cur); - return 0; - } - - while (ret == SQL_NEED_DATA) - { - // We have bound a PyObject* using SQL_LEN_DATA_AT_EXEC, so ODBC is asking us for the data now. We gave the - // PyObject pointer to ODBC in SQLBindParameter -- SQLParamData below gives the pointer back to us. - // - // Note that we did not increment the pointer reference for this since we are still in the same C function call - // that performed the bind. - - szLastFunction = "SQLParamData"; - PyObject* pParam; - Py_BEGIN_ALLOW_THREADS - ret = SQLParamData(cur->hstmt, (SQLPOINTER*)&pParam); - Py_END_ALLOW_THREADS - - if (ret != SQL_NEED_DATA && ret != SQL_NO_DATA && !SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLParamData", cur->cnxn->hdbc, cur->hstmt); - - TRACE("SQLParamData() --> %d\n", ret); - - if (ret == SQL_NEED_DATA) - { - szLastFunction = "SQLPutData"; - if (PyUnicode_Check(pParam)) - { - SQLWChar wchar(pParam); // Will convert to SQLWCHAR if necessary. - - Py_ssize_t offset = 0; // in characters - Py_ssize_t length = wchar.size(); // in characters - - while (offset < length) - { - SQLLEN remaining = min(cur->cnxn->varchar_maxlength, length - offset); - Py_BEGIN_ALLOW_THREADS - ret = SQLPutData(cur->hstmt, (SQLPOINTER)wchar[offset], (SQLLEN)(remaining * sizeof(SQLWCHAR))); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLPutData", cur->cnxn->hdbc, cur->hstmt); - offset += remaining; - } - } - else if (PyBytes_Check(pParam)) - { - const char* p = PyBytes_AS_STRING(pParam); - SQLLEN offset = 0; - SQLLEN cb = (SQLLEN)PyBytes_GET_SIZE(pParam); - while (offset < cb) - { - SQLLEN remaining = min(cur->cnxn->varchar_maxlength, cb - offset); - TRACE("SQLPutData [%d] (%d) %s\n", offset, remaining, &p[offset]); - Py_BEGIN_ALLOW_THREADS - ret = SQLPutData(cur->hstmt, (SQLPOINTER)&p[offset], remaining); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLPutData", cur->cnxn->hdbc, cur->hstmt); - offset += remaining; - } - } -#if PY_VERSION_HEX >= 0x02060000 - else if (PyByteArray_Check(pParam)) - { - const char* p = PyByteArray_AS_STRING(pParam); - SQLLEN offset = 0; - SQLLEN cb = (SQLLEN)PyByteArray_GET_SIZE(pParam); - while (offset < cb) - { - SQLLEN remaining = min(cur->cnxn->varchar_maxlength, cb - offset); - TRACE("SQLPutData [%d] (%d) %s\n", offset, remaining, &p[offset]); - Py_BEGIN_ALLOW_THREADS - ret = SQLPutData(cur->hstmt, (SQLPOINTER)&p[offset], remaining); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLPutData", cur->cnxn->hdbc, cur->hstmt); - offset += remaining; - } - } -#endif -#if PY_MAJOR_VERSION < 3 - else if (PyBuffer_Check(pParam)) - { - // Buffers can have multiple segments, so we might need multiple writes. Looping through buffers isn't - // difficult, but we've wrapped it up in an iterator object to keep this loop simple. - - BufferSegmentIterator it(pParam); - byte* pb; - SQLLEN cb; - while (it.Next(pb, cb)) - { - Py_BEGIN_ALLOW_THREADS - ret = SQLPutData(cur->hstmt, pb, cb); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLPutData", cur->cnxn->hdbc, cur->hstmt); - } - } -#endif - ret = SQL_NEED_DATA; - } - } - - FreeParameterData(cur); - - if (ret == SQL_NO_DATA) - { - // Example: A delete statement that did not delete anything. - cur->rowcount = 0; - Py_INCREF(cur); - return (PyObject*)cur; - } - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle(szLastFunction, cur->cnxn->hdbc, cur->hstmt); - - SQLLEN cRows = -1; - Py_BEGIN_ALLOW_THREADS - ret = SQLRowCount(cur->hstmt, &cRows); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLRowCount", cur->cnxn->hdbc, cur->hstmt); - - cur->rowcount = (int)cRows; - - TRACE("SQLRowCount: %d\n", cRows); - - SQLSMALLINT cCols = 0; - Py_BEGIN_ALLOW_THREADS - ret = SQLNumResultCols(cur->hstmt, &cCols); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - { - // Note: The SQL Server driver sometimes returns HY007 here if multiple statements (separated by ;) were - // submitted. This is not documented, but I've seen it with multiple successful inserts. - - return RaiseErrorFromHandle("SQLNumResultCols", cur->cnxn->hdbc, cur->hstmt); - } - - TRACE("SQLNumResultCols: %d\n", cCols); - - if (cur->cnxn->hdbc == SQL_NULL_HANDLE) - { - // The connection was closed by another thread in the ALLOW_THREADS block above. - return RaiseErrorV(0, ProgrammingError, "The cursor's connection was closed."); - } - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLRowCount", cur->cnxn->hdbc, cur->hstmt); - - if (cCols != 0) - { - // A result set was created. - - if (!PrepareResults(cur, cCols)) - return 0; - - if (!create_name_map(cur, cCols, lowercase())) - return 0; - - } - - Py_INCREF(cur); - return (PyObject*)cur; -} - - -inline bool IsSequence(PyObject* p) -{ - // Used to determine if the first parameter of execute is a collection of SQL parameters or is a SQL parameter - // itself. If the first parameter is a list, tuple, or Row object, then we consider it a collection. Anything - // else, including other sequences (e.g. bytearray), are considered SQL parameters. - - return PyList_Check(p) || PyTuple_Check(p) || Row_Check(p); -} - - -static char execute_doc[] = - "C.execute(sql, [params]) --> Cursor\n" - "\n" - "Prepare and execute a database query or command.\n" - "\n" - "Parameters may be provided as a sequence (as specified by the DB API) or\n" - "simply passed in one after another (non-standard):\n" - "\n" - " cursor.execute(sql, (param1, param2))\n" - "\n" - " or\n" - "\n" - " cursor.execute(sql, param1, param2)\n"; - -PyObject* Cursor_execute(PyObject* self, PyObject* args) -{ - Py_ssize_t cParams = PyTuple_Size(args) - 1; - - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_OPEN | CURSOR_RAISE_ERROR); - if (!cursor) - return 0; - - if (cParams < 0) - { - PyErr_SetString(PyExc_TypeError, "execute() takes at least 1 argument (0 given)"); - return 0; - } - - PyObject* pSql = PyTuple_GET_ITEM(args, 0); - - if (!PyString_Check(pSql) && !PyUnicode_Check(pSql)) - { - PyErr_SetString(PyExc_TypeError, "The first argument to execute must be a string or unicode query."); - return 0; - } - - // Figure out if there were parameters and how they were passed. Our optional parameter passing complicates this slightly. - - bool skip_first = false; - PyObject *params = 0; - if (cParams == 1 && IsSequence(PyTuple_GET_ITEM(args, 1))) - { - // There is a single argument and it is a sequence, so we must treat it as a sequence of parameters. (This is - // the normal Cursor.execute behavior.) - - params = PyTuple_GET_ITEM(args, 1); - skip_first = false; - } - else if (cParams > 0) - { - params = args; - skip_first = true; - } - - // Execute. - - return execute(cursor, pSql, params, skip_first); -} - - -static PyObject* Cursor_executemany(PyObject* self, PyObject* args) -{ - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_OPEN | CURSOR_RAISE_ERROR); - if (!cursor) - return 0; - - cursor->rowcount = -1; - - PyObject *pSql, *param_seq; - if (!PyArg_ParseTuple(args, "OO", &pSql, ¶m_seq)) - return 0; - - if (!PyString_Check(pSql) && !PyUnicode_Check(pSql)) - { - PyErr_SetString(PyExc_TypeError, "The first argument to execute must be a string or unicode query."); - return 0; - } - - if (!IsSequence(param_seq)) - { - PyErr_SetString(ProgrammingError, "The second parameter to executemany must be a sequence."); - return 0; - } - - Py_ssize_t c = PySequence_Size(param_seq); - - if (c == 0) - { - PyErr_SetString(ProgrammingError, "The second parameter to executemany must not be empty."); - return 0; - } - - for (Py_ssize_t i = 0; i < c; i++) - { - PyObject* params = PySequence_GetItem(param_seq, i); - PyObject* result = execute(cursor, pSql, params, false); - bool success = result != 0; - Py_XDECREF(result); - Py_DECREF(params); - if (!success) - { - cursor->rowcount = -1; - return 0; - } - } - - cursor->rowcount = -1; - Py_RETURN_NONE; -} - - -static PyObject* Cursor_fetch(Cursor* cur) -{ - // Internal function to fetch a single row and construct a Row object from it. Used by all of the fetching - // functions. - // - // Returns a Row object if successful. If there are no more rows, zero is returned. If an error occurs, an - // exception is set and zero is returned. (To differentiate between the last two, use PyErr_Occurred.) - - SQLRETURN ret = 0; - Py_ssize_t field_count, i; - PyObject** apValues; - - Py_BEGIN_ALLOW_THREADS - ret = SQLFetch(cur->hstmt); - Py_END_ALLOW_THREADS - - if (cur->cnxn->hdbc == SQL_NULL_HANDLE) - { - // The connection was closed by another thread in the ALLOW_THREADS block above. - return RaiseErrorV(0, ProgrammingError, "The cursor's connection was closed."); - } - - if (ret == SQL_NO_DATA) - return 0; - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLFetch", cur->cnxn->hdbc, cur->hstmt); - - field_count = PyTuple_GET_SIZE(cur->description); - - apValues = (PyObject**)pyodbc_malloc(sizeof(PyObject*) * field_count); - - if (apValues == 0) - return PyErr_NoMemory(); - - for (i = 0; i < field_count; i++) - { - PyObject* value = GetData(cur, i); - - if (!value) - { - FreeRowValues(i, apValues); - return 0; - } - - apValues[i] = value; - } - - return (PyObject*)Row_New(cur->description, cur->map_name_to_index, field_count, apValues); -} - - -static PyObject* Cursor_fetchlist(Cursor* cur, Py_ssize_t max) -{ - // max - // The maximum number of rows to fetch. If -1, fetch all rows. - // - // Returns a list of Rows. If there are no rows, an empty list is returned. - - PyObject* results; - PyObject* row; - - results = PyList_New(0); - if (!results) - return 0; - - while (max == -1 || max > 0) - { - row = Cursor_fetch(cur); - - if (!row) - { - if (PyErr_Occurred()) - { - Py_DECREF(results); - return 0; - } - break; - } - - PyList_Append(results, row); - Py_DECREF(row); - - if (max != -1) - max--; - } - - return results; -} - - -static PyObject* Cursor_iter(PyObject* self) -{ - Py_INCREF(self); - return self; -} - - -static PyObject* Cursor_iternext(PyObject* self) -{ - // Implements the iterator protocol for cursors. Fetches the next row. Returns zero without setting an exception - // when there are no rows. - - PyObject* result; - - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_RESULTS | CURSOR_RAISE_ERROR); - - if (!cursor) - return 0; - - result = Cursor_fetch(cursor); - - return result; -} - - -static PyObject* Cursor_fetchone(PyObject* self, PyObject* args) -{ - UNUSED(args); - - PyObject* row; - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_RESULTS | CURSOR_RAISE_ERROR); - if (!cursor) - return 0; - - row = Cursor_fetch(cursor); - - if (!row) - { - if (PyErr_Occurred()) - return 0; - Py_RETURN_NONE; - } - - return row; -} - - -static PyObject* Cursor_fetchall(PyObject* self, PyObject* args) -{ - UNUSED(args); - - PyObject* result; - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_RESULTS | CURSOR_RAISE_ERROR); - if (!cursor) - return 0; - - result = Cursor_fetchlist(cursor, -1); - - return result; -} - - -static PyObject* Cursor_fetchmany(PyObject* self, PyObject* args) -{ - long rows; - PyObject* result; - - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_RESULTS | CURSOR_RAISE_ERROR); - if (!cursor) - return 0; - - rows = cursor->arraysize; - if (!PyArg_ParseTuple(args, "|l", &rows)) - return 0; - - result = Cursor_fetchlist(cursor, rows); - - return result; -} - - -static char tables_doc[] = - "C.tables(table=None, catalog=None, schema=None, tableType=None) --> self\n" - "\n" - "Executes SQLTables and creates a results set of tables defined in the data\n" - "source.\n" - "\n" - "The table, catalog, and schema interpret the '_' and '%' characters as\n" - "wildcards. The escape character is driver specific, so use\n" - "`Connection.searchescape`.\n" - "\n" - "Each row fetched has the following columns:\n" - " 0) table_cat: The catalog name.\n" - " 1) table_schem: The schema name.\n" - " 2) table_name: The table name.\n" - " 3) table_type: One of 'TABLE', 'VIEW', SYSTEM TABLE', 'GLOBAL TEMPORARY'\n" - " 'LOCAL TEMPORARY', 'ALIAS', 'SYNONYM', or a data source-specific type name."; - -char* Cursor_tables_kwnames[] = { "table", "catalog", "schema", "tableType", 0 }; - -static PyObject* Cursor_tables(PyObject* self, PyObject* args, PyObject* kwargs) -{ - const char* szCatalog = 0; - const char* szSchema = 0; - const char* szTableName = 0; - const char* szTableType = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ssss", Cursor_tables_kwnames, &szTableName, &szCatalog, &szSchema, &szTableType)) - return 0; - - Cursor* cur = Cursor_Validate(self, CURSOR_REQUIRE_OPEN); - - if (!free_results(cur, FREE_STATEMENT | FREE_PREPARED)) - return 0; - - SQLRETURN ret = 0; - - Py_BEGIN_ALLOW_THREADS - ret = SQLTables(cur->hstmt, (SQLCHAR*)szCatalog, SQL_NTS, (SQLCHAR*)szSchema, SQL_NTS, - (SQLCHAR*)szTableName, SQL_NTS, (SQLCHAR*)szTableType, SQL_NTS); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLTables", cur->cnxn->hdbc, cur->hstmt); - - SQLSMALLINT cCols; - Py_BEGIN_ALLOW_THREADS - ret = SQLNumResultCols(cur->hstmt, &cCols); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLNumResultCols", cur->cnxn->hdbc, cur->hstmt); - - if (!PrepareResults(cur, cCols)) - return 0; - - if (!create_name_map(cur, cCols, true)) - return 0; - - // Return the cursor so the results can be iterated over directly. - Py_INCREF(cur); - return (PyObject*)cur; -} - - -static char columns_doc[] = - "C.columns(table=None, catalog=None, schema=None, column=None)\n\n" - "Creates a results set of column names in specified tables by executing the ODBC SQLColumns function.\n" - "Each row fetched has the following columns:\n" - " 0) table_cat\n" - " 1) table_schem\n" - " 2) table_name\n" - " 3) column_name\n" - " 4) data_type\n" - " 5) type_name\n" - " 6) column_size\n" - " 7) buffer_length\n" - " 8) decimal_digits\n" - " 9) num_prec_radix\n" - " 10) nullable\n" - " 11) remarks\n" - " 12) column_def\n" - " 13) sql_data_type\n" - " 14) sql_datetime_sub\n" - " 15) char_octet_length\n" - " 16) ordinal_position\n" - " 17) is_nullable"; - -char* Cursor_column_kwnames[] = { "table", "catalog", "schema", "column", 0 }; - -static PyObject* Cursor_columns(PyObject* self, PyObject* args, PyObject* kwargs) -{ - const char* szCatalog = 0; - const char* szSchema = 0; - const char* szTable = 0; - const char* szColumn = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ssss", Cursor_column_kwnames, &szTable, &szCatalog, &szSchema, &szColumn)) - return 0; - - Cursor* cur = Cursor_Validate(self, CURSOR_REQUIRE_OPEN); - - if (!free_results(cur, FREE_STATEMENT | FREE_PREPARED)) - return 0; - - SQLRETURN ret = 0; - - Py_BEGIN_ALLOW_THREADS - ret = SQLColumns(cur->hstmt, (SQLCHAR*)szCatalog, SQL_NTS, (SQLCHAR*)szSchema, SQL_NTS, (SQLCHAR*)szTable, SQL_NTS, (SQLCHAR*)szColumn, SQL_NTS); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLColumns", cur->cnxn->hdbc, cur->hstmt); - - SQLSMALLINT cCols; - Py_BEGIN_ALLOW_THREADS - ret = SQLNumResultCols(cur->hstmt, &cCols); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLNumResultCols", cur->cnxn->hdbc, cur->hstmt); - - if (!PrepareResults(cur, cCols)) - return 0; - - if (!create_name_map(cur, cCols, true)) - return 0; - - // Return the cursor so the results can be iterated over directly. - Py_INCREF(cur); - return (PyObject*)cur; -} - - -static char statistics_doc[] = - "C.statistics(catalog=None, schema=None, unique=False, quick=True) --> self\n\n" - "Creates a results set of statistics about a single table and the indexes associated with \n" - "the table by executing SQLStatistics.\n" - "unique\n" - " If True, only unique indexes are retured. Otherwise all indexes are returned.\n" - "quick\n" - " If True, CARDINALITY and PAGES are returned only if they are readily available\n" - " from the server\n" - "\n" - "Each row fetched has the following columns:\n\n" - " 0) table_cat\n" - " 1) table_schem\n" - " 2) table_name\n" - " 3) non_unique\n" - " 4) index_qualifier\n" - " 5) index_name\n" - " 6) type\n" - " 7) ordinal_position\n" - " 8) column_name\n" - " 9) asc_or_desc\n" - " 10) cardinality\n" - " 11) pages\n" - " 12) filter_condition"; - -char* Cursor_statistics_kwnames[] = { "table", "catalog", "schema", "unique", "quick", 0 }; - -static PyObject* Cursor_statistics(PyObject* self, PyObject* args, PyObject* kwargs) -{ - const char* szCatalog = 0; - const char* szSchema = 0; - const char* szTable = 0; - PyObject* pUnique = Py_False; - PyObject* pQuick = Py_True; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ssOO", Cursor_statistics_kwnames, &szTable, &szCatalog, &szSchema, - &pUnique, &pQuick)) - return 0; - - Cursor* cur = Cursor_Validate(self, CURSOR_REQUIRE_OPEN); - - if (!free_results(cur, FREE_STATEMENT | FREE_PREPARED)) - return 0; - - SQLUSMALLINT nUnique = (SQLUSMALLINT)(PyObject_IsTrue(pUnique) ? SQL_INDEX_UNIQUE : SQL_INDEX_ALL); - SQLUSMALLINT nReserved = (SQLUSMALLINT)(PyObject_IsTrue(pQuick) ? SQL_QUICK : SQL_ENSURE); - - SQLRETURN ret = 0; - - Py_BEGIN_ALLOW_THREADS - ret = SQLStatistics(cur->hstmt, (SQLCHAR*)szCatalog, SQL_NTS, (SQLCHAR*)szSchema, SQL_NTS, (SQLCHAR*)szTable, SQL_NTS, - nUnique, nReserved); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLStatistics", cur->cnxn->hdbc, cur->hstmt); - - SQLSMALLINT cCols; - Py_BEGIN_ALLOW_THREADS - ret = SQLNumResultCols(cur->hstmt, &cCols); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLNumResultCols", cur->cnxn->hdbc, cur->hstmt); - - if (!PrepareResults(cur, cCols)) - return 0; - - if (!create_name_map(cur, cCols, true)) - return 0; - - // Return the cursor so the results can be iterated over directly. - Py_INCREF(cur); - return (PyObject*)cur; -} - - -static char rowIdColumns_doc[] = - "C.rowIdColumns(table, catalog=None, schema=None, nullable=True) -->\n\n" - "Executes SQLSpecialColumns with SQL_BEST_ROWID which creates a result set of columns that\n" - "uniquely identify a row\n\n" - "Each row fetched has the following columns:\n" - " 0) scope\n" - " 1) column_name\n" - " 2) data_type\n" - " 3) type_name\n" - " 4) column_size\n" - " 5) buffer_length\n" - " 6) decimal_digits\n" - " 7) pseudo_column"; - -static char rowVerColumns_doc[] = - "C.rowIdColumns(table, catalog=None, schema=None, nullable=True) --> self\n\n" - "Executes SQLSpecialColumns with SQL_ROWVER which creates a result set of columns that\n" - "are automatically updated when any value in the row is updated.\n\n" - "Each row fetched has the following columns:\n" - " 0) scope\n" - " 1) column_name\n" - " 2) data_type\n" - " 3) type_name\n" - " 4) column_size\n" - " 5) buffer_length\n" - " 6) decimal_digits\n" - " 7) pseudo_column"; - -char* Cursor_specialColumn_kwnames[] = { "table", "catalog", "schema", "nullable", 0 }; - -static PyObject* _specialColumns(PyObject* self, PyObject* args, PyObject* kwargs, SQLUSMALLINT nIdType) -{ - const char* szTable; - const char* szCatalog = 0; - const char* szSchema = 0; - PyObject* pNullable = Py_True; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ssO", Cursor_specialColumn_kwnames, &szTable, &szCatalog, &szSchema, &pNullable)) - return 0; - - Cursor* cur = Cursor_Validate(self, CURSOR_REQUIRE_OPEN); - - if (!free_results(cur, FREE_STATEMENT | FREE_PREPARED)) - return 0; - - SQLRETURN ret = 0; - - SQLUSMALLINT nNullable = (SQLUSMALLINT)(PyObject_IsTrue(pNullable) ? SQL_NULLABLE : SQL_NO_NULLS); - - Py_BEGIN_ALLOW_THREADS - ret = SQLSpecialColumns(cur->hstmt, nIdType, (SQLCHAR*)szCatalog, SQL_NTS, (SQLCHAR*)szSchema, SQL_NTS, (SQLCHAR*)szTable, SQL_NTS, - SQL_SCOPE_TRANSACTION, nNullable); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLSpecialColumns", cur->cnxn->hdbc, cur->hstmt); - - SQLSMALLINT cCols; - Py_BEGIN_ALLOW_THREADS - ret = SQLNumResultCols(cur->hstmt, &cCols); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLNumResultCols", cur->cnxn->hdbc, cur->hstmt); - - if (!PrepareResults(cur, cCols)) - return 0; - - if (!create_name_map(cur, cCols, true)) - return 0; - - // Return the cursor so the results can be iterated over directly. - Py_INCREF(cur); - return (PyObject*)cur; -} - - -static PyObject* Cursor_rowIdColumns(PyObject* self, PyObject* args, PyObject* kwargs) -{ - return _specialColumns(self, args, kwargs, SQL_BEST_ROWID); -} - - -static PyObject* Cursor_rowVerColumns(PyObject* self, PyObject* args, PyObject* kwargs) -{ - return _specialColumns(self, args, kwargs, SQL_ROWVER); -} - - -static char primaryKeys_doc[] = - "C.primaryKeys(table, catalog=None, schema=None) --> self\n\n" - "Creates a results set of column names that make up the primary key for a table\n" - "by executing the SQLPrimaryKeys function.\n" - "Each row fetched has the following columns:\n" - " 0) table_cat\n" - " 1) table_schem\n" - " 2) table_name\n" - " 3) column_name\n" - " 4) key_seq\n" - " 5) pk_name"; - -char* Cursor_primaryKeys_kwnames[] = { "table", "catalog", "schema", 0 }; - -static PyObject* Cursor_primaryKeys(PyObject* self, PyObject* args, PyObject* kwargs) -{ - const char* szTable; - const char* szCatalog = 0; - const char* szSchema = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ss", Cursor_primaryKeys_kwnames, &szTable, &szCatalog, &szSchema)) - return 0; - - Cursor* cur = Cursor_Validate(self, CURSOR_REQUIRE_OPEN); - - if (!free_results(cur, FREE_STATEMENT | FREE_PREPARED)) - return 0; - - SQLRETURN ret = 0; - - Py_BEGIN_ALLOW_THREADS - ret = SQLPrimaryKeys(cur->hstmt, (SQLCHAR*)szCatalog, SQL_NTS, (SQLCHAR*)szSchema, SQL_NTS, (SQLCHAR*)szTable, SQL_NTS); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLPrimaryKeys", cur->cnxn->hdbc, cur->hstmt); - - SQLSMALLINT cCols; - Py_BEGIN_ALLOW_THREADS - ret = SQLNumResultCols(cur->hstmt, &cCols); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLNumResultCols", cur->cnxn->hdbc, cur->hstmt); - - if (!PrepareResults(cur, cCols)) - return 0; - - if (!create_name_map(cur, cCols, true)) - return 0; - - // Return the cursor so the results can be iterated over directly. - Py_INCREF(cur); - return (PyObject*)cur; -} - - -static char foreignKeys_doc[] = - "C.foreignKeys(table=None, catalog=None, schema=None,\n" - " foreignTable=None, foreignCatalog=None, foreignSchema=None) --> self\n\n" - "Executes the SQLForeignKeys function and creates a results set of column names\n" - "that are foreign keys in the specified table (columns in the specified table\n" - "that refer to primary keys in other tables) or foreign keys in other tables\n" - "that refer to the primary key in the specified table.\n\n" - "Each row fetched has the following columns:\n" - " 0) pktable_cat\n" - " 1) pktable_schem\n" - " 2) pktable_name\n" - " 3) pkcolumn_name\n" - " 4) fktable_cat\n" - " 5) fktable_schem\n" - " 6) fktable_name\n" - " 7) fkcolumn_name\n" - " 8) key_seq\n" - " 9) update_rule\n" - " 10) delete_rule\n" - " 11) fk_name\n" - " 12) pk_name\n" - " 13) deferrability"; - -char* Cursor_foreignKeys_kwnames[] = { "table", "catalog", "schema", "foreignTable", "foreignCatalog", "foreignSchema", 0 }; - -static PyObject* Cursor_foreignKeys(PyObject* self, PyObject* args, PyObject* kwargs) -{ - const char* szTable = 0; - const char* szCatalog = 0; - const char* szSchema = 0; - const char* szForeignTable = 0; - const char* szForeignCatalog = 0; - const char* szForeignSchema = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ssssss", Cursor_foreignKeys_kwnames, &szTable, &szCatalog, &szSchema, - &szForeignTable, &szForeignCatalog, &szForeignSchema)) - return 0; - - Cursor* cur = Cursor_Validate(self, CURSOR_REQUIRE_OPEN); - - if (!free_results(cur, FREE_STATEMENT | FREE_PREPARED)) - return 0; - - SQLRETURN ret = 0; - - Py_BEGIN_ALLOW_THREADS - ret = SQLForeignKeys(cur->hstmt, (SQLCHAR*)szCatalog, SQL_NTS, (SQLCHAR*)szSchema, SQL_NTS, (SQLCHAR*)szTable, SQL_NTS, - (SQLCHAR*)szForeignCatalog, SQL_NTS, (SQLCHAR*)szForeignSchema, SQL_NTS, (SQLCHAR*)szForeignTable, SQL_NTS); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLForeignKeys", cur->cnxn->hdbc, cur->hstmt); - - SQLSMALLINT cCols; - Py_BEGIN_ALLOW_THREADS - ret = SQLNumResultCols(cur->hstmt, &cCols); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLNumResultCols", cur->cnxn->hdbc, cur->hstmt); - - if (!PrepareResults(cur, cCols)) - return 0; - - if (!create_name_map(cur, cCols, true)) - return 0; - - // Return the cursor so the results can be iterated over directly. - Py_INCREF(cur); - return (PyObject*)cur; -} - -static char getTypeInfo_doc[] = - "C.getTypeInfo(sqlType=None) --> self\n\n" - "Executes SQLGetTypeInfo a creates a result set with information about the\n" - "specified data type or all data types supported by the ODBC driver if not\n" - "specified.\n\n" - "Each row fetched has the following columns:\n" - " 0) type_name\n" - " 1) data_type\n" - " 2) column_size\n" - " 3) literal_prefix\n" - " 4) literal_suffix\n" - " 5) create_params\n" - " 6) nullable\n" - " 7) case_sensitive\n" - " 8) searchable\n" - " 9) unsigned_attribute\n" - "10) fixed_prec_scale\n" - "11) auto_unique_value\n" - "12) local_type_name\n" - "13) minimum_scale\n" - "14) maximum_scale\n" - "15) sql_data_type\n" - "16) sql_datetime_sub\n" - "17) num_prec_radix\n" - "18) interval_precision"; - -static PyObject* Cursor_getTypeInfo(PyObject* self, PyObject* args, PyObject* kwargs) -{ - UNUSED(kwargs); - - SQLSMALLINT nDataType = SQL_ALL_TYPES; - - if (!PyArg_ParseTuple(args, "|i", &nDataType)) - return 0; - - Cursor* cur = Cursor_Validate(self, CURSOR_REQUIRE_OPEN); - - if (!free_results(cur, FREE_STATEMENT | FREE_PREPARED)) - return 0; - - SQLRETURN ret = 0; - - Py_BEGIN_ALLOW_THREADS - ret = SQLGetTypeInfo(cur->hstmt, nDataType); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLGetTypeInfo", cur->cnxn->hdbc, cur->hstmt); - - SQLSMALLINT cCols; - Py_BEGIN_ALLOW_THREADS - ret = SQLNumResultCols(cur->hstmt, &cCols); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLNumResultCols", cur->cnxn->hdbc, cur->hstmt); - - if (!PrepareResults(cur, cCols)) - return 0; - - if (!create_name_map(cur, cCols, true)) - return 0; - - // Return the cursor so the results can be iterated over directly. - Py_INCREF(cur); - return (PyObject*)cur; -} - - -static PyObject* Cursor_nextset(PyObject* self, PyObject* args) -{ - UNUSED(args); - - Cursor* cur = Cursor_Validate(self, 0); - - if (!cur) - return 0; - - SQLRETURN ret = 0; - - Py_BEGIN_ALLOW_THREADS - ret = SQLMoreResults(cur->hstmt); - Py_END_ALLOW_THREADS - - if (ret == SQL_NO_DATA) - { - free_results(cur, FREE_STATEMENT | KEEP_PREPARED); - Py_RETURN_FALSE; - } - - SQLSMALLINT cCols; - Py_BEGIN_ALLOW_THREADS - ret = SQLNumResultCols(cur->hstmt, &cCols); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - { - // Note: The SQL Server driver sometimes returns HY007 here if multiple statements (separated by ;) were - // submitted. This is not documented, but I've seen it with multiple successful inserts. - - free_results(cur, FREE_STATEMENT | KEEP_PREPARED); - return RaiseErrorFromHandle("SQLNumResultCols", cur->cnxn->hdbc, cur->hstmt); - } - free_results(cur, KEEP_STATEMENT | KEEP_PREPARED); - - if (cCols != 0) - { - // A result set was created. - - if (!PrepareResults(cur, cCols)) - return 0; - - if (!create_name_map(cur, cCols, lowercase())) - return 0; - } - - SQLLEN cRows; - Py_BEGIN_ALLOW_THREADS - ret = SQLRowCount(cur->hstmt, &cRows); - Py_END_ALLOW_THREADS - cur->rowcount = (int)cRows; - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLRowCount", cur->cnxn->hdbc, cur->hstmt); - - Py_RETURN_TRUE; -} - - -static char procedureColumns_doc[] = - "C.procedureColumns(procedure=None, catalog=None, schema=None) --> self\n\n" - "Executes SQLProcedureColumns and creates a result set of information\n" - "about stored procedure columns and results.\n" - " 0) procedure_cat\n" - " 1) procedure_schem\n" - " 2) procedure_name\n" - " 3) column_name\n" - " 4) column_type\n" - " 5) data_type\n" - " 6) type_name\n" - " 7) column_size\n" - " 8) buffer_length\n" - " 9) decimal_digits\n" - " 10) num_prec_radix\n" - " 11) nullable\n" - " 12) remarks\n" - " 13) column_def\n" - " 14) sql_data_type\n" - " 15) sql_datetime_sub\n" - " 16) char_octet_length\n" - " 17) ordinal_position\n" - " 18) is_nullable"; - -char* Cursor_procedureColumns_kwnames[] = { "procedure", "catalog", "schema", 0 }; - -static PyObject* Cursor_procedureColumns(PyObject* self, PyObject* args, PyObject* kwargs) -{ - const char* szProcedure = 0; - const char* szCatalog = 0; - const char* szSchema = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|sss", Cursor_procedureColumns_kwnames, &szProcedure, &szCatalog, &szSchema)) - return 0; - - Cursor* cur = Cursor_Validate(self, CURSOR_REQUIRE_OPEN); - - if (!free_results(cur, FREE_STATEMENT | FREE_PREPARED)) - return 0; - - SQLRETURN ret = 0; - - Py_BEGIN_ALLOW_THREADS - ret = SQLProcedureColumns(cur->hstmt, (SQLCHAR*)szCatalog, SQL_NTS, (SQLCHAR*)szSchema, SQL_NTS, - (SQLCHAR*)szProcedure, SQL_NTS, 0, 0); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLProcedureColumns", cur->cnxn->hdbc, cur->hstmt); - - SQLSMALLINT cCols; - Py_BEGIN_ALLOW_THREADS - ret = SQLNumResultCols(cur->hstmt, &cCols); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLNumResultCols", cur->cnxn->hdbc, cur->hstmt); - - if (!PrepareResults(cur, cCols)) - return 0; - - if (!create_name_map(cur, cCols, true)) - return 0; - - // Return the cursor so the results can be iterated over directly. - Py_INCREF(cur); - return (PyObject*)cur; -} - - -static char procedures_doc[] = - "C.procedures(procedure=None, catalog=None, schema=None) --> self\n\n" - "Executes SQLProcedures and creates a result set of information about the\n" - "procedures in the data source.\n" - "Each row fetched has the following columns:\n" - " 0) procedure_cat\n" - " 1) procedure_schem\n" - " 2) procedure_name\n" - " 3) num_input_params\n" - " 4) num_output_params\n" - " 5) num_result_sets\n" - " 6) remarks\n" - " 7) procedure_type"; - -char* Cursor_procedures_kwnames[] = { "procedure", "catalog", "schema", 0 }; - -static PyObject* Cursor_procedures(PyObject* self, PyObject* args, PyObject* kwargs) -{ - const char* szProcedure = 0; - const char* szCatalog = 0; - const char* szSchema = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|sss", Cursor_procedures_kwnames, &szProcedure, &szCatalog, &szSchema)) - return 0; - - Cursor* cur = Cursor_Validate(self, CURSOR_REQUIRE_OPEN); - - if (!free_results(cur, FREE_STATEMENT | FREE_PREPARED)) - return 0; - - SQLRETURN ret = 0; - - Py_BEGIN_ALLOW_THREADS - ret = SQLProcedures(cur->hstmt, (SQLCHAR*)szCatalog, SQL_NTS, (SQLCHAR*)szSchema, SQL_NTS, (SQLCHAR*)szProcedure, SQL_NTS); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLProcedures", cur->cnxn->hdbc, cur->hstmt); - - SQLSMALLINT cCols; - Py_BEGIN_ALLOW_THREADS - ret = SQLNumResultCols(cur->hstmt, &cCols); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLNumResultCols", cur->cnxn->hdbc, cur->hstmt); - - if (!PrepareResults(cur, cCols)) - return 0; - - if (!create_name_map(cur, cCols, true)) - return 0; - - // Return the cursor so the results can be iterated over directly. - Py_INCREF(cur); - return (PyObject*)cur; -} - -static char skip_doc[] = - "skip(count) --> None\n" \ - "\n" \ - "Skips the next `count` records by calling SQLFetchScroll with SQL_FETCH_NEXT.\n" - "For convenience, skip(0) is accepted and will do nothing."; - -static PyObject* Cursor_skip(PyObject* self, PyObject* args) -{ - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_RESULTS | CURSOR_RAISE_ERROR); - if (!cursor) - return 0; - - int count; - if (!PyArg_ParseTuple(args, "i", &count)) - return 0; - if (count == 0) - Py_RETURN_NONE; - - // Note: I'm not sure about the performance implications of looping here -- I certainly would rather use - // SQLFetchScroll(SQL_FETCH_RELATIVE, count), but it requires scrollable cursors which are often slower. I would - // not expect skip to be used in performance intensive code since different SQL would probably be the "right" - // answer instead of skip anyway. - - SQLRETURN ret = SQL_SUCCESS; - Py_BEGIN_ALLOW_THREADS - for (int i = 0; i < count && SQL_SUCCEEDED(ret); i++) - ret = SQLFetchScroll(cursor->hstmt, SQL_FETCH_NEXT, 0); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret) && ret != SQL_NO_DATA) - return RaiseErrorFromHandle("SQLFetchScroll", cursor->cnxn->hdbc, cursor->hstmt); - - Py_RETURN_NONE; -} - -static const char* commit_doc = - "Commits any pending transaction to the database on the current connection,\n" - "including those from other cursors.\n"; - -static PyObject* Cursor_commit(PyObject* self, PyObject* args) -{ - Cursor* cur = Cursor_Validate(self, CURSOR_REQUIRE_OPEN | CURSOR_RAISE_ERROR); - if (!cur) - return 0; - return Connection_endtrans(cur->cnxn, SQL_COMMIT); -} - -static char rollback_doc[] = - "Rolls back any pending transaction to the database on the current connection,\n" - "including those from other cursors.\n"; - -static PyObject* Cursor_rollback(PyObject* self, PyObject* args) -{ - Cursor* cur = Cursor_Validate(self, CURSOR_REQUIRE_OPEN | CURSOR_RAISE_ERROR); - if (!cur) - return 0; - return Connection_endtrans(cur->cnxn, SQL_ROLLBACK); -} - - -static PyObject* Cursor_ignored(PyObject* self, PyObject* args) -{ - UNUSED(self, args); - Py_RETURN_NONE; -} - - -static char rowcount_doc[] = - "This read-only attribute specifies the number of rows the last DML statement\n" - " (INSERT, UPDATE, DELETE) affected. This is set to -1 for SELECT statements."; - -static char description_doc[] = - "This read-only attribute is a sequence of 7-item sequences. Each of these\n" \ - "sequences contains information describing one result column: (name, type_code,\n" \ - "display_size, internal_size, precision, scale, null_ok). All values except\n" \ - "name, type_code, and internal_size are None. The type_code entry will be the\n" \ - "type object used to create values for that column (e.g. `str` or\n" \ - "`datetime.datetime`).\n" \ - "\n" \ - "This attribute will be None for operations that do not return rows or if the\n" \ - "cursor has not had an operation invoked via the execute() method yet.\n" \ - "\n" \ - "The type_code can be interpreted by comparing it to the Type Objects defined in\n" \ - "the DB API and defined the pyodbc module: Date, Time, Timestamp, Binary,\n" \ - "STRING, BINARY, NUMBER, and DATETIME."; - -static char arraysize_doc[] = - "This read/write attribute specifies the number of rows to fetch at a time with\n" \ - "fetchmany(). It defaults to 1 meaning to fetch a single row at a time."; - -static char connection_doc[] = - "This read-only attribute return a reference to the Connection object on which\n" \ - "the cursor was created.\n" \ - "\n" \ - "The attribute simplifies writing polymorph code in multi-connection\n" \ - "environments."; - -static PyMemberDef Cursor_members[] = -{ - {"rowcount", T_INT, offsetof(Cursor, rowcount), READONLY, rowcount_doc }, - {"description", T_OBJECT_EX, offsetof(Cursor, description), READONLY, description_doc }, - {"arraysize", T_INT, offsetof(Cursor, arraysize), 0, arraysize_doc }, - {"connection", T_OBJECT_EX, offsetof(Cursor, cnxn), READONLY, connection_doc }, - { 0 } -}; - -static PyObject* Cursor_getnoscan(PyObject* self, void *closure) -{ - UNUSED(closure); - - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_OPEN | CURSOR_RAISE_ERROR); - if (!cursor) - return 0; - - SQLUINTEGER noscan = SQL_NOSCAN_OFF; - SQLRETURN ret; - Py_BEGIN_ALLOW_THREADS - ret = SQLGetStmtAttr(cursor->hstmt, SQL_ATTR_NOSCAN, (SQLPOINTER)&noscan, sizeof(SQLUINTEGER), 0); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - { - // Not supported? We're going to assume 'no'. - Py_RETURN_FALSE; - } - - if (noscan == SQL_NOSCAN_OFF) - Py_RETURN_FALSE; - - Py_RETURN_TRUE; -} - -static int Cursor_setnoscan(PyObject* self, PyObject* value, void *closure) -{ - UNUSED(closure); - - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_OPEN | CURSOR_RAISE_ERROR); - if (!cursor) - return -1; - - if (value == 0) - { - PyErr_SetString(PyExc_TypeError, "Cannot delete the noscan attribute"); - return -1; - } - - uintptr_t noscan = PyObject_IsTrue(value) ? SQL_NOSCAN_ON : SQL_NOSCAN_OFF; - SQLRETURN ret; - Py_BEGIN_ALLOW_THREADS - ret = SQLSetStmtAttr(cursor->hstmt, SQL_ATTR_NOSCAN, (SQLPOINTER)noscan, 0); - Py_END_ALLOW_THREADS - if (!SQL_SUCCEEDED(ret)) - { - RaiseErrorFromHandle("SQLSetStmtAttr(SQL_ATTR_NOSCAN)", cursor->cnxn->hdbc, cursor->hstmt); - return -1; - } - - return 0; -} - -static PyGetSetDef Cursor_getsetters[] = -{ - {"noscan", Cursor_getnoscan, Cursor_setnoscan, "NOSCAN statement attr", 0}, - { 0 } -}; - -static char executemany_doc[] = - "executemany(sql, seq_of_params) --> Cursor | count | None\n" \ - "\n" \ - "Prepare a database query or command and then execute it against all parameter\n" \ - "sequences found in the sequence seq_of_params.\n" \ - "\n" \ - "Only the result of the final execution is returned. See `execute` for a\n" \ - "description of parameter passing the return value."; - -static char nextset_doc[] = "nextset() --> True | None\n" \ - "\n" \ - "Jumps to the next resultset if the last sql has multiple resultset." \ - "Returns True if there is a next resultset otherwise None."; - -static char ignored_doc[] = "Ignored."; - -static char fetchone_doc[] = - "fetchone() --> Row | None\n" \ - "\n" \ - "Fetch the next row of a query result set, returning a single Row instance, or\n" \ - "None when no more data is available.\n" \ - "\n" \ - "A ProgrammingError exception is raised if the previous call to execute() did\n" \ - "not produce any result set or no call was issued yet."; - -static char fetchall_doc[] = - "fetchmany(size=cursor.arraysize) --> list of Rows\n" \ - "\n" \ - "Fetch the next set of rows of a query result, returning a list of Row\n" \ - "instances. An empty list is returned when no more rows are available.\n" \ - "\n" \ - "The number of rows to fetch per call is specified by the parameter. If it is\n" \ - "not given, the cursor's arraysize determines the number of rows to be\n" \ - "fetched. The method should try to fetch as many rows as indicated by the size\n" \ - "parameter. If this is not possible due to the specified number of rows not\n" \ - "being available, fewer rows may be returned.\n" \ - "\n" \ - "A ProgrammingError exception is raised if the previous call to execute() did\n" \ - "not produce any result set or no call was issued yet."; - -static char fetchmany_doc[] = - "fetchmany() --> list of Rows\n" \ - "\n" \ - "Fetch all remaining rows of a query result, returning them as a list of Rows.\n" \ - "An empty list is returned if there are no more rows.\n" \ - "\n" \ - "A ProgrammingError exception is raised if the previous call to execute() did\n" \ - "not produce any result set or no call was issued yet."; - -static char fetchsarray_doc[] = - "fetchsarray(size=-1, return_nulls=False, null_suffix='_isnull')\n" \ - " --> a structured array of rows.\n" \ - "\n" - "Fetch as many rows as specified by size into a NumPy structured array.\n"\ - "The structured array will use a dtype containing one field per column\n" \ - "in the result set. Optionally, boolean fields will be added containing\n" \ - "the nulls in nullable columns.\n" \ - "\n" \ - "Parameters\n" \ -<<<<<<< HEAD - "***REMOVED***\n" \ -======= - "----------\n" \ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - "size : int, optional\n" \ - " The number of rows to fetch. Use -1 (the default) to fetch all\n" \ - " remaining rows.\n" \ - "return_nulls : boolean, optional\n" \ - " If True, information about null values will be included using a\n" \ - " field built by concatenating the original column name and \n" - " null_suffix.\n" \ - "null_suffix : string, optional\n" \ - " A string used as a suffix when building the field names for null\n"\ - " values. Only used if return_nulls is True.\n" \ - "\n" \ - "Returns\n" \ - "-------\n" \ - "out: ndarray\n" \ - " A NumPy ndarray with a structured dtype containing the result\n" \ - " set. The structured array will contain one field per column,\n" \ - " named after that column. Optionally it will also contain null\n" \ - " information for nullable columns in fields named by concatenating\n" \ - " the original column name with the provided null_suffix.\n" \ - "\n" \ - "Remarks\n" \ - "-------\n" \ - "Similar to fetchmany(size), but returning a NumPy container for the\n" \ - "results instead of a Python list of tuples of objects, reducing memory\n" \ - "footprint as well as improving performance.\n" \ - "\n" \ - "See Also\n" \ - "--------\n" \ - "fetchmany : Fetch rows into a Python list of rows.\n" \ - "fetchall : Fetch the remaining rows into a Python lis of rows.\n" \ - "fetchdictarray : Fetch rows into a dictionary of NumPy ndarrays.\n" \ - "\n"; - -static char fetchdictarray_doc[] = - "fetchdictarray(size=-1, return_nulls=False, null_suffix='_isnull')\n" \ - " --> a dictionary of column arrays.\n" \ - "\n" - "Fetch as many rows as specified by size into a dictionary of NumPy\n" \ - "ndarrays (dictarray). The dictionary will contain a key for each column,\n"\ - "with its value being a NumPy ndarray holding its value for the fetched\n" \ - "rows. Optionally, extra columns will be added to signal nulls on\n" \ - "nullable columns.\n" \ - "\n" \ - "Parameters\n" \ -<<<<<<< HEAD - "***REMOVED***\n" \ -======= - "----------\n" \ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - "size : int, optional\n" \ - " The number of rows to fetch. Use -1 (the default) to fetch all\n" \ - " remaining rows.\n" \ - "return_nulls : boolean, optional\n" \ - " If True, information about null values will be included adding a\n" \ - " boolean array using as key a string built by concatenating the\n" \ - " column name and null_suffix.\n" \ - "null_suffix : string, optional\n" \ - " A string used as a suffix when building the key for null values.\n"\ - " Only used if return_nulls is True.\n" \ - "\n" \ - "Returns\n" \ - "-------\n" \ - "out: dict\n" \ - " A dictionary mapping column names to an ndarray holding its values\n" \ - " for the fetched rows. The dictionary will use the column name as\n" \ - " key for the ndarray containing values associated to that column.\n" \ - " Optionally, null information for nullable columns will be provided\n" \ - " by adding additional boolean columns named after the nullable column\n"\ - " concatenated to null_suffix\n" \ - "\n" \ - "Remarks\n" \ - "-------\n" \ - "Similar to fetchmany(size), but returning a dictionary of NumPy ndarrays\n" \ - "for the results instead of a Python list of tuples of objects, reducing\n" \ - "memory footprint as well as improving performance.\n" \ - "fetchdictarray is overall more efficient that fetchsarray.\n" \ - "\n" \ - "See Also\n" \ - "--------\n" \ - "fetchmany : Fetch rows into a Python list of rows.\n" \ - "fetchall : Fetch the remaining rows into a Python lis of rows.\n" \ - "fetchsarray : Fetch rows into a NumPy structured ndarray.\n" \ - "\n"; - -static char enter_doc[] = "__enter__() -> self."; -static PyObject* Cursor_enter(PyObject* self, PyObject* args) -{ - UNUSED(args); - Py_INCREF(self); - return self; -} - -static char exit_doc[] = "__exit__(*excinfo) -> None. Commits the connection if necessary.."; -static PyObject* Cursor_exit(PyObject* self, PyObject* args) -{ - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_OPEN | CURSOR_RAISE_ERROR); - if (!cursor) - return 0; - - // If an error has occurred, `args` will be a tuple of 3 values. Otherwise it will be a tuple of 3 `None`s. - I(PyTuple_Check(args)); - - if (cursor->cnxn->nAutoCommit == SQL_AUTOCOMMIT_OFF && PyTuple_GetItem(args, 0) == Py_None) - { - SQLRETURN ret; - Py_BEGIN_ALLOW_THREADS - ret = SQLEndTran(SQL_HANDLE_DBC, cursor->cnxn->hdbc, SQL_COMMIT); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - return RaiseErrorFromHandle("SQLEndTran(SQL_COMMIT)", cursor->cnxn->hdbc, cursor->hstmt); - } - - Py_RETURN_NONE; -} - - -static PyMethodDef Cursor_methods[] = -{ - { "close", (PyCFunction)Cursor_close, METH_NOARGS, close_doc }, - { "cancel", (PyCFunction)Cursor_cancel, METH_NOARGS, cancel_doc }, - { "execute", (PyCFunction)Cursor_execute, METH_VARARGS, execute_doc }, - { "executemany", (PyCFunction)Cursor_executemany, METH_VARARGS, executemany_doc }, - { "setinputsizes", (PyCFunction)Cursor_ignored, METH_VARARGS, ignored_doc }, - { "setoutputsize", (PyCFunction)Cursor_ignored, METH_VARARGS, ignored_doc }, - { "fetchone", (PyCFunction)Cursor_fetchone, METH_NOARGS, fetchone_doc }, - { "fetchall", (PyCFunction)Cursor_fetchall, METH_NOARGS, fetchall_doc }, - { "fetchmany", (PyCFunction)Cursor_fetchmany, METH_VARARGS, fetchmany_doc }, - { "fetchsarray", (PyCFunction)Cursor_fetchsarray, METH_VARARGS|METH_KEYWORDS, fetchsarray_doc }, - { "fetchdictarray", (PyCFunction)Cursor_fetchdictarray, METH_VARARGS|METH_KEYWORDS, fetchdictarray_doc }, - { "nextset", (PyCFunction)Cursor_nextset, METH_NOARGS, nextset_doc }, - { "tables", (PyCFunction)Cursor_tables, METH_VARARGS|METH_KEYWORDS, tables_doc }, - { "columns", (PyCFunction)Cursor_columns, METH_VARARGS|METH_KEYWORDS, columns_doc }, - { "statistics", (PyCFunction)Cursor_statistics, METH_VARARGS|METH_KEYWORDS, statistics_doc }, - { "rowIdColumns", (PyCFunction)Cursor_rowIdColumns, METH_VARARGS|METH_KEYWORDS, rowIdColumns_doc }, - { "rowVerColumns", (PyCFunction)Cursor_rowVerColumns, METH_VARARGS|METH_KEYWORDS, rowVerColumns_doc }, - { "primaryKeys", (PyCFunction)Cursor_primaryKeys, METH_VARARGS|METH_KEYWORDS, primaryKeys_doc }, - { "foreignKeys", (PyCFunction)Cursor_foreignKeys, METH_VARARGS|METH_KEYWORDS, foreignKeys_doc }, - { "getTypeInfo", (PyCFunction)Cursor_getTypeInfo, METH_VARARGS|METH_KEYWORDS, getTypeInfo_doc }, - { "procedures", (PyCFunction)Cursor_procedures, METH_VARARGS|METH_KEYWORDS, procedures_doc }, - { "procedureColumns", (PyCFunction)Cursor_procedureColumns, METH_VARARGS|METH_KEYWORDS, procedureColumns_doc }, - { "skip", (PyCFunction)Cursor_skip, METH_VARARGS, skip_doc }, - { "commit", (PyCFunction)Cursor_commit, METH_NOARGS, commit_doc }, - { "rollback", (PyCFunction)Cursor_rollback, METH_NOARGS, rollback_doc }, - { "__enter__", Cursor_enter, METH_NOARGS, enter_doc }, - { "__exit__", Cursor_exit, METH_VARARGS, exit_doc }, - { 0, 0, 0, 0 } -}; - -static char cursor_doc[] = - "Cursor objects represent a database cursor, which is used to manage the context\n" \ - "of a fetch operation. Cursors created from the same connection are not\n" \ - "isolated, i.e., any changes done to the database by a cursor are immediately\n" \ - "visible by the other cursors. Cursors created from different connections are\n" \ - "isolated.\n" \ - "\n" \ - "Cursors implement the iterator protocol, so results can be iterated:\n" \ - "\n" \ - " cursor.execute(sql)\n" \ - " for row in cursor:\n" \ - " print row[0]"; - -PyTypeObject CursorType = -{ - PyVarObject_HEAD_INIT(0, 0) - "pyodbc.Cursor", // tp_name - sizeof(Cursor), // tp_basicsize - 0, // tp_itemsize - (destructor)Cursor_dealloc, // destructor tp_dealloc - 0, // tp_print - 0, // tp_getattr - 0, // tp_setattr - 0, // tp_compare - 0, // tp_repr - 0, // tp_as_number - 0, // tp_as_sequence - 0, // tp_as_mapping - 0, // tp_hash - 0, // tp_call - 0, // tp_str - 0, // tp_getattro - 0, // tp_setattro - 0, // tp_as_buffer -#if defined(Py_TPFLAGS_HAVE_ITER) - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, -#else - Py_TPFLAGS_DEFAULT, -#endif - cursor_doc, // tp_doc - 0, // tp_traverse - 0, // tp_clear - 0, // tp_richcompare - 0, // tp_weaklistoffset - Cursor_iter, // tp_iter - Cursor_iternext, // tp_iternext - Cursor_methods, // tp_methods - Cursor_members, // tp_members - Cursor_getsetters, // 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 - 0, // tp_new - 0, // tp_free - 0, // tp_is_gc - 0, // tp_bases - 0, // tp_mro - 0, // tp_cache - 0, // tp_subclasses - 0, // tp_weaklist -}; - -Cursor* -Cursor_New(Connection* cnxn) -{ - // Exported to allow the connection class to create cursors. - -#ifdef _MSC_VER -#pragma warning(disable : 4365) -#endif - Cursor* cur = PyObject_NEW(Cursor, &CursorType); -#ifdef _MSC_VER -#pragma warning(default : 4365) -#endif - - if (cur) - { - cur->cnxn = cnxn; - cur->hstmt = SQL_NULL_HANDLE; - cur->description = Py_None; - cur->pPreparedSQL = 0; - cur->paramcount = 0; - cur->paramtypes = 0; - cur->paramInfos = 0; - cur->colinfos = 0; - cur->arraysize = 1; - cur->rowcount = -1; - cur->map_name_to_index = 0; - - Py_INCREF(cnxn); - Py_INCREF(cur->description); - - SQLRETURN ret; - Py_BEGIN_ALLOW_THREADS - ret = SQLAllocHandle(SQL_HANDLE_STMT, cnxn->hdbc, &cur->hstmt); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - { - RaiseErrorFromHandle("SQLAllocHandle", cnxn->hdbc, SQL_NULL_HANDLE); - Py_DECREF(cur); - return 0; - } - - if (cnxn->timeout) - { - Py_BEGIN_ALLOW_THREADS - ret = SQLSetStmtAttr(cur->hstmt, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER)cnxn->timeout, 0); - Py_END_ALLOW_THREADS - - if (!SQL_SUCCEEDED(ret)) - { - RaiseErrorFromHandle("SQLSetStmtAttr(SQL_ATTR_QUERY_TIMEOUT)", cnxn->hdbc, cur->hstmt); - Py_DECREF(cur); - return 0; - } - } - - TRACE("cursor.new cnxn=%p hdbc=%d cursor=%p hstmt=%d\n", (Connection*)cur->cnxn, ((Connection*)cur->cnxn)->hdbc, cur, cur->hstmt); - } - - return cur; -} - -void Cursor_init() -{ - PyDateTime_IMPORT; -} - -/* -Local Variables: - c-basic-offset: 4 -End: -*/ diff --git a/pyodbc/src/dbspecific.h b/pyodbc/src/dbspecific.h deleted file mode 100644 index 163d7ed..0000000 --- a/pyodbc/src/dbspecific.h +++ /dev/null @@ -1,40 +0,0 @@ - -#ifndef DBSPECIFIC_H -#define DBSPECIFIC_H - -// Items specific to databases. -// -<<<<<<< HEAD -// Obviously we'd like to minimize this, but if they are needed this file isolates ***REMOVED*** I'd like for there to be a -// single build of pyodbc on each platform and not have a bunch of defines for supporting different databases. - - -// ***REMOVED******REMOVED******REMOVED******REMOVED******REMOVED***-- -======= -// Obviously we'd like to minimize this, but if they are needed this file isolates them. I'd like for there to be a -// single build of pyodbc on each platform and not have a bunch of defines for supporting different databases. - - -// --------------------------------------------------------------------------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -// SQL Server - - -// SQL Server 2005 xml type - -#define SQL_SS_XML -152 - - -// SQL Server 2008 time type - -#define SQL_SS_TIME2 -154 - -struct SQL_SS_TIME2_STRUCT -{ - SQLUSMALLINT hour; - SQLUSMALLINT minute; - SQLUSMALLINT second; - SQLUINTEGER fraction; -}; - -#endif // DBSPECIFIC_H diff --git a/pyodbc/src/npcontainer.cpp b/pyodbc/src/npcontainer.cpp deleted file mode 100644 index 1cf3f13..0000000 --- a/pyodbc/src/npcontainer.cpp +++ /dev/null @@ -1,1881 +0,0 @@ -// -// Extensions for putting the data results of queries in NumPy containers. -// Authors: Francesc Alted (original author) -// Oscar Villellas -// Copyright: Continuum Analytics 2012-2014 -// - -#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION - -#include "pyodbc.h" -#include "cursor.h" -#include "pyodbcmodule.h" -#include "connection.h" -#include "errors.h" -#include "dbspecific.h" - -#include "numpy/ndarrayobject.h" -#include "numpy/npy_math.h" - -#include -#include - -<<<<<<< HEAD -// exported variables ***REMOVED******REMOVED******REMOVED***- -======= -// exported variables ---------------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -/* controls the maximum text field width */ -Py_ssize_t iopro_text_limit = 1024; - -<<<<<<< HEAD -// ***REMOVED******REMOVED******REMOVED***-------- -======= -// ----------------------------------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -namespace { - inline size_t - limit_text_size(size_t sz) - { - if (iopro_text_limit < 0) - return sz; - - size_t sz_limit = static_cast(iopro_text_limit); - return sz < sz_limit? sz : sz_limit; - } - - - - class PyNoGIL - /* a RAII class for Python GIL */ - { - public: - PyNoGIL() - { - Py_UNBLOCK_THREADS - } - ~PyNoGIL() - { - Py_BLOCK_THREADS - } - - private: - PyThreadState *_save; - }; - -} - -// The number of rows to be fetched in case the driver cannot specify it -static size_t DEFAULT_ROWS_TO_BE_FETCHED = 10000; -static size_t DEFAULT_ROWS_TO_BE_ALLOCATED = DEFAULT_ROWS_TO_BE_FETCHED; -// API version 7 is the first one that we can use DATE/TIME -// in a pretty bug-free way. This is set to true in -// the module init function if running on Numpy >= API version 7. -static bool CAN_USE_DATETIME = false; - - -const char * -sql_type_to_str(SQLSMALLINT type) -{ -#define TYPENAME(x,y) case x: return y; - switch (type) - { - TYPENAME(SQL_CHAR, "char"); - TYPENAME(SQL_VARCHAR, "varchar"); - TYPENAME(SQL_LONGVARCHAR, "longvarchar"); - TYPENAME(SQL_WCHAR, "wchar"); - TYPENAME(SQL_WVARCHAR, "wvarchar"); - TYPENAME(SQL_WLONGVARCHAR, "wlongvarchar"); - - TYPENAME(SQL_DECIMAL, "decimal"); - TYPENAME(SQL_NUMERIC, "numeric"); - TYPENAME(SQL_SMALLINT, "smallint"); - TYPENAME(SQL_INTEGER, "integer"); - TYPENAME(SQL_REAL, "real"); - TYPENAME(SQL_FLOAT, "float"); - TYPENAME(SQL_DOUBLE, "double"); - TYPENAME(SQL_BIT, "bit"); - TYPENAME(SQL_TINYINT, "tiny"); - TYPENAME(SQL_BIGINT, "bigint"); - - TYPENAME(SQL_BINARY, "binary"); - TYPENAME(SQL_VARBINARY, "varbinary"); - TYPENAME(SQL_LONGVARBINARY, "longvarbinary"); - - TYPENAME(SQL_TYPE_DATE, "date"); - TYPENAME(SQL_TYPE_TIME, "time"); - TYPENAME(SQL_TYPE_TIMESTAMP, "timestamp"); - - TYPENAME(SQL_GUID, "guid"); - default: - return "UNKNOWN"; - } -#undef TYPENAME -} - -const char * -sql_c_type_to_str(SQLSMALLINT type) -{ -#define TYPENAME(x,y) case x: return y; - switch (type) - { - TYPENAME(SQL_C_BIT, "bit"); - TYPENAME(SQL_C_CHAR, "char"); - TYPENAME(SQL_C_WCHAR, "wchar"); - TYPENAME(SQL_C_TINYINT, "tinyint"); - TYPENAME(SQL_C_SSHORT, "sshort"); - TYPENAME(SQL_C_SLONG, "slong"); - TYPENAME(SQL_C_SBIGINT, "sbigint"); - TYPENAME(SQL_C_FLOAT, "float"); - TYPENAME(SQL_C_DOUBLE, "double"); - TYPENAME(SQL_C_TYPE_DATE, "date struct"); - TYPENAME(SQL_C_TIMESTAMP, "timestamp struct"); - TYPENAME(SQL_C_TIME, "time struct"); - default: - return "UNKNOWN"; - } -#undef TYPENAME -} - -using namespace std; - -// Days per month, regular year and leap year -int _days_per_month_table[2][12] = { - { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, - { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } -}; - -// -// Returns 1 if the given year is a leap year, 0 otherwise. -// -int -is_leapyear(SQLSMALLINT year) -{ - return (year & 0x3) == 0 && /* year % 4 == 0 */ - ((year % 100) != 0 || - (year % 400) == 0); -} - -// -// Calculates the days offset from the 1970 epoch. -// -// Code strongly based on its NumPy counterpart. -// -npy_int64 -get_datestruct_days(const DATE_STRUCT *dts) -{ - int i, month; - npy_int64 year, days = 0; - int *month_lengths; - - year = dts->year - 1970; - days = year * 365; - - /* Adjust for leap years */ - if (days >= 0) { - /* - * 1968 is the closest leap year before 1970. - * Exclude the current year, so add 1. - */ - year += 1; - /* Add one day for each 4 years */ - days += year / 4; - /* 1900 is the closest previous year divisible by 100 */ - year += 68; - /* Subtract one day for each 100 years */ - days -= year / 100; - /* 1600 is the closest previous year divisible by 400 */ - year += 300; - /* Add one day for each 400 years */ - days += year / 400; - } - else { - /* - * 1972 is the closest later year after 1970. - * Include the current year, so subtract 2. - */ - year -= 2; - /* Subtract one day for each 4 years */ - days += year / 4; - /* 2000 is the closest later year divisible by 100 */ - year -= 28; - /* Add one day for each 100 years */ - days -= year / 100; - /* 2000 is also the closest later year divisible by 400 */ - /* Subtract one day for each 400 years */ - days += year / 400; - } - - month_lengths = _days_per_month_table[is_leapyear(dts->year)]; - month = dts->month - 1; - /* make sure month is in range. This prevents an illegal access - when bad input is passed to this function */ - month = month<0 || month>11 ? 0:month; - - /* Add the months */ - for (i = 0; i < month; ++i) { - days += month_lengths[i]; - } - - /* Add the days */ - days += dts->day - 1; - - return days; -} - -// -// Convert a datetime from a datetimestruct to a datetime64 based -// on some metadata. The date is assumed to be valid. -// -// This code is heavily based on NumPy 1.7 equivalent function. -// Only conversion to microseconds is supported here. -// -npy_datetime -convert_datetimestruct_to_datetime(const TIMESTAMP_STRUCT *dts) -{ - npy_datetime ret; - - // Calculate the number of days to start - npy_int64 days = get_datestruct_days((DATE_STRUCT*)dts); - ret = (((days * 24 + - dts->hour) * 60 + - dts->minute) * 60 + - dts->second) * 1000000 + - dts->fraction / 1000; // fraction is in ns (billionths of a second) - - return ret; -} - -// -// Convert a date from a datestruct to a datetime64 based -// on some metadata. The date is assumed to be valid. -// -npy_datetime -convert_datestruct_to_datetime(const DATE_STRUCT *dts) -{ - - // Calculate the number of days to start - npy_datetime days = get_datestruct_days(dts); - - return days; -} - -// -// Convert a time from a timestruct to a timedelta64 based -// on some metadata. The time is assumed to be valid. -// -npy_timedelta -convert_timestruct_to_timedelta(const TIME_STRUCT *dts) -{ - npy_timedelta seconds = (((dts->hour * 60) + dts->minute) * 60) + - dts->second; - - return seconds; -} - - -/* - * This is a debug helper function that allows dumping a memory buffer - * to a string for use within TRACE calls. It reuses an internal static - * buffer so it won't be thread safe and it will reuse the same memory - * in different calls, but it will be enough for debugging. - * Note: the string is valid until the next call of this function, as - * the buffer will be reused - */ -static -const char * -raw_buffer_as_print_string(const void *ptr, size_t len) -{ - static char _work_buffer[72]; - static char *hex_digit = "0123456789abcdef"; - const size_t max_bytes_to_dump = (sizeof(_work_buffer)/sizeof(_work_buffer[0]))/3; - size_t pre = len < max_bytes_to_dump ? len : max_bytes_to_dump - 4; - size_t post = len < max_bytes_to_dump ? 0 : max_bytes_to_dump - pre - 1; - char *out = _work_buffer; - const unsigned char *in = reinterpret_cast(ptr); - if (len == 0) - return ""; - - for (size_t i=0; i>4) & 0xf]; - *out++ = hex_digit[c&0xf]; - *out++ = ' '; - } - - if (post) { - *out++ = '.'; - *out++ = '.'; - *out++ = ' '; - in += len - post; - for (size_t i = 0; i < post; i++) - { - unsigned char c = in[i]; - *out++ = hex_digit[(c>>4) & 0xf]; - *out++ = hex_digit[c&0xf]; - *out++ = ' '; - } - } - - out[-1] = '\0'; // overwrite last space - return _work_buffer; -} - - -/* - * Convert the SQLWCHAR array to ucs4. - * At most count elements will be present. - * - * src is assumed to be in utf16 encoding. If the driver manager uses - * utf32 (ucs4) this will not be called. - * - * note: in our context the number of characters is known an comes from - * the database schema. - */ -static void -convert_ucs4_from_utf16(void *dst, const void *src, size_t count) -{ - uint32_t *ucs4_dst = reinterpret_cast(dst); - const uint16_t *utf16_src = reinterpret_cast(src); - //run until we reach the maximum number of characters (count), - // or null-termination (*utf16_src) - for (size_t idx=0; idx < count && *utf16_src; ++idx) { - uint16_t ch = *utf16_src++; - uint32_t ucs4_ch; - if (ch >= 0xd800 && ch <= 0xdfff) { - // surrogate pair - uint32_t upper = 0x3ffu & ch; - uint32_t lower = 0x3ffu & (*utf16_src++); - ucs4_ch = (upper << 10) + lower; - } - else { - ucs4_ch = ch; - } - - ucs4_dst[idx] = ucs4_ch; - } -} - - -// -// Fill NA particular values depending on the NumPy type -// -// The only cases that need to be supported are the ones that can -// actually be generated from SQL types -static void -fill_NAvalue(void *value, PyArray_Descr *dtype) { - int nptype = dtype->type_num; - int elsize = dtype->elsize; - switch (nptype) - { - case NPY_BOOL: - ((npy_bool*)value)[0] = 0; // XXX False is a good default? - break; - case NPY_INT8: - ((npy_int8*)value)[0] = NPY_MIN_INT8; - break; - case NPY_UINT8: - // For uint8 use max, as 0 is more likely to be valid data. - ((npy_uint8*)value)[0] = NPY_MAX_UINT8; - break; - case NPY_INT16: - ((npy_int16*)value)[0] = NPY_MIN_INT16; - break; - case NPY_INT32: - ((npy_int32*)value)[0] = NPY_MIN_INT32; - break; - case NPY_INT64: - ((npy_int64*)value)[0] = NPY_MIN_INT64; - break; - case NPY_FLOAT: - ((npy_float *)value)[0] = NPY_NANF; - break; - case NPY_DOUBLE: - ((npy_double *)value)[0] = NPY_NAN; - break; - case NPY_STRING: - case NPY_UNICODE: - memset(value, 0, static_cast(elsize)); - break; - case NPY_DATETIME: - ((npy_int64*)value)[0] = NPY_DATETIME_NAT; - break; - case NPY_TIMEDELTA: - ((npy_int64*)value)[0] = NPY_DATETIME_NAT; - break; - default: - RaiseErrorV(0, PyExc_TypeError, - "NumPy data type %d is not supported.", nptype); - } -} - -static int -fill_NAarray(PyArrayObject* array, PyArrayObject* array_nulls, SQLLEN* nulls, - size_t offset, size_t nrows) -{ - // Fill array with NA info in nullarray coming from ODBC - npy_intp elsize_array = PyArray_ITEMSIZE(array); - char *data_array = PyArray_BYTES(array); - SQLLEN *data_null = nulls; - - // Only the last nrows have to be updated - data_array += offset * elsize_array; - - if (array_nulls) { - char *data_array_nulls = PyArray_BYTES(array_nulls); - npy_intp elsize_array_nulls = PyArray_ITEMSIZE(array_nulls); - - data_array_nulls += offset * elsize_array_nulls; - - for (size_t i = 0; i < nrows; ++i) { - if (data_null[i] == SQL_NULL_DATA) { - *data_array_nulls = NPY_TRUE; - fill_NAvalue(data_array, PyArray_DESCR(array)); - } else - { - *data_array_nulls = NPY_FALSE; - } - data_array += elsize_array; - data_array_nulls += elsize_array_nulls; - } - } else - { - for (size_t i = 0; i < nrows; ++i) { - // If NULL are detected, don't show data in array - if (data_null[i] == SQL_NULL_DATA) - fill_NAvalue(data_array, PyArray_DESCR(array)); - data_array += elsize_array; - } - } - - return 0; -} - -// -// convert from ODBC format to NumPy format for selected types -// only types that need conversion are handled. -// -static void -convert_buffer(PyArrayObject* dst_array, void* src, int sql_c_type, - SQLLEN offset, npy_intp nrows) -{ - switch (sql_c_type) - { - case SQL_C_TYPE_DATE: - { - npy_datetime *dst = reinterpret_cast(PyArray_DATA(dst_array)) + - offset; - DATE_STRUCT *dates = static_cast(src); - for (npy_intp i = 0; i < nrows; ++i) { - dst[i] = convert_datestruct_to_datetime(dates+i); - } - } - break; - - case SQL_C_TYPE_TIMESTAMP: - { - npy_datetime *dst = reinterpret_cast(PyArray_DATA(dst_array)) + - offset; - TIMESTAMP_STRUCT *timestamps = static_cast(src); - for (npy_intp i = 0; i < nrows; ++i) { - dst[i] = convert_datetimestruct_to_datetime(timestamps+i); - } - } - break; - - case SQL_C_TYPE_TIME: - { - npy_timedelta *dst = reinterpret_cast(PyArray_DATA(dst_array)) + - offset; - TIME_STRUCT *timestamps = static_cast(src); - for (npy_intp i = 0; i < nrows; ++i) { - dst[i] = convert_timestruct_to_timedelta(×tamps[i]); - } - } - break; - - case SQL_C_WCHAR: - { - // note that this conversion will only be called when using ucs2/utf16 - const SQLWCHAR *utf16 = reinterpret_cast(src); - size_t len = PyArray_ITEMSIZE(dst_array)/sizeof(npy_ucs4); - npy_ucs4 *ucs4 = reinterpret_cast(PyArray_DATA(dst_array)) + offset*len; - for (npy_intp i = 0; i < nrows; ++i) { - const SQLWCHAR *src = utf16 + 2*len*i; - npy_ucs4 *dst = ucs4 + len*i; - TRACE_NOLOC("Converting utf-16 buffer at %p:\n'%s'\n", src, - raw_buffer_as_print_string(src, 2*len*sizeof(src[0]))); - convert_ucs4_from_utf16(dst, src, len); - TRACE_NOLOC("resulting in ucs4 buffer at %p:\n'%s'\n", dst, - raw_buffer_as_print_string(dst, len*sizeof(dst[0]))); - } - } - break; - - default: - TRACE_NOLOC("WARN: unexpected conversion in fill_dictarray.\n"); - } -} - -// -// Resize an array to a new length -// -// return 0 on success 1 on failure -// on failure the returned array is unmodified -static int -resize_array(PyArrayObject* array, npy_intp new_len) { - int elsize = PyArray_ITEMSIZE(array); - void *old_data = PyArray_DATA(array); - npy_intp old_len = PyArray_DIMS(array)[0]; - void* new_data = NULL; - - // The next test is made so as to avoid a problem with resizing to 0 - // (it seems that this is solved for NumPy 1.7 series though) - if (new_len > 0) { - new_data = PyDataMem_RENEW(old_data, new_len * elsize); - if (new_data == NULL) { - return 1; - } - } - else { - free(old_data); - } - - // this is far from ideal. We should probably be using internal buffers - // and then creating the NumPy array using that internal buffer. This should - // be possible and would be cleaner. -#if (NPY_API_VERSION >= 0x7) - ((PyArrayObject_fields *)array)->data = (char*)new_data; -#else - array->data = (char*)new_data; -#endif - if ((old_len < new_len) && PyArray_ISSTRING(array)) { - memset(PyArray_BYTES(array) + old_len*elsize, 0, (new_len-old_len)*elsize); - } - - PyArray_DIMS(array)[0] = new_len; - - return 0; -} - -namespace -{ - struct fetch_status - { - fetch_status(SQLHSTMT h, SQLULEN chunk_size); - ~fetch_status(); - - SQLLEN rows_read_; - - /* old stmtattr to restore on destruction */ - SQLHSTMT hstmt_; - SQLULEN old_row_bind_type_; - SQLULEN old_row_array_size_; - SQLULEN *old_rows_fetched_ptr_; - }; - - fetch_status::fetch_status(SQLHSTMT h, SQLULEN chunk_size) : hstmt_(h) - { - /* keep old stmt attr */ - SQLGetStmtAttr(hstmt_, SQL_ATTR_ROW_BIND_TYPE, - &old_row_bind_type_, SQL_IS_UINTEGER, 0); - SQLGetStmtAttr(hstmt_, SQL_ATTR_ROW_ARRAY_SIZE, - &old_row_array_size_, SQL_IS_UINTEGER, 0); - SQLGetStmtAttr(hstmt_, SQL_ATTR_ROWS_FETCHED_PTR, - &old_rows_fetched_ptr_, SQL_IS_POINTER, 0); - - /* configure our stmt attr */ - SQLSetStmtAttr(hstmt_, SQL_ATTR_ROW_BIND_TYPE, - SQL_BIND_BY_COLUMN, 0); - SQLSetStmtAttr(hstmt_, SQL_ATTR_ROW_ARRAY_SIZE, - (SQLPOINTER)chunk_size, 0); - SQLSetStmtAttr(hstmt_, SQL_ATTR_ROWS_FETCHED_PTR, - (SQLPOINTER)&rows_read_, 0); - } - - fetch_status::~fetch_status() - { - /* unbind all cols */ - SQLFreeStmt(hstmt_, SQL_UNBIND); - /* restore stmt attr */ - SQLSetStmtAttr(hstmt_, SQL_ATTR_ROW_BIND_TYPE, - (SQLPOINTER)old_row_bind_type_, 0); - SQLSetStmtAttr(hstmt_, SQL_ATTR_ROW_ARRAY_SIZE, - (SQLPOINTER)old_row_array_size_, 0); - SQLSetStmtAttr(hstmt_, SQL_ATTR_ROWS_FETCHED_PTR, - (SQLPOINTER)old_rows_fetched_ptr_, 0); - hstmt_ = 0; - } - - //////////////////////////////////////////////////////////////////////// - - struct column_desc - { - column_desc(); - ~column_desc(); - - // fields coming from describe col - SQLCHAR sql_name_[300]; - SQLSMALLINT sql_type_; // type returned in SQLDescribeCol. - SQLULEN sql_size_; - SQLSMALLINT sql_decimal_; - SQLSMALLINT sql_nullable_; - - // type info - PyArray_Descr* npy_type_descr_; // type to be used in NumPy - int sql_c_type_; // c_type to be use when binding the column. - - // buffers used - PyArrayObject* npy_array_; // the numpy array that will hold the result - PyArrayObject* npy_array_nulls_; // the boolean numpy array holding null information - void* scratch_buffer_; // source buffer when it needs conversion - SQLLEN* null_buffer_; - SQLLEN element_buffer_size_; - }; - - column_desc::column_desc() : - npy_type_descr_(0), npy_array_(0), npy_array_nulls_(0), scratch_buffer_(0), null_buffer_(0), element_buffer_size_(0) - { - } - - column_desc::~column_desc() - { - if (null_buffer_) { - GUARDED_DEALLOC(null_buffer_); - } - - if (scratch_buffer_) { - GUARDED_DEALLOC(scratch_buffer_); - } - - Py_XDECREF(npy_array_nulls_); - Py_XDECREF(npy_array_); - Py_XDECREF(npy_type_descr_); - } - - - inline PyArray_Descr* - dtype_from_string(const char *dtype_str_spec) - /* - returns a dtype (PyArray_Descr) built from a string that describes it - */ - { - PyObject *python_str = Py_BuildValue("s", dtype_str_spec); - if (python_str) { - PyArray_Descr *dtype = 0; - PyArray_DescrConverter(python_str, &dtype); - Py_DECREF(python_str); - return dtype; - } - return 0; - } - - inline PyArray_Descr* - string_dtype(size_t length) - { - PyArray_Descr* result = PyArray_DescrNewFromType(NPY_STRING); - if (result) - result->elsize = static_cast(length+1) * sizeof(char); - return result; - } - - inline PyArray_Descr* - unicode_dtype(size_t length) - { - PyArray_Descr* result = PyArray_DescrNewFromType(NPY_UNICODE); - if (result) - result->elsize = static_cast(length+1) * sizeof(npy_ucs4); - return result; - } - - int - map_column_desc_types(column_desc& cd, bool unicode) - /* - infer the NumPy dtype and the sql_c_type to use from the - sql_type. - - return 0 on success, 1 on failure - - remember to check support for any new NumPy type added in the function - that handles nulls (fill_NAvalue) - */ - { - PyArray_Descr* dtype = 0; - -#define MAP_SUCCESS(DTYPE, CTYPE) do { \ - cd.npy_type_descr_ = DTYPE; \ - cd.sql_c_type_ = CTYPE; \ - return 0; } while (0) - - - size_t sql_size = cd.sql_size_; - - - switch (cd.sql_type_) - { -<<<<<<< HEAD - // string types ***REMOVED******REMOVED***-- -======= - // string types ------------------------------------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - case SQL_CHAR: - case SQL_VARCHAR: - case SQL_LONGVARCHAR: - case SQL_GUID: - case SQL_SS_XML: - if (!unicode) { - dtype = string_dtype(limit_text_size(sql_size)); - if (dtype) { - cd.element_buffer_size_ = dtype->elsize; - MAP_SUCCESS(dtype, SQL_C_CHAR); - } - break; - } - // else: fallthrough - - case SQL_WCHAR: - case SQL_WVARCHAR: - case SQL_WLONGVARCHAR: - { - dtype = unicode_dtype(limit_text_size(sql_size)); - if (dtype) { - cd.element_buffer_size_ = dtype->elsize; - MAP_SUCCESS(dtype, SQL_C_WCHAR); - } - } - break; - -<<<<<<< HEAD - // real types ***REMOVED******REMOVED***---- -======= - // real types -------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - case SQL_REAL: - dtype = PyArray_DescrFromType(NPY_FLOAT); - if (dtype) { - MAP_SUCCESS(dtype, SQL_C_FLOAT); - } - break; - - case SQL_FLOAT: - case SQL_DOUBLE: - dtype = PyArray_DescrFromType(NPY_DOUBLE); - if (dtype) { - MAP_SUCCESS(dtype, SQL_C_DOUBLE); - } - break; - -<<<<<<< HEAD - // integer types ***REMOVED******REMOVED***- -======= - // integer types ----------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - case SQL_BIT: - dtype = PyArray_DescrFromType(NPY_BOOL); - if (dtype) { - MAP_SUCCESS(dtype, SQL_C_BIT); - } - break; - - case SQL_TINYINT: - dtype = PyArray_DescrFromType(NPY_UINT8); - if (dtype) { - MAP_SUCCESS(dtype, SQL_C_TINYINT); - } - break; - - case SQL_SMALLINT: - dtype = PyArray_DescrFromType(NPY_INT16); - if (dtype) { - MAP_SUCCESS(dtype, SQL_C_SSHORT); - } - break; - - case SQL_INTEGER: - dtype = PyArray_DescrFromType(NPY_INT32); - if (dtype) { - MAP_SUCCESS(dtype, SQL_C_SLONG); - } - break; - - case SQL_BIGINT: - dtype = PyArray_DescrFromType(NPY_INT64); - if (dtype) { - MAP_SUCCESS(dtype, SQL_C_SBIGINT); - } - break; - -<<<<<<< HEAD - // time related types ***REMOVED******REMOVED***-------- -======= - // time related types ------------------------------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - case SQL_TYPE_DATE: - if (CAN_USE_DATETIME) { - dtype = dtype_from_string("M8[D]"); - if (dtype) { - MAP_SUCCESS(dtype, SQL_C_TYPE_DATE); - } - } - break; - - case SQL_TYPE_TIME: - case SQL_SS_TIME2: - if (CAN_USE_DATETIME) { - dtype = dtype_from_string("m8[s]"); - if (dtype) { - MAP_SUCCESS(dtype, SQL_C_TYPE_TIME); - } - } - break; - - case SQL_TYPE_TIMESTAMP: - if (CAN_USE_DATETIME) { - dtype = dtype_from_string("M8[us]"); - if (dtype) { - MAP_SUCCESS(dtype, SQL_C_TYPE_TIMESTAMP); - } - } - break; - -<<<<<<< HEAD - // decimal ***REMOVED******REMOVED***------- -======= - // decimal ----------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - // Note: these are mapped as double as per a request - // this means precision may be lost. - case SQL_DECIMAL: - case SQL_NUMERIC: - dtype = PyArray_DescrFromType(NPY_DOUBLE); - if (dtype) { - MAP_SUCCESS(dtype, SQL_C_DOUBLE); - } - break; - -<<<<<<< HEAD - // unsupported types ***REMOVED******REMOVED***--------- -======= - // unsupported types ------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - // this includes: - // blobs: - // SQL_BINARY, SQL_VARBINARY, SQL_LONGVARBINARY - default: - break; - - } -#undef MAP_SUCCESS - - TRACE_NOLOC("WARN: Failed translation of SQL\n\ttype: %s(%d)\n\tsize: %d\n\tuse_unicode: %s\n", - sql_type_to_str(cd.sql_type_), (int)cd.sql_type_, (int)cd.sql_size_, - unicode ? "Yes":"No"); - - return 1; - } - - struct query_desc - { - SQLRETURN init_from_statement(SQLHSTMT hstmt); - SQLRETURN bind_cols(); - - void lowercase_fields(); - int translate_types(bool use_unicode); - int ensure(); - void convert(size_t read); - void advance(size_t read); - - int allocate_buffers(size_t initial_result_count, size_t chunk_size, bool keep_nulls); - int resize(size_t new_count); - void cleanup(); - - void dump_column_mapping() const; - - query_desc(): allocated_results_count_(0), chunk_size_(0), offset_(0) {} - - std::vector columns_; - size_t allocated_results_count_; - size_t chunk_size_; - size_t offset_; - SQLHSTMT hstmt_; - }; - - SQLRETURN - query_desc::init_from_statement(SQLHSTMT hstmt) - /* - Fill the column descriptor from the sql statement handle hstmt. - - returns SQL_SUCCESS if successful, otherwise it returns the - SQLRESULT from the SQL command that failed. - */ - { - cleanup(); - - hstmt_ = hstmt; - - SQLRETURN ret; - SQLSMALLINT field_count = 0; - - ret = SQLNumResultCols(hstmt, &field_count); - - if (!SQL_SUCCEEDED(ret)) - return ret; - - columns_.resize(field_count); - // columns are 1 base on ODBC... - for (SQLSMALLINT field = 1; field <= field_count; field++) - { - column_desc& c_desc = columns_[field-1]; - ret = SQLDescribeCol(hstmt, - field, - &c_desc.sql_name_[0], - _countof(c_desc.sql_name_), - NULL, - &c_desc.sql_type_, - &c_desc.sql_size_, - &c_desc.sql_decimal_, - &c_desc.sql_nullable_); - - if (!SQL_SUCCEEDED(ret)) - return ret; - } - - return SQL_SUCCESS; - } - - SQLRETURN - query_desc::bind_cols() - { - SQLUSMALLINT col_number = 1; - - TRACE_NOLOC("\nBinding columns:\n"); - for (std::vector::iterator it = columns_.begin(); - it < columns_.end(); ++it) - { - void *bind_ptr; - if (it->scratch_buffer_) { - bind_ptr = it->scratch_buffer_; - } - else { - PyArrayObject* array = it->npy_array_; - bind_ptr = static_cast(PyArray_BYTES(array) + - (offset_*PyArray_ITEMSIZE(array))); - } - - TRACE_NOLOC("\tcolumn:%-10.10s address:%p %s\n", - it->sql_name_, bind_ptr, - bind_ptr==it->scratch_buffer_?"(scratch)":""); - SQLRETURN status = SQLBindCol(hstmt_, col_number, it->sql_c_type_, - bind_ptr, it->element_buffer_size_ , - it->null_buffer_); - if (!SQL_SUCCEEDED(status)) { - return status; - } - - col_number++; - } - - return SQL_SUCCESS; - } - - void - query_desc::lowercase_fields() - /* - Converts all the field names to lowercase - */ - { - for (std::vector::iterator it = columns_.begin(); - it < columns_.end(); ++it) - { - _strlwr((char*)&it->sql_name_[0]); - } - } - - int - query_desc::translate_types(bool use_unicode) - /* - Performs the mapping of types from SQL to numpy dtype and C type. - returns a count with the number of failed translations - */ - { - int failed_translations = 0; - for (std::vector::iterator it = columns_.begin(); - it < columns_.end(); ++it) - { - failed_translations += map_column_desc_types(*it, use_unicode); - } - - return failed_translations; - } - - int - query_desc::allocate_buffers(size_t buffer_element_count, - size_t chunk_element_count, - bool keep_nulls) - /* - allocate buffers to execute the query. - row_count: initial rows to preallocate for the results - chunk_row_count: rows to allocate for "per-chunk" buffers - - returns the number of failed allocations. - */ - { - int alloc_errors = 0; - npy_intp npy_array_count = static_cast(buffer_element_count); - - TRACE_NOLOC("\nAllocating arrays for column data:\n"); - for (std::vector::iterator it = columns_.begin(); - it < columns_.end(); ++it) - { - // Allocate the numpy buffer for the result - PyObject *arr = PyArray_SimpleNewFromDescr(1, &npy_array_count, - it->npy_type_descr_); - if (!arr) { - // failed to allocate mem_buffer - alloc_errors++; - continue; - } - PyArrayObject *array = reinterpret_cast(arr); - - if (PyArray_ISSTRING(array)) { - // clear memory on strings or undefined - memset(PyArray_BYTES(array), 0, buffer_element_count*PyArray_ITEMSIZE(array)); - } - - it->npy_array_ = array; - - if (!arr) - alloc_errors ++; - - TRACE_NOLOC("\tcolumn: %-10.10s address: %p\n", it->sql_name_, PyArray_DATA(array)); - // SimpleNewFromDescr steals the reference for the dtype - Py_INCREF(it->npy_type_descr_); - // if it is a type that needs to perform conversion, - // allocate a buffer for the data to be read in. - // - // TODO: make the type logic decide what size per element - // it needs (if any). this will make the logic about - // conversion simpler. - switch (it->sql_c_type_) - { - case SQL_C_TYPE_DATE: - { - void *mem = GUARDED_ALLOC(chunk_element_count * - sizeof(DATE_STRUCT)); - it->scratch_buffer_ = mem; - if (!mem) - alloc_errors ++; - } - break; - case SQL_C_TYPE_TIMESTAMP: - { - void *mem = GUARDED_ALLOC(chunk_element_count * - sizeof(TIMESTAMP_STRUCT)); - it->scratch_buffer_ = mem; - if (!mem) - alloc_errors ++; - } - break; - case SQL_C_TYPE_TIME: - { - void *mem = GUARDED_ALLOC(chunk_element_count * - sizeof(TIME_STRUCT)); - it->scratch_buffer_ = mem; - if (!mem) - alloc_errors ++; - } - break; - case SQL_C_WCHAR: - { - // this case is quite special, as a scratch - // buffer/conversions will only be needed when the - // underlying ODBC manager does not use UCS4 for - // its unicode strings. - // - // - MS ODBC manager uses UTF-16, which may - // include surrogates (thus variable length encoded). - // - // - unixODBC seems to use UCS-2, which is - // compatible with UTF-16, but may not include - // surrogates limiting encoding to Basic - // Multilingual Plane (not sure about this, it - // will be handled using the same codepath as MS - // ODBC, so it will work even if it produces - // surrogates). - // - // - iODBC uses UCS-4 (UTF-32), so it shouldn't - // need any kind of translation. - // - // In order to check if no translation is needed, the - // size of SQLWCHAR is used. - if (sizeof(SQLWCHAR) == 2) { - TRACE_NOLOC("\tscratch memory for unicode conversion (sizeof(SQLWCHAR) is %d)\n", (int)sizeof(SQLWCHAR)); - - size_t item_count = PyArray_ITEMSIZE(it->npy_array_) / sizeof(npy_ucs4); - // 2 due to possibility of surrogate. - // doing the math, the final buffer could be used instead of a scratch - // buffer, but would require code that can do the conversion in-place. - void *mem = GUARDED_ALLOC(chunk_element_count * item_count * - sizeof(SQLWCHAR) * 2); - it->scratch_buffer_ = mem; - if (!mem) - alloc_errors ++; - } - } - break; - default: - break; - } - - if (it->sql_nullable_) { - // if the type is nullable, allocate a buffer for null - // data (ODBC buffer, that has SQLLEN size) - void *mem = GUARDED_ALLOC(chunk_element_count * sizeof(SQLLEN)); - it->null_buffer_ = static_cast(mem); - if (!mem) - alloc_errors ++; - - if (keep_nulls) - { - // also allocate a numpy array for bools if null data is wanted - arr = PyArray_SimpleNew(1, &npy_array_count, NPY_BOOL); - it->npy_array_nulls_ = reinterpret_cast(arr); - if (!it->npy_array_nulls_) - alloc_errors++; - } - } - } - - if (!alloc_errors) - { - allocated_results_count_ = buffer_element_count; - chunk_size_ = chunk_element_count; - } - - return alloc_errors; - } - - int - query_desc::resize(size_t new_size) - /* - resize the numpy array elements to the new_size. - the chunk_size and associated buffers are to be preserved. - */ - { - int alloc_fail = 0; - npy_intp size = static_cast(new_size); - for (std::vector::iterator it = columns_.begin(); - it < columns_.end(); ++it) - { - void *old_data=PyArray_DATA(it->npy_array_); - int failed = resize_array(it->npy_array_, size); - void *new_data=PyArray_DATA(it->npy_array_); - - TRACE_NOLOC("Array for column %s moved. %p -> %p", it->sql_name_, old_data, new_data); - // if it has an array for nulls, resize it as well - if (it->npy_array_nulls_) - { - failed += resize_array(it->npy_array_nulls_, size); - } - - if (failed) - alloc_fail += failed; - } - - if (!alloc_fail) - allocated_results_count_ = new_size; - - return alloc_fail; - } - - int - query_desc::ensure() - /* - make sure there is space allocated for the next step - return 0 if everything ok, any other value means a problem was found - due to resizing - */ - { - if (allocated_results_count_ < offset_ + chunk_size_) - { - return resize(offset_ + chunk_size_); - } - - return 0; - } - - void - query_desc::convert(size_t count) - /* - Converts any column that requires conversion from the type returned - by odbc to the type expected in numpy. Right now this is only needed - for fields related to time. Note that odbc itself may handle other - conversions, like decimal->double with the appropriate SQLBindCol. - - The conversion also includes the handling of nulls. In the case of - NULL a default value is inserted in the resulting column. - */ - { - for (std::vector::iterator it = columns_.begin(); - it < columns_.end(); ++it) - { - // TODO: It should be possible to generalize this and make it - // more convenient to add types if a conversion function - // was placed in the column structure. - // Probably nulls could be handled by that conversion - // function as well. - if (it->scratch_buffer_) { // a conversion is needed - CHECK_ALLOC_GUARDS(it->scratch_buffer_, - "scratch buffer for field %s\n", - it->sql_name_); - convert_buffer(it->npy_array_, - it->scratch_buffer_, it->sql_c_type_, - offset_, count); - } - - if (it->null_buffer_) { // nulls are present - CHECK_ALLOC_GUARDS(it->null_buffer_, - "null buffer for field %s\n", - it->sql_name_); - fill_NAarray(it->npy_array_, - it->npy_array_nulls_, - it->null_buffer_, - offset_, count); - } - } - } - - void - query_desc::advance(size_t count) - /* - Advance the current position - */ - { - offset_ += count; - } - - void - query_desc::cleanup() - { - std::vector tmp; - columns_.swap(tmp); - } - - void - query_desc::dump_column_mapping() const - { - const char* fmt_str_head = "%-20.20s %-15.15s %-10.10s %-8.8s %-20.20s\n"; - const char* fmt_str = "%-20.20s %-15.15s %-10u %-8.8s %-20.20s\n"; -<<<<<<< HEAD - const char* dashes = "***REMOVED******REMOVED***------"; -======= - const char* dashes = "----------------------------------------"; ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - TRACE_NOLOC(fmt_str_head, "name", "sql type", "size", "null?", "c type"); - TRACE_NOLOC(fmt_str_head, dashes, dashes, dashes, dashes, dashes); - for (std::vector::const_iterator it = columns_.begin(); - it < columns_.end(); ++it) - { - TRACE_NOLOC(fmt_str, it->sql_name_, sql_type_to_str(it->sql_type_), - it->sql_size_, - it->sql_nullable_?"null":"not null", - sql_c_type_to_str(it->sql_c_type_)); - } - } -} - -size_t -print_error_types(query_desc& qd, size_t err_count, char *buff, - size_t buff_size) -{ - size_t acc = snprintf(buff, buff_size, - "%d fields with unsupported types found:\n", - (int)err_count); - - for (std::vector::iterator it = qd.columns_.begin(); - it < qd.columns_.end(); ++it) - { - if (0 == it->npy_type_descr_) { - // if numpy type descr is empty means a failed translation. - acc += snprintf(buff+acc, acc < buff_size? buff_size - acc : 0, - "\t'%s' type: %s (%d) size: %d decimal: %d\n", - it->sql_name_, - sql_type_to_str(it->sql_type_), (int)it->sql_type_, - (int)it->sql_size_, (int)it->sql_decimal_); - } - } - - return acc; -} - -int -raise_unsupported_types_exception(int err_count, query_desc& qd) -{ - char error[4096]; - char *use_string = error; - size_t count = print_error_types(qd, err_count, error, sizeof(error)); - - if (count >= sizeof(error)) - { - // did not fit, truncated - char *error_alloc = (char*)GUARDED_ALLOC(count); - if (error_alloc) { - use_string = error_alloc; - print_error_types(qd, count, error_alloc, count); - } - } - - RaiseErrorV(0, PyExc_TypeError, use_string); - - if (use_string != error) { - // we had to allocate - GUARDED_DEALLOC(use_string); - } - return 0; -} - -/** -// Takes an ODBC cursor object and creates a Python dictionary of -// NumPy arrays. It also creates some helpers for the NULLS, and -// datetimes. -// -// This is called after the ODBC query is complete. -// -// @param cur The ODBC cursor object. -// -// @param nrows The number of rows that were returned by the query. -// -// @param lower If true, makes the column names in the NumPy dtype all -// lowercase. -// -// @returns 0 on success -*/ -static int -perform_array_query(query_desc& result, Cursor* cur, npy_intp nrows, bool lower, bool want_nulls) -{ - SQLRETURN rc; - bool use_unicode = cur->cnxn->unicode_results; - size_t outsize, chunk_size; - - if (nrows < 0) { - // chunked, no know final size - outsize = DEFAULT_ROWS_TO_BE_ALLOCATED; - chunk_size = DEFAULT_ROWS_TO_BE_FETCHED; - } - else { - // all in one go - outsize = static_cast(nrows); - chunk_size = static_cast(nrows); - } - - I(cur->hstmt != SQL_NULL_HANDLE && cur->colinfos != 0); - - if (cur->cnxn->hdbc == SQL_NULL_HANDLE) - { - /* - Is this needed or just convenient? - Won't ODBC fail gracefully (through an ODBC error code) when - trying to use a bad handle? - */ - return 0 == RaiseErrorV(0, ProgrammingError, - "The cursor's connection was closed."); - } - - { - PyNoGIL ctxt; - rc = result.init_from_statement(cur->hstmt); - } - - if (cur->cnxn->hdbc == SQL_NULL_HANDLE) - { - // The connection was closed by another thread in the - // ALLOW_THREADS block above. - return 0 == RaiseErrorV(0, ProgrammingError, - "The cursor's connection was closed."); - } - - if (!SQL_SUCCEEDED(rc)) - { - // Note: The SQL Server driver sometimes returns HY007 here if - // multiple statements (separated by ;) were submitted. This - // is not documented, but I've seen it with multiple - // successful inserts. - return 0 == RaiseErrorFromHandle("ODBC failed to describe the resulting columns", - cur->cnxn->hdbc, cur->hstmt); - } - - if (lower) - result.lowercase_fields(); - - int unsupported_fields = result.translate_types(use_unicode); - if (unsupported_fields) - { - // TODO: add better diagnosis, pointing out the fields and - // their types in a human readable form. - return 0 == raise_unsupported_types_exception(unsupported_fields, result); - } - - if (pyodbc_tracing_enabled) - result.dump_column_mapping(); - - int allocation_errors = result.allocate_buffers(outsize, chunk_size, want_nulls); - if (allocation_errors) - { - return 0 == RaiseErrorV(0, PyExc_MemoryError, - "Can't allocate result buffers", - outsize); - } - - fetch_status status(cur->hstmt, result.chunk_size_); - do { - TRACE_NOLOC("Fetching %d rows..\n", result.chunk_size_); - int error = result.ensure(); - if (error) { - return 0 == RaiseErrorV(0, PyExc_MemoryError, - "Can't allocate result buffers"); - } - - rc = result.bind_cols(); - if (!SQL_SUCCEEDED(rc)) { - return 0 == RaiseErrorFromHandle("ODBC failed when binding columns", - cur->cnxn->hdbc, cur->hstmt); - - } - - // Do the fetch - { - PyNoGIL ctxt; - rc = SQLFetchScroll(status.hstmt_, SQL_FETCH_NEXT, 0); - } - - - // Sometimes (test_exhaust_execute_buffer), the SQLite ODBC - // driver returns an error here, but it should not! I'm not - // sure that this solution is the correct one, but anyway. - if ((rc == SQL_NO_DATA) || (rc == -1)) { // XXX - //if (rc == SQL_NO_DATA) { - TRACE_NOLOC("No more data available (%d)\n", (int)rc); - break; - } - else if (rc < 0) { - PyErr_SetString(PyExc_RuntimeError, "error in SQLFetchScroll"); - return rc; - } - - // The next check creates false positives on SQLite, as the - // NumRowsFetched seems arbitrary (i.e. not set). Probably - // reveals a problem in the ODBC driver. - if (status.rows_read_ > static_cast(result.chunk_size_)) { - // Let's reset its value to 0 instead (the most probable value here) - TRACE_NOLOC("WARN: rows read reported is greater than requested (Read: %d, Requested: %d)\n", - static_cast(status.rows_read_), - static_cast(result.chunk_size_)); - - status.rows_read_ = 0; - } - - TRACE_NOLOC("\nConverting %d row(s)\n", status.rows_read_); - result.convert(status.rows_read_); - result.advance(status.rows_read_); - - // This exits the loop when the amount of rows was known - // a-priori, so it is enough with a single call - if (nrows >= 0) - break; - - // We assume that when the number of rows read is lower than - // the number we asked for, this means we are done. - } while(status.rows_read_ == static_cast(result.chunk_size_)); - - // Finally, shrink size of final container, if needed - if (result.offset_ < result.allocated_results_count_) { - int alloc_failures = result.resize(result.offset_); - if (alloc_failures) { - // note that this shouldn't be happening, as a shrinking realloc - // should always succeed! - TRACE_NOLOC("WARN: Unexpected failure when trying to shrink arrays"); - return 0 == RaiseErrorV(0, PyExc_MemoryError, - "Can't allocate result buffers"); - } - } - - return 0; -} - - -static PyObject* -query_desc_to_dictarray(query_desc& qd, const char *null_suffix) -/* - Build a dictarray (dictionary of NumPy arrays) from the query_desc - - returns the python dictionary object, or 0 if an error occurred. In case - of an error the appropriate python exception is raised. - */ -{ - PyObject *dictarray = PyDict_New(); - - if (dictarray) { - for (std::vector::iterator it = qd.columns_.begin(); - it < qd.columns_.end(); ++it) - { - int rv; - rv = PyDict_SetItemString(dictarray, - reinterpret_cast(it->sql_name_), - reinterpret_cast(it->npy_array_)); - - if (rv < 0) { - /* out of mem is very likely here */ - Py_DECREF(dictarray); - return 0; - } - - if (it->npy_array_nulls_) { - char column_nulls_name[350]; - snprintf(column_nulls_name, sizeof(column_nulls_name), "%s%s",it->sql_name_,null_suffix); - rv = PyDict_SetItemString(dictarray, - column_nulls_name, - reinterpret_cast(it->npy_array_nulls_)); - if (rv < 0) { - Py_DECREF(dictarray); - return 0; - } - } - } - } - - return dictarray; -} - -// -// Create and fill a dictarray out of a query -// -// arguments: -// cursor - cursor object to fetch the rows from -// nrows - number of rows to fetch, -1 for all rows -// null_suffix - suffix to add to the column name for the bool column holding the nulls. NULL means we don't want nulls. -static PyObject* -create_fill_dictarray(Cursor* cursor, npy_intp nrows, const char* null_suffix) -{ - int error; - query_desc qd; - - error = perform_array_query(qd, cursor, nrows, lowercase(), null_suffix != 0); - if (error) { - TRACE_NOLOC("WARN: perform_querydesc returned %d errors\n", error); - return 0; - } - - TRACE_NOLOC("\nBuilding dictarray.\n"); - PyObject *dictarray = query_desc_to_dictarray(qd, null_suffix); - if (!dictarray) { - TRACE_NOLOC("WARN: Failed to build dictarray from the query results.\n"); - return 0; - } - - return dictarray; -} - - -static PyArray_Descr* -query_desc_to_record_dtype(query_desc &qd, const char *null_suffix) -/* - Build a record dtype from the column information in a query - desc. - - returns the dtype (PyArray_Descr) on success with a reference - count. 0 if something failed. On failure the appropriate python - exception will be already raised. - - In order to create the structured dtype, PyArray_DescrConverter is - called passing a dictionary that maps the fields. - */ -{ - PyObject* record_dict = 0; - - record_dict = PyDict_New(); - - if (!record_dict) - return 0; - - long offset = 0; - for (std::vector::iterator it = qd.columns_.begin(); - it < qd.columns_.end(); ++it) { - PyObject *field_desc = PyTuple_New(2); - - if (!field_desc) { - Py_DECREF(record_dict); - return 0; /* out of memory? */ - } - - // PyTuple_SET_ITEM steals the reference, we want to keep one - // reference for us. We don't want the extra checks made by - // PyTuple_SetItem. - Py_INCREF(it->npy_type_descr_); - PyTuple_SET_ITEM(field_desc, 0, (PyObject*)it->npy_type_descr_); - PyTuple_SET_ITEM(field_desc, 1, PyInt_FromLong(offset)); - - int not_inserted = PyDict_SetItemString(record_dict, (const char*) it->sql_name_, - field_desc); - Py_DECREF(field_desc); - if (not_inserted) { - Py_DECREF(record_dict); - return 0; /* out of memory? */ - } - - offset += it->npy_type_descr_->elsize; - - // handle nulls... - if (it->npy_array_nulls_) { - field_desc = PyTuple_New(2); - if (!field_desc) - { - Py_DECREF(record_dict); - return 0; - } - - PyArray_Descr *descr = PyArray_DESCR(it->npy_array_nulls_); - Py_INCREF(descr); - PyTuple_SET_ITEM(field_desc, 0, (PyObject*)descr); - PyTuple_SET_ITEM(field_desc, 1, PyInt_FromLong(offset)); - char null_column_name[350]; - snprintf(null_column_name, sizeof(null_column_name), - "%s%s", it->sql_name_, null_suffix); - - not_inserted = PyDict_SetItemString(record_dict, null_column_name, field_desc); - Py_DECREF(field_desc); - if (not_inserted) { - Py_DECREF(record_dict); - return 0; - } - offset += descr->elsize; - } - } - - PyArray_Descr *dtype=0; - int success = PyArray_DescrConverter(record_dict, &dtype); - Py_DECREF(record_dict); - if (!success) { - RaiseErrorV(0, ProgrammingError, - "Failed conversion from dict type into a NumPy record dtype"); - return 0; - } - - return dtype; -} - -static PyArrayObject* -query_desc_to_sarray(query_desc &qd, const char *null_suffix) -/* - Build a sarray (structured array) from a query_desc. - */ -{ - // query_desc contains "column-wise" results as NumPy arrays. In a - // sarray we want the data row-wise (structured layout). This - // means a whole new array will need to be allocated and memory - // copying will be needed. - - // 1. build the record dtype. - PyArray_Descr *dtype = query_desc_to_record_dtype(qd, null_suffix); - - if (!dtype) { - TRACE_NOLOC("WARN: failed to create record dtype.\n"); - return 0; - } - - // 2. build the NumPy Array. It is not needed to clear any data - // (even string data) as everything will be overwritten when - // copying the column arrays. The column arrays where already - // properly initialized before fetching the data. - npy_intp dims = (npy_intp)qd.allocated_results_count_; - PyArrayObject* sarray = reinterpret_cast(PyArray_SimpleNewFromDescr(1, &dims, dtype)); - // note: dtype got its reference stolen, but it is still valid as - // long as the array is valid. The reference is stolen even if the - // array fails to create (according to NumPy source code). - - if (!sarray) { - TRACE_NOLOC("WARN: failed to create structured array.\n"); - return 0; - } - - // 3. copy the data into the structured array. Note: the offsets - // will be the same as in the record array by construction. - { - PyNoGIL no_gil; - long offset = 0; - for (std::vector::iterator it = qd.columns_.begin(); - it < qd.columns_.end(); ++it) - { - size_t sarray_stride = PyArray_ITEMSIZE(sarray); - char *sarray_data = PyArray_BYTES(sarray) + offset; - size_t carray_stride = PyArray_ITEMSIZE(it->npy_array_); - char *carray_data = PyArray_BYTES(it->npy_array_); - // this approach may not be the most efficient, but it is good enough for now. - // TODO: make the transform in a way that is sequential on the write stream - for (size_t i = 0; i < qd.allocated_results_count_; ++i) - { - memcpy(sarray_data, carray_data, carray_stride); - sarray_data += sarray_stride; - carray_data += carray_stride; - } - - offset += carray_stride; - - if (it->npy_array_nulls_) - { - // TODO: refactor this code that is duplicated - sarray_stride = PyArray_ITEMSIZE(sarray); - sarray_data = PyArray_BYTES(sarray) + offset; - carray_stride = PyArray_ITEMSIZE(it->npy_array_nulls_); - carray_data = PyArray_BYTES(it->npy_array_nulls_); - // this approach may not be the most efficient, but it is good enough for now. - // TODO: make the transform in a way that is sequential on the write stream - for (size_t i = 0; i < qd.allocated_results_count_; ++i) - { - memcpy(sarray_data, carray_data, carray_stride); - sarray_data += sarray_stride; - carray_data += carray_stride; - } - - offset += carray_stride; - } - } - } - - return sarray; -} - -static PyObject* -create_fill_sarray(Cursor* cursor, npy_intp nrows, const char* null_suffix) -{ - int error; - query_desc qd; - - error = perform_array_query(qd, cursor, nrows, lowercase(), null_suffix != 0); - if (error) { - TRACE_NOLOC("perform_querydesc returned %d errors\n", error); - return 0; - } - - TRACE_NOLOC("\nBuilding sarray\n"); - PyObject *sarray = reinterpret_cast(query_desc_to_sarray(qd, null_suffix)); - if (!sarray) { - TRACE_NOLOC("WARN: Failed to build sarray from the query results.\n"); - } - - return sarray; -} - - -<<<<<<< HEAD -// ***REMOVED******REMOVED******REMOVED***-------- -// Method implementation -// ***REMOVED******REMOVED******REMOVED***-------- -======= -// ----------------------------------------------------------------------------- -// Method implementation -// ----------------------------------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -static char *Cursor_npfetch_kwnames[] = { - "size", // keyword to read the maximum number of rows. Defaults to all. - "return_nulls", // keyword to make a given fetch to add boolean columns for nulls - "null_suffix", // keyword providing the string to use as suffix -}; - - -// -// The main cursor.fetchsarray() method -// -PyObject* -Cursor_fetchsarray(PyObject *self, PyObject *args, PyObject *kwargs) -{ - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_RESULTS | CURSOR_RAISE_ERROR); - if (!cursor) - return 0; - - TRACE("\n\nParse tuple\n"); - ssize_t nrows = -1; - const char *null_suffix = "_isnull"; - PyObject *return_nulls = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|nOs", Cursor_npfetch_kwnames, - &nrows, &return_nulls, &null_suffix)) - return 0; - - bool preserve_nulls = return_nulls ? PyObject_IsTrue(return_nulls) : false; - - TRACE_NOLOC("\n\nCursor fetchsarray\n\tnrows:%d\n\treturn_nulls:%s\n\tnull_suffix:%s\n\thandle:%p\n\tunicode_results:%s\n", - (int)nrows, preserve_nulls?"Yes":"No", null_suffix, (void*)cursor->hstmt, - cursor->cnxn->unicode_results?"Yes":"No"); - npy_intp arg = nrows; - PyObject* rv = create_fill_sarray(cursor, arg, preserve_nulls?null_suffix:0); - TRACE_NOLOC("\nCursor fetchsarray done.\n\tsarray: %p\n\n", rv); - - return rv; -} - -// -// The main cursor.fetchdict() method -// - -PyObject* -Cursor_fetchdictarray(PyObject* self, PyObject* args, PyObject *kwargs) -{ - Cursor* cursor = Cursor_Validate(self, CURSOR_REQUIRE_RESULTS | CURSOR_RAISE_ERROR); - if (!cursor) - return 0; - - /* - note: ssize_t is used as a type for parse tuple as it looks like - the integer in ParseTuple that is more likely to have the same size - as a npy_intp - */ - TRACE("\n\nParse tuple\n"); - ssize_t nrows = -1; - PyObject *return_nulls = NULL; - const char *null_suffix = "_isnull"; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|nOs", Cursor_npfetch_kwnames, - &nrows, &return_nulls, &null_suffix)) - return 0; - - bool preserve_nulls = return_nulls?PyObject_IsTrue(return_nulls):false; - TRACE("Foo\n"); - TRACE_NOLOC("\n\nCursor fetchdictarray\n\tnrows:%d\n\treturn_nulls:%s\n\tnull_suffix:%s\n\thandle:%p\n\tunicode_results:%s\n", - (int)nrows, preserve_nulls?"yes":"no", null_suffix, (void*)cursor->hstmt, - cursor->cnxn->unicode_results?"Yes":"No"); - npy_intp arg = nrows; - PyObject *rv = create_fill_dictarray(cursor, arg, preserve_nulls?null_suffix:0); - TRACE_NOLOC("\nCursor fetchdictarray done.\n\tdictarray: %p\n\n", rv); - return rv; -} - - -#if PY_VERSION_HEX >= 0x03000000 -int NpContainer_init() -#else -void NpContainer_init() -#endif -{ - import_array(); - // If the version of Numpy is >= API 7 (Numpy 1.7), - // then enable datetime features. This allows datetime - // to work even if pyodbc is built against Numpy 1.5. - if (PyArray_GetNDArrayCFeatureVersion() >= 7) { - CAN_USE_DATETIME = true; - } - -#if PY_VERSION_HEX >= 0x03000000 - return 0; -#else - return; -#endif -} - - -/* -Local Variables: - c-basic-offset: 4 - indent-tabs-mode: nil -End: -*/ diff --git a/pyodbc/src/pyodbc.h b/pyodbc/src/pyodbc.h deleted file mode 100644 index ec6ee17..0000000 --- a/pyodbc/src/pyodbc.h +++ /dev/null @@ -1,211 +0,0 @@ - -// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -// documentation files (the "Software"), to deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS -// OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef PYODBC_H -#define PYODBC_H - - -<<<<<<< HEAD -// Python definitions ***REMOVED******REMOVED***------ -======= -// Python definitions ---------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -// first include Python.h to avoid warnings. -#define PY_SSIZE_T_CLEAN 1 - -#include -#include -#include -#include -#include -#include - -#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) -typedef int Py_ssize_t; -#define PY_SSIZE_T_MAX INT_MAX -#define PY_SSIZE_T_MIN INT_MIN -#define PyInt_AsSsize_t PyInt_AsLong -#define lenfunc inquiry -#define ssizeargfunc intargfunc -#define ssizeobjargproc intobjargproc -#endif - -<<<<<<< HEAD -// System definitions ***REMOVED******REMOVED***------ -======= -// System definitions ---------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -#ifdef _MSC_VER -# define _CRT_SECURE_NO_WARNINGS -# include -# include -typedef __int64 INT64; -typedef unsigned __int64 UINT64; -#else -typedef unsigned char byte; -typedef unsigned int UINT; -typedef long long INT64; -typedef unsigned long long UINT64; -# define _strcmpi strcasecmp -# ifdef __MINGW32__ -# include -# include -# else -inline int max(int lhs, int rhs) { return (rhs > lhs) ? rhs : lhs; } -# endif -#endif - -#ifdef __SUN__ -# include -#endif - -#if defined(_MSC_VER) - #if _MSC_VER < 1600 - /* Visual Studio before 2010 didn't have stdint.h */ - typedef signed char int8_t; - typedef short int16_t; - typedef int int32_t; - typedef __int64 int64_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; - typedef unsigned __int64 uint64_t; - #else - #include - #endif -#endif - -#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) || (defined(__GNUC__) && !defined(__MINGW32__)) -# include -# include -# define CDECL cdecl -# define min(X,Y) ((X) < (Y) ? (X) : (Y)) -# define max(X,Y) ((X) > (Y) ? (X) : (Y)) -# define _alloca alloca -inline void _strlwr(char* name) -{ - while (*name) { *name = tolower(*name); name++; } -} -#else -# define CDECL -#endif - - -<<<<<<< HEAD -// ODBC definitions ***REMOVED******REMOVED***-------- -======= -// ODBC definitions ------------------------------------------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -#include -#include - - -<<<<<<< HEAD -// Utility functions/definitions ***REMOVED******REMOVED***------ -======= -// Utility functions/definitions ---------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -#ifndef _countof -#define _countof(a) (sizeof(a) / sizeof(a[0])) -#endif - -inline bool IsSet(DWORD grf, DWORD flags) -{ - return (grf & flags) == flags; -} - -#ifdef UNUSED -#undef UNUSED -#endif -inline void UNUSED(...) { } - -#define STRINGIFY(x) #x -#define TOSTRING(x) STRINGIFY(x) - - -<<<<<<< HEAD -// Debugging support ***REMOVED******REMOVED***------- -======= -// Debugging support ----------------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -// Building an actual debug version of Python is so much of a pain that it never happens. I'm providing release-build -// versions of assertions. - -extern bool pyodbc_tracing_enabled; -extern bool pyodbc_alloc_guards; -void pyodbc_assertion_failed(const char *file, int line, const char *expr); -void pyodbc_trace_func(const char *file, int line, const char* fmt, ...); -void *pyodbc_guarded_alloc(const char *file, int line, size_t size); -void pyodbc_guarded_dealloc(const char *file, int line, void* ptr); -void pyodbc_check_guards(const char* file, int line, void* ptr, const char *fmt, ...); - -#if defined(PYODBC_ASSERT) - #define I(expr) if (!(expr)) pyodbc_assertion_failed(__FILE__, __LINE__, #expr); - #define N(expr) if (expr) pyodbc_assertion_failed(__FILE__, __LINE__, #expr); -#else - #define I(expr) - #define N(expr) -#endif - - -#define TRACE(...) \ - if (pyodbc_tracing_enabled) \ - pyodbc_trace_func(__FILE__, __LINE__, __VA_ARGS__) - -#define TRACE_NOLOC(...) \ - if (pyodbc_tracing_enabled) \ - pyodbc_trace_func(NULL, 0, __VA_ARGS__) - -#define GUARDED_ALLOC(...) \ - ((!pyodbc_alloc_guards)? \ - malloc(__VA_ARGS__) : \ - pyodbc_guarded_alloc(__FILE__, __LINE__, __VA_ARGS__)) - -#define GUARDED_DEALLOC(...) \ - do if (!pyodbc_alloc_guards) { \ - free(__VA_ARGS__); \ - } \ - else { \ - pyodbc_guarded_dealloc(__FILE__, __LINE__, __VA_ARGS__); \ - } while(0) - -#define CHECK_ALLOC_GUARDS(...) \ - if (pyodbc_alloc_guards) \ - pyodbc_check_guards(__FILE__, __LINE__, __VA_ARGS__, "") - -#ifdef PYODBC_LEAK_CHECK -#define pyodbc_malloc(len) _pyodbc_malloc(__FILE__, __LINE__, len) -void* _pyodbc_malloc(const char* filename, int lineno, size_t len); -void pyodbc_free(void* p); -void pyodbc_leak_check(); -#else -#define pyodbc_malloc malloc -#define pyodbc_free free -#endif - - -void PrintBytes(void* p, size_t len); - - -<<<<<<< HEAD -// Python 3 compatibility definitions ***REMOVED******REMOVED***-- -======= -// Python 3 compatibility definitions ------------------------------------ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -#include "pyodbccompat.h" - - -#endif // pyodbc_h diff --git a/pyodbc/tests/README.rst b/pyodbc/tests/README.rst deleted file mode 100644 index 2acc9e7..0000000 --- a/pyodbc/tests/README.rst +++ /dev/null @@ -1,81 +0,0 @@ -Tests for IOPro/pyodbc -====================== - -In order to test pyodbc access to a database and a properly configured -ODBC driver setup is needed. - -A valid ODBC connection string should be provided in order to run the -test suite. All configuration needed to run the test suite is -performed via environment variables. - - -Configuring the test suite -========================== - -The following environment variables are used to configure the test -suite: - - -IOPRO_PYODBC_TEST_CONNSTR -<<<<<<< HEAD -***REMOVED******REMOVED***-- -======= ------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -The connection string to use when performing database connections. - -For example: -'DRIVER={FreeTDS};SERVER=192.168.1.135;DATABASE=test;Port=1433;Uid=test;Pwd=test' - -IOPRO_PYODBC_TEST_DBMS -<<<<<<< HEAD -***REMOVED******REMOVED***-- -======= ------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -If set, specifies which DBMS is behind the ODBC connection. Some -tests containing DBMS specific SQL will be skipped unless the -appropriate DBMS is set in this variable. - -Supported values are: -'sql_server' - Microsoft SQL server. -'postgresql' - PostgreSQL. - - -IOPRO_PYODBC_TEST_LOGGING -<<<<<<< HEAD -***REMOVED******REMOVED***-- -======= ------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -If set to a value that evaluates to True, enable tracing when -executing the test suite. This results in very verbose actions on -whats going on inside pyodbc. This is mostly a debugging tool. - -It basically sets "enable_tracing" in IOPro/pyodbc when running the -tests. - - -IOPRO_PYODBC_TEST_UNICODE_RESULTS -<<<<<<< HEAD -***REMOVED******REMOVED******REMOVED*** -======= --------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -If set to a value that evaluates to True, tell pyodbc to use unicode -results when connecting to the database. This means that connection to -the database is performed by setting the unicode_results keyword -argument for connect to True. - - -A word of warning about side effects of running the test suite -============================================================== - -The test suite creates and drops tables in order to perform the -tests. This means that the database used for test may have tables -created and dropped. Needless to say, use a blank database meant for -testing to run the tests on, using a database user meant for testing. diff --git a/pyodbc/tests/unittest_support.py b/pyodbc/tests/unittest_support.py deleted file mode 100644 index 2f7098a..0000000 --- a/pyodbc/tests/unittest_support.py +++ /dev/null @@ -1,102 +0,0 @@ -""" -support classes for IOPro/pyodbc tests -""" - -from __future__ import absolute_import, print_function, division - -from unittest import TestCase -import os -import iopro.pyodbc as pyodbc -from contextlib import contextmanager - -import functools - -_conn_string_key = 'IOPRO_PYODBC_TEST_CONNSTR' -_conn_string = os.environ.get(_conn_string_key) -_enable_logging = bool(os.environ.get('IOPRO_PYODBC_TEST_LOGGING')) -_unicode_results = bool(os.environ.get('IOPRO_PYODBC_TEST_UNICODE_RESULTS')) -_test_db = os.environ.get("IOPRO_PYODBC_TEST_DBMS") - -_error_string = """ -Set the environment variable "{0}" to the connection string for -your test database. -example (bash): -export IOPRO_PYODBC_TEST_CONNSTR='DRIVER={{FreeTDS}};SERVER=192.168.1.135;DATABASE=test;Port=1433;Uid=test;Pwd=test' -""".format(_conn_string_key) - - -<<<<<<< HEAD -# Configure pyodbc for execution ***REMOVED******REMOVED***- -======= -# Configure pyodbc for execution ----------------------------------------------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -class IOProPyodbcTest(TestCase): - """ - Provides a connection (self.conn) that is initialized from - environment variables. - - Subclasses can implement a couple of methods to create/cleanup - tables used as tests. This should be implemented as class - methods so that the tables are created once per class. - """ - - def setUp(self): - pyodbc.enable_mem_guards(True) - pyodbc.enable_tracing(_enable_logging) - self.assertIsNotNone(_conn_string, msg=_error_string) - try: - self.conn = pyodbc.connect(_conn_string, unicode_results=_unicode_results, timeout=3) - except Exception as e: - raise Exception('It seems that your {0} is not setup correctly. Attempting to connect resulted in:\n{1}'.format(_conn_string_key, e.args[1])) - - def tearDown(self): - del self.conn - - -# decorators for test specific to some databases... -class DBMS(object): - SQL_Server = 'sql_server' - PostgreSQL = 'postgresql' - -_supported_dbms = [getattr(DBMS, i) for i in dir(DBMS) if not i.startswith('_')] -_warn_message=""" -Warn: Supplied IOPRO_PYODBC_TEST_DBMS '{0}' ignored. -Try one of the following: -\t{1} -""" - -if _test_db and not _test_db in _supported_dbms: - print(_warn_message.format(_test_db, '\n\t'.join(_supported_dbms))) - - -class dbms_specific(object): - """ - A decorator to mark tests as specific to a given (set) of DBMS. - Because they use DBMS specific types/SQL extensions, for example. - - Sample use: - @dbms_specific(DBMS.SQL_Server, DBMS.PostgreSQL) - """ - def __init__(self, *args): - self.dbms = args - - def __call__(self, fn): - if _test_db in self.dbms: - return fn - else: - @functools.wraps(fn) - def fail(*args, **kwargs): - raise SkipTest("only for dbms: {0}".format(', '.join(self.dbms))) - return fail - -def get_connection_string(): - return _conn_string - - -@contextmanager -def text_limit(size): - old = pyodbc.iopro_set_text_limit(size) - yield - pyodbc.iopro_set_text_limit(old) - diff --git a/pyodbc/web/docs.html b/pyodbc/web/docs.html deleted file mode 100644 index 2b05f78..0000000 --- a/pyodbc/web/docs.html +++ /dev/null @@ -1,1170 +0,0 @@ - - - - -pyodbc - - - - -
    - pyodbc - A Python DB API module for ODBC -
    - - - -
    - - - -

    This module implements the Python Database API Specification, -so you should first be familiar with it.

    - -

    Quick Examples

    - -

    Make a direct connection to a database and create a cursor:

    - -
    -  cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;DATABASE=testdb;UID=me;PWD=pass')
    -  cursor = cnxn.cursor()
    - -

    Select some values and print them:

    - -
    -  cursor.execute("select user_id, user_name from users")
    -  for row in cursor:
    -      print row.user_id, row.user_name
    - -

    Select the values, but use a more compact form. The execute function returns the cursor -object when a SELECT is executed, so execute can be moved into the for loop:

    - -
    -  for row in cursor.execute("select user_id, user_name from users"):
    -      print row.user_id, row.user_name
    - - -

    Select a calculated value, giving it a name:

    - -
    -  cursor.execute("select count(*) as user_count from users")
    -  row = cursor.fetchone()
    -  print '%d users' % row.user_count
    - -

    Supply parameters:

    - -
    -  cursor.execute("select count(*) as user_count from users where age > ?", 21)
    -  row = cursor.fetchone()
    -  print '%d users' % row.user_count
    - -

    Delete some records and retrieve the count:

    - -
    -  count = cursor.execute("delete from users where age < ?", 18)
    -  print "deleted %s users" % count
    - -

    Module Interface

    - -

    connect(connectionstring, autocommit=False)

    - -
    -
    connectionstring
    -
    The ODBC connection string.
    - -
    autocommit -
    A Boolean that determines if the connection should be in autocommit mode or manual-commit - mode.
    -
    - -

    Returns a new Connection object.

    - -

    The connection string is passed unmodified to SQLDriverConnect. -Connection strings can have driver specific components and you should refer to the -SQLDriverConnect or other ODBC documentation for details, but below are two common examples.

    - -

    To connect using a DSN (a data source specified in the Data Access control panel applet), -use a string similar to the following.

    - -
    -  cnxn = pyodbc.connect("DSN=dsnname")
    -  cnxn = pyodbc.connect("DSN=dsnname;PWD=password")
    -  cnxn = pyodbc.connect("DSN=dsnname;UID=user;PWD=password")
    - -

    To connect to SQL Server directly (without a DSN), you must specify the server and database -to connect to using SQL Server-specific keywords. Note that the braces are required around the -driver name.

    - -
    -  cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=server;DATABASE=database;UID=user;PWD=password)
    - -

    Module Description Variables

    -
    -
    version
    -
    The pyodbc version as a string in the format major.minor.revision.
    - -
    apilevel
    -
    The string constant '2.0' indicating this module supports DB API level 2.0.
    - -
    lowercase
    -
    A Boolean that controls whether column names in result rows are lowercased. This can be - changed any time and affects queries executed after the change. The default is False. This - can be useful when database columns have inconsistent capitalization.
    - -
    pooling
    -
    A Boolean indicating whether connection pooling is enabled. This is a global (HENV) - setting, so it can only be modified before the first connection is made. The default is - True, which enables ODBC connection pooling.
    - -
    threadsafety
    -
    The integer 1, indicating that threads may share the module but not connections. Note - that connections and cursors may be used by different threads, just not at the same time.
    - -
    qmark
    -
    The string constant "qmark" to indicate parameters are identified using question marks.
    -
    - -

    DB API Type Functions

    - -

    The DB API defines a set of functions that convert from well-known types to data types -required by the database module. If your code does not need to be portable between database -modules (if you will only use pyodbc), you do not need to use these.

    - -
    - -
    Date(year,month,day), DateFromTicks(ticks)
    -
    Both of these return - a datetime.date instance.
    - -
    Time(hour,minute,second), TimeFromTicks(ticks)
    -
    Both of these return - a datetime.time instance.
    - -
    Timestamp(year,month,day,hour,minute,second), TimestampFromTicks(ticks)
    -
    Both of these return - a datetime.datetime - instance.
    - -
    DATETIME
    - -
    Set to the datetime.datetime type. This is not - entirely accurate since dates and times actually use two different classes, datetime.date and - datetime.time, but there is no way to specify this.
    - -
    STRING
    -
    Set to the string type.
    - -
    NUMBER
    - -
    Set to the float type. This is not entirely accurate since the module uses different types of numbers - for different ODBC data types. Instead of using this, simply pass int, float, double, or decimal objects.
    - -
    ROWID
    - -
    Set to the int type.
    - -
    Binary(string)
    - -
    Returns a buffer instance.
    - -
    BINARY
    - -
    Set to the buffer type.
    - -
    - -

    Module Constants

    - -

    The following ODBC constants are defined. They only used with ODBC specific functions such -as Cursor.tables.

    - -
      -
    • SQL_ACCESSIBLE_PROCEDURES
    • -
    • SQL_ACCESSIBLE_TABLES
    • -
    • SQL_ACTIVE_ENVIRONMENTS
    • -
    • SQL_AGGREGATE_FUNCTIONS
    • -
    • SQL_ALTER_DOMAIN
    • -
    • SQL_ALTER_TABLE
    • -
    • SQL_ASYNC_MODE
    • -
    • SQL_BATCH_ROW_COUNT
    • -
    • SQL_BATCH_SUPPORT
    • -
    • SQL_BIGINT
    • -
    • SQL_BINARY
    • -
    • SQL_BIT
    • -
    • SQL_BOOKMARK_PERSISTENCE
    • -
    • SQL_CATALOG_LOCATION
    • -
    • SQL_CATALOG_NAME
    • -
    • SQL_CATALOG_NAME_SEPARATOR
    • -
    • SQL_CATALOG_TERM
    • -
    • SQL_CATALOG_USAGE
    • -
    • SQL_CHAR
    • -
    • SQL_COLLATION_SEQ
    • -
    • SQL_COLUMN_ALIAS
    • -
    • SQL_CONCAT_NULL_BEHAVIOR
    • -
    • SQL_CONVERT_FUNCTIONS
    • -
    • SQL_CONVERT_VARCHAR
    • -
    • SQL_CORRELATION_NAME
    • -
    • SQL_CREATE_ASSERTION
    • -
    • SQL_CREATE_CHARACTER_SET
    • -
    • SQL_CREATE_COLLATION
    • -
    • SQL_CREATE_DOMAIN
    • -
    • SQL_CREATE_SCHEMA
    • -
    • SQL_CREATE_TABLE
    • -
    • SQL_CREATE_TRANSLATION
    • -
    • SQL_CREATE_VIEW
    • -
    • SQL_CURSOR_COMMIT_BEHAVIOR
    • -
    • SQL_CURSOR_ROLLBACK_BEHAVIOR
    • -
    • SQL_DATABASE_NAME
    • -
    • SQL_DATA_SOURCE_NAME
    • -
    • SQL_DATA_SOURCE_READ_ONLY
    • -
    • SQL_DATETIME_LITERALS
    • -
    • SQL_DBMS_NAME
    • -
    • SQL_DBMS_VER
    • -
    • SQL_DDL_INDEX
    • -
    • SQL_DECIMAL
    • -
    • SQL_DEFAULT_TXN_ISOLATION
    • -
    • SQL_DESCRIBE_PARAMETER
    • -
    • SQL_DM_VER
    • -
    • SQL_DOUBLE
    • -
    • SQL_DRIVER_NAME
    • -
    • SQL_DRIVER_ODBC_VER
    • -
    • SQL_DRIVER_VER
    • -
    • SQL_DROP_ASSERTION
    • -
    • SQL_DROP_CHARACTER_SET
    • -
    • SQL_DROP_COLLATION
    • -
    • SQL_DROP_DOMAIN
    • -
    • SQL_DROP_SCHEMA
    • -
    • SQL_DROP_TABLE
    • -
    • SQL_DROP_TRANSLATION
    • -
    • SQL_DROP_VIEW
    • -
    • SQL_DYNAMIC_CURSOR_ATTRIBUTES1
    • -
    • SQL_DYNAMIC_CURSOR_ATTRIBUTES2
    • -
    • SQL_EXPRESSIONS_IN_ORDERBY
    • -
    • SQL_FILE_USAGE
    • -
    • SQL_FLOAT
    • -
    • SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1
    • -
    • SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
    • -
    • SQL_GETDATA_EXTENSIONS
    • -
    • SQL_GROUP_BY
    • -
    • SQL_GUID
    • -
    • SQL_IDENTIFIER_CASE
    • -
    • SQL_IDENTIFIER_QUOTE_CHAR
    • -
    • SQL_INDEX_KEYWORDS
    • -
    • SQL_INFO_SCHEMA_VIEWS
    • -
    • SQL_INSERT_STATEMENT
    • -
    • SQL_INTEGER
    • -
    • SQL_INTEGRITY
    • -
    • SQL_INTERVAL_DAY
    • -
    • SQL_INTERVAL_DAY_TO_HOUR
    • -
    • SQL_INTERVAL_DAY_TO_MINUTE
    • -
    • SQL_INTERVAL_DAY_TO_SECOND
    • -
    • SQL_INTERVAL_HOUR
    • -
    • SQL_INTERVAL_HOUR_TO_MINUTE
    • -
    • SQL_INTERVAL_HOUR_TO_SECOND
    • -
    • SQL_INTERVAL_MINUTE
    • -
    • SQL_INTERVAL_MINUTE_TO_SECOND
    • -
    • SQL_INTERVAL_MONTH
    • -
    • SQL_INTERVAL_SECOND
    • -
    • SQL_INTERVAL_YEAR
    • -
    • SQL_INTERVAL_YEAR_TO_MONTH
    • -
    • SQL_KEYSET_CURSOR_ATTRIBUTES1
    • -
    • SQL_KEYSET_CURSOR_ATTRIBUTES2
    • -
    • SQL_KEYWORDS
    • -
    • SQL_LIKE_ESCAPE_CLAUSE
    • -
    • SQL_LONGVARBINARY
    • -
    • SQL_LONGVARCHAR
    • -
    • SQL_MAX_ASYNC_CONCURRENT_STATEMENTS
    • -
    • SQL_MAX_BINARY_LITERAL_LEN
    • -
    • SQL_MAX_CATALOG_NAME_LEN
    • -
    • SQL_MAX_CHAR_LITERAL_LEN
    • -
    • SQL_MAX_COLUMNS_IN_GROUP_BY
    • -
    • SQL_MAX_COLUMNS_IN_INDEX
    • -
    • SQL_MAX_COLUMNS_IN_ORDER_BY
    • -
    • SQL_MAX_COLUMNS_IN_SELECT
    • -
    • SQL_MAX_COLUMNS_IN_TABLE
    • -
    • SQL_MAX_COLUMN_NAME_LEN
    • -
    • SQL_MAX_CONCURRENT_ACTIVITIES
    • -
    • SQL_MAX_CURSOR_NAME_LEN
    • -
    • SQL_MAX_DRIVER_CONNECTIONS
    • -
    • SQL_MAX_IDENTIFIER_LEN
    • -
    • SQL_MAX_INDEX_SIZE
    • -
    • SQL_MAX_PROCEDURE_NAME_LEN
    • -
    • SQL_MAX_ROW_SIZE
    • -
    • SQL_MAX_ROW_SIZE_INCLUDES_LONG
    • -
    • SQL_MAX_SCHEMA_NAME_LEN
    • -
    • SQL_MAX_STATEMENT_LEN
    • -
    • SQL_MAX_TABLES_IN_SELECT
    • -
    • SQL_MAX_TABLE_NAME_LEN
    • -
    • SQL_MAX_USER_NAME_LEN
    • -
    • SQL_MULTIPLE_ACTIVE_TXN
    • -
    • SQL_MULT_RESULT_SETS
    • -
    • SQL_NEED_LONG_DATA_LEN
    • -
    • SQL_NON_NULLABLE_COLUMNS
    • -
    • SQL_NO_NULLS
    • -
    • SQL_NULLABLE
    • -
    • SQL_NULLABLE_UNKNOWN
    • -
    • SQL_NULL_COLLATION
    • -
    • SQL_NUMERIC
    • -
    • SQL_NUMERIC_FUNCTIONS
    • -
    • SQL_ODBC_INTERFACE_CONFORMANCE
    • -
    • SQL_ODBC_VER
    • -
    • SQL_OJ_CAPABILITIES
    • -
    • SQL_ORDER_BY_COLUMNS_IN_SELECT
    • -
    • SQL_PARAM_ARRAY_ROW_COUNTS
    • -
    • SQL_PARAM_ARRAY_SELECTS
    • -
    • SQL_PC_NOT_PSEUDO
    • -
    • SQL_PC_PSEUDO
    • -
    • SQL_PC_UNKNOWN
    • -
    • SQL_PROCEDURES
    • -
    • SQL_PROCEDURE_TERM
    • -
    • SQL_QUOTED_IDENTIFIER_CASE
    • -
    • SQL_REAL
    • -
    • SQL_ROW_UPDATES
    • -
    • SQL_SCHEMA_TERM
    • -
    • SQL_SCHEMA_USAGE
    • -
    • SQL_SCOPE_CURROW
    • -
    • SQL_SCOPE_SESSION
    • -
    • SQL_SCOPE_TRANSACTION
    • -
    • SQL_SCROLL_OPTIONS
    • -
    • SQL_SEARCH_PATTERN_ESCAPE
    • -
    • SQL_SERVER_NAME
    • -
    • SQL_SMALLINT
    • -
    • SQL_SPECIAL_CHARACTERS
    • -
    • SQL_SQL92_DATETIME_FUNCTIONS
    • -
    • SQL_SQL92_FOREIGN_KEY_DELETE_RULE
    • -
    • SQL_SQL92_FOREIGN_KEY_UPDATE_RULE
    • -
    • SQL_SQL92_GRANT
    • -
    • SQL_SQL92_NUMERIC_VALUE_FUNCTIONS
    • -
    • SQL_SQL92_PREDICATES
    • -
    • SQL_SQL92_RELATIONAL_JOIN_OPERATORS
    • -
    • SQL_SQL92_REVOKE
    • -
    • SQL_SQL92_ROW_VALUE_CONSTRUCTOR
    • -
    • SQL_SQL92_STRING_FUNCTIONS
    • -
    • SQL_SQL92_VALUE_EXPRESSIONS
    • -
    • SQL_SQL_CONFORMANCE
    • -
    • SQL_STANDARD_CLI_CONFORMANCE
    • -
    • SQL_STATIC_CURSOR_ATTRIBUTES1
    • -
    • SQL_STATIC_CURSOR_ATTRIBUTES2
    • -
    • SQL_STRING_FUNCTIONS
    • -
    • SQL_SUBQUERIES
    • -
    • SQL_SYSTEM_FUNCTIONS
    • -
    • SQL_TABLE_TERM
    • -
    • SQL_TIMEDATE_ADD_INTERVALS
    • -
    • SQL_TIMEDATE_DIFF_INTERVALS
    • -
    • SQL_TIMEDATE_FUNCTIONS
    • -
    • SQL_TINYINT
    • -
    • SQL_TXN_CAPABLE
    • -
    • SQL_TXN_ISOLATION_OPTION
    • -
    • SQL_TYPE_DATE
    • -
    • SQL_TYPE_TIME
    • -
    • SQL_TYPE_TIMESTAMP
    • -
    • SQL_UNION
    • -
    • SQL_UNKNOWN_TYPE
    • -
    • SQL_USER_NAME
    • -
    • SQL_VARBINARY
    • -
    • SQL_VARCHAR
    • -
    • SQL_WCHAR
    • -
    • SQL_WLONGVARCHAR
    • -
    • SQL_WVARCHAR
    • -
    • SQL_XOPEN_CLI_YEAR
    • -
    - -

    Connection Objects

    - -

    autocommit

    - -

    False if the connection is in manual-commit mode (the default), which is the mode described -by the DB API. True if the connection is in auto-commit mode. This can be set using the -autocommit keyword in the connection function or can be changed by setting this attribute.

    - -

    searchesc

    - -

    The search pattern escape character used to escape '%' and '_' in search patterns, as returned by -SQLGetInfo(SQL_SEARCH_PATTERN_ESCAPE). The value is driver specific.

    - -

    execute(sql, [params])

    - -

    This is a new method (not in the DB API) that creates a new Cursor object and returns -Cursor.execute(...). See Cursor.execute for a description of the -parameters.

    - -
    -  for results in cnxn.execute("select user_id from tmp"):
    -      print results.user_id
    - -

    Since a new Cursor is created by each call, do not use when executing multiple statements in -a row.

    - -

    close()

    - -

    Close the connection now (rather than whenever __del__ is called). The connection will be -unusable from this point forward; a ProgrammingError exception will be raised if any operation -is attempted with the connection. The same applies to all cursor objects trying to use the -connection. Note that closing a connection without committing the changes first will cause an -implicit rollback to be performed.

    - -

    commit()

    - -

    Commit any pending transaction to the database.

    - -

    Note that Connections do not (yet) support autocommit; Connection.commit() must -be called or changes will be rolled back when the connection is closed.

    - -

    rollback()

    - -

    Causes the the database to roll back to the start of any pending transaction.

    - -

    cursor()

    - -

    Return a new Cursor object using the connection.

    - -

    getinfo(infotype)

    - -

    Calls SQLGetInfo, passing infotype and returns the result as a Boolean, string, -integer, or long value. The return type is determined by infotype.

    - -

    The infotype value should be one of the following constants, defined in the pyodbc module. -The table below shows the data type returned. See - -SQLGetInfo for the meaning of each constant.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ConstantReturn Type
    SQL_ACCESSIBLE_PROCEDURESTrue or False
    SQL_ACCESSIBLE_TABLESTrue or False
    SQL_ACTIVE_ENVIRONMENTSint
    SQL_AGGREGATE_FUNCTIONSint or long
    SQL_ALTER_DOMAINint or long
    SQL_ALTER_TABLEint or long
    SQL_ASYNC_MODEint or long
    SQL_BATCH_ROW_COUNTint or long
    SQL_BATCH_SUPPORTint or long
    SQL_BOOKMARK_PERSISTENCEint or long
    SQL_CATALOG_LOCATIONint
    SQL_CATALOG_NAMETrue or False
    SQL_CATALOG_NAME_SEPARATORstring
    SQL_CATALOG_TERMstring
    SQL_CATALOG_USAGEint or long
    SQL_COLLATION_SEQstring
    SQL_COLUMN_ALIASTrue or False
    SQL_CONCAT_NULL_BEHAVIORint
    SQL_CONVERT_FUNCTIONSint or long
    SQL_CONVERT_VARCHARint or long
    SQL_CORRELATION_NAMEint
    SQL_CREATE_ASSERTIONint or long
    SQL_CREATE_CHARACTER_SETint or long
    SQL_CREATE_COLLATIONint or long
    SQL_CREATE_DOMAINint or long
    SQL_CREATE_SCHEMAint or long
    SQL_CREATE_TABLEint or long
    SQL_CREATE_TRANSLATIONint or long
    SQL_CREATE_VIEWint or long
    SQL_CURSOR_COMMIT_BEHAVIORint
    SQL_CURSOR_ROLLBACK_BEHAVIORint
    SQL_DATABASE_NAMEstring
    SQL_DATA_SOURCE_NAMEstring
    SQL_DATA_SOURCE_READ_ONLYTrue or False
    SQL_DATETIME_LITERALSint or long
    SQL_DBMS_NAMEstring
    SQL_DBMS_VERstring
    SQL_DDL_INDEXint or long
    SQL_DEFAULT_TXN_ISOLATIONint or long
    SQL_DESCRIBE_PARAMETERTrue or False
    SQL_DM_VERstring
    SQL_DRIVER_HDESCint or long
    SQL_DRIVER_HENVint or long
    SQL_DRIVER_HLIBint or long
    SQL_DRIVER_HSTMTint or long
    SQL_DRIVER_NAMEstring
    SQL_DRIVER_ODBC_VERstring
    SQL_DRIVER_VERstring
    SQL_DROP_ASSERTIONint or long
    SQL_DROP_CHARACTER_SETint or long
    SQL_DROP_COLLATIONint or long
    SQL_DROP_DOMAINint or long
    SQL_DROP_SCHEMAint or long
    SQL_DROP_TABLEint or long
    SQL_DROP_TRANSLATIONint or long
    SQL_DROP_VIEWint or long
    SQL_DYNAMIC_CURSOR_ATTRIBUTES1int or long
    SQL_DYNAMIC_CURSOR_ATTRIBUTES2int or long
    SQL_EXPRESSIONS_IN_ORDERBYTrue or False
    SQL_FILE_USAGEint
    SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1int or long
    SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2int or long
    SQL_GETDATA_EXTENSIONSint or long
    SQL_GROUP_BYint
    SQL_IDENTIFIER_CASEint
    SQL_IDENTIFIER_QUOTE_CHARstring
    SQL_INDEX_KEYWORDSint or long
    SQL_INFO_SCHEMA_VIEWSint or long
    SQL_INSERT_STATEMENTint or long
    SQL_INTEGRITYTrue or False
    SQL_KEYSET_CURSOR_ATTRIBUTES1int or long
    SQL_KEYSET_CURSOR_ATTRIBUTES2int or long
    SQL_KEYWORDSstring
    SQL_LIKE_ESCAPE_CLAUSETrue or False
    SQL_MAX_ASYNC_CONCURRENT_STATEMENTSint or long
    SQL_MAX_BINARY_LITERAL_LENint or long
    SQL_MAX_CATALOG_NAME_LENint
    SQL_MAX_CHAR_LITERAL_LENint or long
    SQL_MAX_COLUMNS_IN_GROUP_BYint
    SQL_MAX_COLUMNS_IN_INDEXint
    SQL_MAX_COLUMNS_IN_ORDER_BYint
    SQL_MAX_COLUMNS_IN_SELECTint
    SQL_MAX_COLUMNS_IN_TABLEint
    SQL_MAX_COLUMN_NAME_LENint
    SQL_MAX_CONCURRENT_ACTIVITIESint
    SQL_MAX_CURSOR_NAME_LENint
    SQL_MAX_DRIVER_CONNECTIONSint
    SQL_MAX_IDENTIFIER_LENint
    SQL_MAX_INDEX_SIZEint or long
    SQL_MAX_PROCEDURE_NAME_LENint
    SQL_MAX_ROW_SIZEint or long
    SQL_MAX_ROW_SIZE_INCLUDES_LONGTrue or False
    SQL_MAX_SCHEMA_NAME_LENint
    SQL_MAX_STATEMENT_LENint or long
    SQL_MAX_TABLES_IN_SELECTint
    SQL_MAX_TABLE_NAME_LENint
    SQL_MAX_USER_NAME_LENint
    SQL_MULTIPLE_ACTIVE_TXNTrue or False
    SQL_MULT_RESULT_SETSTrue or False
    SQL_NEED_LONG_DATA_LENTrue or False
    SQL_NON_NULLABLE_COLUMNSint
    SQL_NULL_COLLATIONint
    SQL_NUMERIC_FUNCTIONSint or long
    SQL_ODBC_INTERFACE_CONFORMANCEint or long
    SQL_ODBC_VERstring
    SQL_OJ_CAPABILITIESint or long
    SQL_ORDER_BY_COLUMNS_IN_SELECTTrue or False
    SQL_PARAM_ARRAY_ROW_COUNTSint or long
    SQL_PARAM_ARRAY_SELECTSint or long
    SQL_PROCEDURESTrue or False
    SQL_PROCEDURE_TERMstring
    SQL_QUOTED_IDENTIFIER_CASEint
    SQL_ROW_UPDATESTrue or False
    SQL_SCHEMA_TERMstring
    SQL_SCHEMA_USAGEint or long
    SQL_SCROLL_OPTIONSint or long
    SQL_SEARCH_PATTERN_ESCAPEstring
    SQL_SERVER_NAMEstring
    SQL_SPECIAL_CHARACTERSstring
    SQL_SQL92_DATETIME_FUNCTIONSint or long
    SQL_SQL92_FOREIGN_KEY_DELETE_RULEint or long
    SQL_SQL92_FOREIGN_KEY_UPDATE_RULEint or long
    SQL_SQL92_GRANTint or long
    SQL_SQL92_NUMERIC_VALUE_FUNCTIONSint or long
    SQL_SQL92_PREDICATESint or long
    SQL_SQL92_RELATIONAL_JOIN_OPERATORSint or long
    SQL_SQL92_REVOKEint or long
    SQL_SQL92_ROW_VALUE_CONSTRUCTORint or long
    SQL_SQL92_STRING_FUNCTIONSint or long
    SQL_SQL92_VALUE_EXPRESSIONSint or long
    SQL_SQL_CONFORMANCEint or long
    SQL_STANDARD_CLI_CONFORMANCEint or long
    SQL_STATIC_CURSOR_ATTRIBUTES1int or long
    SQL_STATIC_CURSOR_ATTRIBUTES2int or long
    SQL_STRING_FUNCTIONSint or long
    SQL_SUBQUERIESint or long
    SQL_SYSTEM_FUNCTIONSint or long
    SQL_TABLE_TERMstring
    SQL_TIMEDATE_ADD_INTERVALSint or long
    SQL_TIMEDATE_DIFF_INTERVALSint or long
    SQL_TIMEDATE_FUNCTIONSint or long
    SQL_TXN_CAPABLEint
    SQL_TXN_ISOLATION_OPTIONint or long
    SQL_UNIONint or long
    SQL_USER_NAMEstring
    SQL_XOPEN_CLI_YEARstring
    - -

    Cursor Objects

    - -

    These objects represent a database cursor, which is used to manage the context of a fetch operation. Cursors -created from the same connection are not isolated, i.e., any changes done to the database by a cursor are immediately -visible by the other cursors.

    - -

    description

    - -

    This read-only attribute is a sequence of 7-item sequences. Each of these sequences contains information describing -one result column: (name, type_code, display_size, internal_size, precision, scale, null_ok). pyodbc only provides -values for name, type_code, internal_size, and null_ok. The other values are set to None. - -This attribute will be None for operations that do not return rows or if the cursor has not had an operation invoked -via the executeXXX() method yet. - -The type_code member is the class type used to create the Python objects when reading rows. For example, a varchar -column's type will be str. The complete list of types supported is listed in the Data -Types section.

    - -

    rowcount

    - -

    This is always -1.

    - -

    callproc(procname[,parameters])

    - -

    This is not yet supported.

    - -

    close()

    - -

    Close the cursor now (rather than whenever __del__ is called). The cursor will be unusable from this point forward; -a ProgrammingError exception will be raised if any operation is attempted with the cursor.

    - -

    execute(sql [,parameters])

    - -

    Prepare and execute SQL. Parameters may be passed as a sequence, as specified by the DB API, or as individual -parameters.

    - -
    -  # standard
    -  cursor.execute("select a from tbl where b=? and c=?", (x, y))
    -
    -  # pyodbc extension
    -  cursor.execute("select a from tbl where b=? and c=?", x, y)
    - -

    The DB API specification does not specify the return value of this method. Cursors in pyodbc return different -things based on the SQL statement executed. Select statements return the Cursor object itself to allow more compact -code such as putting the execute method into for loops or appending fetchone or fetchall:

    - -
    -  for row in cursor.execute("select album_id, photo_id from photos"):
    -      print row.album_id, row.photo_id
    -  
    -  row = cursor.execute("select count(*) from tmp").fetchone()
    -  
    -  rows = cursor.execute("select * from tmp").fetchall()
    - -

    Update and delete statements return the number of rows affected:

    - -
    -  count = cursor.execute("update photos set processed=1 where user_id=1")
    -
    -  count = cursor.execute("delete from photos where user_id=1")
    - -

    All other statements return None.

    - -

    executemany(sql, seq_of_parameters)

    - -

    Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings -found in the sequence seq_of_parameters. This method returns None.

    - -

    fetchone()

    - -

    Fetch the next row of a query result set, returning a single Row, or None when no more -data is available.

    - -

    A ProgrammingError exception is raised if the previous call to executeXXX() did not produce any result set or no -call was issued yet.

    - -
    -  cursor.execute("select user_name from photos where user_id=?", userid)
    -  row = cursor.fetchone()
    -  if row:
    -      print row.user_name
    - -

    nextset, setinputsizes, setoutputsize

    - -

    These are optional in the API and are not supported.

    - -

    fetchmany([size=cursor.arraysize])

    - -

    Fetch the next set of rows of a query result, returning a list of Rows. An empty list is returned -when no more rows are available.

    - -

    The number of rows to fetch per call is specified by the parameter. If it is not given, the cursor's arraysize, -which defaults to 1, determines the number of rows to be fetched. If this is not possible due to the specified number -of rows not being available, fewer rows may be returned.

    - -

    A ProgrammingError exception is raised if the previous call to executeXXX() did not produce any result set or no -call was issued yet.

    - -

    fetchall()

    - -

    Fetch all remaining rows of a query result, returning them as a list of Rows. Since this reads -all rows into memory, it should not be used if there are a lot of rows. Consider iterating over the rows instead.

    - -

    A ProgrammingError exception is raised if the previous call to executeXXX() did not produce any result set or no -call was issued yet.

    - -
    -  cursor.execute("select photo_id from photos where user_id=1")
    -  rows = cursor.fetchall()
    -  for row in rows:
    -      print row.user_name
    - -

    __iter__, next

    - -

    These methods allow a cursor to be used in a for loop, returning a single Row for -each iteration. This allows all rows to be visited easily.

    - -
    -  cursor.execute("select photo_id from photos where user_id=1")
    -  for row in cursor:
    -      print row.photo_id
    - -

    tables(table=None, catalog=None, schema=None, tableType=None)

    - -

    Executes SQLTables and creates a results set of tables defined in the data source. Returns the Cursor.

    - -

    The table, catalog, and schema interpret the '_' and '%' characters as wildcards. The escape character is driver -specific, so use Connection.searchescape.

    - -

    Each row has the following columns. See the SQLTables documentation for more information.

    - -
      -
    1. table_cat: The catalog name.
    2. -
    3. table_schem: The schema name.
    4. -
    5. table_name: The table name.
    6. -
    7. table_type: One of 'TABLE', 'VIEW', SYSTEM TABLE', 'GLOBAL TEMPORARY' -'LOCAL TEMPORARY', 'ALIAS', 'SYNONYM', or a data source-specific type name.
    8. -
    - -
    -  for row in cursor.tables():
    -      print row.table_name
    - -

    columns(table=None, catalog=None, schema=None, column=None)

    - -

    Creates a results set of column names in specified tables by executing the ODBC SQLColumns function. -Each row fetched has the following columns:

    - -
      -
    1. table_cat
    2. -
    3. table_schem
    4. -
    5. table_name
    6. -
    7. column_name
    8. -
    9. data_type
    10. -
    11. type_name
    12. -
    13. column_size
    14. -
    15. buffer_length
    16. -
    17. decimal_digits
    18. -
    19. num_prec_radix
    20. -
    21. nullable
    22. -
    23. remarks
    24. -
    25. column_def
    26. -
    27. sql_data_type
    28. -
    29. sql_datetime_sub
    30. -
    31. char_octet_length
    32. -
    33. ordinal_position
    34. -
    35. is_nullable: One of SQL_NULLABLE, SQL_NO_NULLS, SQL_NULLS_UNKNOWN.
    36. -
    - - -

    statistics(table, catalog=None, schema=None, unique=False, quick=True)

    - -Creates a results set of statistics about a single table and the indexes -associated with the table by executing SQLStatistics. - -
    -
    unique
    -
    If True, only unique indexes are retured. Otherwise all -indexes are returned.
    - -
    quick
    -
    If True, CARDINALITY and PAGES are returned only if they are -readily available from the server
    -
    - -

    Each row fetched has the following columns:

    - -
      -
    1. table_cat
    2. -
    3. table_schem
    4. -
    5. table_name
    6. -
    7. non_unique
    8. -
    9. index_qualifier
    10. -
    11. index_name
    12. -
    13. type
    14. -
    15. ordinal_position
    16. -
    17. column_name
    18. -
    19. asc_or_desc
    20. -
    21. cardinality
    22. -
    23. pages
    24. -
    25. filter_condition
    26. -
    - -

    rowIdColumns(table, catalog=None, schema=None, nullable=True)

    - -

    Executes SQLSpecialColumns with SQL_BEST_ROWID which creates a result set of columns that uniquely identify a row. -Returns the Cursor object. Each row fetched has the following columns.

    - -
      -
    1. scope: One of SQL_SCOPE_CURROW, SQL_SCOPE_TRANSACTION, or SQL_SCOPE_SESSION
    2. -
    3. column_name
    4. -
    5. data_type: The ODBC SQL data type constant (e.g. SQL_CHAR)
    6. -
    7. type_name
    8. -
    9. column_size
    10. -
    11. buffer_length
    12. -
    13. decimal_digits
    14. -
    15. pseudo_column: One of SQL_PC_UNKNOWN, SQL_PC_NOT_PSEUDO, SQL_PC_PSEUDO
    16. -
    - -

    rowVerColumns(table, catalog=None, schema=None, nullable=True)

    - -

    Executes SQLSpecialColumns with SQL_ROWVER which creates a result set of -columns that are automatically updated when any value in the row is updated. -Returns the Cursor object. Each row fetched has the following columns.

    - -
      -
    1. scope: One of SQL_SCOPE_CURROW, SQL_SCOPE_TRANSACTION, or SQL_SCOPE_SESSION
    2. -
    3. column_name
    4. -
    5. data_type: The ODBC SQL data type constant (e.g. SQL_CHAR)
    6. -
    7. type_name
    8. -
    9. column_size
    10. -
    11. buffer_length
    12. -
    13. decimal_digits
    14. -
    15. pseudo_column: One of SQL_PC_UNKNOWN, SQL_PC_NOT_PSEUDO, SQL_PC_PSEUDO
    16. -
    - - -

    primaryKeys(table, catalog=None, schema=None)

    - -

    Creates a results set of column names that make up the primary key for a -table by executing the SQLPrimaryKeys function. Each row fetched has the -following columns:

    - -
      -
    1. table_cat
    2. -
    3. table_schem
    4. -
    5. table_name
    6. -
    7. column_name
    8. -
    9. key_seq
    10. -
    11. pk_name
    12. -
    - -

    foreignKeys(table=None, catalog=None, schema=None, -foreignTable=None, foreignCatalog=None, foreignSchema=None)

    - -

    Executes the SQLForeignKeys function and creates a results set of column -names that are foreign keys in the specified table (columns in the specified -table that refer to primary keys in other tables) or foreign keys in other -tables that refer to the primary key in the specified table. Each row fetched -has the following columns:

    - -
      -
    1. pktable_cat
    2. -
    3. pktable_schem
    4. -
    5. pktable_name
    6. -
    7. pkcolumn_name
    8. -
    9. fktable_cat
    10. -
    11. fktable_schem
    12. -
    13. fktable_name
    14. -
    15. fkcolumn_name
    16. -
    17. key_seq
    18. -
    19. update_rule
    20. -
    21. delete_rule
    22. -
    23. fk_name
    24. -
    25. pk_name
    26. -
    27. deferrability
    28. -
    - -

    procedures(procedure=None, catalog=None, schema=None)

    - -

    Executes SQLProcedures and creates a result set of information about the -procedures in the data source. Each row fetched has the following columns:

    - -
      -
    1. procedure_cat
    2. -
    3. procedure_schem
    4. -
    5. procedure_name
    6. -
    7. num_input_params
    8. -
    9. num_output_params
    10. -
    11. num_result_sets
    12. -
    13. remarks
    14. -
    15. procedure_type
    16. -
    - -

    getTypeInfo(sqlType=None)

    - -

    Executes SQLGetTypeInfo a creates a result set with information about the -specified data type or all data types supported by the ODBC driver if not -specified. Each row fetched has the following columns:

    - -
      -
    1. type_name
    2. -
    3. data_type
    4. -
    5. column_size
    6. -
    7. literal_prefix
    8. -
    9. literal_suffix
    10. -
    11. create_params
    12. -
    13. nullable
    14. -
    15. case_sensitive
    16. -
    17. searchable
    18. -
    19. unsigned_attribute
    20. -
    21. fixed_prec_scale
    22. -
    23. auto_unique_value
    24. -
    25. local_type_name
    26. -
    27. minimum_scale
    28. -
    29. maximum_scale
    30. -
    31. sql_data_type
    32. -
    33. sql_datetime_sub
    34. -
    35. num_prec_radix
    36. -
    37. interval_precision
    38. -
    - -

    Row Objects

    - -

    cursor_description

    - -

    The column metadata from Cursor.description is also accessible from Row objects as -the cursor_description attribute. This is convenient when Rows are used as ad-hoc -data structures and are passed to other functions that need the metadata; now the Cursor does -<<<<<<< HEAD -not need to be passed with ***REMOVED***

    -======= -not need to be passed with them.

    ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 - -
    -row = cursor.execute("select name, account_id from persons").fetchone()
    -column_names = [ t[0] for t in row.cursor_description ]
    -
    - -

    Accessing Values

    - -

    The DB API specifies that results must be tuple-like, so columns are normally accessed by indexing into the -sequence (e.g. row[0]) and pyodbc supports this. However, columns can also be accessed by name:

    - -
    -cursor.execute("select album_id, photo_id from photos where user_id=1")
    -row = cursor.fetchone()
    -print row.album_id, row.photo_id 
    -print row[0], row[1] # same as above, but less readable
    - -

    This makes the code easier to maintain when modifying SQL, more readable, and allows rows to be used where a -custom class might otherwise be used. All rows from a single execute share the same dictionary of -column names, so using Row objects to hold a large result set may also use less memory than creating a object for -each row.

    - -

    The SQL "as" keyword allows the name of a column in the result set to be specified. This is useful if a column -name has a spaces or if there is no name:

    - -
    -cursor.execute("select count(*) as photo_count from photos where user_id=1")
    -row = cursor.fetchone()
    -print row.photo_count
    - -

    Rows Are Mutable

    - -

    Though SQL is very powerful, values sometimes need to be modified before they can be used. -Rows allow their values to be replaced, which makes Rows even more convenient ad-hoc dat -structures.

    - -
    -# Replace a datetime in each row with one that has a time zone.
    -rows = cursor.fetchall()
    -for row in rows:
    -  row.start_date = row.start_date.astimezone(tz)
    - -

    Note that only existing columns can be replaced; new columns cannot be added to rows. If -you want to add a value that doesn't exist in the database, add a NULL to the select statement -as a placeholder:

    - -
    -row = cursor.execute("select name, NULL as account_id from persons").fetchone()
    -row.account_id = 1
    -
    - -

    Data Types

    - -

    The following table shows the ODBC data types supported and the Python type used to represent values. -None is always used for NULL values.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ODBCPython
    char, varchar, longvarchar, GUIDstring
    wchar, wvarchar, wlongvarcharunicode
    smallint, integer, tinyintint
    bigintlong
    decimal, numericdecimal
    real, float, doubledouble
    datedatetime.date
    timedatetime.time
    timestampdatetime.datetime
    bitbool
    binary, varbinary, longvarbinarybuffer
    - -

    Errors

    - -

    When an error occurs, the type of exception raised is based on the SQLSTATE.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SQLSTATEException Class
    0A000NotSupportedError
    22xxxDataError
    23xxxIntegrityError
    40002IntegrityError
    24xxx, 25xxx, 42xxxProgramming Error
    All OthersDatabaseError
    - -

    Catalog Functions

    - -

    Most of the ODBC catalog functions are available as methods on Cursor objects. The results -are presented as SELECT results in rows that are fetched normally. Refer to Microsoft's ODBC -documentation for details of how to use each function.

    - -
    -cnxn   = pyodbc.connect(...)
    -cursor = cnxn.cursor()
    -for row in cursor.tables():
    -    print row.table_name
    - -

    Some of the parameters, such as table in Cursor.tables (SQLTables) accept -search patterns. In these parameters, the underscore character (_) is represents a -single-character wildcard and the percent character (%) represents any sequence of zero or more -characters. To include these characters as literals, precede them with the escape character -Connection.searchesc. (The escape character is driver dependent.)

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ODBC FunctionMethodDescription
    SQLTablesCursor.tablesReturns a list of table, catalog, or schema names, and table types.
    SQLColumnsCursor.columnsReturns a list of column names in specified tables.
    SQLStatisticsCursor.statisticsReturns a list of statistics about a single table and the indexes associated with the table.
    SQLSpecialColumnsCursor.rowIdColumnsReturns a list of columns that uniquely identify a row.
    SQLSpecialColumnsCursor.rowVerColumnsReturns a list of columns that are automatically updated any any value in the row is updated.
    SQLPrimaryKeysCursor.primaryKeysReturns a list of column names that make up the primary key for a table.
    SQLForeignKeysCursor.foreignKeysReturns a list of column names that are foreign keys in the specified table (columns - in the specified table that refer to primary keys in other tables) or foreign keys in - other tables that refer to the primary key in the specified table.
    SQLProceduresCursor.proceduresReturns information about the procedures in the data source.
    SQLGetTypeInfoCursor.getTypeInfoReturns a information about the specified data type or all data types supported by the driver.
    - -
    - -
    -SourceForge.net Logo - - - diff --git a/setup.py b/setup.py index 6db18f4..cb4168f 100755 --- a/setup.py +++ b/setup.py @@ -1,12 +1,12 @@ import os import sys -from glob import glob from distutils.core import setup, Command from distutils.extension import Extension from Cython.Distutils import build_ext import numpy import versioneer + class CleanInplace(Command): user_options = [] @@ -17,16 +17,8 @@ def finalize_options(self): self.cwd = os.getcwd() def run(self): - files = ['./TextAdapter/textadapter/TextAdapter.c', - './TextAdapter/textadapter/TextAdapter.so'] - - dirs = ['./TextAdapter/build/*', - './__pycache__/*', - './TextAdapter/__pycache__/*'] - for dir in dirs: - for file in glob(dir): - files.append(file) - + files = ['./textadapter/core/TextAdapter.c', + './textadapter/core/TextAdapter.so'] for file in files: try: os.remove(file) @@ -35,12 +27,12 @@ def run(self): def setup_text(include_dirs, lib_dirs): - src = ['TextAdapter/textadapter/TextAdapter.pyx', - 'TextAdapter/textadapter/text_adapter.c', - 'TextAdapter/lib/converter_functions.c', - 'TextAdapter/textadapter/io_functions.c', - 'TextAdapter/lib/field_info.c', - 'TextAdapter/textadapter/json_tokenizer.c'] + src = ['textadapter/core/TextAdapter.pyx', + 'textadapter/core/text_adapter.c', + 'textadapter/lib/converter_functions.c', + 'textadapter/core/io_functions.c', + 'textadapter/lib/field_info.c', + 'textadapter/core/json_tokenizer.c'] if sys.platform == 'win32': zlib_lib = 'zlibstatic' @@ -55,18 +47,18 @@ def setup_text(include_dirs, lib_dirs): compile_args.append('-DDEBUG_ADAPTER') libraries = ['pcre', zlib_lib] - include_dirs = ['TextAdapter/textadapter'] + include_dirs + include_dirs = ['textadapter/core'] + include_dirs - return Extension("TextAdapter.textadapter.TextAdapter", + return Extension("textadapter.core.TextAdapter", src, include_dirs=include_dirs, library_dirs=lib_dirs, libraries=libraries, extra_compile_args=compile_args) -def run_setup(): - include_dirs = [os.path.join('TextAdapter', 'lib'), +def run_setup(): + include_dirs = [os.path.join('textadapter', 'lib'), numpy.get_include()] if sys.platform == 'win32': include_dirs.append(os.path.join(sys.prefix, 'Library', 'include')) @@ -80,20 +72,21 @@ def run_setup(): lib_dirs.append(os.path.join(sys.prefix, 'lib')) ext_modules = [] - packages = ['TextAdapter', 'TextAdapter.lib', 'TextAdapter.tests'] + packages = ['textadapter', 'textadapter.lib', 'textadapter.tests'] + ext_modules.append(setup_text(include_dirs, lib_dirs)) - packages.append('TextAdapter.textadapter') + packages.append('textadapter.core') - versioneer.versionfile_source = 'TextAdapter/_version.py' - versioneer.versionfile_build = 'TextAdapter/_version.py' + versioneer.versionfile_source = 'textadapter/_version.py' + versioneer.versionfile_build = 'textadapter/_version.py' versioneer.tag_prefix = '' - versioneer.parentdir_prefix = 'TextAdapter-' + versioneer.parentdir_prefix = 'textadapter-' cmdclass = versioneer.get_cmdclass() cmdclass['build_ext'] = build_ext cmdclass['cleanall'] = CleanInplace - setup(name='TextAdapter', + setup(name='textadapter', version = versioneer.get_version(), description='optimized IO for NumPy/Blaze', author='Continuum Analytics', @@ -104,11 +97,4 @@ def run_setup(): if __name__ == '__main__': - - def parse_build_arg(name): - if '--build_{0}'.format(name) in sys.argv: - sys.argv.remove('--build_{0}'.format(name)) - return True - return False - run_setup() diff --git a/textadapter/__init__.py b/textadapter/__init__.py new file mode 100755 index 0000000..8df6d3a --- /dev/null +++ b/textadapter/__init__.py @@ -0,0 +1,40 @@ +""" + TextAdapter + ~~~~~ + + TextAdapter provides tools to interface large data files in a fast, memory-efficient way. +""" +from __future__ import absolute_import + +from textadapter._version import get_versions +__version__ = get_versions()['version'] +del get_versions + +from textadapter.core.TextAdapter import (ArrayDealloc, CSVTextAdapter, + FixedWidthTextAdapter, JSONTextAdapter, + RegexTextAdapter, s3_text_adapter, + text_adapter) +from textadapter.core.loadtxt import loadtxt +from textadapter.core.genfromtxt import genfromtxt +from textadapter.lib.errors import (AdapterException, AdapterIndexError, + ArgumentError, ConfigurationError, + DataIndexError, DataTypeError, + InternalInconsistencyError, NoSuchFieldError, + ParserError, SourceError, SourceNotFoundError) + + +def test(verbosity=1, num_records=100000, results=[]): + from textadapter.tests.test_TextAdapter import run as run_textadapter_tests + result_text = run_textadapter_tests(verbosity=verbosity, + num_records=num_records) + results.append(result_text) + + from textadapter.tests.test_io import run as run_io_tests + result_text = run_io_tests(verbosity=verbosity) + results.append(result_text) + + for result in results: + if not result.wasSuccessful(): + return False + return True + diff --git a/TextAdapter/_version.py b/textadapter/_version.py old mode 100644 new mode 100755 similarity index 98% rename from TextAdapter/_version.py rename to textadapter/_version.py index caf86b8..31e7ae3 --- a/TextAdapter/_version.py +++ b/textadapter/_version.py @@ -176,8 +176,8 @@ def versions_from_parentdir(parentdir_prefix, versionfile_source, verbose=False) return {"version": dirname[len(parentdir_prefix):], "full": ""} tag_prefix = "" -parentdir_prefix = "TextAdapter-" -versionfile_source = "TextAdapter/_version.py" +parentdir_prefix = "textadapter-" +versionfile_source = "textadapter/_version.py" def get_versions(default={"version": "unknown", "full": ""}, verbose=False): variables = { "refnames": git_refnames, "full": git_full } diff --git a/TextAdapter/textadapter/IO.pyx b/textadapter/core/IO.pyx old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/textadapter/IO.pyx rename to textadapter/core/IO.pyx diff --git a/TextAdapter/textadapter/Index.pyx b/textadapter/core/Index.pyx old mode 100644 new mode 100755 similarity index 98% rename from TextAdapter/textadapter/Index.pyx rename to textadapter/core/Index.pyx index 46f9a7c..8cf7213 --- a/TextAdapter/textadapter/Index.pyx +++ b/textadapter/core/Index.pyx @@ -53,18 +53,8 @@ class ExactIndex(object): | | | | version ----+ | | | options --------+ | | -<<<<<<< HEAD:iopro/textadapter/Index.pyx -<<<<<<< HEAD - checksum ***REMOVED***-+ | - typesize ***REMOVED***-----+ -======= checksum ------------+ | typesize ----------------+ ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= - checksum ------------+ | - typesize ----------------+ ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c:TextAdapter/textadapter/Index.pyx |-0-|-1-|-2-|-3-|-4-|-5-|-6-|-7-|-8-|-9-|-A-|-B-|-C-|-D-|-E-|-F-| | num_offsets | num_gzip_access_points | diff --git a/TextAdapter/textadapter/TextAdapter.pxd b/textadapter/core/TextAdapter.pxd old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/textadapter/TextAdapter.pxd rename to textadapter/core/TextAdapter.pxd diff --git a/TextAdapter/textadapter/TextAdapter.pyx b/textadapter/core/TextAdapter.pyx old mode 100644 new mode 100755 similarity index 98% rename from TextAdapter/textadapter/TextAdapter.pyx rename to textadapter/core/TextAdapter.pyx index ba49a18..99505cc --- a/TextAdapter/textadapter/TextAdapter.pyx +++ b/textadapter/core/TextAdapter.pyx @@ -9,7 +9,7 @@ import logging import csv import encodings import math -from TextAdapter.lib import errors +from textadapter.lib import errors from six import string_types, StringIO from cpython.ref cimport Py_INCREF @@ -433,30 +433,14 @@ cdef class TextAdapter(object): Set fields to read. Args: -<<<<<<< HEAD:iopro/textadapter/TextAdapter.pyx -<<<<<<< HEAD - ***REMOVED*** list of field names or indices to read -======= fields: list of field names or indices to read ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= - fields: list of field names or indices to read ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c:TextAdapter/textadapter/TextAdapter.pyx """ if fields is None or len(fields) == 0: self._field_filter = range(self.field_count) else: field_filter = [] -<<<<<<< HEAD:iopro/textadapter/TextAdapter.pyx -<<<<<<< HEAD - for field in ***REMOVED*** -======= - for field in fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= for field in fields: ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c:TextAdapter/textadapter/TextAdapter.pyx if isinstance(field, (int, long)): field_filter.append(field) elif isinstance(field, string_types): @@ -634,15 +618,7 @@ cdef class TextAdapter(object): field = key if isinstance(key, string_types): field = self._field_names.index(key) -<<<<<<< HEAD:iopro/textadapter/TextAdapter.pyx -<<<<<<< HEAD - if field < 0 or field >= self.adapter.fields.num_***REMOVED*** -======= - if field < 0 or field >= self.adapter.fields.num_fields: ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= if field < 0 or field >= self.adapter.fields.num_fields: ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c:TextAdapter/textadapter/TextAdapter.pyx raise errors.NoSuchFieldError('invalid field number ' + str(field)) if isinstance(values, string_types): values = [values] diff --git a/TextAdapter/lib/__init__.py b/textadapter/core/__init__.py old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/lib/__init__.py rename to textadapter/core/__init__.py diff --git a/TextAdapter/textadapter/genfromtxt.py b/textadapter/core/genfromtxt.py old mode 100644 new mode 100755 similarity index 94% rename from TextAdapter/textadapter/genfromtxt.py rename to textadapter/core/genfromtxt.py index a6a028f..6ae3fb9 --- a/TextAdapter/textadapter/genfromtxt.py +++ b/textadapter/core/genfromtxt.py @@ -3,7 +3,7 @@ from numpy.lib._iotools import LineSplitter, NameValidator, easy_dtype, _is_string_like import warnings import operator -import TextAdapter +import textadapter import sys from numpy.compat import ( @@ -29,15 +29,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, character, and characters following the `comments` character are discarded. Parameters -<<<<<<< HEAD:iopro/textadapter/genfromtxt.py -<<<<<<< HEAD - ***REMOVED*** -======= ---------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= - ---------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c:TextAdapter/textadapter/genfromtxt.py fname : file or str File, filename, or generator to read. If the filename extension is `.gz` or `.bz2`, the file is first decompressed. Note that @@ -62,15 +54,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, The converters can also be used to provide a default value for missing data: ``converters = {3: lambda s: float(s or 0)}``. missing_values : variable, optional -<<<<<<< HEAD:iopro/textadapter/genfromtxt.py -<<<<<<< HEAD - The set of strings corresponding to ***REMOVED*** -======= - The set of strings corresponding to missing data. ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= The set of strings corresponding to missing data. ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c:TextAdapter/textadapter/genfromtxt.py filling_values : variable, optional The set of values to be used as default when the data are missing. usecols : sequence, optional @@ -132,15 +116,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, When using a custom converter, make sure the function does remove spaces. References -<<<<<<< HEAD:iopro/textadapter/genfromtxt.py -<<<<<<< HEAD - ***REMOVED*** -======= - ---------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= ---------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c:TextAdapter/textadapter/genfromtxt.py .. [1] Numpy User Guide, section `I/O with Numpy `_. @@ -249,12 +225,12 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, try: if isinstance(delimiter, basestring): - adapter = TextAdapter.text_adapter(fname, parser='csv', delimiter=delimiter, + adapter = textadapter.text_adapter(fname, parser='csv', delimiter=delimiter, comment=comments, header=skip_header, footer=skip_footer, compression=compression, field_names=set_names, infer_types=True, whitespace_delims=whitespace_delims) elif isinstance(delimiter, int) or isinstance(delimiter, (list, tuple)): - adapter = TextAdapter.text_adapter(fname, parser='fixed_width', + adapter = textadapter.text_adapter(fname, parser='fixed_width', field_widths=delimiter, comment=comments, header=skip_header, footer=skip_footer, field_names=set_names, infer_types=True) except EOFError: diff --git a/TextAdapter/textadapter/index.h b/textadapter/core/index.h old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/textadapter/index.h rename to textadapter/core/index.h diff --git a/TextAdapter/textadapter/io.h b/textadapter/core/io.h old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/textadapter/io.h rename to textadapter/core/io.h diff --git a/TextAdapter/textadapter/io_functions.c b/textadapter/core/io_functions.c old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/textadapter/io_functions.c rename to textadapter/core/io_functions.c diff --git a/TextAdapter/textadapter/io_functions.h b/textadapter/core/io_functions.h old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/textadapter/io_functions.h rename to textadapter/core/io_functions.h diff --git a/TextAdapter/textadapter/json_tokenizer.c b/textadapter/core/json_tokenizer.c old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/textadapter/json_tokenizer.c rename to textadapter/core/json_tokenizer.c diff --git a/TextAdapter/textadapter/json_tokenizer.h b/textadapter/core/json_tokenizer.h old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/textadapter/json_tokenizer.h rename to textadapter/core/json_tokenizer.h diff --git a/TextAdapter/textadapter/loadtxt.py b/textadapter/core/loadtxt.py old mode 100644 new mode 100755 similarity index 96% rename from TextAdapter/textadapter/loadtxt.py rename to textadapter/core/loadtxt.py index c0d4f98..3e5a810 --- a/TextAdapter/textadapter/loadtxt.py +++ b/textadapter/core/loadtxt.py @@ -1,6 +1,6 @@ import numpy import operator -import TextAdapter +import textadapter from numpy.compat import ( asstr, bytes, basestring, unicode @@ -16,15 +16,7 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, Each row in the text file must have the same number of values. Parameters -<<<<<<< HEAD:iopro/textadapter/loadtxt.py -<<<<<<< HEAD - ***REMOVED*** -======= ---------- ->>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= - ---------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c:TextAdapter/textadapter/loadtxt.py fname : file or str File, filename, or generator to read. If the filename extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note that @@ -114,7 +106,7 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, compression = 'gzip' try: - adapter = TextAdapter.text_adapter(fname, parser='csv', delimiter=delimiter, + adapter = textadapter.text_adapter(fname, parser='csv', delimiter=delimiter, comment=comments, header=skiprows, compression=compression, whitespace_delims=whitespace_delims, field_names=False, infer_types=False) except EOFError: diff --git a/TextAdapter/textadapter/text_adapter.c b/textadapter/core/text_adapter.c old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/textadapter/text_adapter.c rename to textadapter/core/text_adapter.c diff --git a/TextAdapter/textadapter/text_adapter.h b/textadapter/core/text_adapter.h old mode 100644 new mode 100755 similarity index 99% rename from TextAdapter/textadapter/text_adapter.h rename to textadapter/core/text_adapter.h index 6804c8c..21eb12a --- a/TextAdapter/textadapter/text_adapter.h +++ b/textadapter/core/text_adapter.h @@ -12,7 +12,7 @@ #include "index.h" #include "field_info.h" #include "json_tokenizer.h" -#include "numpy_types.h" + /* Buffer size for reading in compressed gzip data before uncompressing */ #define COMPRESSED_BUFFER_SIZE 1024*1024 diff --git a/TextAdapter/examples/README b/textadapter/examples/README old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/examples/README rename to textadapter/examples/README diff --git a/TextAdapter/examples/basic.py b/textadapter/examples/basic.py old mode 100644 new mode 100755 similarity index 81% rename from TextAdapter/examples/basic.py rename to textadapter/examples/basic.py index 6807988..6e20d5c --- a/TextAdapter/examples/basic.py +++ b/textadapter/examples/basic.py @@ -1,6 +1,6 @@ -import TextAdapter +import textadapter -adapter = TextAdapter.CSVTextAdapter('../tests/data/ints', delimiter=',', field_names=False) +adapter = textadapter.CSVTextAdapter('../tests/data/ints', delimiter=',', field_names=False) # Set dtype for each field in record adapter.set_field_types({0:'u4', 1:'u8', 2:'f4', 3:'f8', 4:'S10'}) diff --git a/TextAdapter/examples/converter.py b/textadapter/examples/converter.py old mode 100644 new mode 100755 similarity index 76% rename from TextAdapter/examples/converter.py rename to textadapter/examples/converter.py index ddc7263..131ac8c --- a/TextAdapter/examples/converter.py +++ b/textadapter/examples/converter.py @@ -1,6 +1,6 @@ -import TextAdapter +import textadapter -adapter = TextAdapter.CSVTextAdapter('../tests/data/ints', delimiter=',', field_names=False) +adapter = textadapter.CSVTextAdapter('../tests/data/ints', delimiter=',', field_names=False) # Set dtype for each field in record adapter.set_field_types({0:'u4', 1:'u8', 2:'f4', 3:'f8', 4:'S10'}) diff --git a/TextAdapter/examples/fixed_width.py b/textadapter/examples/fixed_width.py old mode 100644 new mode 100755 similarity index 65% rename from TextAdapter/examples/fixed_width.py rename to textadapter/examples/fixed_width.py index 765f94b..40ea5c9 --- a/TextAdapter/examples/fixed_width.py +++ b/textadapter/examples/fixed_width.py @@ -1,6 +1,6 @@ -import TextAdapter +import textadapter -adapter = TextAdapter.FixedWidthTextAdapter('../tests/data/fixedwidths', [2,3,4,5,6]) +adapter = textadapter.FixedWidthTextAdapter('../tests/data/fixedwidths', [2,3,4,5,6]) # Set dtype for each field in record adapter.set_field_types(dict(zip(range(5), ['u4']*5))) diff --git a/TextAdapter/examples/gzip_ints.py b/textadapter/examples/gzip_ints.py old mode 100644 new mode 100755 similarity index 93% rename from TextAdapter/examples/gzip_ints.py rename to textadapter/examples/gzip_ints.py index 0d0485b..e1e59ea --- a/TextAdapter/examples/gzip_ints.py +++ b/textadapter/examples/gzip_ints.py @@ -1,6 +1,6 @@ -import TextAdapter +import textadapter -adapter = TextAdapter.CSVTextAdapter('../tests/data/ints.gz', delimiter=',', compression='gzip', field_names=False) +adapter = textadapter.CSVTextAdapter('../tests/data/ints.gz', delimiter=',', compression='gzip', field_names=False) # Set dtype for each field in record adapter.set_field_types({0:'u4', 1:'u8', 2:'f4', 3:'f8', 4:'S10'}) diff --git a/TextAdapter/examples/missing_values.py b/textadapter/examples/missing_values.py old mode 100644 new mode 100755 similarity index 83% rename from TextAdapter/examples/missing_values.py rename to textadapter/examples/missing_values.py index 2046a7d..db7922b --- a/TextAdapter/examples/missing_values.py +++ b/textadapter/examples/missing_values.py @@ -1,6 +1,6 @@ -import TextAdapter +import textadapter -adapter = TextAdapter.CSVTextAdapter('../tests/data/missingvalues', delimiter=',', field_names=False) +adapter = textadapter.CSVTextAdapter('../tests/data/missingvalues', delimiter=',', field_names=False) # Set dtype for each field in record adapter.set_field_types({0:'u4', 1:'u4', 2:'u4', 3:'u4', 4:'u4'}) diff --git a/TextAdapter/examples/regex.py b/textadapter/examples/regex.py old mode 100644 new mode 100755 similarity index 76% rename from TextAdapter/examples/regex.py rename to textadapter/examples/regex.py index de0eb70..c38ac9d --- a/TextAdapter/examples/regex.py +++ b/textadapter/examples/regex.py @@ -1,6 +1,6 @@ -import TextAdapter +import textadapter -adapter = TextAdapter.RegexTextAdapter('../tests/data/ints', '([0-9]*),([0-9]*),([0-9]*),([0-9]*),([0-9]*)') +adapter = textadapter.RegexTextAdapter('../tests/data/ints', '([0-9]*),([0-9]*),([0-9]*),([0-9]*),([0-9]*)') # Set dtype for each group in regular expression. # Any groups without a dtype defined for it will not be diff --git a/TextAdapter/lib/Converters.pyx b/textadapter/lib/Converters.pyx old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/lib/Converters.pyx rename to textadapter/lib/Converters.pyx diff --git a/TextAdapter/tests/__init__.py b/textadapter/lib/__init__.py old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/tests/__init__.py rename to textadapter/lib/__init__.py diff --git a/TextAdapter/lib/_stdint.h b/textadapter/lib/_stdint.h old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/lib/_stdint.h rename to textadapter/lib/_stdint.h diff --git a/TextAdapter/lib/converter_functions.c b/textadapter/lib/converter_functions.c old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/lib/converter_functions.c rename to textadapter/lib/converter_functions.c diff --git a/TextAdapter/lib/converter_functions.h b/textadapter/lib/converter_functions.h old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/lib/converter_functions.h rename to textadapter/lib/converter_functions.h diff --git a/TextAdapter/lib/errors.py b/textadapter/lib/errors.py old mode 100644 new mode 100755 similarity index 96% rename from TextAdapter/lib/errors.py rename to textadapter/lib/errors.py index 0c55332..cf1b3ee --- a/TextAdapter/lib/errors.py +++ b/textadapter/lib/errors.py @@ -50,7 +50,7 @@ def __init__(self, message=None, token=None): self.token = token class ArgumentError(AdapterException): - """Invalid arguments used in calling TextAdapter functions/methods""" + """Invalid arguments used in calling textadapter functions/methods""" pass class InternalInconsistencyError(AdapterException): diff --git a/TextAdapter/lib/field_info.c b/textadapter/lib/field_info.c old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/lib/field_info.c rename to textadapter/lib/field_info.c diff --git a/TextAdapter/lib/field_info.h b/textadapter/lib/field_info.h old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/lib/field_info.h rename to textadapter/lib/field_info.h diff --git a/TextAdapter/lib/khash.h b/textadapter/lib/khash.h old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/lib/khash.h rename to textadapter/lib/khash.h diff --git a/TextAdapter/lib/kstring.c b/textadapter/lib/kstring.c old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/lib/kstring.c rename to textadapter/lib/kstring.c diff --git a/TextAdapter/lib/kstring.h b/textadapter/lib/kstring.h old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/lib/kstring.h rename to textadapter/lib/kstring.h diff --git a/TextAdapter/lib/kvec.h b/textadapter/lib/kvec.h old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/lib/kvec.h rename to textadapter/lib/kvec.h diff --git a/TextAdapter/tests/Makefile b/textadapter/tests/Makefile old mode 100644 new mode 100755 similarity index 64% rename from TextAdapter/tests/Makefile rename to textadapter/tests/Makefile index e917ba6..f25900a --- a/TextAdapter/tests/Makefile +++ b/textadapter/tests/Makefile @@ -3,18 +3,7 @@ CFLAGS = -g -Werror -Wall -Wdeclaration-after-statement TEXT_INCLUDE_DIRS = -I ../textadapter -I ../lib TEXT_LIBS = -lz -lpcre TEXT_OBJS = test_text_adapter.o text_adapter.o converter_functions.o index.o -MONGO_INCLUDE_DIRS = -I ../mongoadapter -I ../lib -MONGO_LIBS = -lmongoc -MONGO_OBJS = test_mongo_adapter.o mongo_adapter.o converter_functions.o field_info.o -test_mongo_adapter: $(MONGO_OBJS) - $(CC) $(CFLAGS) $(MONGO_OBJS) -o test_mongo_adapter $(MONGO_LIBS) - -test_mongo_adapter.o: test_mongo_adapter.c - $(CC) $(CFLAGS) -c test_mongo_adapter.c $(MONGO_INCLUDE_DIRS) - -mongo_adapter.o: ../mongoadapter/mongo_adapter.c - $(CC) $(CFLAGS) -c ../mongoadapter/mongo_adapter.c $(MONGO_INCLUDE_DIRS) test_text_adapter: $(TEXT_OBJS) $(CC) $(CFLAGS) $(TEXT_OBJS) -o test_text_adapter $(TEXT_LIBS) diff --git a/TextAdapter/textadapter/__init__.py b/textadapter/tests/__init__.py old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/textadapter/__init__.py rename to textadapter/tests/__init__.py diff --git a/TextAdapter/tests/conftest.py b/textadapter/tests/conftest.py old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/tests/conftest.py rename to textadapter/tests/conftest.py diff --git a/TextAdapter/tests/data/benchmarks.py b/textadapter/tests/data/benchmarks.py old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/tests/data/benchmarks.py rename to textadapter/tests/data/benchmarks.py diff --git a/TextAdapter/tests/generate.py b/textadapter/tests/generate.py old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/tests/generate.py rename to textadapter/tests/generate.py diff --git a/TextAdapter/tests/test_TextAdapter.py b/textadapter/tests/test_TextAdapter.py old mode 100644 new mode 100755 similarity index 86% rename from TextAdapter/tests/test_TextAdapter.py rename to textadapter/tests/test_TextAdapter.py index ff3c300..ce44500 --- a/TextAdapter/tests/test_TextAdapter.py +++ b/textadapter/tests/test_TextAdapter.py @@ -1,7 +1,7 @@ #!/usr/bin/python import sys -import TextAdapter +import textadapter import unittest from .generate import (generate_dataset, IntIter, MissingValuesIter, FixedWidthIter) @@ -27,17 +27,17 @@ def assert_equality(self, left, right): # Basic parsing tests def test_string_parsing(self): data = StringIO('1,2,3\n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.set_field_types({0:'S5', 1:'S5', 2:'S5'}) assert_array_equal(adapter[:], np.array([('1', '2', '3')], dtype='S5,S5,S5')) data = io.StringIO(u'1,2,3\n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.set_field_types({0:'S5', 1:'S5', 2:'S5'}) assert_array_equal(adapter[:], np.array([('1', '2', '3')], dtype='S5,S5,S5')) data = io.BytesIO(b'1,2,3\n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.set_field_types({0:'S5', 1:'S5', 2:'S5'}) assert_array_equal(adapter[:], np.array([('1', '2', '3')], dtype='S5,S5,S5')) @@ -45,45 +45,45 @@ def test_string_parsing(self): def test_utf8_parsing(self): # test single byte character data = io.BytesIO(u'1,2,\u0033'.encode('utf_8')) - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) expected = np.array([('1', '2', '3')], dtype='u8,u8,u8') assert_array_equal(adapter[:], expected) # test multibyte character data = io.BytesIO(u'1,2,\u2092'.encode('utf_8')) - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) expected = np.array([('1', '2', u'\u2092')], dtype='u8,u8,O') assert_array_equal(adapter[:], expected) def test_no_whitespace_stripping(self): data = StringIO('1 ,2 ,3 \n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.set_field_types({0:'S3', 1:'S3', 2:'S3'}) assert_array_equal(adapter[:], np.array([('1 ', '2 ', '3 ')], dtype='S3,S3,S3')) data = StringIO(' 1, 2, 3\n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.set_field_types({0:'S3', 1:'S3', 2:'S3'}) assert_array_equal(adapter[:], np.array([(' 1', ' 2', ' 3')], dtype='S3,S3,S3')) data = StringIO(' 1 , 2 , 3 \n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.set_field_types({0:'S5', 1:'S5', 2:'S5'}) assert_array_equal(adapter[:], np.array([(' 1 ', ' 2 ', ' 3 ')], dtype='S5,S5,S5')) data = StringIO('\t1\t,\t2\t,\t3\t\n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.set_field_types({0:'S3', 1:'S3', 2:'S3'}) assert_array_equal(adapter[:], np.array([('\t1\t', '\t2\t', '\t3\t')], dtype='S3,S3,S3')) def test_quoted_whitespace(self): data = StringIO('"1 ","2 ","3 "\n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.set_field_types({0:'S3', 1:'S3', 2:'S3'}) assert_array_equal(adapter[:], np.array([('1 ', '2 ', '3 ')], dtype='S3,S3,S3')) data = StringIO('"\t1\t"\t"\t2\t"\t"\t3\t"\n') - adapter = TextAdapter.text_adapter(data, field_names=False, delimiter='\t') + adapter = textadapter.text_adapter(data, field_names=False, delimiter='\t') adapter.set_field_types({0:'S3', 1:'S3', 2:'S3'}) assert_array_equal(adapter[:], np.array([('\t1\t', '\t2\t', '\t3\t')], dtype='S3,S3,S3')) @@ -96,7 +96,7 @@ def test_fixed_simple(self): # This test does not work on Windows return data = StringIO(" 1 2 3\n 4 5 67\n890123 4") - adapter = TextAdapter.FixedWidthTextAdapter(data, 3, infer_types=False, field_names=False) + adapter = textadapter.FixedWidthTextAdapter(data, 3, infer_types=False, field_names=False) adapter.set_field_types({0:'i', 1:'i', 2:'i'}) control = np.array([(1, 2, 3), (4, 5, 67), (890, 123, 4)], dtype='i,i,i') @@ -104,7 +104,7 @@ def test_fixed_simple(self): def test_spaces_around_numeric_values(self): data = StringIO(' 1 , -2 , 3.3 , -4.4 \n 5 , -6 , 7.7 , -8.8 ') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.set_field_types({0:'u4', 1:'i8', 2:'f4', 3:'f8'}) array = adapter[:] @@ -114,7 +114,7 @@ def test_spaces_around_numeric_values(self): def test_slicing(self): data = StringIO() generate_dataset(data, IntIter(), ',', self.num_records) - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.set_field_types({0:'u4',1:'u4',2:'u4',3:'u4',4:'u4'}) assert_array_equal(adapter[0], np.array([(0, 1, 2, 3, 4)], dtype='u4,u4,u4,u4,u4')) @@ -188,14 +188,14 @@ def test_slicing(self): try: adapter[self.num_records] - except TextAdapter.AdapterIndexError: + except textadapter.AdapterIndexError: pass else: self.fail('AdaperIndexError not thrown') try: adapter[0:self.num_records+1] - except TextAdapter.AdapterIndexError: + except textadapter.AdapterIndexError: pass else: self.fail('AdaperIndexError not thrown') @@ -204,7 +204,7 @@ def test_slicing(self): def test_converters(self): data = StringIO() generate_dataset(data, IntIter(), ',', self.num_records) - adapter = TextAdapter.text_adapter(data, delimiter=',', field_names=False) + adapter = textadapter.text_adapter(data, delimiter=',', field_names=False) #adapter.set_field_types({0:'u4', 1:'u4', 2:'u4', 3:'u4', 4:'u4'}) def increment(input_str): @@ -238,7 +238,7 @@ def test_missing_fill_values(self): data = StringIO() generate_dataset(data, MissingValuesIter(), ',', self.num_records) - adapter = TextAdapter.text_adapter(data, delimiter=',', field_names=False, infer_types=False) + adapter = textadapter.text_adapter(data, delimiter=',', field_names=False, infer_types=False) adapter.set_field_types({'f0':'u4', 1:'u4', 2:'u4', 3:'u4', 'f4':'u4'}) adapter.set_missing_values({0:['NA', 'NaN'], 'f4':['xx','inf']}) adapter.set_fill_values({0:99, 4:999}) @@ -261,7 +261,7 @@ def test_missing_fill_values(self): record[3] += 5 data.seek(0) - adapter = TextAdapter.text_adapter(data, delimiter=',', field_names=False, infer_types=True) + adapter = textadapter.text_adapter(data, delimiter=',', field_names=False, infer_types=True) adapter.set_missing_values({0:['NA', 'NaN'], 4:['xx','inf']}) array = adapter[:] @@ -283,7 +283,7 @@ def test_missing_fill_values(self): # Test missing field data = StringIO('1,2,3\n4,5\n7,8,9') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.field_types = {0:'O', 1:'O', 2:'O'} adapter.set_fill_values({0:np.nan, 1:np.nan, 2:np.nan}) array = adapter[:] @@ -295,7 +295,7 @@ def test_missing_fill_values(self): def test_fixed_width(self): data = StringIO() generate_dataset(data, FixedWidthIter(), '', self.num_records) - adapter = TextAdapter.FixedWidthTextAdapter(data, [2,3,4,5,6], field_names=False, infer_types=False) + adapter = textadapter.FixedWidthTextAdapter(data, [2,3,4,5,6], field_names=False, infer_types=False) adapter.set_field_types({0:'u4',1:'u4',2:'u4',3:'u4',4:'u4'}) array = adapter[:] @@ -319,7 +319,7 @@ def test_fixed_width(self): # Test skipping blank lines data = StringIO(' 1 2 3\n\n 4 5 6') - adapter = TextAdapter.text_adapter(data, parser='fixed_width', + adapter = textadapter.text_adapter(data, parser='fixed_width', field_widths=[2,2,2], field_names=False) array = adapter[:] assert_array_equal(array, np.array([(1,2,3), (4,5,6)], @@ -327,7 +327,7 @@ def test_fixed_width(self): # Test comment lines data = StringIO('# 1 2 3\n 1 2 3\n# foo\n 4 5 6') - adapter = TextAdapter.text_adapter(data, parser='fixed_width', + adapter = textadapter.text_adapter(data, parser='fixed_width', field_widths=[2,2,2], field_names=False) array = adapter[:] assert_array_equal(array, np.array([(1,2,3), (4,5,6)], @@ -335,7 +335,7 @@ def test_fixed_width(self): # Test field names line data = StringIO(' a b c\n 1 2 3') - adapter = TextAdapter.text_adapter(data, parser='fixed_width', + adapter = textadapter.text_adapter(data, parser='fixed_width', field_widths=[2,2,2], field_names=True) array = adapter[:] assert_array_equal(array, np.array([(1,2,3)], @@ -343,7 +343,7 @@ def test_fixed_width(self): # Test field names line as comment line data = StringIO('# a b c\n 1 2 3') - adapter = TextAdapter.text_adapter(data, parser='fixed_width', + adapter = textadapter.text_adapter(data, parser='fixed_width', field_widths=[2,2,2], field_names=True) array = adapter[:] assert_array_equal(array, np.array([(1,2,3)], @@ -351,7 +351,7 @@ def test_fixed_width(self): # Test incomplete field names line data = StringIO(' a\n 1 2 3') - adapter = TextAdapter.text_adapter(data, parser='fixed_width', + adapter = textadapter.text_adapter(data, parser='fixed_width', field_widths=[2,2,2], field_names=True) array = adapter[:] assert_array_equal(array, np.array([(1,2,3)], @@ -360,7 +360,7 @@ def test_fixed_width(self): def test_regex(self): data = StringIO() generate_dataset(data, IntIter(), ',', self.num_records) - adapter = TextAdapter.RegexTextAdapter(data, '([0-9]*),([0-9]*),([0-9]*),([0-9]*),([0-9]*)\n', field_names=False, infer_types=False) + adapter = textadapter.RegexTextAdapter(data, '([0-9]*),([0-9]*),([0-9]*),([0-9]*),([0-9]*)\n', field_names=False, infer_types=False) adapter.set_field_types({0:'u4',1:'u4',2:'u4',3:'u4',4:'u4'}) array = adapter[:] @@ -374,7 +374,7 @@ def test_regex(self): # Test skipping blank lines data = StringIO('1 2 3\n\n4 5 6') - adapter = TextAdapter.text_adapter(data, parser='regex', + adapter = textadapter.text_adapter(data, parser='regex', regex_string='([0-9]) ([0-9]) ([0-9])', field_names=False) array = adapter[:] assert_array_equal(array, np.array([(1,2,3), (4,5,6)], @@ -382,7 +382,7 @@ def test_regex(self): # Test comment lines data = StringIO('#1 2 3\n1 2 3\n# foo\n4 5 6') - adapter = TextAdapter.text_adapter(data, parser='regex', + adapter = textadapter.text_adapter(data, parser='regex', regex_string='([0-9]) ([0-9]) ([0-9])', field_names=False) array = adapter[:] assert_array_equal(array, np.array([(1,2,3), (4,5,6)], @@ -390,7 +390,7 @@ def test_regex(self): # Test field names line data = StringIO('a b c\n4 5 6') - adapter = TextAdapter.text_adapter(data, parser='regex', + adapter = textadapter.text_adapter(data, parser='regex', regex_string='([0-9]) ([0-9]) ([0-9])', field_names=True) array = adapter[:] assert_array_equal(array, np.array([(4,5,6)], @@ -398,7 +398,7 @@ def test_regex(self): # Test field names line as comment line data = StringIO('#a b c\n4 5 6') - adapter = TextAdapter.text_adapter(data, parser='regex', + adapter = textadapter.text_adapter(data, parser='regex', regex_string='([0-9]) ([0-9]) ([0-9])', field_names=True) array = adapter[:] assert_array_equal(array, np.array([(4,5,6)], @@ -406,7 +406,7 @@ def test_regex(self): # Test incomplete field names line data = StringIO('a b\n4 5 6') - adapter = TextAdapter.text_adapter(data, parser='regex', + adapter = textadapter.text_adapter(data, parser='regex', regex_string='([0-9]) ([0-9]) ([0-9])', field_names=True) array = adapter[:] assert_array_equal(array, np.array([(4,5,6)], @@ -414,7 +414,7 @@ def test_regex(self): # Test field names line that doesn't match regex data = StringIO('a b c\n1 2 3 4 5 6') - adapter = TextAdapter.text_adapter(data, parser='regex', + adapter = textadapter.text_adapter(data, parser='regex', regex_string='([0-9\s]+) ([0-9\s]+) ([0-9\s]+)', field_names=True) array = adapter[:] assert_array_equal(array, np.array([('1 2', '3 4', '5 6')], @@ -432,7 +432,7 @@ def test_index(self): generate_dataset(data, IntIter(), ',', num_records) # test explicit index building - adapter = TextAdapter.text_adapter(data, delimiter=',', field_names=False, infer_types=False) + adapter = textadapter.text_adapter(data, delimiter=',', field_names=False, infer_types=False) adapter.set_field_types({0:'u4',1:'u4',2:'u4',3:'u4',4:'u4'}) adapter.create_index() @@ -448,7 +448,7 @@ def test_index(self): if os.path.exists('test.idx'): os.remove('test.idx') data.seek(0) - adapter = TextAdapter.text_adapter(data, delimiter=',', field_names=False, infer_types=False, index_name='test.idx') + adapter = textadapter.text_adapter(data, delimiter=',', field_names=False, infer_types=False, index_name='test.idx') adapter.set_field_types({0:'u4',1:'u4',2:'u4',3:'u4',4:'u4'}) adapter.to_array() @@ -464,7 +464,7 @@ def test_index(self): # test loading disk index data.seek(0) - adapter2 = TextAdapter.text_adapter(data, delimiter=',', field_names=False, infer_types=False, index_name='test.idx') + adapter2 = textadapter.text_adapter(data, delimiter=',', field_names=False, infer_types=False, index_name='test.idx') adapter2.set_field_types({0:'u4',1:'u4',2:'u4',3:'u4',4:'u4'}) self.assert_equality(adapter2[0].item(), tuple([(0*5) + x for x in range(5)])) @@ -500,7 +500,7 @@ def test_gzip_index(self): dataz.seek(0) # test explicit index building - adapter = TextAdapter.text_adapter(dataz, compression='gzip', delimiter=',', field_names=False, infer_types=False) + adapter = textadapter.text_adapter(dataz, compression='gzip', delimiter=',', field_names=False, infer_types=False) adapter.set_field_types({0:'u4',1:'u4',2:'u4',3:'u4',4:'u4'}) adapter.create_index() @@ -519,7 +519,7 @@ def test_gzip_index(self): # test implicitly creating disk index on the fly # JNB: not implemented yet - '''adapter = TextAdapter.text_adapter(dataz, compression='gzip', delimiter=',', field_names=False, infer_types=False, indexing=True, index_filename='test.idx') + '''adapter = textadapter.text_adapter(dataz, compression='gzip', delimiter=',', field_names=False, infer_types=False, indexing=True, index_filename='test.idx') adapter.set_field_types({0:'u4',1:'u4',2:'u4',3:'u4',4:'u4'}) adapter.to_array() @@ -537,7 +537,7 @@ def test_gzip_index(self): self.assert_equality(adapter[818000].item(), tuple([(818000*5) + x for x in range(5)])) # test loading disk index - adapter2 = TextAdapter.text_adapter(dataz, compression='gzip', delimiter=',', field_names=False, infer_types=False, indexing=True, index_filename='test.idx') + adapter2 = textadapter.text_adapter(dataz, compression='gzip', delimiter=',', field_names=False, infer_types=False, indexing=True, index_filename='test.idx') adapter2.set_field_types({0:'u4',1:'u4',2:'u4',3:'u4',4:'u4'}) self.assert_equality(adapter2[0].item(), tuple([(0*5) + x for x in range(5)])) @@ -558,19 +558,19 @@ def test_gzip_index(self): def test_header_footer(self): data = StringIO('0,1,2,3,4\n5,6,7,8,9\n10,11,12,13,14') - adapter = TextAdapter.text_adapter(data, header=1, field_names=False) + adapter = textadapter.text_adapter(data, header=1, field_names=False) adapter.field_types = dict(zip(range(5), ['u4']*5)) assert_array_equal(adapter[:], np.array([(5,6,7,8,9), (10,11,12,13,14)], dtype='u4,u4,u4,u4,u4')) data.seek(0) - adapter = TextAdapter.text_adapter(data, header=2, field_names=False) + adapter = textadapter.text_adapter(data, header=2, field_names=False) adapter.field_types = dict(zip(range(5), ['u4']*5)) assert_array_equal(adapter[:], np.array([(10,11,12,13,14)], dtype='u4,u4,u4,u4,u4')) data.seek(0) - adapter = TextAdapter.text_adapter(data, header=1, field_names=True) + adapter = textadapter.text_adapter(data, header=1, field_names=True) adapter.field_types = dict(zip(range(5), ['u4']*5)) assert_array_equal(adapter[:], np.array([(10,11,12,13,14)], dtype=[('5','u4'),('6','u4'),('7','u4'),('8','u4'),('9','u4')])) @@ -578,29 +578,29 @@ def test_header_footer(self): def test_delimiter(self): data = StringIO('1,2,3\n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) self.assert_equality(adapter[0].item(), (1,2,3)) data = StringIO('1 2 3\n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) self.assert_equality(adapter[0].item(), (1,2,3)) data = StringIO('1\t2\t3\n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) self.assert_equality(adapter[0].item(), (1,2,3)) data = StringIO('1x2x3\n') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) self.assert_equality(adapter[0].item(), (1,2,3)) # Test no delimiter in single field csv data data = StringIO('aaa\nbbb\nccc') - array = TextAdapter.text_adapter(data, field_names=False, delimiter=None)[:] + array = textadapter.text_adapter(data, field_names=False, delimiter=None)[:] assert_array_equal(array, np.array([('aaa',), ('bbb',), ('ccc',)], dtype=[('f0', 'O')])) def test_auto_type_inference(self): data = StringIO('0,1,2,3,4\n5.5,6,7,8,9\n10,11,12,13,14a\n15,16,xxx,18,19') - adapter = TextAdapter.text_adapter(data, field_names=False, infer_types=True) + adapter = textadapter.text_adapter(data, field_names=False, infer_types=True) array = adapter.to_array() self.assert_equality(array.dtype.fields['f0'][0], np.dtype('float64')) self.assert_equality(array.dtype.fields['f1'][0], np.dtype('uint64')) @@ -609,7 +609,7 @@ def test_auto_type_inference(self): self.assert_equality(array.dtype.fields['f4'][0], np.dtype('O')) data = StringIO('0,1,2,3,4\n5.5,6,7,8,9\n10,11,12,13,14a\n15,16,xxx,18,19') - adapter = TextAdapter.text_adapter(data, field_names=False, infer_types=True) + adapter = textadapter.text_adapter(data, field_names=False, infer_types=True) self.assert_equality(adapter[0].dtype.fields['f0'][0], np.dtype('uint64')) self.assert_equality(adapter[1:3].dtype.fields['f0'][0], np.dtype('float64')) self.assert_equality(adapter[3].dtype.fields['f4'][0], np.dtype('uint64')) @@ -619,22 +619,22 @@ def test_auto_type_inference(self): def test_64bit_ints(self): data = StringIO(str((2**63)-1) + ',' + str(((2**63)-1)*-1) + ',' + str((2**64)-1)) - adapter = TextAdapter.text_adapter(data, delimiter=',', field_names=False, infer_types=False) + adapter = textadapter.text_adapter(data, delimiter=',', field_names=False, infer_types=False) adapter.set_field_types({0:'i8', 1:'i8', 2:'u8'}) array = adapter.to_array() self.assert_equality(array[0].item(), ((2**63)-1, ((2**63)-1)*-1, (2**64)-1)) def test_adapter_factory(self): data = StringIO("1,2,3") - adapter = TextAdapter.text_adapter(data, "csv", delimiter=',', field_names=False, infer_types=False) - self.assertTrue(isinstance(adapter, TextAdapter.CSVTextAdapter)) + adapter = textadapter.text_adapter(data, "csv", delimiter=',', field_names=False, infer_types=False) + self.assertTrue(isinstance(adapter, textadapter.CSVTextAdapter)) - self.assertRaises(TextAdapter.AdapterException, TextAdapter.text_adapter, data, "foobar") + self.assertRaises(textadapter.AdapterException, textadapter.text_adapter, data, "foobar") def test_field_names(self): # Test for ignoring of extra fields data = StringIO('f0,f1\n0,1,2\n3,4,5') - adapter = TextAdapter.text_adapter(data, 'csv', delimiter=',', field_names=True) + adapter = textadapter.text_adapter(data, 'csv', delimiter=',', field_names=True) array = adapter.to_array() self.assert_equality(array.dtype.names, ('f0', 'f1')) self.assert_equality(array[0].item(), (0,1)) @@ -642,14 +642,14 @@ def test_field_names(self): # Test for duplicate field names data = StringIO('f0,field,field\n0,1,2\n3,4,5') - adapter = TextAdapter.text_adapter(data, 'csv', delimiter=',', field_names=True, infer_types=False) + adapter = textadapter.text_adapter(data, 'csv', delimiter=',', field_names=True, infer_types=False) adapter.set_field_types({0:'u4', 1:'u4', 2:'u4'}) array = adapter.to_array() self.assert_equality(array.dtype.names, ('f0', 'field', 'field1')) # Test for field names list data = StringIO('0,1,2\n3,4,5') - adapter = TextAdapter.text_adapter(data, field_names=['a', 'b', 'c'], infer_types=False) + adapter = textadapter.text_adapter(data, field_names=['a', 'b', 'c'], infer_types=False) adapter.field_types = {0:'u4', 1:'u4', 2:'u4'} array = adapter[:] self.assertTrue(array.dtype.names == ('a', 'b', 'c')) @@ -657,7 +657,7 @@ def test_field_names(self): def test_float_conversion(self): data = StringIO('10,1.333,-1.23,10.0E+2,999.9e-2') - adapter = TextAdapter.text_adapter(data, field_names=False, infer_types=False) + adapter = textadapter.text_adapter(data, field_names=False, infer_types=False) adapter.set_field_types(dict(zip(range(5), ['f8']*5))) array = adapter[0] #self.assert_equality(array[0].item(), (10.0,1.333,-1.23,1000.0,9.999)) @@ -672,7 +672,7 @@ def int_generator(num_recs): for i in range(num_recs): yield ','.join([str(i*5), str(i*5+1), str(i*5+2), str(i*5+3), str(i*5+4)]) - adapter = TextAdapter.text_adapter(int_generator(self.num_records), field_names=False) + adapter = textadapter.text_adapter(int_generator(self.num_records), field_names=False) array = adapter[:] self.assert_equality(array.size, self.num_records) @@ -688,13 +688,13 @@ def int_generator(num_recs): def test_comments(self): data = StringIO('1,2,3\n#4,5,6') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) array = adapter[:] self.assert_equality(array.size, 1) self.assert_equality(array[0].item(), (1,2,3)) data = StringIO('1,2,3\n#4,5,6') - adapter = TextAdapter.text_adapter(data, field_names=False, comment=None) + adapter = textadapter.text_adapter(data, field_names=False, comment=None) array = adapter[:] self.assert_equality(array.size, 2) self.assert_equality(array[0].item(), ('1',2,3)) @@ -702,22 +702,22 @@ def test_comments(self): def test_escapechar(self): data = StringIO('1,2\\2,3\n4,5\\5\\5,6') - array = TextAdapter.text_adapter(data, field_names=False)[:] + array = textadapter.text_adapter(data, field_names=False)[:] assert_array_equal(array, np.array([(1,22,3), (4,555,6)], dtype='u8,u8,u8')) data = StringIO('\\1,2,3\n4,5,6\\') - array = TextAdapter.text_adapter(data, field_names=False)[:] + array = textadapter.text_adapter(data, field_names=False)[:] assert_array_equal(array, np.array([(1,2,3), (4,5,6)], dtype='u8,u8,u8')) data = StringIO('a,b\\,b,c\na,b\\,b\\,b,c') - array = TextAdapter.text_adapter(data, field_names=False)[:] + array = textadapter.text_adapter(data, field_names=False)[:] assert_array_equal(array, np.array([('a', 'b,b', 'c'), ('a', 'b,b,b', 'c')], dtype='O,O,O')) data = StringIO('a,bx,b,c\na,bx,bx,b,c') - array = TextAdapter.text_adapter(data, field_names=False, escape='x')[:] + array = textadapter.text_adapter(data, field_names=False, escape='x')[:] assert_array_equal(array, np.array([('a', 'b,b', 'c'), ('a', 'b,b,b', 'c')], dtype='O,O,O')) @@ -730,7 +730,7 @@ def test_escapechar(self): # Test filling blank lines with fill values if output is dataframe data = StringIO('1,2,3\n\n4,5,6') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) adapter.field_types = {0:'O', 1:'O', 2:'O'} adapter.set_fill_values({0:np.nan, 1:np.nan, 2:np.nan}) df = adapter.to_dataframe()''' @@ -738,7 +738,7 @@ def test_escapechar(self): def test_csv(self): # Test skipping blank lines data = StringIO('1,2,3\n\n4,5,6') - adapter = TextAdapter.text_adapter(data, field_names=False) + adapter = textadapter.text_adapter(data, field_names=False) array = adapter[:] assert_array_equal(array, np.array([(1,2,3), (4,5,6)], dtype=[('f0','>>>>>> 14dcbb9542f8d05344fd4a2cc4ef07c47528a8f1 -======= -#####-------------------------------------------------------------------------- ->>>>>>> 0e94e8123ce07aa964a82f678b115c7defb0a49c:TextAdapter/tests/test_io.py class TestFromTxt(TestCase): @@ -372,7 +364,7 @@ def test_array(self): # data.seek(0) control = np.array([[1, 2], [3, 4]], dtype=float) - test = TextAdapter.loadtxt(data, dtype=float) + test = textadapter.loadtxt(data, dtype=float) assert_array_equal(test, control) def test_skiprows(self): @@ -381,7 +373,7 @@ def test_skiprows(self): kwargs = dict(dtype=int, delimiter=',') # data = StringIO('# comment\n1,2,3,5\n') - test = TextAdapter.loadtxt(data, skiprows=1, **kwargs) + test = textadapter.loadtxt(data, skiprows=1, **kwargs) assert_equal(test, control) @unittest.expectedFailure @@ -391,7 +383,7 @@ def test_skip_footer(self): data.extend(["%i,%3.1f,%03s" % (i, i, i) for i in range(51)]) data[-1] = "99,99" kwargs = dict(delimiter=",", names=True, skip_header=5, skip_footer=10) - test = TextAdapter.genfromtxt(StringIO("\n".join(data)), **kwargs) + test = textadapter.genfromtxt(StringIO("\n".join(data)), **kwargs) ctrl = np.array([("%f" % i, "%f" % i, "%f" % i) for i in range(41)], dtype=[(_, float) for _ in "ABC"]) assert_equal(test, ctrl) @@ -404,18 +396,18 @@ def test_skip_footer_with_invalid(self): basestr = '1 1\n2 2\n3 3\n4 4\n5 \n6 \n7 \n' warnings.filterwarnings("ignore") # Footer too small to get rid of all invalid values - assert_raises(ValueError, TextAdapter.genfromtxt, + assert_raises(ValueError, textadapter.genfromtxt, StringIO(basestr), skip_footer=1) - a = TextAdapter.genfromtxt(StringIO(basestr), skip_footer=1, invalid_raise=False) + a = textadapter.genfromtxt(StringIO(basestr), skip_footer=1, invalid_raise=False) assert_equal(a, np.array([[1., 1.], [2., 2.], [3., 3.], [4., 4.]])) # - a = TextAdapter.genfromtxt(StringIO(basestr), skip_footer=3) + a = textadapter.genfromtxt(StringIO(basestr), skip_footer=3) assert_equal(a, np.array([[1., 1.], [2., 2.], [3., 3.], [4., 4.]])) # basestr = '1 1\n2 \n3 3\n4 4\n5 \n6 6\n7 7\n' - a = TextAdapter.genfromtxt(StringIO(basestr), skip_footer=1, invalid_raise=False) + a = textadapter.genfromtxt(StringIO(basestr), skip_footer=1, invalid_raise=False) assert_equal(a, np.array([[1., 1.], [3., 3.], [4., 4.], [6., 6.]])) - a = TextAdapter.genfromtxt(StringIO(basestr), skip_footer=3, invalid_raise=False) + a = textadapter.genfromtxt(StringIO(basestr), skip_footer=3, invalid_raise=False) assert_equal(a, np.array([[1., 1.], [3., 3.], [4., 4.]])) finally: warn_ctx.__exit__() @@ -429,9 +421,9 @@ def test_commented_header(self): M 33 21.99 """) # The # is part of the first name and should be deleted automatically. - test = TextAdapter.genfromtxt(data, names=True, dtype=None) + test = textadapter.genfromtxt(data, names=True, dtype=None) ctrl = np.array([('M', 21, 72.1), ('F', 35, 58.33), ('M', 33, 21.99)], - # JNB: changed test because TextAdapter defaults to object string + # JNB: changed test because textadapter defaults to object string # instead of fixed length string, and unsigned long int # instead of int. dtype=[('gender', 'O'), ('age', 'u8'), ('weight', 'f8')]) @@ -444,7 +436,7 @@ def test_commented_header(self): F 35 58.330000 M 33 21.99 """) - test = TextAdapter.genfromtxt(data, names=True, dtype=None) + test = textadapter.genfromtxt(data, names=True, dtype=None) assert_equal(test, ctrl) @unittest.expectedFailure @@ -459,7 +451,7 @@ def test_invalid_converter(self): "D02N03,10/10/2004,R 1,,7,145.55") kwargs = dict(converters={2 : strip_per, 3 : strip_rand}, delimiter=",", dtype=None) - assert_raises(ConverterError, TextAdapter.genfromtxt, s, **kwargs) + assert_raises(ConverterError, textadapter.genfromtxt, s, **kwargs) @unittest.expectedFailure def test_tricky_converter_bug1666(self): @@ -467,7 +459,7 @@ def test_tricky_converter_bug1666(self): assert_equal(True, False) s = StringIO('q1,2\nq3,4') cnv = lambda s:float(s[1:]) - test = TextAdapter.genfromtxt(s, delimiter=',', converters={0:cnv}) + test = textadapter.genfromtxt(s, delimiter=',', converters={0:cnv}) control = np.array([[1., 2.], [3., 4.]]) assert_equal(test, control) @@ -482,7 +474,7 @@ def test_dtype_with_object(self): ndtype = [('idx', int), ('code', np.object)] func = lambda s: strptime(s.strip(), "%Y-%m-%d") converters = {1: func} - test = TextAdapter.genfromtxt(StringIO(data), delimiter=";", dtype=ndtype, + test = textadapter.genfromtxt(StringIO(data), delimiter=";", dtype=ndtype, converters=converters) control = np.array([(1, datetime(2001, 1, 1)), (2, datetime(2002, 1, 31))], dtype=ndtype) @@ -490,7 +482,7 @@ def test_dtype_with_object(self): # ndtype = [('nest', [('idx', int), ('code', np.object)])] try: - test = TextAdapter.genfromtxt(StringIO(data), delimiter=";", + test = textadapter.genfromtxt(StringIO(data), delimiter=";", dtype=ndtype, converters=converters) except NotImplementedError: errmsg = "Nested dtype involving objects should be supported." @@ -500,7 +492,7 @@ def test_dtype_with_object(self): def test_userconverters_with_explicit_dtype(self): "Test user_converters w/ explicit (standard) dtype" data = StringIO('skip,skip,2001-01-01,1.0,skip') - test = TextAdapter.genfromtxt(data, delimiter=",", names=None, dtype=float, + test = textadapter.genfromtxt(data, delimiter=",", names=None, dtype=float, usecols=(2, 3), converters={2: bytes}) control = np.array([('2001-01-01', 1.)], dtype=[('', '|S10'), ('', float)]) @@ -510,7 +502,7 @@ def test_userconverters_with_explicit_dtype(self): def test_integer_delimiter(self): "Test using an integer for delimiter" data = " 1 2 3\n 4 5 67\n890123 4" - test = TextAdapter.genfromtxt(StringIO(data), delimiter=3, dtype=int) + test = textadapter.genfromtxt(StringIO(data), delimiter=3, dtype=int) control = np.array([[1, 2, 3], [4, 5, 67], [890, 123, 4]]) assert_equal(test, control) @@ -520,7 +512,7 @@ def test_integer_delimiter(self): def test_missing_with_tabs(self): "Test w/ a delimiter tab" txt = "1\t2\t3\n\t2\t\n1\t\t3" - test = TextAdapter.genfromtxt(StringIO(txt), delimiter="\t", + test = textadapter.genfromtxt(StringIO(txt), delimiter="\t", usemask=True,) ctrl_d = np.array([(1, 2, 3), (np.nan, 2, np.nan), (1, np.nan, 3)],) ctrl_m = np.array([(0, 0, 0), (1, 0, 1), (0, 1, 0)], dtype=bool) @@ -530,14 +522,14 @@ def test_missing_with_tabs(self): def test_usecols_as_css(self): "Test giving usecols with a comma-separated string" data = "1 2 3\n4 5 6" - test = TextAdapter.genfromtxt(StringIO(data), + test = textadapter.genfromtxt(StringIO(data), names="a, b, c", usecols="a, c") ctrl = np.array([(1, 3), (4, 6)], dtype=[(_, float) for _ in "ac"]) assert_equal(test, ctrl) def test_usecols_with_integer(self): "Test usecols with an integer" - test = TextAdapter.genfromtxt(StringIO("1 2 3\n4 5 6"), usecols=0) + test = textadapter.genfromtxt(StringIO("1 2 3\n4 5 6"), usecols=0) assert_equal(test, np.array([1., 4.])) def test_usecols_with_named_columns(self): @@ -545,9 +537,9 @@ def test_usecols_with_named_columns(self): ctrl = np.array([(1, 3), (4, 6)], dtype=[('a', float), ('c', float)]) data = "1 2 3\n4 5 6" kwargs = dict(names="a, b, c") - test = TextAdapter.genfromtxt(StringIO(data), usecols=(0, -1), **kwargs) + test = textadapter.genfromtxt(StringIO(data), usecols=(0, -1), **kwargs) assert_equal(test, ctrl) - test = TextAdapter.genfromtxt(StringIO(data), + test = textadapter.genfromtxt(StringIO(data), usecols=('a', 'c'), **kwargs) assert_equal(test, ctrl) @@ -558,7 +550,7 @@ def test_empty_file(self): try: warnings.filterwarnings("ignore", message="genfromtxt: Empty input file:") data = StringIO() - test = TextAdapter.genfromtxt(data) + test = textadapter.genfromtxt(data) assert_equal(test, np.array([])) finally: warn_ctx.__exit__() @@ -572,11 +564,11 @@ def test_user_filling_values(self): names="a,b,c", missing_values={0:"N/A", 'b':" ", 2:"???"}, filling_values={0:0, 'b':0, 2:-999}) - test = TextAdapter.genfromtxt(StringIO(data), **kwargs) + test = textadapter.genfromtxt(StringIO(data), **kwargs) ctrl = np.array([(0, 2, 3), (4, 0, -999)], dtype=[(_, int) for _ in "abc"]) assert_equal(test, ctrl) - test = TextAdapter.genfromtxt(StringIO(data), usecols=(0, -1), **kwargs) + test = textadapter.genfromtxt(StringIO(data), usecols=(0, -1), **kwargs) ctrl = np.array([(0, 3), (4, -999)], dtype=[(_, int) for _ in "ac"]) assert_equal(test, ctrl) @@ -585,7 +577,7 @@ def test_user_filling_values(self): def test_with_masked_column_uniform(self): "Test masked column" data = StringIO('1 2 3\n4 5 6\n') - test = TextAdapter.genfromtxt(data, dtype=None, + test = textadapter.genfromtxt(data, dtype=None, missing_values='2,5', usemask=True) control = ma.array([[1, 2, 3], [4, 5, 6]], mask=[[0, 1, 0], [0, 1, 0]]) assert_equal(test, control) @@ -595,7 +587,7 @@ def test_with_masked_column_uniform(self): def test_with_masked_column_various(self): "Test masked column" data = StringIO('True 2 3\nFalse 5 6\n') - test = TextAdapter.genfromtxt(data, dtype=None, + test = textadapter.genfromtxt(data, dtype=None, missing_values='2,5', usemask=True) control = ma.array([(1, 2, 3), (0, 5, 6)], mask=[(0, 1, 0), (0, 1, 0)], @@ -609,20 +601,20 @@ def test_replace_space(self): "Test the 'replace_space' option" txt = "A.A, B (B), C:C\n1, 2, 3.14" # Test default: replace ' ' by '_' and delete non-alphanum chars - test = TextAdapter.genfromtxt(StringIO(txt), + test = textadapter.genfromtxt(StringIO(txt), delimiter=",", names=True, dtype=None) ctrl_dtype = [("AA", int), ("B_B", int), ("CC", float)] ctrl = np.array((1, 2, 3.14), dtype=ctrl_dtype) assert_equal(test, ctrl) # Test: no replace, no delete - test = TextAdapter.genfromtxt(StringIO(txt), + test = textadapter.genfromtxt(StringIO(txt), delimiter=",", names=True, dtype=None, replace_space='', deletechars='') ctrl_dtype = [("A.A", int), ("B (B)", int), ("C:C", float)] ctrl = np.array((1, 2, 3.14), dtype=ctrl_dtype) assert_equal(test, ctrl) # Test: no delete (spaces are replaced by _) - test = TextAdapter.genfromtxt(StringIO(txt), + test = textadapter.genfromtxt(StringIO(txt), delimiter=",", names=True, dtype=None, deletechars='') ctrl_dtype = [("A.A", int), ("B_(B)", int), ("C:C", float)] @@ -632,7 +624,7 @@ def test_replace_space(self): def test_names_auto_completion(self): "Make sure that names are properly completed" data = "1 2 3\n 4 5 6" - test = TextAdapter.genfromtxt(StringIO(data), + test = textadapter.genfromtxt(StringIO(data), dtype=(int, float, int), names="a") ctrl = np.array([(1, 2, 3), (4, 5, 6)], dtype=[('a', int), ('f1', float), ('f2', int)]) @@ -642,17 +634,17 @@ def test_names_with_usecols_bug1636(self): "Make sure we pick up the right names w/ usecols" data = "A,B,C,D,E\n0,1,2,3,4\n0,1,2,3,4\n0,1,2,3,4" ctrl_names = ("A", "C", "E") - test = TextAdapter.genfromtxt(StringIO(data), + test = textadapter.genfromtxt(StringIO(data), dtype=(int, int, int), delimiter=",", usecols=(0, 2, 4), names=True) assert_equal(test.dtype.names, ctrl_names) # - test = TextAdapter.genfromtxt(StringIO(data), + test = textadapter.genfromtxt(StringIO(data), dtype=(int, int, int), delimiter=",", usecols=("A", "C", "E"), names=True) assert_equal(test.dtype.names, ctrl_names) # - test = TextAdapter.genfromtxt(StringIO(data), + test = textadapter.genfromtxt(StringIO(data), dtype=int, delimiter=",", usecols=("A", "C", "E"), names=True) assert_equal(test.dtype.names, ctrl_names) @@ -673,7 +665,7 @@ def test_gft_using_filename(self): # reopen the file. try: os.write(f, asbytes(data)) - assert_array_equal(TextAdapter.genfromtxt(name), wanted) + assert_array_equal(textadapter.genfromtxt(name), wanted) finally: os.close(f) os.unlink(name) @@ -683,7 +675,7 @@ def count(): for i in range(10): yield "%d" % i - res = TextAdapter.genfromtxt(count()) + res = textadapter.genfromtxt(count()) assert_array_equal(res, np.arange(10)) @@ -703,7 +695,7 @@ def test_gzip_loadtxt(): try: os.write(f, s.read()) s.close() - assert_array_equal(TextAdapter.loadtxt(name), [1, 2, 3]) + assert_array_equal(textadapter.loadtxt(name), [1, 2, 3]) finally: os.close(f) os.unlink(name) @@ -716,7 +708,7 @@ def test_gzip_loadtxt_from_string(): s.seek(0) f = gzip.GzipFile(fileobj=s, mode="r") - assert_array_equal(TextAdapter.loadtxt(f), [1, 2, 3]) + assert_array_equal(textadapter.loadtxt(f), [1, 2, 3]) def run(verbosity=1): suite= unittest.TestSuite() diff --git a/TextAdapter/tests/test_text_adapter.c b/textadapter/tests/test_text_adapter.c old mode 100644 new mode 100755 similarity index 100% rename from TextAdapter/tests/test_text_adapter.c rename to textadapter/tests/test_text_adapter.c